Bluetooth: Controller: llcp: fix wrong cond in prepare instant
In a function pu_prepare_instant there is a condition that checks if there is actual change of a PHY. That condition was based on ctx->data.pu.tx and ctx->data.pu.rx. These members store PHY that is or will be used, hence the condition is wrong. Even there is no actual change in the PHY, values could be not equal to zero. In such case the instant value would be set to wrong value. What more the condition be an 'or' not an 'and' because one of the values must be different than zero to have the PHY change and instant different than zero. After update of the condition, the function call places must be changed. The ctx->data.pu.c_to_p_phy and ctx->data.pu.p_to_c_phy are set in pu_prepare_update_ind function, hence pu_prepare_instant should be called after that. Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
parent
da3a6fc879
commit
c18477ad25
1 changed files with 3 additions and 3 deletions
|
@ -310,7 +310,7 @@ static void pu_prepare_instant(struct ll_conn *conn, struct proc_ctx *ctx)
|
|||
/* Set instance only in case there is actual PHY change. Otherwise the instant should be
|
||||
* set to 0.
|
||||
*/
|
||||
if (ctx->data.pu.tx != 0 && ctx->data.pu.rx != 0) {
|
||||
if (ctx->data.pu.c_to_p_phy != 0 || ctx->data.pu.p_to_c_phy != 0) {
|
||||
ctx->data.pu.instant = ull_conn_event_counter(conn) + PHY_UPDATE_INSTANT_DELTA;
|
||||
} else {
|
||||
ctx->data.pu.instant = 0;
|
||||
|
@ -342,6 +342,7 @@ static void lp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode)
|
|||
#if defined(CONFIG_BT_CENTRAL)
|
||||
case PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND:
|
||||
pu_prep_update_ind(conn, ctx);
|
||||
pu_prepare_instant(conn, ctx);
|
||||
llcp_pdu_encode_phy_update_ind(ctx, pdu);
|
||||
break;
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
|
@ -473,7 +474,6 @@ static void lp_pu_send_phy_update_ind(struct ll_conn *conn, struct proc_ctx *ctx
|
|||
if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) {
|
||||
ctx->state = LP_PU_STATE_WAIT_TX_PHY_UPDATE_IND;
|
||||
} else {
|
||||
pu_prepare_instant(conn, ctx);
|
||||
lp_pu_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND);
|
||||
ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED;
|
||||
ctx->state = LP_PU_STATE_WAIT_TX_ACK_PHY_UPDATE_IND;
|
||||
|
@ -815,6 +815,7 @@ static void rp_pu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode)
|
|||
#if defined(CONFIG_BT_CENTRAL)
|
||||
case PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND:
|
||||
pu_prep_update_ind(conn, ctx);
|
||||
pu_prepare_instant(conn, ctx);
|
||||
llcp_pdu_encode_phy_update_ind(ctx, pdu);
|
||||
break;
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
|
@ -886,7 +887,6 @@ static void rp_pu_send_phy_update_ind(struct ll_conn *conn, struct proc_ctx *ctx
|
|||
ctx->state = RP_PU_STATE_WAIT_TX_PHY_UPDATE_IND;
|
||||
} else {
|
||||
llcp_rr_set_paused_cmd(conn, PROC_CTE_REQ);
|
||||
pu_prepare_instant(conn, ctx);
|
||||
rp_pu_tx(conn, ctx, PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND);
|
||||
|
||||
ctx->rx_opcode = PDU_DATA_LLCTRL_TYPE_UNUSED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue