mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-10 20:17:56 +00:00
nimble/ll: Fix channel map update instant calculation
The instant for channel map update was calculated at the time PDU was enqueued in connsm. This caused new map to be always applied at instant regardless if PDU was even dequeued for tx, e.g. in case there encryption procedure pending. This could result in connection being dropped. Currently we calculate instant when PDU is dequeued to make sure this is the next PDU to be sent and thus instant is valid.
This commit is contained in:
@@ -1883,12 +1883,15 @@ ble_ll_ctrl_chanmap_req_make(struct ble_ll_conn_sm *connsm, uint8_t *pyld)
|
||||
memcpy(pyld, g_ble_ll_data.chan_map, BLE_LL_CHAN_MAP_LEN);
|
||||
memcpy(connsm->req_chanmap, pyld, BLE_LL_CHAN_MAP_LEN);
|
||||
|
||||
/* Instant is placed in ble_ll_ctrl_chanmap_req_instant()*/
|
||||
}
|
||||
|
||||
static void
|
||||
ble_ll_ctrl_chanmap_req_instant(struct ble_ll_conn_sm *connsm, uint8_t *pyld)
|
||||
{
|
||||
/* Place instant into request */
|
||||
connsm->chanmap_instant = connsm->event_cntr + connsm->periph_latency + 6 + 1;
|
||||
put_le16(pyld + BLE_LL_CHAN_MAP_LEN, connsm->chanmap_instant);
|
||||
|
||||
/* Set scheduled flag */
|
||||
connsm->flags.chanmap_update_sched = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3106,6 +3109,10 @@ ble_ll_ctrl_tx_start(struct ble_ll_conn_sm *connsm, struct os_mbuf *txpdu)
|
||||
ble_ll_ctrl_conn_update_make_ind_pdu(connsm, ctrdata);
|
||||
connsm->flags.conn_update_sched = 1;
|
||||
break;
|
||||
case BLE_LL_CTRL_CHANNEL_MAP_REQ:
|
||||
ble_ll_ctrl_chanmap_req_instant(connsm, ctrdata);
|
||||
connsm->flags.chanmap_update_sched = 1;
|
||||
break;
|
||||
#if MYNEWT_VAL(BLE_LL_PHY)
|
||||
case BLE_LL_CTRL_PHY_UPDATE_IND:
|
||||
if (ble_ll_ctrl_phy_update_ind_instant(connsm, ctrdata)) {
|
||||
|
||||
Reference in New Issue
Block a user