Skip to content

Commit c8c81d2

Browse files
wopu-otstephanosio
authored andcommitted
Bluetooth: controller: Only allow supported feature bits to be set by host
Redefine mask of host-controlled feature bits to include only features that are supported by the controller. This fixes a conformance test failure where setting an unsupported host-controlled feature bit was not rejected as it should. Set the Connected Isochronous Streams (Host Support) bit from the host only if unicast support is configured to avoid failures in broadcast-only configurations. Signed-off-by: Wolfgang Puffitsch <[email protected]>
1 parent 36ffed2 commit c8c81d2

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

subsys/bluetooth/controller/include/ll_feat.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,6 @@
243243
/* Mask to filter away octet 0 for feature exchange */
244244
#define LL_FEAT_FILTER_OCTET0 (LL_FEAT_BIT_MASK & ~0xFFULL)
245245

246-
/* Mask for host controlled features */
247-
#define LL_FEAT_HOST_BIT_MASK 0x4100000000ULL
248-
249246
/* Feature bits of this controller */
250247
#define LL_FEAT (LL_FEAT_BIT_ENC | \
251248
LL_FEAT_BIT_CONN_PARAM_REQ | \
@@ -276,3 +273,17 @@
276273
LL_FEAT_BIT_ISO_BROADCASTER | \
277274
LL_FEAT_BIT_SYNC_RECEIVER | \
278275
LL_FEAT_BIT_PERIODIC_ADI_SUPPORT)
276+
277+
/* Connected Isochronous Stream (Host Support) bit is controlled by host */
278+
#if defined(CONFIG_BT_CTLR_CONN_ISO)
279+
#define LL_FEAT_HOST_BITS_ISO_CHANNELS BIT64(BT_LE_FEAT_BIT_ISO_CHANNELS)
280+
#else /* !CONFIG_BT_CTLR_CONN_ISO */
281+
#define LL_FEAT_HOST_BITS_ISO_CHANNELS 0U
282+
#endif /* !CONFIG_BT_CTLR_CONN_ISO */
283+
284+
/* Connection subrating not supported and bit thus cannot be set by host */
285+
#define LL_FEAT_HOST_BITS_CONN_SUBRATING 0U
286+
287+
/* Mask for host controlled features */
288+
#define LL_FEAT_HOST_BIT_MASK (LL_FEAT_HOST_BITS_ISO_CHANNELS |\
289+
LL_FEAT_HOST_BITS_CONN_SUBRATING)

subsys/bluetooth/host/hci_core.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,10 +2894,12 @@ static int le_init_iso(void)
28942894
int err;
28952895
struct net_buf *rsp;
28962896

2897-
/* Set Isochronous Channels - Host support */
2898-
err = le_set_host_feature(BT_LE_FEAT_BIT_ISO_CHANNELS, 1);
2899-
if (err) {
2900-
return err;
2897+
if (IS_ENABLED(CONFIG_BT_ISO_UNICAST)) {
2898+
/* Set Connected Isochronous Streams - Host support */
2899+
err = le_set_host_feature(BT_LE_FEAT_BIT_ISO_CHANNELS, 1);
2900+
if (err) {
2901+
return err;
2902+
}
29012903
}
29022904

29032905
/* Octet 41, bit 5 is read buffer size V2 */

0 commit comments

Comments
 (0)