ps3_gelic: Fix start_xmit kick error path
authorAndre Heider <a.heider@gmail.com>
Tue, 12 Jul 2011 10:13:25 +0000 (10:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Jul 2011 17:12:15 +0000 (10:12 -0700)
Revert to a proper state when gelic_card_kick_txdma() fails:
- Don't trigger BUG_ON when releasing the unsent tx descriptor
- Reset the tx chain head since the tail was not modified and
  hence not in sync
- Unlink the released descriptor bus address from its predecessor

Signed-off-by: Andre Heider <a.heider@gmail.com>
Acked-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ps3_gelic_net.c

index 9652d10b0159ab8535ba65d334764882c59b2dd6..94422fcc8576afd61961ed36b9b28d5220fca284 100644 (file)
@@ -897,12 +897,16 @@ int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
        if (gelic_card_kick_txdma(card, descr)) {
                /*
                 * kick failed.
-                * release descriptors which were just prepared
+                * release descriptor which was just prepared
                 */
                netdev->stats.tx_dropped++;
+               /* don't trigger BUG_ON() in gelic_descr_release_tx */
+               descr->data_status = cpu_to_be32(GELIC_DESCR_TX_TAIL);
                gelic_descr_release_tx(card, descr);
-               gelic_descr_release_tx(card, descr->next);
-               card->tx_chain.tail = descr->next->next;
+               /* reset head */
+               card->tx_chain.head = descr;
+               /* reset hw termination */
+               descr->prev->next_descr_addr = 0;
                dev_info(ctodev(card), "%s: kick failure\n", __func__);
        }