From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Fabio Estevam <fabio.estevam@freescale.com>,
Frank Li <Frank.Li@freescale.com>,
Shawn Guo <shawn.guo@linaro.org>,
kernel@pengutronix.de, Hector Palacios <hector.palacios@digi.com>,
Tim Sander <tim.sander@hbm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] net/fec: call netif_carrier_off when not having link
Date: Thu, 25 Jul 2013 15:27:55 +0200 [thread overview]
Message-ID: <1374758875-7926-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
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
next reply other threads:[~2013-07-25 13:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 13:27 Uwe Kleine-König [this message]
2013-07-25 16:03 ` [PATCH] net/fec: call netif_carrier_off when not having link 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374758875-7926-1-git-send-email-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=Frank.Li@freescale.com \
--cc=davem@davemloft.net \
--cc=fabio.estevam@freescale.com \
--cc=hector.palacios@digi.com \
--cc=kernel@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=shawn.guo@linaro.org \
--cc=tglx@linutronix.de \
--cc=tim.sander@hbm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).