void rcvpkt(int card, RspMessage *rcvmsg) { LLData newll; struct sk_buff *skb; if(!IS_VALID_CARD(card)) { pr_debug("invalid param: %d is not a valid card id\n", card); return; } switch(rcvmsg->rsp_status){ case 0x01: case 0x02: case 0x70: pr_debug("%s: error status code: 0x%x\n", sc_adapter[card]->devicename, rcvmsg->rsp_status); return; case 0x00: if (!(skb = dev_alloc_skb(rcvmsg->msg_data.response.msg_len))) { printk(KERN_WARNING "%s: rcvpkt out of memory, dropping packet\n", sc_adapter[card]->devicename); return; } skb_put(skb, rcvmsg->msg_data.response.msg_len); pr_debug("%s: getting data from offset: 0x%x\n", sc_adapter[card]->devicename, rcvmsg->msg_data.response.buff_offset); memcpy_fromshmem(card, skb_put(skb, rcvmsg->msg_data.response.msg_len), (char *)rcvmsg->msg_data.response.buff_offset, rcvmsg->msg_data.response.msg_len); sc_adapter[card]->card->rcvcallb_skb(sc_adapter[card]->driverId, rcvmsg->phy_link_no-1, skb); case 0x03: /* * Recycle the buffer */ pr_debug("%s: buffer size : %d\n", sc_adapter[card]->devicename, BUFFER_SIZE); /* memset_shmem(card, rcvmsg->msg_data.response.buff_offset, 0, BUFFER_SIZE); */ newll.buff_offset = rcvmsg->msg_data.response.buff_offset; newll.msg_len = BUFFER_SIZE; pr_debug("%s: recycled buffer at offset 0x%x size %d\n", sc_adapter[card]->devicename, newll.buff_offset, newll.msg_len); sendmessage(card, CEPID, ceReqTypeLnk, ceReqClass1, ceReqLnkRead, rcvmsg->phy_link_no, sizeof(LLData), (unsigned int *)&newll); } }
/* * Dump message queue in shared memory to screen */ void dump_messages(int card) { DualPortMemory dpm; unsigned long flags; int i =0; if (!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); } save_flags(flags); cli(); outb(adapter[card]->ioport[adapter[card]->shmem_pgport], (adapter[card]->shmem_magic >> 14) | 0x80); memcpy_fromshmem(card, &dpm, 0, sizeof(dpm)); restore_flags(flags); pr_debug("%s: Dumping Request Queue\n", adapter[card]->devicename); for (i = 0; i < dpm.req_head; i++) { pr_debug("%s: Message #%d: (%d,%d,%d), link: %d\n", adapter[card]->devicename, i, dpm.req_queue[i].type, dpm.req_queue[i].class, dpm.req_queue[i].code, dpm.req_queue[i].phy_link_no); } pr_debug("%s: Dumping Response Queue\n", adapter[card]->devicename); for (i = 0; i < dpm.rsp_head; i++) { pr_debug("%s: Message #%d: (%d,%d,%d), link: %d, status: %d\n", adapter[card]->devicename, i, dpm.rsp_queue[i].type, dpm.rsp_queue[i].class, dpm.rsp_queue[i].code, dpm.rsp_queue[i].phy_link_no, dpm.rsp_queue[i].rsp_status); } }