mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
netdev/ieee802154_submac: add retransmission reporting
If we do software retransmissions, we already keep a count. Allow to query it with `NETOPT_TX_RETRIES_NEEDED`.
This commit is contained in:
parent
08621f67b4
commit
37aad4ef38
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user