netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] be2net: free tx buffers when completions never arrive
@ 2010-02-18  9:36 Sathya Perla
  2010-02-18 10:16 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Sathya Perla @ 2010-02-18  9:36 UTC (permalink / raw)
  To: netdev

In cases like when a pci device is disconnected after a pci error,
pending tx completions will never arrive. Unmap and free such
buffers in the tx cleanup path.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
---
 drivers/net/benet/be_main.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 68e7848..810d2a4 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1128,6 +1128,9 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
 	struct be_queue_info *txq = &adapter->tx_obj.q;
 	struct be_eth_tx_compl *txcp;
 	u16 end_idx, cmpl = 0, timeo = 0;
+	struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list;
+	struct sk_buff *sent_skb;
+        bool dummy_wrb;

 	/* Wait for a max of 200ms for all the tx-completions to arrive. */
 	do {
@@ -1151,6 +1154,15 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
 	if (atomic_read(&txq->used))
 		dev_err(&adapter->pdev->dev, "%d pending tx-completions\n",
 			atomic_read(&txq->used));
+	
+	/* free posted tx for which compls will never arrive */
+        while (atomic_read(&txq->used)) {
+                sent_skb = sent_skbs[txq->tail];
+                end_idx = txq->tail;
+                index_adv(&end_idx,
+                        wrb_cnt_for_skb(sent_skb, &dummy_wrb) - 1, txq->len);
+                be_tx_compl_process(adapter, end_idx);
+        }
 }

 static void be_mcc_queues_destroy(struct be_adapter *adapter)
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-18 23:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-18  9:36 [PATCH net-next-2.6] be2net: free tx buffers when completions never arrive Sathya Perla
2010-02-18 10:16 ` David Miller
2010-02-18 10:37   ` Sathya Perla
2010-02-18 23:44     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).