Bluetooth: controller: Add CTE present bit to pdu_data
If the CTE is attached to data channel packet, the packet must include information about CTE. The information is stored in CTEInfo structure that is available in S1 byte of a packet. Radio checks if the S1 byte is present by verification of CTE present (CP) bit in byte S0. The commit add these data to pdu_data structure declaration. That allows to prepare packet before it is parsed and send by Radio peripheral. Besides that there added a new function ull_pdu_data_init that initlializes fields in pdu_data object that are read only by lower link layer. CP bit in S0 byte and content of S1 bytes are examples of such fields. Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
parent
ef24a141fb
commit
f650fd99e0
6 changed files with 99 additions and 9 deletions
|
@ -607,10 +607,6 @@ void lll_conn_pdu_tx_prep(struct lll_conn *lll, struct pdu_data **pdu_data_tx)
|
|||
}
|
||||
|
||||
p->rfu = 0U;
|
||||
|
||||
#if !defined(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR)
|
||||
p->resv = 0U;
|
||||
#endif /* !CONFIG_BT_CTLR_DATA_LENGTH_CLEAR */
|
||||
}
|
||||
|
||||
*pdu_data_tx = p;
|
||||
|
@ -864,4 +860,8 @@ static void empty_tx_init(void)
|
|||
|
||||
p = (void *)radio_pkt_empty_get();
|
||||
p->ll_id = PDU_DATA_LLID_DATA_CONTINUE;
|
||||
p->cp = PDU_DATA_CTE_PRESENT_BIT_DISABLED;
|
||||
#if !defined(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR)
|
||||
p->resv = 0U;
|
||||
#endif /* CONFIG_BT_CTLR_DATA_LENGTH_CLEAR */
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ struct pdu_cte_info {
|
|||
#else
|
||||
#error "Unsupported endianness"
|
||||
#endif
|
||||
};
|
||||
} __packed;
|
||||
|
||||
struct pdu_adv_sync_info {
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
|
@ -809,9 +809,11 @@ struct pdu_data {
|
|||
uint8_t nesn:1;
|
||||
uint8_t sn:1;
|
||||
uint8_t md:1;
|
||||
uint8_t rfu:3;
|
||||
uint8_t cp:1;
|
||||
uint8_t rfu:2;
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
uint8_t rfu:3;
|
||||
uint8_t rfu:2;
|
||||
uint8_t cp:1;
|
||||
uint8_t md:1;
|
||||
uint8_t sn:1;
|
||||
uint8_t nesn:1;
|
||||
|
@ -824,7 +826,10 @@ struct pdu_data {
|
|||
|
||||
#if !defined(CONFIG_SOC_OPENISA_RV32M1_RISCV32)
|
||||
#if !defined(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR)
|
||||
uint8_t resv:8; /* TODO: remove nRF specific code */
|
||||
union {
|
||||
uint8_t resv; /* TODO: remove nRF specific code */
|
||||
struct pdu_cte_info cte_info; /* BT 5.1 Core spec. CTEInfo storage */
|
||||
};
|
||||
#endif /* !CONFIG_BT_CTLR_DATA_LENGTH_CLEAR */
|
||||
#endif /* !CONFIG_SOC_OPENISA_RV32M1_RISCV32 */
|
||||
|
||||
|
|
|
@ -641,6 +641,8 @@ uint8_t ll_enc_req_send(uint16_t handle, uint8_t const *const rand_num,
|
|||
|
||||
pdu_data_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_data_tx);
|
||||
|
||||
memcpy(&conn->llcp_enc.ltk[0], ltk, sizeof(conn->llcp_enc.ltk));
|
||||
|
||||
if (!conn->lll.enc_rx && !conn->lll.enc_tx) {
|
||||
|
|
|
@ -1309,6 +1309,8 @@ int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire, uint16_t lazy)
|
|||
if (tx) {
|
||||
struct pdu_data *pdu_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_tx);
|
||||
|
||||
/* Terminate Procedure initiated,
|
||||
* make (req - ack) == 2
|
||||
*/
|
||||
|
@ -2047,6 +2049,22 @@ uint16_t ull_conn_lll_max_tx_octets_get(struct lll_conn *lll)
|
|||
return max_tx_octets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize pdu_data members that are read only in lower link layer.
|
||||
*
|
||||
* @param pdu_tx Pointer to pdu_data object to be initialized
|
||||
*/
|
||||
void ull_pdu_data_init(struct pdu_data *pdu_tx)
|
||||
{
|
||||
LL_ASSERT(pdu_tx);
|
||||
|
||||
pdu_tx->cp = PDU_DATA_CTE_PRESENT_BIT_DISABLED;
|
||||
pdu_tx->rfu = 0U;
|
||||
#if !defined(CONFIG_BT_CTLR_DATA_LENGTH_CLEAR)
|
||||
pdu_tx->resv = 0U;
|
||||
#endif /* CONFIG_BT_CTLR_DATA_LENGTH_CLEAR */
|
||||
}
|
||||
|
||||
static int init_reset(void)
|
||||
{
|
||||
/* Initialize conn pool. */
|
||||
|
@ -2994,6 +3012,8 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
|||
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SCHED_ADVANCED)
|
||||
event_conn_upd_init(conn, event_counter, ticks_at_expire,
|
||||
pdu_ctrl_tx, &s_mfy_sched_offset,
|
||||
|
@ -3279,6 +3299,8 @@ static inline void event_ch_map_prep(struct ll_conn *conn,
|
|||
if (tx) {
|
||||
struct pdu_data *pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
/* reset initiate flag */
|
||||
conn->llcp.chan_map.initiate = 0U;
|
||||
|
||||
|
@ -3429,6 +3451,8 @@ static inline void event_enc_prep(struct ll_conn *conn)
|
|||
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
/* central sends encrypted enc start rsp in control priority */
|
||||
if (!lll->role) {
|
||||
/* calc the Session Key */
|
||||
|
@ -3585,6 +3609,8 @@ static inline void event_fex_prep(struct ll_conn *conn)
|
|||
if (tx) {
|
||||
struct pdu_data *pdu = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu);
|
||||
|
||||
/* procedure request acked, move to waiting state */
|
||||
conn->llcp_feature.ack--;
|
||||
|
||||
|
@ -3627,6 +3653,8 @@ static inline void event_vex_prep(struct ll_conn *conn)
|
|||
uint16_t cid;
|
||||
uint16_t svn;
|
||||
|
||||
ull_pdu_data_init(pdu);
|
||||
|
||||
/* procedure request acked, move to waiting state */
|
||||
conn->llcp_version.ack--;
|
||||
|
||||
|
@ -3708,6 +3736,9 @@ static inline void event_conn_param_req(struct ll_conn *conn,
|
|||
|
||||
/* place the conn param req packet as next in tx queue */
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, conn_param_req) +
|
||||
sizeof(struct pdu_data_llctrl_conn_param_req);
|
||||
|
@ -3801,6 +3832,9 @@ static inline void event_conn_param_rsp(struct ll_conn *conn)
|
|||
|
||||
/* central/peripheral response with reject ext ind */
|
||||
pdu = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu);
|
||||
|
||||
pdu->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;
|
||||
pdu->len = offsetof(struct pdu_data_llctrl, reject_ext_ind) +
|
||||
|
@ -3868,6 +3902,9 @@ static inline void event_conn_param_rsp(struct ll_conn *conn)
|
|||
|
||||
/* place the conn param rsp packet as next in tx queue */
|
||||
pdu = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu);
|
||||
|
||||
pdu->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu->len = offsetof(struct pdu_data_llctrl, conn_param_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_conn_param_rsp);
|
||||
|
@ -4014,6 +4051,8 @@ static inline void event_ping_prep(struct ll_conn *conn)
|
|||
if (tx) {
|
||||
struct pdu_data *pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
/* procedure request acked */
|
||||
conn->llcp_ack = conn->llcp_req;
|
||||
|
||||
|
@ -4142,6 +4181,9 @@ static inline void event_len_prep(struct ll_conn *conn)
|
|||
|
||||
/* place the length req packet as next in tx queue */
|
||||
pdu_ctrl_tx = (void *) tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len =
|
||||
offsetof(struct pdu_data_llctrl, length_req) +
|
||||
|
@ -4304,6 +4346,9 @@ static inline void event_phy_req_prep(struct ll_conn *conn)
|
|||
|
||||
/* place the phy req packet as next in tx queue */
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len =
|
||||
offsetof(struct pdu_data_llctrl, phy_req) +
|
||||
|
@ -4476,6 +4521,9 @@ static inline void event_phy_upd_ind_prep(struct ll_conn *conn,
|
|||
* tx queue
|
||||
*/
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len =
|
||||
offsetof(struct pdu_data_llctrl, phy_upd_ind) +
|
||||
|
@ -4766,6 +4814,9 @@ static void enc_req_reused_send(struct ll_conn *conn, struct node_tx **tx)
|
|||
struct pdu_data *pdu_ctrl_tx;
|
||||
|
||||
pdu_ctrl_tx = (void *)(*tx)->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, enc_req) +
|
||||
sizeof(struct pdu_data_llctrl_enc_req);
|
||||
|
@ -4809,6 +4860,9 @@ static int enc_rsp_send(struct ll_conn *conn)
|
|||
}
|
||||
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, enc_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_enc_rsp);
|
||||
|
@ -4858,6 +4912,8 @@ static int start_enc_rsp_send(struct ll_conn *conn,
|
|||
/* enable transmit encryption */
|
||||
conn->lll.enc_tx = 1;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, enc_rsp);
|
||||
pdu_ctrl_tx->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_RSP;
|
||||
|
@ -4918,6 +4974,9 @@ static int unknown_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
|||
}
|
||||
|
||||
pdu = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu);
|
||||
|
||||
pdu->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu->len = offsetof(struct pdu_data_llctrl, unknown_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_unknown_rsp);
|
||||
|
@ -4991,6 +5050,9 @@ static int feature_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
|||
|
||||
/* Enqueue feature response */
|
||||
pdu_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_tx);
|
||||
|
||||
pdu_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_tx->len = offsetof(struct pdu_data_llctrl, feature_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_feature_rsp);
|
||||
|
@ -5080,6 +5142,9 @@ static int pause_enc_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
|||
|
||||
/* Enqueue pause enc rsp */
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, enc_rsp);
|
||||
pdu_ctrl_tx->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP;
|
||||
|
@ -5109,6 +5174,9 @@ static int version_ind_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
|||
conn->llcp_version.tx = 1U;
|
||||
|
||||
pdu_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_tx);
|
||||
|
||||
pdu_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_tx->len =
|
||||
offsetof(struct pdu_data_llctrl, version_ind) +
|
||||
|
@ -5164,6 +5232,9 @@ static int reject_ext_ind_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
|||
}
|
||||
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, reject_ext_ind) +
|
||||
sizeof(struct pdu_data_llctrl_reject_ext_ind);
|
||||
|
@ -5487,6 +5558,9 @@ static void length_resp_send(struct ll_conn *conn, struct node_tx *tx,
|
|||
struct pdu_data *pdu_tx;
|
||||
|
||||
pdu_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_tx);
|
||||
|
||||
pdu_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_tx->len = offsetof(struct pdu_data_llctrl, length_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_length_rsp);
|
||||
|
@ -5778,6 +5852,9 @@ static int ping_resp_send(struct ll_conn *conn, struct node_rx_pdu *rx)
|
|||
}
|
||||
|
||||
pdu_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_tx);
|
||||
|
||||
pdu_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_tx->len = offsetof(struct pdu_data_llctrl, ping_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_ping_rsp);
|
||||
|
@ -5833,6 +5910,9 @@ static int phy_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
|||
conn->llcp_phy.rx &= p->tx_phys;
|
||||
|
||||
pdu_ctrl_tx = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu_ctrl_tx);
|
||||
|
||||
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu_ctrl_tx->len = offsetof(struct pdu_data_llctrl, phy_rsp) +
|
||||
sizeof(struct pdu_data_llctrl_phy_rsp);
|
||||
|
@ -5987,6 +6067,8 @@ void event_send_cis_rsp(struct ll_conn *conn)
|
|||
if (tx) {
|
||||
struct pdu_data *pdu = (void *)tx->pdu;
|
||||
|
||||
ull_pdu_data_init(pdu);
|
||||
|
||||
pdu->ll_id = PDU_DATA_LLID_CTRL;
|
||||
pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CIS_RSP;
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ void *ull_conn_ack_dequeue(void);
|
|||
void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx);
|
||||
uint8_t ull_conn_llcp_req(void *conn);
|
||||
|
||||
void ull_pdu_data_init(struct pdu_data *pdu_tx);
|
||||
|
||||
#if !defined(CONFIG_BT_LL_SW_LLCP_LEGACY)
|
||||
|
||||
uint16_t ull_conn_event_counter(struct ll_conn *conn);
|
||||
|
|
|
@ -1032,7 +1032,6 @@ uint8_t ll_df_set_conn_cte_rx_params(uint16_t handle, uint8_t sampling_enable,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
df_rx_params->state = DF_CTE_SAMPLING_ENABLED;
|
||||
df_rx_params->slot_durations = slot_durations;
|
||||
memcpy(df_rx_params->ant_ids, ant_ids, switch_pattern_len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue