Bluetooth: controller: Rework procedure pause logic
llcp_lr_pause()/llcp_rr_pause() only pauses currently pending procedures in their respective request machines, any future initiations are not paused, thus they are allowed to run, when the opposite was expected. Change the procedure pause logic into a global pause on the request machines them self, this is essence what the per-procedure pause flag was trying to achieve. Add new query function llcp_?r_ispaused() to not expose the logic behind the pause functionality. Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
This commit is contained in:
parent
79092c3cf4
commit
fefa83d5ed
10 changed files with 70 additions and 56 deletions
|
@ -414,7 +414,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
switch (ctx->proc) {
|
||||
#if defined(CONFIG_BT_CTLR_LE_PING)
|
||||
case PROC_LE_PING:
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
lp_comm_tx(conn, ctx);
|
||||
|
@ -423,7 +423,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
break;
|
||||
#endif /* CONFIG_BT_CTLR_LE_PING */
|
||||
case PROC_FEATURE_EXCHANGE:
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
lp_comm_tx(conn, ctx);
|
||||
|
@ -433,7 +433,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
break;
|
||||
#if defined(CONFIG_BT_CTLR_MIN_USED_CHAN) && defined(CONFIG_BT_PERIPHERAL)
|
||||
case PROC_MIN_USED_CHANS:
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
lp_comm_tx(conn, ctx);
|
||||
|
@ -446,7 +446,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
* one LL_VERSION_IND PDU during a connection.
|
||||
*/
|
||||
if (!conn->llcp.vex.sent) {
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
lp_comm_tx(conn, ctx);
|
||||
|
@ -469,7 +469,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
|
||||
case PROC_DATA_LENGTH_UPDATE:
|
||||
if (!ull_cp_remote_dle_pending(conn)) {
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
/* Pause data tx, to ensure we can later (on RSP rx-ack)
|
||||
|
@ -497,7 +497,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
#else
|
||||
if (1) {
|
||||
#endif /* CONFIG_BT_CTLR_PHY */
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx) ||
|
||||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx) ||
|
||||
(llcp_rr_get_paused_cmd(conn) == PROC_CTE_REQ)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
|
@ -529,7 +529,7 @@ static void lp_comm_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
{
|
||||
switch (evt) {
|
||||
case LP_COMMON_EVT_RUN:
|
||||
if (ctx->pause) {
|
||||
if (llcp_lr_ispaused(conn)) {
|
||||
ctx->state = LP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
lp_comm_send_req(conn, ctx, evt, param);
|
||||
|
@ -910,7 +910,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
#if defined(CONFIG_BT_CTLR_LE_PING)
|
||||
case PROC_LE_PING:
|
||||
/* Always respond on remote ping */
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = RP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
rp_comm_tx(conn, ctx);
|
||||
|
@ -921,7 +921,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
#endif /* CONFIG_BT_CTLR_LE_PING */
|
||||
case PROC_FEATURE_EXCHANGE:
|
||||
/* Always respond on remote feature exchange */
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = RP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
rp_comm_tx(conn, ctx);
|
||||
|
@ -938,7 +938,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
* LL_VERSION_IND PDU to the peer device.
|
||||
*/
|
||||
if (!conn->llcp.vex.sent) {
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = RP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
rp_comm_tx(conn, ctx);
|
||||
|
@ -987,7 +987,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
break;
|
||||
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
|
||||
case PROC_DATA_LENGTH_UPDATE:
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = RP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
/* On RSP tx close the window for possible local req piggy-back */
|
||||
|
@ -1000,7 +1000,7 @@ static void rp_comm_send_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t
|
|||
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
|
||||
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RSP)
|
||||
case PROC_CTE_REQ:
|
||||
if (ctx->pause || !llcp_tx_alloc_peek(conn, ctx) ||
|
||||
if (llcp_rr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx) ||
|
||||
(llcp_rr_get_paused_cmd(conn) == PROC_CTE_REQ)) {
|
||||
ctx->state = RP_COMMON_STATE_WAIT_TX;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue