Bluetooth: L2CAP: Enable L2CAP dynamic channels without Enhanced CBFC

Allow application to enable L2CAP dynamic channels without support
for Enhanced Credit Based Flow Control (CBFC).

Since these are separate features in the qualification it should
be possible to qualify L2CAP connection oriented channels without
also having to qualify L2CAP enhanced credit based flow control.

The L2CAP/LE/REJ/BI-02-C conformance test will fail when enhanced CBFC
has not been selected in the ICS.

The lower tester expects that since the Enhanced CBFC is not supported,
the command L2CAP_CREDIT_BASED_CONNECTION_REQ should be met with an
L2CAP_COMMAND_REJECT_RSP and not an L2CAP_CREDIT_BASED_CONNECTION_RSP.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-10-30 13:02:47 +01:00 committed by Carles Cufí
commit f8956cfbc7
5 changed files with 22 additions and 1 deletions

View file

@ -36,7 +36,7 @@ config BT_ATT_TX_MAX
config BT_EATT
bool "Enhanced ATT Bearers support [EXPERIMENTAL]"
depends on BT_L2CAP_DYNAMIC_CHANNEL
depends on BT_L2CAP_ECRED
help
This option enables support for Enhanced ATT bearers support. When
enabled additional L2CAP channels can be connected as bearers enabling

View file

@ -56,6 +56,13 @@ config BT_L2CAP_DYNAMIC_CHANNEL
This option enables support for LE Connection oriented Channels,
allowing the creation of dynamic L2CAP Channels.
config BT_L2CAP_ECRED
bool "L2CAP Enhanced Credit Based Flow Control support"
depends on BT_L2CAP_DYNAMIC_CHANNEL
help
This option enables support for LE Connection oriented Channels with
Enhanced Credit Based Flow Control support on dynamic L2CAP Channels.
config BT_DEBUG_L2CAP
bool "Bluetooth L2CAP debug"
depends on BT_DEBUG

View file

@ -29,6 +29,7 @@ config BT_AUDIO_UNICAST
select BT_ISO
select BT_GATT_DYNAMIC_DB
select BT_GATT_CACHING
select BT_L2CAP_ECRED
select BT_EATT
help
This option enables support for Bluetooth Unicast Audio using

View file

@ -469,6 +469,7 @@ static int l2cap_le_conn_req(struct bt_l2cap_le_chan *ch)
return 0;
}
#if defined(CONFIG_BT_L2CAP_ECRED)
static int l2cap_ecred_conn_req(struct bt_l2cap_chan **chan, int channels)
{
struct net_buf *buf;
@ -509,6 +510,7 @@ static int l2cap_ecred_conn_req(struct bt_l2cap_chan **chan, int channels)
return 0;
}
#endif /* defined(CONFIG_BT_L2CAP_ECRED) */
static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status)
{
@ -524,6 +526,7 @@ static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status)
goto fail;
}
#if defined(CONFIG_BT_L2CAP_ECRED)
if (chan->ident) {
struct bt_l2cap_chan *echan[L2CAP_ECRED_CHAN_MAX];
struct bt_l2cap_le_chan *ch;
@ -537,6 +540,7 @@ static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status)
l2cap_ecred_conn_req(echan, i);
return;
}
#endif /* defined(CONFIG_BT_L2CAP_ECRED) */
/* Retry to connect */
err = l2cap_le_conn_req(BT_L2CAP_LE_CHAN(chan));
@ -1081,6 +1085,7 @@ rsp:
bt_l2cap_send(conn, BT_L2CAP_CID_LE_SIG, buf);
}
#if defined(CONFIG_BT_L2CAP_ECRED)
static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
struct net_buf *buf)
{
@ -1257,6 +1262,7 @@ response:
bt_l2cap_send(conn, BT_L2CAP_CID_LE_SIG, buf);
}
#endif /* defined(CONFIG_BT_L2CAP_ECRED) */
static struct bt_l2cap_le_chan *l2cap_remove_rx_cid(struct bt_conn *conn,
uint16_t cid)
@ -1370,6 +1376,7 @@ static int l2cap_change_security(struct bt_l2cap_le_chan *chan, uint16_t err)
return 0;
}
#if defined(CONFIG_BT_L2CAP_ECRED)
static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
struct net_buf *buf)
{
@ -1476,6 +1483,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
break;
}
}
#endif /* CONFIG_BT_L2CAP_ECRED */
static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
struct net_buf *buf)
@ -1923,6 +1931,7 @@ static int l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
case BT_L2CAP_CMD_REJECT:
reject_cmd(l2cap, hdr->ident, buf);
break;
#if defined(CONFIG_BT_L2CAP_ECRED)
case BT_L2CAP_ECRED_CONN_REQ:
le_ecred_conn_req(l2cap, hdr->ident, buf);
break;
@ -1932,6 +1941,7 @@ static int l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
case BT_L2CAP_ECRED_RECONF_REQ:
le_ecred_reconf_req(l2cap, hdr->ident, buf);
break;
#endif /* defined(CONFIG_BT_L2CAP_ECRED) */
#else
case BT_L2CAP_CMD_REJECT:
/* Ignored */
@ -2406,6 +2416,7 @@ fail:
return err;
}
#if defined(CONFIG_BT_L2CAP_ECRED)
static int l2cap_ecred_init(struct bt_conn *conn,
struct bt_l2cap_le_chan *ch, uint16_t psm)
{
@ -2466,6 +2477,7 @@ fail:
return err;
}
#endif /* defined(CONFIG_BT_L2CAP_ECRED) */
int bt_l2cap_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan,
uint16_t psm)

View file

@ -21,6 +21,7 @@ CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_L2CAP_TX_BUF_COUNT=4
CONFIG_BT_ID_MAX=2
CONFIG_BT_EATT=y
CONFIG_BT_L2CAP_ECRED=y
CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_HRS=y
CONFIG_BT_WHITELIST=y