Bluetooth: Controller: Remove separate done memq

The separate done memq was introduced to handle the old LLCP
stalling processing of the rx queue; This is no longer an issue with
the new LLCP, so we can remove it

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2023-07-28 14:08:08 +02:00 committed by Carles Cufí
commit 0a2d538c2b
4 changed files with 10 additions and 95 deletions

View file

@ -15,11 +15,6 @@
#define TICKER_USER_ID_THREAD MAYFLY_CALL_ID_PROGRAM
#define EVENT_PIPELINE_MAX 7
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
#define EVENT_DONE_LINK_CNT 0
#else
#define EVENT_DONE_LINK_CNT 1
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
#define ADV_INT_UNIT_US 625U
#define SCAN_INT_UNIT_US 625U
@ -598,9 +593,7 @@ void *ull_pdu_rx_alloc(void);
void *ull_iso_pdu_rx_alloc_peek(uint8_t count);
void *ull_iso_pdu_rx_alloc(void);
void ull_rx_put(memq_link_t *link, void *rx);
void ull_rx_put_done(memq_link_t *link, void *done);
void ull_rx_sched(void);
void ull_rx_sched_done(void);
void ull_rx_put_sched(memq_link_t *link, void *rx);
void ull_iso_rx_put(memq_link_t *link, void *rx);
void ull_iso_rx_sched(void);

View file

@ -323,8 +323,6 @@ static MFIFO_DEFINE(prep, sizeof(struct lll_event), EVENT_PIPELINE_MAX);
* - mem_done: Backing data pool for struct node_rx_event_done elements
* - mem_link_done: Pool of memq_link_t elements
*
* An extra link may be reserved for use by the ull_done memq (EVENT_DONE_LINK_CNT).
*
* Queue of pointers to struct node_rx_event_done.
* The actual backing behind these pointers is mem_done.
*
@ -363,7 +361,7 @@ static MFIFO_DEFINE(prep, sizeof(struct lll_event), EVENT_PIPELINE_MAX);
#endif
static RXFIFO_DEFINE(done, sizeof(struct node_rx_event_done),
EVENT_DONE_MAX, EVENT_DONE_LINK_CNT);
EVENT_DONE_MAX, 0U);
/* Minimum number of node rx for ULL to LL/HCI thread per connection.
* Increasing this by times the max. simultaneous connection count will permit
@ -494,9 +492,6 @@ static struct {
static MEMQ_DECLARE(ull_rx);
static MEMQ_DECLARE(ll_rx);
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
static MEMQ_DECLARE(ull_done);
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
#if defined(CONFIG_BT_CONN)
static MFIFO_DEFINE(ll_pdu_rx_free, sizeof(void *), LL_PDU_RX_CNT);
@ -544,15 +539,12 @@ static inline void rx_demux_conn_tx_ack(uint8_t ack_last, uint16_t handle,
memq_link_t *link,
struct node_tx *node_tx);
#endif /* CONFIG_BT_CONN || CONFIG_BT_CTLR_ADV_ISO */
static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx);
static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx);
static inline void rx_demux_event_done(memq_link_t *link,
struct node_rx_hdr *rx);
static void ll_rx_link_quota_inc(void);
static void ll_rx_link_quota_dec(void);
static void disabled_cb(void *param);
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
static void ull_done(void *param);
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
int ll_init(struct k_sem *sem_rx)
{
@ -1996,23 +1988,6 @@ void ull_rx_put_sched(memq_link_t *link, void *rx)
ull_rx_sched();
}
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
void ull_rx_put_done(memq_link_t *link, void *done)
{
/* Enqueue the done object */
memq_enqueue(link, done, &memq_ull_done.tail);
}
void ull_rx_sched_done(void)
{
static memq_link_t link;
static struct mayfly mfy = {0, 0, &link, NULL, ull_done};
/* Kick the ULL (using the mayfly, tailchain it) */
mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_HIGH, 1, &mfy);
}
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
struct lll_event *ull_prepare_enqueue(lll_is_abort_cb_t is_abort_cb,
lll_abort_cb_t abort_cb,
struct lll_prepare_param *prepare_param,
@ -2185,12 +2160,7 @@ void *ull_event_done(void *param)
evdone->hdr.type = NODE_RX_TYPE_EVENT_DONE;
evdone->param = param;
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
ull_rx_put_done(link, evdone);
ull_rx_sched_done();
#else
ull_rx_put_sched(link, evdone);
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
return evdone;
}
@ -2265,15 +2235,6 @@ static inline int init_reset(void)
/* Initialize ull rx memq */
MEMQ_INIT(ull_rx, link);
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
/* Acquire a link to initialize ull done memq */
link = mem_acquire(&mem_link_done.free);
LL_ASSERT(link);
/* Initialize ull done memq */
MEMQ_INIT(ull_done, link);
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
/* Acquire a link to initialize ll rx memq */
link = mem_acquire(&mem_link_rx.free);
LL_ASSERT(link);
@ -2466,7 +2427,6 @@ static void rx_demux(void *param)
memq_link_t *link_tx;
uint16_t handle; /* Handle to Ack TX */
#endif /* CONFIG_BT_CONN */
int nack = 0;
LL_ASSERT(rx);
@ -2479,17 +2439,11 @@ static void rx_demux(void *param)
} else
#endif /* CONFIG_BT_CONN */
{
nack = rx_demux_rx(link, rx);
rx_demux_rx(link, rx);
}
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
if (!nack) {
rx_demux_yield();
}
#else /* !CONFIG_BT_CTLR_LOW_LAT_ULL */
if (nack) {
break;
}
rx_demux_yield();
#endif /* !CONFIG_BT_CTLR_LOW_LAT_ULL */
#if defined(CONFIG_BT_CONN)
@ -2718,43 +2672,21 @@ static inline void rx_demux_conn_tx_ack(uint8_t ack_last, uint16_t handle,
}
#endif /* CONFIG_BT_CONN || CONFIG_BT_CTLR_ADV_ISO */
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
static void ull_done(void *param)
{
memq_link_t *link;
struct node_rx_hdr *done;
do {
link = memq_peek(memq_ull_done.head, memq_ull_done.tail,
(void **)&done);
if (link) {
/* Process done event */
(void)memq_dequeue(memq_ull_done.tail,
&memq_ull_done.head, NULL);
rx_demux_event_done(link, done);
}
} while (link);
}
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
/**
* @brief Dispatch rx objects
* @details Rx objects are only peeked, not dequeued yet.
* Execution context: ULL high priority Mayfly
*/
static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
{
/* Demux Rx objects */
switch (rx->type) {
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
case NODE_RX_TYPE_EVENT_DONE:
{
(void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL);
rx_demux_event_done(link, rx);
}
break;
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
#if defined(CONFIG_BT_OBSERVER)
#if defined(CONFIG_BT_CTLR_ADV_EXT)
@ -2837,12 +2769,7 @@ static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
case NODE_RX_TYPE_DC_PDU:
{
int nack;
nack = ull_conn_rx(link, (void *)&rx);
if (nack) {
return nack;
}
ull_conn_rx(link, (void *)&rx);
(void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL);
@ -2922,8 +2849,6 @@ static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
}
break;
}
return 0;
}
static inline void rx_demux_event_done(memq_link_t *link,

View file

@ -803,7 +803,7 @@ void ull_conn_setup(memq_link_t *rx_link, struct node_rx_hdr *rx)
}
}
int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
void ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
{
struct pdu_data *pdu_rx;
struct ll_conn *conn;
@ -813,7 +813,7 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
/* Mark for buffer for release */
(*rx)->hdr.type = NODE_RX_TYPE_RELEASE;
return 0;
return;
}
ull_cp_tx_ntf(conn);
@ -828,7 +828,7 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
ull_cp_rx(conn, link, *rx);
return 0;
return;
}
case PDU_DATA_LLID_DATA_CONTINUE:
@ -860,9 +860,6 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
break;
}
return 0;
}
int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire,

View file

@ -22,7 +22,7 @@ bool ull_conn_peer_connected(uint8_t const own_id_addr_type,
uint8_t const peer_id_addr_type,
uint8_t const *const peer_id_addr);
void ull_conn_setup(memq_link_t *rx_link, struct node_rx_hdr *rx);
int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx);
void ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx);
int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire,
uint32_t remainder, uint16_t lazy);
void ull_conn_done(struct node_rx_event_done *done);