drivers: ieee802154: fix ACK length handling
OpenThread expects the FCS field at the end of the ACK frame to be passed with `otPlatRadioTxDone`. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
This commit is contained in:
parent
9c3450d87e
commit
9c6895105d
2 changed files with 8 additions and 2 deletions
|
@ -358,10 +358,16 @@ static int nrf5_set_txpower(const struct device *dev, int16_t dbm)
|
||||||
|
|
||||||
static int handle_ack(struct nrf5_802154_data *nrf5_radio)
|
static int handle_ack(struct nrf5_802154_data *nrf5_radio)
|
||||||
{
|
{
|
||||||
uint8_t ack_len = nrf5_radio->ack_frame.psdu[0] - NRF5_FCS_LENGTH;
|
uint8_t ack_len;
|
||||||
struct net_pkt *ack_pkt;
|
struct net_pkt *ack_pkt;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_IEEE802154_RAW_MODE) || IS_ENABLED(CONFIG_NET_L2_OPENTHREAD)) {
|
||||||
|
ack_len = nrf5_radio->ack_frame.psdu[0];
|
||||||
|
} else {
|
||||||
|
ack_len = nrf5_radio->ack_frame.psdu[0] - NRF5_FCS_LENGTH;
|
||||||
|
}
|
||||||
|
|
||||||
ack_pkt = net_pkt_alloc_with_buffer(nrf5_radio->iface, ack_len,
|
ack_pkt = net_pkt_alloc_with_buffer(nrf5_radio->iface, ack_len,
|
||||||
AF_UNSPEC, 0, K_NO_WAIT);
|
AF_UNSPEC, 0, K_NO_WAIT);
|
||||||
if (!ack_pkt) {
|
if (!ack_pkt) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_OPENTHREAD_L2_LOG_LEVEL);
|
||||||
#if defined(CONFIG_IEEE802154_2015)
|
#if defined(CONFIG_IEEE802154_2015)
|
||||||
#define ACK_PKT_LENGTH 127
|
#define ACK_PKT_LENGTH 127
|
||||||
#else
|
#else
|
||||||
#define ACK_PKT_LENGTH 3
|
#define ACK_PKT_LENGTH 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FRAME_TYPE_MASK 0x07
|
#define FRAME_TYPE_MASK 0x07
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue