1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 05:53:49 +01:00

Merge pull request #21796 from Morigawa/pr/netdev_ieee802154_submac_fix_bytestx

drivers/netdev_ieee802154_submac: fix bytes_tx
This commit is contained in:
crasbe 2025-10-31 20:20:49 +00:00 committed by GitHub
commit 12b719a0bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

@ -2,4 +2,5 @@ USEMODULE += netdev_ieee802154
USEMODULE += netdev_new_api
USEMODULE += ieee802154
USEMODULE += ieee802154_submac
USEMODULE += iolist
USEMODULE += ztimer_usec

View File

@ -196,7 +196,14 @@ static int _send(netdev_t *netdev, const iolist_t *pkt)
* inside the TX Done callback */
netdev_submac->ev = NETDEV_EVENT_TX_STARTED;
}
netdev_submac->bytes_tx = res;
if (res == 0) {
uint8_t len = iolist_size(pkt);
if (len > 0) {
len += IEEE802154_FCS_LEN;
}
netdev_submac->bytes_tx = len;
}
return res;
}

View File

@ -189,7 +189,7 @@ void send_pkt(otInstance *aInstance, netdev_t *dev, netdev_event_t event)
} else if (res == -EHOSTUNREACH) {
otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, OT_ERROR_NO_ACK);
} else {
otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, OT_ERROR_FAILED);
otPlatRadioTxDone(aInstance, &sTransmitFrame, NULL, OT_ERROR_ABORT);
}
}
#else