1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #21031 from benpicco/net_fixes-misc

drivers/at86rf215: return ENETDOWN when interface is down
This commit is contained in:
Marian Buschsieweke 2024-11-23 16:30:32 +00:00 committed by GitHub
commit c700aa92d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 10 deletions

View File

@ -247,7 +247,7 @@ static bool _tx_ongoing(at86rf215_t *dev)
int at86rf215_tx_prepare(at86rf215_t *dev) int at86rf215_tx_prepare(at86rf215_t *dev)
{ {
if (dev->state == AT86RF215_STATE_SLEEP) { if (dev->state == AT86RF215_STATE_SLEEP) {
return -EAGAIN; return -ENETDOWN;
} }
if (_tx_ongoing(dev)) { if (_tx_ongoing(dev)) {

View File

@ -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); netdev_ieee802154_t *netdev_ieee802154 = container_of(netdev, netdev_ieee802154_t, netdev);
at86rf215_t *dev = container_of(netdev_ieee802154, at86rf215_t, netdev); at86rf215_t *dev = container_of(netdev_ieee802154, at86rf215_t, netdev);
size_t len = 0;
if (at86rf215_tx_prepare(dev)) { ssize_t len = at86rf215_tx_prepare(dev);
return -EBUSY; if (len) {
return len;
} }
/* load packet data into FIFO */ /* load packet data into FIFO */
@ -176,9 +176,6 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
at86rf215_tx_exec(dev); at86rf215_tx_exec(dev);
} }
/* store successfully sent number of bytes */
dev->tx_frame_len = len;
/* netdev_new just returns 0 on success */ /* netdev_new just returns 0 on success */
return 0; return 0;
} }

View File

@ -1807,7 +1807,7 @@ static void _tx_done(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt,
return; /* early return to not release */ return; /* early return to not release */
} }
else { 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 /* If we got here, it means the device was busy and the pkt queue
* was full. The packet should be dropped here anyway */ * was full. The packet should be dropped here anyway */
gnrc_pktbuf_release_error(pkt, ENOMEM); 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; return;
} }
else { 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 */ /* try to send anyway */
} }
} }

View File

@ -327,7 +327,7 @@ int nanotest_client_get_non_cmd(int argc, char **argv)
{ {
int res; int res;
uint8_t response[CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT]; uint8_t response[coap_szx2size(CONFIG_NANOCOAP_BLOCKSIZE_DEFAULT)];
if (argc < 2) { if (argc < 2) {
printf("usage: %s <url>\n", argv[0]); printf("usage: %s <url>\n", argv[0]);