From dbd52079e1101a18d244929114e59f50dc41e5d4 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 15 Nov 2024 14:16:37 +0100 Subject: [PATCH 1/2] drivers/netdev: revise return values of .confirm_send() --- drivers/include/net/netdev.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/include/net/netdev.h b/drivers/include/net/netdev.h index 12266ffa64..53362e59bb 100644 --- a/drivers/include/net/netdev.h +++ b/drivers/include/net/netdev.h @@ -468,10 +468,12 @@ typedef struct netdev_driver { * frame delimiters, etc. May be an estimate for performance * reasons.) * @retval -EAGAIN Transmission still ongoing. (Call later again!) - * @retval -ECOMM Any kind of transmission error, such as collision - * detected, layer 2 ACK timeout, etc. + * @retval -EHOSTUNREACH Layer 2 ACK timeout + * @retval -EBUSY Medium is busy. (E.g. Auto-CCA failed / timed out, + * collision detected) + * @retval -ENETDOWN Interface is not connected / powered down + * @retval -EIO Any kind of transmission error * Use @p info for more details - * @retval -EBUSY Medium is busy. (E.g. Auto-CCA failed / timed out) * @retval <0 Other error. (Please use a negative errno code.) * * @warning After netdev_driver_t::send was called and returned zero, this From 08fc52b53a5c2729b9a9ac55a081f89f350740fa Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 15 Nov 2024 14:17:33 +0100 Subject: [PATCH 2/2] cpu/sam0_common: eth: collision should return -EBUSY --- cpu/sam0_common/sam0_eth/eth-netdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpu/sam0_common/sam0_eth/eth-netdev.c b/cpu/sam0_common/sam0_eth/eth-netdev.c index 3b1ce6166a..d61bb19e94 100644 --- a/cpu/sam0_common/sam0_eth/eth-netdev.c +++ b/cpu/sam0_common/sam0_eth/eth-netdev.c @@ -221,13 +221,13 @@ static int _sam0_eth_confirm_send(netdev_t *netdev, void *info) return -EAGAIN; } - /* Retry Limit Exceeded */ - if (tsr & GMAC_TSR_RLE) { + /* Retry Limit Exceeded, Collision Occurred */ + if (tsr & (GMAC_TSR_RLE | GMAC_TSR_COL)) { return -EBUSY; } - /* Transmit Frame Corruption, Collision Occurred */ - if (tsr & (GMAC_TSR_TFC | GMAC_TSR_COL)) { + /* Transmit Frame Corruption */ + if (tsr & GMAC_TSR_TFC) { return -EIO; }