Skip to content

Commit a536456

Browse files
sjanccarlescufi
authored andcommitted
Bluetooth: controller: Make sure effective DLE is valid
If peer sends invalid data length in response IUT should fix those when calculating effective data length. This was affecting following qualification test cases: LL/CON/PER/BI-10-C LL/CON/PER/BI-11-C LL/CON/PER/BI-12-C LL/CON/CEN/BI-07-C LL/CON/CEN/BI-08-C LL/CON/CEN/BI-09-C Signed-off-by: Szymon Janc <[email protected]>
1 parent ffdc621 commit a536456

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

subsys/bluetooth/controller/ll_sw/pdu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
/* Data channel minimum payload size and time */
8080
#define PDU_DC_PAYLOAD_SIZE_MIN 27
8181
#define PDU_DC_PAYLOAD_TIME_MIN 328
82+
#define PDU_DC_PAYLOAD_TIME_MIN_CODED 2704
8283

8384
/* Link Layer header size of Data PDU. Assumes pdu_data is packed */
8485
#define PDU_DC_LL_HEADER_SIZE (offsetof(struct pdu_data, lldata))

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7877,14 +7877,24 @@ uint8_t ull_dle_update_eff(struct ll_conn *conn)
78777877
uint8_t dle_changed = 0;
78787878

78797879
const uint16_t eff_tx_octets =
7880-
MIN(conn->lll.dle.local.max_tx_octets, conn->lll.dle.remote.max_rx_octets);
7880+
MAX(MIN(conn->lll.dle.local.max_tx_octets, conn->lll.dle.remote.max_rx_octets),
7881+
PDU_DC_PAYLOAD_SIZE_MIN);
78817882
const uint16_t eff_rx_octets =
7882-
MIN(conn->lll.dle.local.max_rx_octets, conn->lll.dle.remote.max_tx_octets);
7883+
MAX(MIN(conn->lll.dle.local.max_rx_octets, conn->lll.dle.remote.max_tx_octets),
7884+
PDU_DC_PAYLOAD_SIZE_MIN);
7885+
78837886
#if defined(CONFIG_BT_CTLR_PHY)
7887+
unsigned int min_eff_tx_time = (conn->lll.phy_tx == PHY_CODED) ?
7888+
PDU_DC_PAYLOAD_TIME_MIN_CODED : PDU_DC_PAYLOAD_TIME_MIN;
7889+
unsigned int min_eff_rx_time = (conn->lll.phy_rx == PHY_CODED) ?
7890+
PDU_DC_PAYLOAD_TIME_MIN_CODED : PDU_DC_PAYLOAD_TIME_MIN;
7891+
78847892
const uint16_t eff_tx_time =
7885-
MIN(conn->lll.dle.local.max_tx_time, conn->lll.dle.remote.max_rx_time);
7893+
MAX(MIN(conn->lll.dle.local.max_tx_time, conn->lll.dle.remote.max_rx_time),
7894+
min_eff_tx_time);
78867895
const uint16_t eff_rx_time =
7887-
MIN(conn->lll.dle.local.max_rx_time, conn->lll.dle.remote.max_tx_time);
7896+
MAX(MIN(conn->lll.dle.local.max_rx_time, conn->lll.dle.remote.max_tx_time),
7897+
min_eff_rx_time);
78887898

78897899
if (eff_tx_time != conn->lll.dle.eff.max_tx_time) {
78907900
conn->lll.dle.eff.max_tx_time = eff_tx_time;

0 commit comments

Comments
 (0)