From ef639df76fa03518480fdd210a14d8b146092d78 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 22 Nov 2024 19:44:12 +0100 Subject: [PATCH 1/4] drivers/at86rf215: return ENETDOWN when interface is down --- drivers/at86rf215/at86rf215.c | 2 +- drivers/at86rf215/at86rf215_netdev.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/at86rf215/at86rf215.c b/drivers/at86rf215/at86rf215.c index 9df5cda50b..c107948fef 100644 --- a/drivers/at86rf215/at86rf215.c +++ b/drivers/at86rf215/at86rf215.c @@ -247,7 +247,7 @@ static bool _tx_ongoing(at86rf215_t *dev) int at86rf215_tx_prepare(at86rf215_t *dev) { if (dev->state == AT86RF215_STATE_SLEEP) { - return -EAGAIN; + return -ENETDOWN; } if (_tx_ongoing(dev)) { diff --git a/drivers/at86rf215/at86rf215_netdev.c b/drivers/at86rf215/at86rf215_netdev.c index 74eb08b65e..99dd571823 100644 --- a/drivers/at86rf215/at86rf215_netdev.c +++ b/drivers/at86rf215/at86rf215_netdev.c @@ -149,10 +149,10 @@ static int _send(netdev_t *netdev, const iolist_t *iolist) { netdev_ieee802154_t *netdev_ieee802154 = container_of(netdev, netdev_ieee802154_t, netdev); at86rf215_t *dev = container_of(netdev_ieee802154, at86rf215_t, netdev); - size_t len = 0; - if (at86rf215_tx_prepare(dev)) { - return -EBUSY; + ssize_t len = at86rf215_tx_prepare(dev); + if (len) { + return len; } /* load packet data into FIFO */ From a379658fa139d6087e0c8bd2ee908793eef655b1 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 22 Nov 2024 19:44:49 +0100 Subject: [PATCH 2/4] drivers/at86rf215: tx_frame_len is already set by at86rf215_tx_load() --- drivers/at86rf215/at86rf215_netdev.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/at86rf215/at86rf215_netdev.c b/drivers/at86rf215/at86rf215_netdev.c index 99dd571823..ea6661877b 100644 --- a/drivers/at86rf215/at86rf215_netdev.c +++ b/drivers/at86rf215/at86rf215_netdev.c @@ -176,9 +176,6 @@ static int _send(netdev_t *netdev, const iolist_t *iolist) at86rf215_tx_exec(dev); } - /* store successfully sent number of bytes */ - dev->tx_frame_len = len; - /* netdev_new just returns 0 on success */ return 0; } From 2a6b8a3fedcc45f4de0af69ab55c91b0528d61c9 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 22 Nov 2024 19:45:43 +0100 Subject: [PATCH 3/4] gnrc_netif: use different error messages for can't queue packet --- sys/net/gnrc/netif/gnrc_netif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index aa6cd4020f..6b6619bfc0 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -1807,7 +1807,7 @@ static void _tx_done(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, return; /* early return to not release */ } else { - LOG_ERROR("gnrc_netif: can't queue packet for sending\n"); + LOG_ERROR("gnrc_netif: can't queue packet for sending, drop it\n"); /* If we got here, it means the device was busy and the pkt queue * was full. The packet should be dropped here anyway */ gnrc_pktbuf_release_error(pkt, ENOMEM); @@ -1880,7 +1880,7 @@ static void _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, bool push_back) return; } else { - LOG_WARNING("gnrc_netif: can't queue packet for sending\n"); + LOG_WARNING("gnrc_netif: can't queue packet for sending, try sending\n"); /* try to send anyway */ } } From 9d22e46fa9dca50bd214db79d85f0141eda0a02e Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 22 Nov 2024 19:46:20 +0100 Subject: [PATCH 4/4] test/net/nanocoap_cli: fix buffer size for get_non --- tests/net/nanocoap_cli/nanocli_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/nanocoap_cli/nanocli_client.c b/tests/net/nanocoap_cli/nanocli_client.c index 3266c69055..2f8351a14e 100644 --- a/tests/net/nanocoap_cli/nanocli_client.c +++ b/tests/net/nanocoap_cli/nanocli_client.c @@ -327,7 +327,7 @@ int nanotest_client_get_non_cmd(int argc, char **argv) { int res; - uint8_t response[CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT]; + uint8_t response[coap_szx2size(CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT)]; if (argc < 2) { printf("usage: %s \n", argv[0]);