Bluetooth: Controller: Rename CPR mutual exclusion functions
Rename CPR mutual exclusion function to not sound similar to OS mutex interfaces. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
a8d4c062fa
commit
0bd05c0ed9
|
@ -111,8 +111,14 @@ static inline bool ctrl_is_unexpected(struct ll_conn *conn, uint8_t opcode);
|
|||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||
static inline void cpr_mutex_check_and_give(struct ll_conn *conn);
|
||||
static inline void cpr_mutex_give(void);
|
||||
/* NOTE: cpr_active_* functions are inline as they are simple assignment to
|
||||
* global variable, and if in future get called from more than two caller
|
||||
* functions, we dont want the caller function branching into these which
|
||||
* can add to CPU use inside ULL ISR.
|
||||
*/
|
||||
static inline void cpr_active_check_and_reset(struct ll_conn *conn);
|
||||
static inline void cpr_active_reset(void);
|
||||
|
||||
static inline void event_conn_param_prep(struct ll_conn *conn,
|
||||
uint16_t event_counter,
|
||||
uint32_t ticks_at_expire);
|
||||
|
@ -763,7 +769,7 @@ int ull_conn_reset(void)
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_give();
|
||||
cpr_active_reset();
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
err = init_reset();
|
||||
|
@ -1988,7 +1994,7 @@ static void conn_cleanup(struct ll_conn *conn, uint8_t reason)
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_check_and_give(conn);
|
||||
cpr_active_check_and_reset(conn);
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
/* Only termination structure is populated here in ULL context
|
||||
|
@ -2440,31 +2446,31 @@ static bool is_enc_req_pause_tx(struct ll_conn *conn)
|
|||
*/
|
||||
static struct ll_conn *conn_upd_curr;
|
||||
|
||||
static inline void cpr_mutex_check_and_take(struct ll_conn *conn)
|
||||
static inline void cpr_active_check_and_set(struct ll_conn *conn)
|
||||
{
|
||||
if (!conn_upd_curr) {
|
||||
conn_upd_curr = conn;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void cpr_mutex_take(struct ll_conn *conn)
|
||||
static inline void cpr_active_set(struct ll_conn *conn)
|
||||
{
|
||||
conn_upd_curr = conn;
|
||||
}
|
||||
|
||||
static inline bool cpr_mutex_is_taken(struct ll_conn *conn)
|
||||
static inline bool cpr_active_is_set(struct ll_conn *conn)
|
||||
{
|
||||
return conn_upd_curr && (conn_upd_curr != conn);
|
||||
}
|
||||
|
||||
static inline void cpr_mutex_check_and_give(struct ll_conn *conn)
|
||||
static inline void cpr_active_check_and_reset(struct ll_conn *conn)
|
||||
{
|
||||
if (conn == conn_upd_curr) {
|
||||
conn_upd_curr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void cpr_mutex_give(void)
|
||||
static inline void cpr_active_reset(void)
|
||||
{
|
||||
conn_upd_curr = NULL;
|
||||
}
|
||||
|
@ -2577,7 +2583,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
|||
conn->llcp_conn_param.ack = conn->llcp_conn_param.req;
|
||||
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_give();
|
||||
cpr_active_reset();
|
||||
|
||||
/* enqueue control PDU */
|
||||
pdu_ctrl_tx =
|
||||
|
@ -2627,7 +2633,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||
/* Set CPR mutex */
|
||||
cpr_mutex_check_and_take(conn);
|
||||
cpr_active_check_and_set(conn);
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
(void)ll_pdu_rx_alloc();
|
||||
|
@ -2690,7 +2696,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
|||
}
|
||||
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_check_and_give(conn);
|
||||
cpr_active_check_and_reset(conn);
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
lll = &conn->lll;
|
||||
|
@ -3368,7 +3374,7 @@ static inline void event_conn_param_req(struct ll_conn *conn,
|
|||
p->offset5 = sys_cpu_to_le16(0xffff);
|
||||
|
||||
/* Set CPR mutex */
|
||||
cpr_mutex_take(conn);
|
||||
cpr_active_set(conn);
|
||||
|
||||
/* Start Procedure Timeout (TODO: this shall not replace
|
||||
* terminate procedure).
|
||||
|
@ -3452,7 +3458,7 @@ static inline void event_conn_param_rsp(struct ll_conn *conn)
|
|||
conn->llcp_conn_param.ack = conn->llcp_conn_param.req;
|
||||
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_give();
|
||||
cpr_active_reset();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -3582,7 +3588,7 @@ static inline void event_conn_param_prep(struct ll_conn *conn,
|
|||
uint32_t ticks_at_expire)
|
||||
{
|
||||
/* Defer new CPR if another in progress across active connections */
|
||||
if (cpr_mutex_is_taken(conn)) {
|
||||
if (cpr_active_is_set(conn)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4292,7 +4298,7 @@ static uint8_t conn_upd_recv(struct ll_conn *conn, memq_link_t *link,
|
|||
/* Set CPR mutex, if only not already set. As a master the mutex shall
|
||||
* be set, but a slave we accept it as new 'set' of mutex.
|
||||
*/
|
||||
cpr_mutex_check_and_take(conn);
|
||||
cpr_active_check_and_set(conn);
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
conn->llcp_cu.win_size = pdu->llctrl.conn_update_ind.win_size;
|
||||
|
@ -4836,7 +4842,7 @@ static inline int reject_ind_conn_upd_recv(struct ll_conn *conn,
|
|||
|
||||
if (conn->llcp_conn_param.state == LLCP_CPR_STATE_RSP_WAIT) {
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_give();
|
||||
cpr_active_reset();
|
||||
|
||||
/* Procedure complete */
|
||||
conn->llcp_conn_param.ack = conn->llcp_conn_param.req;
|
||||
|
@ -6247,7 +6253,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
|||
/* check CUI/CPR mutex for other connections having CPR in
|
||||
* progress.
|
||||
*/
|
||||
if (cpr_mutex_is_taken(conn)) {
|
||||
if (cpr_active_is_set(conn)) {
|
||||
/* Unsupported LL Parameter Value */
|
||||
nack = reject_ext_ind_send(conn, *rx,
|
||||
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ,
|
||||
|
@ -6394,7 +6400,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
|||
conn->llcp_conn_param.ack--;
|
||||
|
||||
/* Set CPR mutex */
|
||||
cpr_mutex_check_and_take(conn);
|
||||
cpr_active_check_and_set(conn);
|
||||
}
|
||||
} else if ((conn->llcp_conn_param.req ==
|
||||
conn->llcp_conn_param.ack) ||
|
||||
|
@ -6479,7 +6485,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
|||
conn->llcp_conn_param.ack--;
|
||||
|
||||
/* Set CPR mutex */
|
||||
cpr_mutex_check_and_take(conn);
|
||||
cpr_active_check_and_set(conn);
|
||||
} else {
|
||||
/* Ignore duplicate request as peripheral is busy
|
||||
* processing the previously initiated connection
|
||||
|
@ -6642,7 +6648,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
|||
}
|
||||
|
||||
/* Reset CPR mutex */
|
||||
cpr_mutex_give();
|
||||
cpr_active_reset();
|
||||
|
||||
/* Procedure complete */
|
||||
conn->llcp_conn_param.ack = conn->llcp_conn_param.req;
|
||||
|
|
Loading…
Reference in a new issue