enic: make vnic_wq_buf doubly linked
authorGovindarajulu Varadarajan <_govind@gmx.com>
Wed, 24 Dec 2014 10:29:36 +0000 (15:59 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Dec 2014 18:08:45 +0000 (13:08 -0500)
This patch makes vnic_wq_buf doubly liked list. This is needed for dma_mapping
error check, in case some frag's dma map fails, we need to move back and remove
previously queued buffers.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cisco/enic/vnic_wq.c
drivers/net/ethernet/cisco/enic/vnic_wq.h

index 3e6b8d54dafcbac2e7c628b850378b89cb8ab7fe..b5a1c937fad2fb321336340b91b3358b551cf95e 100644 (file)
@@ -47,11 +47,14 @@ static int vnic_wq_alloc_bufs(struct vnic_wq *wq)
                                wq->ring.desc_size * buf->index;
                        if (buf->index + 1 == count) {
                                buf->next = wq->bufs[0];
+                               buf->next->prev = buf;
                                break;
                        } else if (j + 1 == VNIC_WQ_BUF_BLK_ENTRIES(count)) {
                                buf->next = wq->bufs[i + 1];
+                               buf->next->prev = buf;
                        } else {
                                buf->next = buf + 1;
+                               buf->next->prev = buf;
                                buf++;
                        }
                }
index 816f1ad6072f142b7e6ac19e372fd6338f2a6efb..296154351823e2ebc30a205f72d2437bf86d0c30 100644 (file)
@@ -62,6 +62,7 @@ struct vnic_wq_buf {
        uint8_t cq_entry; /* Gets completion event from hw */
        uint8_t desc_skip_cnt; /* Num descs to occupy */
        uint8_t compressed_send; /* Both hdr and payload in one desc */
+       struct vnic_wq_buf *prev;
 };
 
 /* Break the vnic_wq_buf allocations into blocks of 32/64 entries */