49 lines
1.5 KiB
Diff
49 lines
1.5 KiB
Diff
From patchwork Thu Mar 15 14:07:09 2018
|
|
Content-Type: text/plain; charset="utf-8"
|
|
MIME-Version: 1.0
|
|
Content-Transfer-Encoding: 7bit
|
|
Subject: [U-Boot] net: Only access network devices after init
|
|
X-Patchwork-Submitter: Alexander Graf <agraf@suse.de>
|
|
X-Patchwork-Id: 886255
|
|
Message-Id: <20180315140709.10346-1-agraf@suse.de>
|
|
To: u-boot@lists.denx.de
|
|
Cc: Joe Hershberger <joe.hershberger@ni.com>
|
|
Date: Thu, 15 Mar 2018 15:07:09 +0100
|
|
From: Alexander Graf <agraf@suse.de>
|
|
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
|
|
|
In the efi_loader main loop we call eth_rx() occasionally. This rx function
|
|
might end up calling into devices that haven't been initialized yet,
|
|
potentially resulting in a lot of transfer timeouts.
|
|
|
|
Instead, let's make sure the ethernet device is actually initialized before
|
|
reading from or writing to it.
|
|
|
|
Signed-off-by: Alexander Graf <agraf@suse.de>
|
|
---
|
|
net/eth-uclass.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
|
|
index d30b04ba86..240b596534 100644
|
|
--- a/net/eth-uclass.c
|
|
+++ b/net/eth-uclass.c
|
|
@@ -336,7 +336,7 @@ int eth_send(void *packet, int length)
|
|
if (!current)
|
|
return -ENODEV;
|
|
|
|
- if (!device_active(current))
|
|
+ if (!eth_is_active(current))
|
|
return -EINVAL;
|
|
|
|
ret = eth_get_ops(current)->send(current, packet, length);
|
|
@@ -359,7 +359,7 @@ int eth_rx(void)
|
|
if (!current)
|
|
return -ENODEV;
|
|
|
|
- if (!device_active(current))
|
|
+ if (!eth_is_active(current))
|
|
return -EINVAL;
|
|
|
|
/* Process up to 32 packets at one time */
|