Bluetooth: Controller: Add packet TX restrictions for CTE REQ/RSP PDUs

There are packet restrictions imposed by PHY update procedure
for PDU that includes CTE (BT Core 5.3 :
- central/peripheral can't send PDU with CTE after receive or send
LLPHY_UPDATE_IND until instant if the PHY after instant is CODED
- peripheral can't send PDU including CTE after it sends LL_PHY_REQ
PDU until receive LL_PHY_UPDATE_IND, LL_UNKNOWN_RSP, LL_REJECTED_EXT_-
IND_PDU if there is a CODE PHY in TX_PHYS
- peripheral can't send PDU including CTE after it sends LL_PHY_RSP
PDU until receive LL_PHY_UPDATE_IND if there is a CODED PHY in TX_PHYS
of LL_PHY_RSP PDU or RX_PHYS of LL_PHY_REQ PDU.

The BT 5.3 Core spec defines only one PDU that may include CTE, that is
LL_CTE_RSP PDU. To avoid a situation that there is such PDU enqueued
for transmission in LLL when packet transmission restrictions should
be applied, both procedures in almost all cases will not be executed
in parallel.

Current implementation always handles remote procedurerequest first.

There are possible three scenarios:
1. Remotely requested PHY update. Locally initiated CTE REQ.
   In this case there is no problem with LL_CTE_RSP waiting in a TX
   queue in LLL. Both procedures may be executed one after another.
2. Remotely requested CTE REQ. Locally initiated PHY update.
   In this case the CTE REQ is handled first and it will pause the
   PHY update procedure until LL_CTE_RSP PDU is acknowledged by
   remote. Then the CTE REQ procedure will be completed and PHY update
   continued.
3. Locally initiated PHY update is pending. Arrives remote CTE REQ.
   In this case the CTE REQ will be paused until localy initiated PHY
   update is completed. Then the CTE REQ will be continued.

Thanks to that there should be no PDU including CTE in LLL TX quueue.
That releases us from a situation there is a LL_CTE_RSP PDU in the
LLL TX qeueue that must be changed into LL_REJECT_EXT_IND PDU due to
change of PHY to CODED PHY after PHY update procedure completes.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2022-01-18 11:42:30 +01:00 committed by Christopher Friedt
commit aa4819994e
6 changed files with 61 additions and 8 deletions

View file

@ -20,6 +20,8 @@ enum llcp_proc {
PROC_CHAN_MAP_UPDATE,
PROC_DATA_LENGTH_UPDATE,
PROC_CTE_REQ,
/* A helper enum entry, to use in pause prcedure context */
PROC_NONE = 0x0,
};
#if ((CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM <\
(CONFIG_BT_CTLR_LLCP_TX_PER_CONN_TX_CTRL_BUF_NUM_MAX *\
@ -446,6 +448,8 @@ void llcp_lr_abort(struct ll_conn *conn);
*/
void llcp_rr_set_incompat(struct ll_conn *conn, enum proc_incompat incompat);
bool llcp_rr_get_collision(struct ll_conn *conn);
void llcp_rr_set_paused_cmd(struct ll_conn *conn, enum llcp_proc);
enum llcp_proc llcp_rr_get_paused_cmd(struct ll_conn *conn);
struct proc_ctx *llcp_rr_peek(struct ll_conn *conn);
void llcp_rr_pause(struct ll_conn *conn);
void llcp_rr_resume(struct ll_conn *conn);