Skip to contentSkip to conversation

be2net: free tx buffers when completions never arrive

PATCH Applied Sathya Perla 2 participants 4 messages Feb 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 be2net: free tx buffers when completions never arrive

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.

---
 drivers/net/benet/be_main.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/net/benet/be_main.c +12 -0
index 68e7848..810d2a4 100644
@@ -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)
Signature · 1 line
1.6.3.3
maintainer
#1 lore raw

From: Sathya Perla <[email protected]>
Date: Thu, 18 Feb 2010 15:06:03 +0530

Quoted 14 lines

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.

---
 drivers/net/benet/be_main.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/net/benet/be_main.c +0 -0
index 68e7848..810d2a4 100644

drivers/net/benet/be_main.c static void be_tx_compl_clean(struct be_adapter *adapter) · line 1133

Quoted 6 lines
drivers/net/benet/be_main.c +3 -0
@@ -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;

Some of your lines start with tabs, some with spaces. You
have to use tabs consistently.

drivers/net/benet/be_main.c static void be_tx_compl_clean(struct be_adapter *adapter) · line 1166

Quoted 10 lines
drivers/net/benet/be_main.c +9 -0
+	
+	/* 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);
+        }
 }

More tabbing and indentation problems here too.

#2 lore raw

On 18/02/10 02:16 -0800, David Miller wrote:
<snip>

Quoted 5 lines
Quoted 1 line

+ bool dummy_wrb;

Some of your lines start with tabs, some with spaces. You
have to use tabs consistently.

<snip>

Sorry, mistake fixed; patch below. Thanks a lot...

-Sathya

Quoted 1 line

From 8f9134221833d4d00da1482f3051751b625649ca Mon Sep 17 00:00:00 2001

From: Sathya Perla <[email protected]>
Date: Thu, 18 Feb 2010 14:57:35 +0530
Subject: [PATCH net-next-2.6] be2net: free tx buffers when completions never arrive

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

---
 drivers/net/benet/be_main.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/net/benet/be_main.c +12 -0
index 68e7848..545c841 100644
@@ -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)
Signature · 1 line
1.6.3.3
maintainer Applied
#3 lore raw

From: Sathya Perla <[email protected]>
Date: Thu, 18 Feb 2010 16:07:17 +0530

Quoted 11 lines · David Miller

<snip>

Quoted 5 lines
Quoted 1 line

+ bool dummy_wrb;

Some of your lines start with tabs, some with spaces. You
have to use tabs consistently.

<snip>

Sorry, mistake fixed; patch below. Thanks a lot...

Applied.