Skip to content

Commit b525db2

Browse files
wopu-otcarlescufi
authored andcommitted
Bluetooth: controller: Avoid the use of weak functions for ISO data path
Avoid the use of weak functions and call the respective functions only if vendor-specific data path is supported. The weak dummy functions will not implement the desired behavior anyway. This change makes it explicit that these functions need to be implemented by the vendor. Signed-off-by: Wolfgang Puffitsch <[email protected]>
1 parent f7cf252 commit b525db2

File tree

7 files changed

+51
-69
lines changed

7 files changed

+51
-69
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,14 @@ static void configure_data_path(struct net_buf *buf,
640640

641641
vs_config = &cmd->vs_config[0];
642642

643-
status = ll_configure_data_path(cmd->data_path_dir,
644-
cmd->data_path_id,
645-
cmd->vs_config_len,
646-
vs_config);
643+
if (IS_ENABLED(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH)) {
644+
status = ll_configure_data_path(cmd->data_path_dir,
645+
cmd->data_path_id,
646+
cmd->vs_config_len,
647+
vs_config);
648+
} else {
649+
status = BT_HCI_ERR_INVALID_PARAM;
650+
}
647651

648652
rp = hci_cmd_complete(evt, sizeof(*rp));
649653
rp->status = status;

subsys/bluetooth/controller/include/ll.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ uint8_t ll_cis_parameters_test_set(uint8_t cis_id, uint8_t nse,
164164
uint16_t c_pdu, uint16_t p_pdu,
165165
uint8_t c_phy, uint8_t p_phy,
166166
uint8_t c_bn, uint8_t p_bn);
167+
/* Must be implemented by vendor if vendor-specific data path is supported */
167168
uint8_t ll_configure_data_path(uint8_t data_path_dir,
168169
uint8_t data_path_id,
169170
uint8_t vs_config_len,

subsys/bluetooth/controller/ll_sw/nordic/ull/ull_iso_vendor.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <stdbool.h>
99

1010
#include <zephyr/bluetooth/hci.h>
11+
#include "isoal.h"
12+
#include "ull_iso_types.h"
1113

1214
/* FIXME: Implement vendor specific data path configuration */
1315
static bool dummy;
@@ -20,6 +22,23 @@ bool ll_data_path_configured(uint8_t data_path_dir, uint8_t data_path_id)
2022
return dummy;
2123
}
2224

25+
bool ll_data_path_source_create(uint16_t handle,
26+
struct ll_iso_datapath *datapath,
27+
isoal_source_pdu_alloc_cb *pdu_alloc,
28+
isoal_source_pdu_write_cb *pdu_write,
29+
isoal_source_pdu_emit_cb *pdu_emit,
30+
isoal_source_pdu_release_cb *pdu_release)
31+
{
32+
ARG_UNUSED(handle);
33+
ARG_UNUSED(datapath);
34+
ARG_UNUSED(pdu_alloc);
35+
ARG_UNUSED(pdu_write);
36+
ARG_UNUSED(pdu_emit);
37+
ARG_UNUSED(pdu_release);
38+
39+
return false;
40+
}
41+
2342
uint8_t ll_configure_data_path(uint8_t data_path_dir, uint8_t data_path_id,
2443
uint8_t vs_config_len, uint8_t *vs_config)
2544
{

subsys/bluetooth/controller/ll_sw/nrf.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ if(CONFIG_BT_LL_SW_SPLIT)
8080
CONFIG_BT_CTLR_PERIPHERAL_ISO
8181
ll_sw/nordic/lll/lll_peripheral_iso.c
8282
)
83-
if(CONFIG_BT_CTLR_ISO)
83+
if(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH)
8484
zephyr_library_sources(
8585
ll_sw/nordic/ull/ull_iso_vendor.c
8686
)

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3084,19 +3084,3 @@ void *ull_rxfifo_release(uint8_t s, uint8_t n, uint8_t f, uint8_t *l, uint8_t *m
30843084

30853085
return rx;
30863086
}
3087-
3088-
#if defined(CONFIG_BT_CTLR_HCI_CODEC_AND_DELAY_INFO)
3089-
/* Contains vendor specific argument, function to be implemented by vendors */
3090-
__weak uint8_t ll_configure_data_path(uint8_t data_path_dir,
3091-
uint8_t data_path_id,
3092-
uint8_t vs_config_len,
3093-
uint8_t *vs_config)
3094-
{
3095-
ARG_UNUSED(data_path_dir);
3096-
ARG_UNUSED(data_path_id);
3097-
ARG_UNUSED(vs_config_len);
3098-
ARG_UNUSED(vs_config);
3099-
3100-
return BT_HCI_ERR_CMD_DISALLOWED;
3101-
}
3102-
#endif /* CONFIG_BT_CTLR_HCI_CODEC_AND_DELAY_INFO */

subsys/bluetooth/controller/ll_sw/ull_iso.c

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,6 @@ static struct {
156156

157157
#endif /* CONFIG_BT_CTLR_ADV_ISO || CONFIG_BT_CTLR_CONN_ISO */
158158

159-
/* Must be implemented by vendor */
160-
__weak bool ll_data_path_configured(uint8_t data_path_dir,
161-
uint8_t data_path_id)
162-
{
163-
ARG_UNUSED(data_path_dir);
164-
ARG_UNUSED(data_path_id);
165-
166-
return false;
167-
}
168-
169159
uint8_t ll_read_iso_tx_sync(uint16_t handle, uint16_t *seq,
170160
uint32_t *timestamp, uint32_t *offset)
171161
{
@@ -196,41 +186,6 @@ uint8_t ll_read_iso_tx_sync(uint16_t handle, uint16_t *seq,
196186
return BT_HCI_ERR_UNKNOWN_CONN_ID;
197187
}
198188

199-
/* Must be implemented by vendor */
200-
__weak bool ll_data_path_sink_create(uint16_t handle,
201-
struct ll_iso_datapath *datapath,
202-
isoal_sink_sdu_alloc_cb *sdu_alloc,
203-
isoal_sink_sdu_emit_cb *sdu_emit,
204-
isoal_sink_sdu_write_cb *sdu_write)
205-
{
206-
ARG_UNUSED(handle);
207-
ARG_UNUSED(datapath);
208-
209-
*sdu_alloc = NULL;
210-
*sdu_emit = NULL;
211-
*sdu_write = NULL;
212-
213-
return false;
214-
}
215-
216-
/* Could be implemented by vendor */
217-
__weak bool ll_data_path_source_create(uint16_t handle,
218-
struct ll_iso_datapath *datapath,
219-
isoal_source_pdu_alloc_cb *pdu_alloc,
220-
isoal_source_pdu_write_cb *pdu_write,
221-
isoal_source_pdu_emit_cb *pdu_emit,
222-
isoal_source_pdu_release_cb *pdu_release)
223-
{
224-
ARG_UNUSED(handle);
225-
ARG_UNUSED(datapath);
226-
ARG_UNUSED(pdu_alloc);
227-
ARG_UNUSED(pdu_write);
228-
ARG_UNUSED(pdu_emit);
229-
ARG_UNUSED(pdu_release);
230-
231-
return false;
232-
}
233-
234189
static inline bool path_is_vendor_specific(uint8_t path_id)
235190
{
236191
return (path_id >= BT_HCI_DATAPATH_ID_VS &&
@@ -396,7 +351,8 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
396351
}
397352

398353
if (path_is_vendor_specific(path_id) &&
399-
!ll_data_path_configured(path_dir, path_id)) {
354+
(!IS_ENABLED(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) ||
355+
!ll_data_path_configured(path_dir, path_id))) {
400356
/* Data path must be configured prior to setup */
401357
return BT_HCI_ERR_CMD_DISALLOWED;
402358
}
@@ -451,7 +407,8 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
451407
isoal_sink_sdu_write_cb sdu_write;
452408

453409
/* Request vendor sink callbacks for path */
454-
if (ll_data_path_sink_create(handle, dp, &sdu_alloc,
410+
if (IS_ENABLED(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) &&
411+
ll_data_path_sink_create(handle, dp, &sdu_alloc,
455412
&sdu_emit, &sdu_write)) {
456413
err = isoal_sink_create(handle, role, framed,
457414
burst_number,
@@ -503,7 +460,8 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
503460
isoal_source_pdu_release_cb pdu_release;
504461

505462
if (path_is_vendor_specific(path_id)) {
506-
if (!ll_data_path_source_create(handle, dp,
463+
if (!IS_ENABLED(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) ||
464+
!ll_data_path_source_create(handle, dp,
507465
&pdu_alloc, &pdu_write,
508466
&pdu_emit,
509467
&pdu_release)) {

subsys/bluetooth/controller/ll_sw/ull_iso_internal.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,19 @@ void ll_iso_rx_put(memq_link_t *link, void *rx);
2929
void *ll_iso_rx_get(void);
3030
void ll_iso_rx_dequeue(void);
3131
void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire);
32+
33+
/* Must be implemented by vendor if vendor-specific data path is supported */
34+
bool ll_data_path_configured(uint8_t data_path_dir, uint8_t data_path_id);
35+
/* Must be implemented by vendor if vendor-specific data path is supported */
36+
bool ll_data_path_sink_create(uint16_t handle,
37+
struct ll_iso_datapath *datapath,
38+
isoal_sink_sdu_alloc_cb *sdu_alloc,
39+
isoal_sink_sdu_emit_cb *sdu_emit,
40+
isoal_sink_sdu_write_cb *sdu_write);
41+
/* Must be implemented by vendor if vendor-specific data path is supported */
42+
bool ll_data_path_source_create(uint16_t handle,
43+
struct ll_iso_datapath *datapath,
44+
isoal_source_pdu_alloc_cb *pdu_alloc,
45+
isoal_source_pdu_write_cb *pdu_write,
46+
isoal_source_pdu_emit_cb *pdu_emit,
47+
isoal_source_pdu_release_cb *pdu_release);

0 commit comments

Comments
 (0)