drivers: ieee802154: nrf5: set security enabled bit value
Assign `ack_seb` in `net_pkt_cb_ieee802154`. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
This commit is contained in:
parent
ec75b7704f
commit
3676e7c360
|
@ -58,11 +58,6 @@ struct nrf5_802154_config {
|
|||
|
||||
static struct nrf5_802154_data nrf5_data;
|
||||
|
||||
#define ACK_REQUEST_BYTE 1
|
||||
#define ACK_REQUEST_BIT (1 << 5)
|
||||
#define FRAME_PENDING_BYTE 1
|
||||
#define FRAME_PENDING_BIT (1 << 4)
|
||||
|
||||
#define DRX_SLOT_RX 0 /* Delayed reception window ID */
|
||||
|
||||
#define NSEC_PER_TEN_SYMBOLS (10 * IEEE802154_PHY_OQPSK_780_TO_2450MHZ_SYMBOL_PERIOD_NS)
|
||||
|
@ -183,6 +178,10 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
|||
net_pkt_set_timestamp_ns(pkt, rx_frame->time * NSEC_PER_USEC);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_L2_OPENTHREAD)
|
||||
net_pkt_set_ieee802154_ack_seb(pkt, rx_frame->ack_seb);
|
||||
#endif
|
||||
|
||||
LOG_DBG("Caught a packet (%u) (LQI: %u)",
|
||||
pkt_len, rx_frame->lqi);
|
||||
|
||||
|
@ -1031,13 +1030,10 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi,
|
|||
nrf_802154_timestamp_end_to_phr_convert(time, data[0]);
|
||||
#endif
|
||||
|
||||
if (data[ACK_REQUEST_BYTE] & ACK_REQUEST_BIT) {
|
||||
nrf5_data.rx_frames[i].ack_fpb = nrf5_data.last_frame_ack_fpb;
|
||||
} else {
|
||||
nrf5_data.rx_frames[i].ack_fpb = false;
|
||||
}
|
||||
|
||||
nrf5_data.rx_frames[i].ack_seb = nrf5_data.last_frame_ack_seb;
|
||||
nrf5_data.last_frame_ack_fpb = false;
|
||||
nrf5_data.last_frame_ack_seb = false;
|
||||
|
||||
k_fifo_put(&nrf5_data.rx_fifo, &nrf5_data.rx_frames[i]);
|
||||
|
||||
|
@ -1097,6 +1093,8 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id)
|
|||
}
|
||||
|
||||
nrf5_data.last_frame_ack_fpb = false;
|
||||
nrf5_data.last_frame_ack_seb = false;
|
||||
|
||||
if (nrf5_data.event_handler) {
|
||||
nrf5_data.event_handler(dev, IEEE802154_EVENT_RX_FAILED, (void *)&reason);
|
||||
}
|
||||
|
@ -1104,8 +1102,8 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id)
|
|||
|
||||
void nrf_802154_tx_ack_started(const uint8_t *data)
|
||||
{
|
||||
nrf5_data.last_frame_ack_fpb =
|
||||
data[FRAME_PENDING_BYTE] & FRAME_PENDING_BIT;
|
||||
nrf5_data.last_frame_ack_fpb = data[FRAME_PENDING_OFFSET] & FRAME_PENDING_BIT;
|
||||
nrf5_data.last_frame_ack_seb = data[SECURITY_ENABLED_OFFSET] & SECURITY_ENABLED_BIT;
|
||||
}
|
||||
|
||||
void nrf_802154_transmitted_raw(uint8_t *frame,
|
||||
|
|
|
@ -19,6 +19,7 @@ struct nrf5_802154_rx_frame {
|
|||
uint8_t lqi; /* Last received frame LQI value. */
|
||||
int8_t rssi; /* Last received frame RSSI value. */
|
||||
bool ack_fpb; /* FPB value in ACK sent for the received frame. */
|
||||
bool ack_seb; /* SEB value in ACK sent for the received frame. */
|
||||
};
|
||||
|
||||
struct nrf5_802154_data {
|
||||
|
@ -45,6 +46,9 @@ struct nrf5_802154_data {
|
|||
/* Frame pending bit value in ACK sent for the last received frame. */
|
||||
bool last_frame_ack_fpb;
|
||||
|
||||
/* Security Enabled bit value in ACK sent for the last received frame. */
|
||||
bool last_frame_ack_seb;
|
||||
|
||||
/* CCA complete semaphore. Unlocked when CCA is complete. */
|
||||
struct k_sem cca_wait;
|
||||
|
||||
|
|
Loading…
Reference in a new issue