mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: barebox@lists.infradead.org
Cc: "Daniel Glöckner" <dg@emlix.com>
Subject: [PATCH 3/3] fastboot net: workaround for receiving before sending
Date: Fri, 28 Feb 2020 21:48:23 +0100	[thread overview]
Message-ID: <20200228204823.28415-4-dg@emlix.com> (raw)
In-Reply-To: <20200228204823.28415-1-dg@emlix.com>

eth_rx will poll a device only if it is active, but the only way to
activate a device is by calling eth_check_open. Although eth_check_open is
called both by eth_send and __eth_rx, only the call from eth_send has an
effect, because eth_rx will not call __eth_rx unless it is active.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
 include/net.h  | 1 +
 net/eth.c      | 2 +-
 net/fastboot.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/net.h b/include/net.h
index 6912a557b..b9b821c9a 100644
--- a/include/net.h
+++ b/include/net.h
@@ -83,6 +83,7 @@ int eth_set_ethaddr(struct eth_device *edev, const char *ethaddr);
 
 int eth_send(struct eth_device *edev, void *packet, int length);	   /* Send a packet		*/
 int eth_rx(void);			/* Check for received packets	*/
+int eth_check_open(struct eth_device *edev);
 
 /* associate a MAC address to a ethernet device. Should be called by
  * board code for boards which store their MAC address at some unusual
diff --git a/net/eth.c b/net/eth.c
index 53d24baa1..25ed9a88e 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -215,7 +215,7 @@ static int eth_carrier_check(struct eth_device *edev, int force)
  * Check if we have a current ethernet device and
  * eventually open it if we have to.
  */
-static int eth_check_open(struct eth_device *edev)
+int eth_check_open(struct eth_device *edev)
 {
 	int ret;
 
diff --git a/net/fastboot.c b/net/fastboot.c
index 41d1859ab..57128258d 100644
--- a/net/fastboot.c
+++ b/net/fastboot.c
@@ -393,6 +393,7 @@ struct fastboot_net *fastboot_net_init(struct fastboot_opts *opts)
 	}
 	net_udp_bind(fbn->net_con, FASTBOOT_PORT);
 
+	eth_check_open(fbn->net_con->edev);
 	fbn->poller.func = fastboot_poll;
 	ret = poller_register(&fbn->poller);
 	if (ret)
-- 
2.17.1


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

  parent reply	other threads:[~2020-02-28 20:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 20:48 [PATCH 0/3] Support for fastboot over UDP Daniel Glöckner
2020-02-28 20:48 ` [PATCH 1/3] fastboot: split generic code from USB gadget Daniel Glöckner
2020-03-05  7:25   ` Sascha Hauer
2020-02-28 20:48 ` [PATCH 2/3] fastboot net: implement fastboot over UDP Daniel Glöckner
2020-03-05  7:50   ` Sascha Hauer
2020-03-05 20:15     ` Daniel Glöckner
2020-03-06 19:36       ` Sascha Hauer
2020-02-28 20:48 ` Daniel Glöckner [this message]
2020-03-05  7:54 ` [PATCH 0/3] Support for " Sascha Hauer
2020-03-09  7:14 ` Sascha Hauer
2020-03-09 15:38   ` Daniel Glöckner
2020-03-12  8:26     ` 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=20200228204823.28415-4-dg@emlix.com \
    --to=dg@emlix.com \
    --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