Skip to content

Commit

Permalink
Bluetooth: controller: legacy: Fix mandatory min PDU len Code PHY
Browse files Browse the repository at this point in the history
Fix to return the max tx/rx time back to set default time
after using mandatory minimum PDU length and time while
switching back from Coded PHY to 1M PHY.

Also fixes #23109.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
  • Loading branch information
cvinayak authored and nashif committed Nov 17, 2020
1 parent d2713b1 commit 578a23b
Showing 1 changed file with 20 additions and 27 deletions.
47 changes: 20 additions & 27 deletions subsys/bluetooth/controller/ll_sw/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -8853,44 +8853,35 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
conn->phy_tx = conn->llcp.phy_upd_ind.tx;

#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
u16_t tx_time = RADIO_PKT_TIME(conn->max_tx_octets,
conn->phy_tx);
if (tx_time >=
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0)) {
eff_tx_time = MIN(tx_time, max_tx_time);
eff_tx_time =
MAX(RADIO_PKT_TIME(conn->max_tx_octets,
conn->phy_tx),
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0));
eff_tx_time = MIN(eff_tx_time, max_tx_time);

#if defined(CONFIG_BT_CTLR_PHY_CODED)
eff_tx_time = MAX(eff_tx_time,
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
conn->phy_tx));
eff_tx_time = MAX(eff_tx_time,
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
conn->phy_tx));
#endif /* CONFIG_BT_CTLR_PHY_CODED */
} else {
eff_tx_time =
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
0);
}
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
}

if (conn->llcp.phy_upd_ind.rx) {
conn->phy_rx = conn->llcp.phy_upd_ind.rx;

#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
u16_t rx_time = RADIO_PKT_TIME(conn->max_rx_octets,
conn->phy_rx);
if (rx_time >=
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0)) {
eff_rx_time = MIN(rx_time, max_rx_time);
eff_rx_time =
MAX(RADIO_PKT_TIME(conn->max_rx_octets,
conn->phy_rx),
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0));
eff_rx_time = MIN(eff_rx_time, max_rx_time);

#if defined(CONFIG_BT_CTLR_PHY_CODED)
eff_rx_time = MAX(eff_rx_time,
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
conn->phy_rx));
eff_rx_time = MAX(eff_rx_time,
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
conn->phy_rx));
#endif /* CONFIG_BT_CTLR_PHY_CODED */
} else {
eff_rx_time =
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
0);
}
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
}
conn->phy_flags = conn->phy_pref_flags;
Expand Down Expand Up @@ -8927,7 +8918,9 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
/* Update max tx and/or max rx if changed */
if ((eff_tx_time <= conn->max_tx_time) &&
(eff_rx_time <= conn->max_rx_time)) {
(conn->max_tx_time <= max_tx_time) &&
(eff_rx_time <= conn->max_rx_time) &&
(conn->max_rx_time <= max_rx_time)) {
return;
}
conn->max_tx_time = eff_tx_time;
Expand Down

0 comments on commit 578a23b

Please sign in to comment.