mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] net: disable all other devices when enabling the new one
Date: Fri, 15 Nov 2019 17:20:14 +0100	[thread overview]
Message-ID: <20191115162014.16111-1-m.grzeschik@pengutronix.de> (raw)

Some network devices need proper reinitialization before they can be
used. This is especially the case when using devices that share the same
driver.

Therefor the current approach, starting the open routine of an ether
device just once with the first call of send, runs those devices into
some unreliable behaviour.

This patch disables all devices that are not being used so they get
reinitialized with the next usage.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 net/eth.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/eth.c b/net/eth.c
index 53d24baa16..0c26324d3f 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -217,6 +217,7 @@ static int eth_carrier_check(struct eth_device *edev, int force)
  */
 static int eth_check_open(struct eth_device *edev)
 {
+	struct eth_device *tmpedev;
 	int ret;
 
 	if (edev->active)
@@ -226,6 +227,9 @@ static int eth_check_open(struct eth_device *edev)
 	if (ret)
 		return ret;
 
+	for_each_netdev(tmpedev)
+		tmpedev->active = 0;
+
 	edev->active = 1;
 
 	return eth_carrier_check(edev, 1);
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2019-11-15 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 16:20 Michael Grzeschik [this message]
2019-11-18  8:19 ` Sascha Hauer

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=20191115162014.16111-1-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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