ps3_gelic: Fix error paths when a tx dma fails
Subsystems (4)
cover ps3_gelic: Fix error paths when a tx dma fails
This series fixes a few bugs for the error paths once a tx dma request fails. Without these I either ran into BUG_ON, the device got killed, or the kernel crashed.
Note about #2:
I'm not sure what "gelic_descr_release_tx(card, descr->next)" was doing there, ->next was never touched. Did i miss something?
Andre Heider (3):
ps3_gelic: Fix typos
ps3_gelic: Fix start_xmit kick error path
ps3_gelic: Don't kill the device on DMA failure
drivers/net/ps3_gelic_net.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/3 ps3_gelic: Fix typos
--- drivers/net/ps3_gelic_net.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ps3_gelic_net.c +3 -3
@@ -876,7 +876,7 @@ int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) result =gelic_descr_prepare_tx (card, descr, skb);if (result) {/* -* DMA map failed. As chanses are that failure +* DMA map failed. As chances are that failure * would continue, just release skb and return */ netdev->stats.tx_dropped++;
@@ -1041,7 +1041,7 @@ static int gelic_card_decode_one_descr(struct gelic_card *card) goto refill; }/* -* descriptoers any other than FRAME_END here should +* descriptors any other than FRAME_END here should * be treated as error. */ if (status !=GELIC_DESCR_DMA_FRAME_END ) {
@@ -1200,7 +1200,7 @@ void gelic_net_poll_controller(struct net_device *netdev)#endif /* CONFIG_NET_POLL_CONTROLLER */ /** -* gelic_net_open - called upon ifonfig up +* gelic_net_open - called upon ifconfig up * @netdev: interface device structure * * returns 0 on success, <0 on failure
Signature · 1 line
1.7.5.4
PATCH 2/3 ps3_gelic: Fix start_xmit kick error path
In reply to Andre HeiderRevert 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
--- drivers/net/ps3_gelic_net.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/ps3_gelic_net.c +7 -3
@@ -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__); }
Signature · 1 line
1.7.5.4
PATCH 3/3 ps3_gelic: Don't kill the device on DMA failure
In reply to Andre HeiderReset card->tx_dma_progress when lv1_net_start_tx_dma() fails or it won't send anything afterwards anymore
--- drivers/net/ps3_gelic_net.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ps3_gelic_net.c +3 -1
@@ -838,9 +838,11 @@ static int gelic_card_kick_txdma(struct gelic_card *card, card->tx_dma_progress =1 ; status =lv1_net_start_tx_dma (bus_id (card),dev_id (card), descr->bus_addr,0 ); -if (status) +if (status) { + card->tx_dma_progress =0 ;dev_info (ctodev (card),"lv1_net_start_txdma failed," \"status=%d\n" , status); + } }return status; }
Signature · 1 line
1.7.5.4
Geoff Levand
maintainerHi Andre,
Quoted 3 lines · Andre Heider
This series fixes a few bugs for the error paths once a tx dma request fails. Without these I either ran into
BUG_ON, the device got killed, or the kernel crashed.
Thanks for preparing the fixes. I added them to my ps3-linux tree and did some quick tests which didn't show any problems. I'll try to do some more through testing with them sometime soon.
-Geoff
Hey Geoff,
Quoted 11 lines · Geoff Levand
Hi Andre,
Quoted 3 lines · Andre Heider
This series fixes a few bugs for the error paths once a tx dma request fails. Without these I either ran into
BUG_ON, the device got killed, or the kernel crashed.Thanks for preparing the fixes. I added them to my ps3-linux tree and did some quick tests which didn't show any problems. I'll try to do some more through testing with them sometime soon.
nice, thanks :)
Regards,
Andre
David Miller
maintainerFrom: Andre Heider <[email protected]>
Date: Thu, 14 Jul 2011 10:36:32 +0200
Quoted 10 lines
Hey Geoff,
Quoted 7 lines · Geoff Levand
Hi Andre,
Quoted 3 lines · Andre Heider
This series fixes a few bugs for the error paths once a tx dma request fails. Without these I either ran into
BUG_ON, the device got killed, or the kernel crashed.
Quoted 6 lines
Quoted 4 lines
Thanks for preparing the fixes. I added them to my ps3-linux tree and did some quick tests which didn't show any problems. I'll try to do some more through testing with them sometime soon.
nice, thanks :)
Should I toss these into net-next-2.6 now?
Hi Dave,
Quoted 11 lines · David Miller
From: Andre Heider <[email protected]>
Date: Thu, 14 Jul 2011 10:36:32 +0200Quoted 9 lines · Geoff Levand
Quoted 7 lines
Hi Andre,
Quoted 3 lines · Andre Heider
This series fixes a few bugs for the error paths once a tx dma request fails. Without these I either ran into
BUG_ON, the device got killed, or the kernel crashed.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Thanks for preparing the fixes. I added them to my ps3-linux tree and did some quick tests which didn't show any problems. I'll try to do some more through testing with them sometime soon.
Should I toss these into net-next-2.6 now?
It seems reasonable to add these in. I also have a fix for an RX interrupt hang that I'll send you.
David Miller
maintainerFrom: Geoff Levand <[email protected]>
Date: Thu, 14 Jul 2011 10:10:07 -0700
Quoted 7 lines · David Miller
Quoted 1 line
Should I toss these into net-next-2.6 now?
It seems reasonable to add these in. I also have a fix for an RX interrupt hang that I'll send you.
Acked-by Geoff Levand <[email protected]>
Great, done.