Skip to content

Commit 2890f42

Browse files
ppryga-nordiccarlescufi
authored andcommitted
Bluetooth: Controller: df: Fix CTE reqest proc enable if feat supported
The CTE request procedure should be enabled only if a peer supports CTE response feature. That information can be obtained by feature exchange procedure. If there were no feature exchange then CTE request feature may be disabled if a peer responses with LL_UNKNOWN_RSP for a CTE request. The implementation of ll_df_set_conn_cte_req_enable was checking if CTE response feature is supported only when there was feature exchange. There was missing possibility to stop CTE request if a peer responded with LL_UNKNOWN_RSP for an earlier CTE request. The commit changes the implementation of ll_df_set_conn_cte_req_enable. The CTE response feature check is moved to ull_cp_cte_req function, because it belongs more to control procedure than to function that handles Host request to start the procedure. Second change is related with use of conn->llcp.fex.features_used. It stores information about features supported by peer. It does not depend on execution of the feature exchange control procedure. By the way, there were removed else statement in ll_df_set_conn_cte_- req_enable because it was not needed. Signed-off-by: Piotr Pryga <[email protected]>
1 parent 40cdd65 commit 2890f42

File tree

1 file changed

+28
-36
lines changed
  • subsys/bluetooth/controller/ll_sw

1 file changed

+28
-36
lines changed

subsys/bluetooth/controller/ll_sw/ull_df.c

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,51 +1166,43 @@ uint8_t ll_df_set_conn_cte_req_enable(uint16_t handle, uint8_t enable,
11661166
ull_cp_cte_req_set_disable(conn);
11671167

11681168
return BT_HCI_ERR_SUCCESS;
1169-
} else {
1170-
if (!conn->lll.df_rx_cfg.is_initialized) {
1171-
return BT_HCI_ERR_CMD_DISALLOWED;
1172-
}
1169+
}
11731170

1174-
if (conn->llcp.cte_req.is_enabled) {
1175-
return BT_HCI_ERR_CMD_DISALLOWED;
1176-
}
1171+
if (!conn->lll.df_rx_cfg.is_initialized) {
1172+
return BT_HCI_ERR_CMD_DISALLOWED;
1173+
}
1174+
1175+
if (conn->llcp.cte_req.is_enabled) {
1176+
return BT_HCI_ERR_CMD_DISALLOWED;
1177+
}
11771178

11781179
#if defined(CONFIG_BT_CTLR_PHY)
1179-
/* CTE request may be enabled only in case the receiver PHY is not CODED */
1180-
if (conn->lll.phy_rx == PHY_CODED) {
1181-
return BT_HCI_ERR_CMD_DISALLOWED;
1182-
}
1180+
/* CTE request may be enabled only in case the receiver PHY is not CODED */
1181+
if (conn->lll.phy_rx == PHY_CODED) {
1182+
return BT_HCI_ERR_CMD_DISALLOWED;
1183+
}
11831184
#endif /* CONFIG_BT_CTLR_PHY */
11841185

1185-
if (cte_request_interval != 0 && cte_request_interval < conn->lll.latency) {
1186-
return BT_HCI_ERR_CMD_DISALLOWED;
1187-
}
1188-
1189-
if (requested_cte_length < BT_HCI_LE_CTE_LEN_MIN ||
1190-
requested_cte_length > BT_HCI_LE_CTE_LEN_MAX) {
1191-
return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL;
1192-
}
1193-
1194-
if (requested_cte_type != BT_HCI_LE_AOA_CTE &&
1195-
requested_cte_type != BT_HCI_LE_AOD_CTE_1US &&
1196-
requested_cte_type != BT_HCI_LE_AOD_CTE_2US) {
1197-
return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL;
1198-
}
1186+
if (cte_request_interval != 0 && cte_request_interval < conn->lll.latency) {
1187+
return BT_HCI_ERR_CMD_DISALLOWED;
1188+
}
11991189

1200-
/* If controller is aware of features supported by peer device then check
1201-
* whether required features are enabled.
1202-
*/
1203-
if (conn->llcp.fex.valid &&
1204-
(!(conn->llcp.fex.features_peer & BIT64(BT_LE_FEAT_BIT_CONN_CTE_RESP)))) {
1205-
return BT_HCI_ERR_UNSUPP_REMOTE_FEATURE;
1206-
}
1190+
if (requested_cte_length < BT_HCI_LE_CTE_LEN_MIN ||
1191+
requested_cte_length > BT_HCI_LE_CTE_LEN_MAX) {
1192+
return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL;
1193+
}
12071194

1208-
conn->llcp.cte_req.is_enabled = 1U;
1209-
conn->llcp.cte_req.req_interval = cte_request_interval;
1210-
conn->llcp.cte_req.cte_type = requested_cte_type;
1211-
conn->llcp.cte_req.min_cte_len = requested_cte_length;
1195+
if (requested_cte_type != BT_HCI_LE_AOA_CTE &&
1196+
requested_cte_type != BT_HCI_LE_AOD_CTE_1US &&
1197+
requested_cte_type != BT_HCI_LE_AOD_CTE_2US) {
1198+
return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL;
12121199
}
12131200

1201+
conn->llcp.cte_req.is_enabled = 1U;
1202+
conn->llcp.cte_req.req_interval = cte_request_interval;
1203+
conn->llcp.cte_req.cte_type = requested_cte_type;
1204+
conn->llcp.cte_req.min_cte_len = requested_cte_length;
1205+
12141206
return ull_cp_cte_req(conn, requested_cte_length, requested_cte_type);
12151207
}
12161208
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_REQ */

0 commit comments

Comments
 (0)