Skip to content

nimble/ll: Add Channel Sounding#1765

Open
mkasenberg wants to merge 16 commits into
apache:masterfrom
mkasenberg:cs-setup-phase
Open

nimble/ll: Add Channel Sounding#1765
mkasenberg wants to merge 16 commits into
apache:masterfrom
mkasenberg:cs-setup-phase

Conversation

@mkasenberg

Copy link
Copy Markdown
Contributor

No description provided.

@mkasenberg mkasenberg force-pushed the cs-setup-phase branch 4 times, most recently from fcafb89 to 6a71e3d Compare April 18, 2024 11:13

@sjanc sjanc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look good, few nitpicks here and there

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
cssm = connsm->cssm;

/* Check if a disabled role is used in CS configs */
for (int i = 0; i < ARRAY_SIZE(cssm->config); i++) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: we typically declare variable at top of the function, also could be unsigned to avoid signed-unsigned comparison


/* Check if a disabled role is used in CS configs */
for (int i = 0; i < ARRAY_SIZE(cssm->config); i++) {
struct ble_ll_cs_config *conf = &cssm->config[i];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
}

cssm->roles_enabled = cmd->role_enable;
cssm->cs_sync_antenna_selection = cmd->cs_sync_antenna_selection;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we are very consistent with this but maybe sm could be modified only after all validation is done? ie to avoid modifying it and stil returning error status

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
int
ble_ll_cs_rx_fae_req(struct ble_ll_conn_sm *connsm, uint8_t *rspbuf)
{
memcpy(rspbuf, connsm->cssm->local_fae_table, 72);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite a lot, is it guaranteed that there is enough linear space in underlying mbuf?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, there wasn't ;)

Comment thread nimble/controller/src/ble_ll_cs_drbg.c Outdated

if (!rc) {
swap_buf(out_data, ecb.cipher_text, BLE_ENC_BLOCK_SIZE);
rc = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rc is already 0 here

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
{
uint8_t config_id = connsm->cssm->config_req_id;
uint8_t action = connsm->cssm->config_req_action;
const struct ble_ll_cs_config *conf = &connsm->cssm->config[config_id];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is config_id already validated here?

return BLE_ERR_UNK_CONN_ID;
}

conf = &connsm->cssm->config[cmd->config_id];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_id should be validated before being used for indexing

Comment thread nimble/controller/pkg.yml Outdated

pkg.cflags.TEST:
- -Irepos/mbedtls/include
- -Irepos/include/mbedtls

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

includes should be added automatically from pkg dep

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
uint8_t *pv = connsm->cssm->drbg_ctx.pv;

if (!connsm->flags.encrypted) {
return rej_ext_ind_make(BLE_LL_CTRL_CS_SEC_REQ,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ble_ll_ctrl_rej_ext_ind_make + return

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
struct ble_ll_cs_drbg_ctx *drbg_ctx = &connsm->cssm->drbg_ctx;

if (!IS_PENDING_CTRL_PROC(connsm, BLE_LL_CTRL_PROC_CS_SEC_START)) {
/* Should never happen */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in bluetooth it will happen ;)
just change the comment to "ignore" or smth

Comment thread nimble/controller/src/ble_ll_cs.c Outdated
void
ble_ll_cs_rx_capabilities_rsp(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
{
ble_ll_cs_update_rem_capabilities(connsm, dptr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should verify data in rsp and return error if needed

@mkasenberg

Copy link
Copy Markdown
Contributor Author

Just rebase

@mkasenberg mkasenberg changed the title nimble/controller: Add Channel Sounding setup phase nimble/ll: Add Channel Sounding Nov 24, 2025
@github-actions github-actions Bot removed the host label Nov 24, 2025
There were changes to HCI between the draft and final version of the
Bluetooth 6.0 specification.
Initialize the CS state machine with the connection state machine.
Add lengths and opcodes of Channel Sounding LL CTRL PDUs.
Implement the LE CS Read Local Supported Capabilities command.
Enable basic CS capabilities in local controller.
Implements:
- LE CS Read Remote Supported Capabilities command,
- LE CS Write Cached Remote Supported Capabilities command.
The HCI_LE_CS_Set_Default_Settings command is used by a Host to set
default CS settings in the local Controller for the connection.
Implements:
- LE CS Read Remote FAE Table command
- LE CS Write Cached Remote FAE Table command
Implements:
- LE CS Create Config command
- LE CS Remove Config command
Implements LE CS Security Enable command.
The spec does not define a mechanism to inform which CS parameter the
controller rejects during CS start parameters negotiation, so a few
logs on the controller side will definitely be useful.
@mkasenberg

Copy link
Copy Markdown
Contributor Author

Contains UPF fixes now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants