Skip to contentSkip to conversation

net: Only access network devices after init

PATCH In review Alexander Graf 2 participants 3 messages Mar 15, 2018 – Mar 26, 2018 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Only access network devices after init

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.

---
 net/eth-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/eth-uclass.c +2 -2
index d30b04ba86..240b596534 100644
@@ -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 */
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/1 net: Only access network devices after init

Quoted 8 lines · Alexander Graf

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.