20 #include <linux/netdevice.h>
21 #include <linux/module.h>
22 #include <linux/pci.h>
23 #include <linux/sched.h>
24 #include <linux/slab.h>
27 #include <linux/if_arp.h>
46 #if VERBOSE > SHOW_ERROR_MESSAGES
54 printk(
"[%02x]", *buffer & 255);
84 static pimfor_header_t *
85 pimfor_decode_header(
void *
data,
int len)
87 pimfor_header_t *
h =
data;
89 while ((
void *) h < data + len) {
115 #if VERBOSE > SHOW_ERROR_MESSAGES
128 "Error allocating management frame.\n");
139 "Failed to make memory DMA'able.\n");
168 void *data,
int length)
188 ndev->
name, frag_len);
200 pimfor_encode_header(operation, oid, length, (pimfor_header_t *)
p);
208 #if VERBOSE > SHOW_ERROR_MESSAGES
210 pimfor_header_t *h =
buf.mem;
212 "PIMFOR: op %i, oid 0x%08lx, device %i, flags 0x%x length 0x%x\n",
213 h->operation, oid, h->device_id, h->flags, length);
222 buf.pci_addr = pci_map_single(priv->
pdev,
buf.mem, frag_len,
255 islpci_trigger(priv);
315 "%s: Bogus packet size of %d (%#x).\n",
316 ndev->
name, frag_len, frag_len);
325 header = pimfor_decode_header(buf->
mem, frag_len);
335 header->device_id = priv->
ndev->ifindex;
337 #if VERBOSE > SHOW_ERROR_MESSAGES
339 "PIMFOR: op %i, oid 0x%08x, device %i, flags 0x%x length 0x%x\n",
340 header->operation, header->oid, header->device_id,
341 header->flags, header->length);
352 "%s: errant PIMFOR application frame\n",
363 "%s: Out of memory, cannot handle oid 0x%08x\n",
364 ndev->
name, header->oid);
369 frame->
header = (pimfor_header_t *) frame->
buf;
374 "frame: header: %p, data: %p, size: %d\n",
379 #if VERBOSE > SHOW_ERROR_MESSAGES
381 "TRAP: oid 0x%x, device %i, flags 0x%x length %i\n",
382 header->oid, header->device_id, header->flags,
396 "%s: mgmt response not collected\n",
400 #if VERBOSE > SHOW_ERROR_MESSAGES
450 int operation,
unsigned long oid,
451 void *senddata,
int sendlen,
466 err = islpci_mgt_transmit(ndev, operation, oid, senddata, sendlen);
471 while (timeout_left > 0) {
478 if (frame->
header->oid == oid) {
484 "%s: expecting oid 0x%x, received 0x%x.\n",
485 ndev->
name, (
unsigned int) oid,
493 "%s: timeout waiting for mgmt response %lu, "
494 "triggering device\n",
495 ndev->
name, timeout_left);
496 islpci_trigger(priv);
498 timeout_left += timeleft - wait_cycle_jiffies;