Skip to contentSkip to conversation

ps3_gelic: Fix error paths when a tx dma fails

PATCH In review Andre Heider 3 participants 9 messages Jul 12, 2011 – Jul 14, 2011

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

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
#1 lore raw

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
index 35e47c3..9652d10 100644
@@ -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
#2 lore raw

PATCH 2/3 ps3_gelic: Fix start_xmit kick error path

In reply to Andre Heider

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

---
 drivers/net/ps3_gelic_net.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/ps3_gelic_net.c +7 -3
index 9652d10..94422fc 100644
@@ -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
#3 lore raw

PATCH 3/3 ps3_gelic: Don't kill the device on DMA failure

In reply to Andre Heider

Reset 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
index 94422fc..4acc17b 100644
@@ -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
maintainer
#4 lore raw
In reply to Andre Heider

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.

-Geoff

#5 lore raw

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

maintainer
#6 lore raw

From: 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?

maintainer Acked-by
#7 lore raw

Hi Dave,

Quoted 11 lines · David Miller

From: Andre Heider <[email protected]>
Date: Thu, 14 Jul 2011 10:36:32 +0200

Quoted 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.

maintainer
#8 lore raw

From: 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.

Great, done.