aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSathya Perla <sathyap@serverengines.com>2010-02-17 19:37:17 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-18 18:43:10 -0500
commitb03388d6389e8853ddd9ae19d2ba15a6dbbe5d21 (patch)
tree032417e678d19da31df28e702fbf63d9534e1baf /drivers
parent72032fdbcde8b333e65b3430e1bcb4358e2d6716 (diff)
be2net: free tx buffers when completions never arrive
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. Signed-off-by: Sathya Perla <sathyap@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/benet/be_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 68e7848ac0b0..545c8417fc26 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)
1128 struct be_queue_info *txq = &adapter->tx_obj.q; 1128 struct be_queue_info *txq = &adapter->tx_obj.q;
1129 struct be_eth_tx_compl *txcp; 1129 struct be_eth_tx_compl *txcp;
1130 u16 end_idx, cmpl = 0, timeo = 0; 1130 u16 end_idx, cmpl = 0, timeo = 0;
1131 struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list;
1132 struct sk_buff *sent_skb;
1133 bool dummy_wrb;
1131 1134
1132 /* Wait for a max of 200ms for all the tx-completions to arrive. */ 1135 /* Wait for a max of 200ms for all the tx-completions to arrive. */
1133 do { 1136 do {
@@ -1151,6 +1154,15 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
1151 if (atomic_read(&txq->used)) 1154 if (atomic_read(&txq->used))
1152 dev_err(&adapter->pdev->dev, "%d pending tx-completions\n", 1155 dev_err(&adapter->pdev->dev, "%d pending tx-completions\n",
1153 atomic_read(&txq->used)); 1156 atomic_read(&txq->used));
1157
1158 /* free posted tx for which compls will never arrive */
1159 while (atomic_read(&txq->used)) {
1160 sent_skb = sent_skbs[txq->tail];
1161 end_idx = txq->tail;
1162 index_adv(&end_idx,
1163 wrb_cnt_for_skb(sent_skb, &dummy_wrb) - 1, txq->len);
1164 be_tx_compl_process(adapter, end_idx);
1165 }
1154} 1166}
1155 1167
1156static void be_mcc_queues_destroy(struct be_adapter *adapter) 1168static void be_mcc_queues_destroy(struct be_adapter *adapter)