Bluetooth: controller: legacy: Fix mandatory min PDU len Code PHY

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>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-02-26 23:22:19 +05:30 committed by Johan Hedberg
commit b466d5399c

View file

@ -8874,22 +8874,17 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
conn->phy_tx = conn->llcp.phy_upd_ind.tx; conn->phy_tx = conn->llcp.phy_upd_ind.tx;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH) #if defined(CONFIG_BT_CTLR_DATA_LENGTH)
u16_t tx_time = RADIO_PKT_TIME(conn->max_tx_octets, eff_tx_time =
conn->phy_tx); MAX(RADIO_PKT_TIME(conn->max_tx_octets,
if (tx_time >= conn->phy_tx),
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0)) { RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0));
eff_tx_time = MIN(tx_time, max_tx_time); eff_tx_time = MIN(eff_tx_time, max_tx_time);
#if defined(CONFIG_BT_CTLR_PHY_CODED) #if defined(CONFIG_BT_CTLR_PHY_CODED)
eff_tx_time = MAX(eff_tx_time, eff_tx_time = MAX(eff_tx_time,
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
conn->phy_tx)); conn->phy_tx));
#endif /* CONFIG_BT_CTLR_PHY_CODED */ #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 */ #endif /* CONFIG_BT_CTLR_DATA_LENGTH */
} }
@ -8897,21 +8892,17 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
conn->phy_rx = conn->llcp.phy_upd_ind.rx; conn->phy_rx = conn->llcp.phy_upd_ind.rx;
#if defined(CONFIG_BT_CTLR_DATA_LENGTH) #if defined(CONFIG_BT_CTLR_DATA_LENGTH)
u16_t rx_time = RADIO_PKT_TIME(conn->max_rx_octets, eff_rx_time =
conn->phy_rx); MAX(RADIO_PKT_TIME(conn->max_rx_octets,
if (rx_time >= conn->phy_rx),
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0)) { RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, 0));
eff_rx_time = MIN(rx_time, max_rx_time); eff_rx_time = MIN(eff_rx_time, max_rx_time);
#if defined(CONFIG_BT_CTLR_PHY_CODED) #if defined(CONFIG_BT_CTLR_PHY_CODED)
eff_rx_time = MAX(eff_rx_time, eff_rx_time = MAX(eff_rx_time,
RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN, RADIO_PKT_TIME(PDU_DC_PAYLOAD_SIZE_MIN,
conn->phy_rx)); conn->phy_rx));
#endif /* CONFIG_BT_CTLR_PHY_CODED */ #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 */ #endif /* CONFIG_BT_CTLR_DATA_LENGTH */
} }
conn->phy_flags = conn->phy_pref_flags; conn->phy_flags = conn->phy_pref_flags;
@ -8948,7 +8939,9 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
#if defined(CONFIG_BT_CTLR_DATA_LENGTH) #if defined(CONFIG_BT_CTLR_DATA_LENGTH)
/* Update max tx and/or max rx if changed */ /* Update max tx and/or max rx if changed */
if ((eff_tx_time <= conn->max_tx_time) && 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; return;
} }
conn->max_tx_time = eff_tx_time; conn->max_tx_time = eff_tx_time;