aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/sge.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-22 04:29:52 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-22 04:29:52 -0400
commit147e70e62fdd5af6263106ad634b03c5154c1e56 (patch)
treee56fdeb0b035149e157952bffbf8c04b04f0d7a3 /drivers/net/cxgb3/sge.c
parent38783e671399b5405f1fd177d602c400a9577ae6 (diff)
cxgb3: Use SKB list interfaces instead of home-grown implementation.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/sge.c')
-rw-r--r--drivers/net/cxgb3/sge.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 1b0861d73ab7..6990c0ddc854 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1704,16 +1704,15 @@ int t3_offload_tx(struct t3cdev *tdev, struct sk_buff *skb)
1704 */ 1704 */
1705static inline void offload_enqueue(struct sge_rspq *q, struct sk_buff *skb) 1705static inline void offload_enqueue(struct sge_rspq *q, struct sk_buff *skb)
1706{ 1706{
1707 skb->next = skb->prev = NULL; 1707 int was_empty = skb_queue_empty(&q->rx_queue);
1708 if (q->rx_tail) 1708
1709 q->rx_tail->next = skb; 1709 __skb_queue_tail(&q->rx_queue, skb);
1710 else { 1710
1711 if (was_empty) {
1711 struct sge_qset *qs = rspq_to_qset(q); 1712 struct sge_qset *qs = rspq_to_qset(q);
1712 1713
1713 napi_schedule(&qs->napi); 1714 napi_schedule(&qs->napi);
1714 q->rx_head = skb;
1715 } 1715 }
1716 q->rx_tail = skb;
1717} 1716}
1718 1717
1719/** 1718/**
@@ -1754,26 +1753,29 @@ static int ofld_poll(struct napi_struct *napi, int budget)
1754 int work_done = 0; 1753 int work_done = 0;
1755 1754
1756 while (work_done < budget) { 1755 while (work_done < budget) {
1757 struct sk_buff *head, *tail, *skbs[RX_BUNDLE_SIZE]; 1756 struct sk_buff *skb, *tmp, *skbs[RX_BUNDLE_SIZE];
1757 struct sk_buff_head queue;
1758 int ngathered; 1758 int ngathered;
1759 1759
1760 spin_lock_irq(&q->lock); 1760 spin_lock_irq(&q->lock);
1761 head = q->rx_head; 1761 __skb_queue_head_init(&queue);
1762 if (!head) { 1762 skb_queue_splice_init(&q->rx_queue, &queue);
1763 if (skb_queue_empty(&queue)) {
1763 napi_complete(napi); 1764 napi_complete(napi);
1764 spin_unlock_irq(&q->lock); 1765 spin_unlock_irq(&q->lock);
1765 return work_done; 1766 return work_done;
1766 } 1767 }
1767
1768 tail = q->rx_tail;
1769 q->rx_head = q->rx_tail = NULL;
1770 spin_unlock_irq(&q->lock); 1768 spin_unlock_irq(&q->lock);
1771 1769
1772 for (ngathered = 0; work_done < budget && head; work_done++) { 1770 ngathered = 0;
1773 prefetch(head->data); 1771 skb_queue_walk_safe(&queue, skb, tmp) {
1774 skbs[ngathered] = head; 1772 if (work_done >= budget)
1775 head = head->next; 1773 break;
1776 skbs[ngathered]->next = NULL; 1774 work_done++;
1775
1776 __skb_unlink(skb, &queue);
1777 prefetch(skb->data);
1778 skbs[ngathered] = skb;
1777 if (++ngathered == RX_BUNDLE_SIZE) { 1779 if (++ngathered == RX_BUNDLE_SIZE) {
1778 q->offload_bundles++; 1780 q->offload_bundles++;
1779 adapter->tdev.recv(&adapter->tdev, skbs, 1781 adapter->tdev.recv(&adapter->tdev, skbs,
@@ -1781,12 +1783,10 @@ static int ofld_poll(struct napi_struct *napi, int budget)
1781 ngathered = 0; 1783 ngathered = 0;
1782 } 1784 }
1783 } 1785 }
1784 if (head) { /* splice remaining packets back onto Rx queue */ 1786 if (!skb_queue_empty(&queue)) {
1787 /* splice remaining packets back onto Rx queue */
1785 spin_lock_irq(&q->lock); 1788 spin_lock_irq(&q->lock);
1786 tail->next = q->rx_head; 1789 skb_queue_splice(&queue, &q->rx_queue);
1787 if (!q->rx_head)
1788 q->rx_tail = tail;
1789 q->rx_head = head;
1790 spin_unlock_irq(&q->lock); 1790 spin_unlock_irq(&q->lock);
1791 } 1791 }
1792 deliver_partial_bundle(&adapter->tdev, q, skbs, ngathered); 1792 deliver_partial_bundle(&adapter->tdev, q, skbs, ngathered);
@@ -2934,6 +2934,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
2934 q->rspq.gen = 1; 2934 q->rspq.gen = 1;
2935 q->rspq.size = p->rspq_size; 2935 q->rspq.size = p->rspq_size;
2936 spin_lock_init(&q->rspq.lock); 2936 spin_lock_init(&q->rspq.lock);
2937 skb_queue_head_init(&q->rspq.rx_queue);
2937 2938
2938 q->txq[TXQ_ETH].stop_thres = nports * 2939 q->txq[TXQ_ETH].stop_thres = nports *
2939 flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); 2940 flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3);