[PATCH 23/25] net: efi-snp: Check for carrier before sending

Sascha Hauer s.hauer at pengutronix.de
Mon Dec 13 13:09:03 PST 2021


We have carrier informations available, so check them before sending a
packet.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/efi-snp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/efi-snp.c b/drivers/net/efi-snp.c
index def2714bee..3c0663c802 100644
--- a/drivers/net/efi-snp.c
+++ b/drivers/net/efi-snp.c
@@ -134,6 +134,9 @@ static int efi_snp_eth_send(struct eth_device *edev, void *packet, int length)
 	void *txbuf;
 	uint64_t start;
 
+	if (!priv->snp->Mode->MediaPresent)
+		return -ENOMEDIUM;
+
 	efiret = priv->snp->transmit(priv->snp, 0, length, packet, NULL, NULL, NULL);
 	if (EFI_ERROR(efiret)) {
 		dev_err(priv->dev, "failed to send: %s\n", efi_strerror(efiret));
-- 
2.30.2




More information about the barebox mailing list