Skip to content

Commit 1611b4c

Browse files
rlubosjgl-meta
authored andcommitted
drivers: ieee802154_nrf5: Use generic symbols for packet size
Use generic symbols defined in ieee802154.h for packet/FCS size instead of redefining them in the driver header. Signed-off-by: Robert Lubos <[email protected]> (cherry picked from commit 5c5be08)
1 parent 8e62e70 commit 1611b4c

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
150150
if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) {
151151
pkt_len = rx_frame->psdu[0];
152152
} else {
153-
pkt_len = rx_frame->psdu[0] - NRF5_FCS_LENGTH;
153+
pkt_len = rx_frame->psdu[0] - IEEE802154_FCS_LENGTH;
154154
}
155155

156156
#if defined(CONFIG_NET_BUF_DATA_SIZE)
@@ -377,7 +377,7 @@ static int handle_ack(struct nrf5_802154_data *nrf5_radio)
377377
if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) {
378378
ack_len = nrf5_radio->ack_frame.psdu[0];
379379
} else {
380-
ack_len = nrf5_radio->ack_frame.psdu[0] - NRF5_FCS_LENGTH;
380+
ack_len = nrf5_radio->ack_frame.psdu[0] - IEEE802154_FCS_LENGTH;
381381
}
382382

383383
ack_pkt = net_pkt_rx_alloc_with_buffer(nrf5_radio->iface, ack_len,
@@ -577,14 +577,14 @@ static int nrf5_tx(const struct device *dev,
577577
uint8_t *payload = frag->data;
578578
bool ret = true;
579579

580-
if (payload_len > NRF5_PSDU_LENGTH) {
580+
if (payload_len > IEEE802154_MTU) {
581581
LOG_ERR("Payload too large: %d", payload_len);
582582
return -EMSGSIZE;
583583
}
584584

585585
LOG_DBG("%p (%u)", payload, payload_len);
586586

587-
nrf5_radio->tx_psdu[0] = payload_len + NRF5_FCS_LENGTH;
587+
nrf5_radio->tx_psdu[0] = payload_len + IEEE802154_FCS_LENGTH;
588588
memcpy(nrf5_radio->tx_psdu + 1, payload, payload_len);
589589

590590
/* Reset semaphore in case ACK was received after timeout */

drivers/ieee802154/ieee802154_nrf5.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#include <zephyr/net/ieee802154_radio.h>
1212

13-
#define NRF5_FCS_LENGTH (2)
14-
#define NRF5_PSDU_LENGTH (125)
1513
#define NRF5_PHR_LENGTH (1)
1614

1715
struct nrf5_802154_rx_frame {
@@ -61,7 +59,7 @@ struct nrf5_802154_data {
6159
/* TX buffer. First byte is PHR (length), remaining bytes are
6260
* MPDU data.
6361
*/
64-
uint8_t tx_psdu[NRF5_PHR_LENGTH + NRF5_PSDU_LENGTH + NRF5_FCS_LENGTH];
62+
uint8_t tx_psdu[NRF5_PHR_LENGTH + IEEE802154_MAX_PHY_PACKET_SIZE];
6563

6664
/* TX result, updated in radio transmit callbacks. */
6765
uint8_t tx_result;

0 commit comments

Comments
 (0)