netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/fec: call netif_carrier_off when not having link
@ 2013-07-25 13:27 Uwe Kleine-König
  2013-07-25 16:03 ` Stephen Hemminger
  2013-07-30  9:29 ` [PATCH] net/fec: Don't let ndo_start_xmit return NETDEV_TX_BUSY without link Uwe Kleine-König
  0 siblings, 2 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2013-07-25 13:27 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Fabio Estevam, Frank Li, Shawn Guo, kernel,
	Hector Palacios, Tim Sander, Steven Rostedt, Thomas Gleixner

Without this patch I see a machine running an -rt patched Linux being
stuck in sch_direct_xmit when it looses link while there is still a
packet to be send. In this case the fec_enet_start_xmit routine returns
NETDEV_TX_BUSY which makes the network stack reschedule the packet and
so sch_direct_xmit calls fec_enet_start_xmit again.

The right fix is to tell the network stack that the link was lost (using
netif_carrier_off) so that it doesn't even try to get rid of the pending
packets.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

this resembles a problem described on the linux-rt mailing list some
time ago:

	http://thread.gmane.org/gmane.linux.rt.user/7815

So I Cc:d the people that participated in that thread.

IMHO this is 3.11 material (assuming I did it right) and is even worth
backporting as I think the problem exists in mainline, too, just harder
to trigger.

Best regards
Uwe

 drivers/net/ethernet/freescale/fec_main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 0642006..631bd5a 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -280,11 +280,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	unsigned short	status;
 	unsigned int index;
 
-	if (!fep->link) {
-		/* Link is down or auto-negotiation is in progress. */
-		return NETDEV_TX_BUSY;
-	}
-
 	/* Fill in a Tx ring entry */
 	bdp = fep->cur_tx;
 
@@ -459,6 +454,11 @@ fec_restart(struct net_device *ndev, int duplex)
 		netif_tx_lock_bh(ndev);
 	}
 
+	if (!fep->link)
+		netif_carrier_off(ndev);
+	else
+		netif_carrier_on(ndev);
+
 	/* Whack a reset.  We should wait for this. */
 	writel(1, fep->hwp + FEC_ECNTRL);
 	udelay(10);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-08-01  2:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 13:27 [PATCH] net/fec: call netif_carrier_off when not having link Uwe Kleine-König
2013-07-25 16:03 ` Stephen Hemminger
2013-07-26  9:35   ` Duan Fugang-B38611
2013-07-26 10:06     ` Florian Fainelli
2013-07-26 10:52       ` Sascha Hauer
2013-07-26 15:31     ` Ben Hutchings
2013-07-29  2:10       ` Duan Fugang-B38611
2013-07-29  2:14       ` Duan Fugang-B38611
2013-07-30  9:29 ` [PATCH] net/fec: Don't let ndo_start_xmit return NETDEV_TX_BUSY without link Uwe Kleine-König
2013-07-30  9:59   ` Duan Fugang-B38611
2013-07-30 23:05   ` David Miller
2013-07-31  8:16     ` Uwe Kleine-König
2013-07-31 18:51       ` David Miller
2013-08-01  2:01         ` Duan Fugang-B38611
2013-08-01  2:25           ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).