diff options
author | Sathya Perla <sathyap@serverengines.com> | 2010-02-18 00:37:17 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-18 15:43:10 -0800 |
commit | b03388d6389e8853ddd9ae19d2ba15a6dbbe5d21 (patch) | |
tree | 032417e678d19da31df28e702fbf63d9534e1baf /drivers/net/benet | |
parent | 72032fdbcde8b333e65b3430e1bcb4358e2d6716 (diff) | |
download | kernel_samsung_smdk4412-b03388d6389e8853ddd9ae19d2ba15a6dbbe5d21.zip kernel_samsung_smdk4412-b03388d6389e8853ddd9ae19d2ba15a6dbbe5d21.tar.gz kernel_samsung_smdk4412-b03388d6389e8853ddd9ae19d2ba15a6dbbe5d21.tar.bz2 |
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/net/benet')
-rw-r--r-- | 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..545c841 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) |