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

Merge pull request #15208 from benpicco/ieee802154_submac-etx

netdev/ieee802154_submac: add retransmission reporting
This commit is contained in:
benpicco 2020-10-15 14:31:54 +02:00 committed by GitHub
commit 4edf5c7cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View File

@ -49,6 +49,7 @@ typedef struct {
ieee802154_submac_t submac; /**< IEEE 802.15.4 SubMAC descriptor */
xtimer_t ack_timer; /**< xtimer descriptor for the ACK timeout timer */
int isr_flags; /**< netdev submac @ref NETDEV_EVENT_ISR flags */
int8_t retrans; /**< number of frame retransmissions of the last TX */
} netdev_ieee802154_submac_t;
/**

View File

@ -61,6 +61,12 @@ static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len)
case NETOPT_STATE:
*((netopt_state_t*) value) = _get_submac_state(submac);
return 0;
case NETOPT_TX_RETRIES_NEEDED:
if (netdev_submac->retrans < 0) {
return -ENOTSUP;
}
*((uint8_t*) value) = netdev_submac->retrans;
return 1;
default:
break;
}
@ -201,12 +207,15 @@ static void submac_tx_done(ieee802154_submac_t *submac, int status,
ieee802154_tx_info_t *info)
{
(void)status;
(void)info;
netdev_ieee802154_submac_t *netdev_submac = container_of(submac,
netdev_ieee802154_submac_t,
submac);
netdev_t *netdev = (netdev_t *)netdev_submac;
if (info) {
netdev_submac->retrans = info->retrans;
}
switch (status) {
case TX_STATUS_SUCCESS:
netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE);

View File

@ -252,7 +252,7 @@ typedef struct {
*/
typedef struct {
ieee802154_tx_status_t status; /**< status of the last transmission */
uint8_t retrans; /**< number of frame retransmissions of the last TX */
int8_t retrans; /**< number of frame retransmissions of the last TX */
} ieee802154_tx_info_t;
/**

View File

@ -182,6 +182,9 @@ static void _handle_tx_success(ieee802154_submac_t *submac,
if (ieee802154_radio_has_frame_retrans(dev) ||
ieee802154_radio_has_irq_ack_timeout(dev) || !submac->wait_for_ack) {
if (!ieee802154_radio_has_frame_retrans_info(dev)) {
info->retrans = -1;
}
_tx_end(submac, info->status, info);
}
else {