Skip to content

Commit 6d7a04a

Browse files
Andries Kruithofcarlescufi
authored andcommitted
Bluetooth: controller: llcp: initialise DLE parameters
The initialisation of DLE parameters for the peripheral was done before the intialisation of the PHY settings. Since the DLE parameters depend on PHY settings this can result in incorrect parameters for tx/rx time and octets One scenario is where a previous connection set the PHY to 2M or CODED, then when a new connection is established it uses the same memory-locations for connection settings as the previous connection, and the (uninitialised) PHY settings will be set to 2M or CODED, and thus the DLE parameters will be wrong This PR moves the initialisation of DLE parameters after that of PHY settings EBQ tests effected include LL/CON/PER/BV-77-C. Signed-off-by: Andries Kruithof <[email protected]>
1 parent d5ab3ee commit 6d7a04a

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

subsys/bluetooth/controller/ll_sw/ull_adv.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -992,15 +992,6 @@ uint8_t ll_adv_enable(uint8_t enable)
992992
#endif /* CONFIG_BT_CTLR_ADV_EXT */
993993
#endif /* CONFIG_BT_CTLR_PHY */
994994
#endif
995-
#else /* CONFIG_BT_LL_SW_LLCP_LEGACY */
996-
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
997-
#if defined(CONFIG_BT_CTLR_PHY) && defined(CONFIG_BT_CTLR_ADV_EXT)
998-
const uint8_t phy = lll->phy_s;
999-
#else
1000-
const uint8_t phy = PHY_1M;
1001-
#endif
1002-
ull_dle_init(conn, phy);
1003-
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
1004995
#endif /* CONFIG_BT_LL_SW_LLCP_LEGACY */
1005996

1006997
#if defined(CONFIG_BT_CTLR_PHY)
@@ -1138,7 +1129,7 @@ uint8_t ll_adv_enable(uint8_t enable)
11381129

11391130
conn->tx_head = conn->tx_ctrl = conn->tx_ctrl_last =
11401131
conn->tx_data = conn->tx_data_last = 0;
1141-
#else /* CONFIG_BT_LL_SW_LLCP_LEGACY */
1132+
#else /* !CONFIG_BT_LL_SW_LLCP_LEGACY */
11421133
/* Re-initialize the control procedure data structures */
11431134
ull_llcp_init(conn);
11441135

@@ -1157,9 +1148,22 @@ uint8_t ll_adv_enable(uint8_t enable)
11571148
conn->pause_rx_data = 0U;
11581149
#endif /* CONFIG_BT_CTLR_LE_ENC */
11591150

1151+
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
1152+
uint8_t phy_in_use = PHY_1M;
1153+
1154+
1155+
#if defined(CONFIG_BT_CTLR_ADV_EXT)
1156+
if (pdu_adv->type == PDU_ADV_TYPE_EXT_IND) {
1157+
phy_in_use = lll->phy_s;
1158+
}
1159+
#endif /* CONFIG_BT_CTLR_ADV_EXT */
1160+
1161+
ull_dle_init(conn, phy_in_use);
1162+
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
1163+
11601164
/* Re-initialize the Tx Q */
11611165
ull_tx_q_init(&conn->tx_q);
1162-
#endif /* CONFIG_BT_LL_SW_LLCP_LEGACY */
1166+
#endif /* !CONFIG_BT_LL_SW_LLCP_LEGACY */
11631167

11641168
/* NOTE: using same link as supplied for terminate ind */
11651169
adv->link_cc_free = link;

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8189,6 +8189,11 @@ void ull_dle_init(struct ll_conn *conn, uint8_t phy)
81898189
conn->lll.dle.remote.max_rx_time = max_time_min;
81908190
#endif /* CONFIG_BT_CTLR_PHY */
81918191

8192+
/*
8193+
* ref. Bluetooth Core Specification version 5.3, Vol. 6,
8194+
* Part B, section 4.5.10 we can call ull_dle_update_eff
8195+
* for initialisation
8196+
*/
81928197
ull_dle_update_eff(conn);
81938198

81948199
/* Check whether the controller should perform a data length update after

0 commit comments

Comments
 (0)