Skip to content

Commit 0a2d538

Browse files
Tronilcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 3509f8b commit 0a2d538

File tree

4 files changed

+10
-95
lines changed

4 files changed

+10
-95
lines changed

subsys/bluetooth/controller/ll_sw/lll.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
#define TICKER_USER_ID_THREAD MAYFLY_CALL_ID_PROGRAM
1616

1717
#define EVENT_PIPELINE_MAX 7
18-
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
19-
#define EVENT_DONE_LINK_CNT 0
20-
#else
21-
#define EVENT_DONE_LINK_CNT 1
22-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
2318

2419
#define ADV_INT_UNIT_US 625U
2520
#define SCAN_INT_UNIT_US 625U
@@ -598,9 +593,7 @@ void *ull_pdu_rx_alloc(void);
598593
void *ull_iso_pdu_rx_alloc_peek(uint8_t count);
599594
void *ull_iso_pdu_rx_alloc(void);
600595
void ull_rx_put(memq_link_t *link, void *rx);
601-
void ull_rx_put_done(memq_link_t *link, void *done);
602596
void ull_rx_sched(void);
603-
void ull_rx_sched_done(void);
604597
void ull_rx_put_sched(memq_link_t *link, void *rx);
605598
void ull_iso_rx_put(memq_link_t *link, void *rx);
606599
void ull_iso_rx_sched(void);

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 6 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ static MFIFO_DEFINE(prep, sizeof(struct lll_event), EVENT_PIPELINE_MAX);
323323
* - mem_done: Backing data pool for struct node_rx_event_done elements
324324
* - mem_link_done: Pool of memq_link_t elements
325325
*
326-
* An extra link may be reserved for use by the ull_done memq (EVENT_DONE_LINK_CNT).
327-
*
328326
* Queue of pointers to struct node_rx_event_done.
329327
* The actual backing behind these pointers is mem_done.
330328
*
@@ -363,7 +361,7 @@ static MFIFO_DEFINE(prep, sizeof(struct lll_event), EVENT_PIPELINE_MAX);
363361
#endif
364362

365363
static RXFIFO_DEFINE(done, sizeof(struct node_rx_event_done),
366-
EVENT_DONE_MAX, EVENT_DONE_LINK_CNT);
364+
EVENT_DONE_MAX, 0U);
367365

368366
/* Minimum number of node rx for ULL to LL/HCI thread per connection.
369367
* Increasing this by times the max. simultaneous connection count will permit
@@ -494,9 +492,6 @@ static struct {
494492

495493
static MEMQ_DECLARE(ull_rx);
496494
static MEMQ_DECLARE(ll_rx);
497-
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
498-
static MEMQ_DECLARE(ull_done);
499-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
500495

501496
#if defined(CONFIG_BT_CONN)
502497
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,
544539
memq_link_t *link,
545540
struct node_tx *node_tx);
546541
#endif /* CONFIG_BT_CONN || CONFIG_BT_CTLR_ADV_ISO */
547-
static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx);
542+
static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx);
548543
static inline void rx_demux_event_done(memq_link_t *link,
549544
struct node_rx_hdr *rx);
550545
static void ll_rx_link_quota_inc(void);
551546
static void ll_rx_link_quota_dec(void);
552547
static void disabled_cb(void *param);
553-
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
554-
static void ull_done(void *param);
555-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
556548

557549
int ll_init(struct k_sem *sem_rx)
558550
{
@@ -1996,23 +1988,6 @@ void ull_rx_put_sched(memq_link_t *link, void *rx)
19961988
ull_rx_sched();
19971989
}
19981990

1999-
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
2000-
void ull_rx_put_done(memq_link_t *link, void *done)
2001-
{
2002-
/* Enqueue the done object */
2003-
memq_enqueue(link, done, &memq_ull_done.tail);
2004-
}
2005-
2006-
void ull_rx_sched_done(void)
2007-
{
2008-
static memq_link_t link;
2009-
static struct mayfly mfy = {0, 0, &link, NULL, ull_done};
2010-
2011-
/* Kick the ULL (using the mayfly, tailchain it) */
2012-
mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_HIGH, 1, &mfy);
2013-
}
2014-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
2015-
20161991
struct lll_event *ull_prepare_enqueue(lll_is_abort_cb_t is_abort_cb,
20171992
lll_abort_cb_t abort_cb,
20181993
struct lll_prepare_param *prepare_param,
@@ -2185,12 +2160,7 @@ void *ull_event_done(void *param)
21852160
evdone->hdr.type = NODE_RX_TYPE_EVENT_DONE;
21862161
evdone->param = param;
21872162

2188-
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
2189-
ull_rx_put_done(link, evdone);
2190-
ull_rx_sched_done();
2191-
#else
21922163
ull_rx_put_sched(link, evdone);
2193-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
21942164

21952165
return evdone;
21962166
}
@@ -2265,15 +2235,6 @@ static inline int init_reset(void)
22652235
/* Initialize ull rx memq */
22662236
MEMQ_INIT(ull_rx, link);
22672237

2268-
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
2269-
/* Acquire a link to initialize ull done memq */
2270-
link = mem_acquire(&mem_link_done.free);
2271-
LL_ASSERT(link);
2272-
2273-
/* Initialize ull done memq */
2274-
MEMQ_INIT(ull_done, link);
2275-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
2276-
22772238
/* Acquire a link to initialize ll rx memq */
22782239
link = mem_acquire(&mem_link_rx.free);
22792240
LL_ASSERT(link);
@@ -2466,7 +2427,6 @@ static void rx_demux(void *param)
24662427
memq_link_t *link_tx;
24672428
uint16_t handle; /* Handle to Ack TX */
24682429
#endif /* CONFIG_BT_CONN */
2469-
int nack = 0;
24702430

24712431
LL_ASSERT(rx);
24722432

@@ -2479,17 +2439,11 @@ static void rx_demux(void *param)
24792439
} else
24802440
#endif /* CONFIG_BT_CONN */
24812441
{
2482-
nack = rx_demux_rx(link, rx);
2442+
rx_demux_rx(link, rx);
24832443
}
24842444

24852445
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
2486-
if (!nack) {
2487-
rx_demux_yield();
2488-
}
2489-
#else /* !CONFIG_BT_CTLR_LOW_LAT_ULL */
2490-
if (nack) {
2491-
break;
2492-
}
2446+
rx_demux_yield();
24932447
#endif /* !CONFIG_BT_CTLR_LOW_LAT_ULL */
24942448

24952449
#if defined(CONFIG_BT_CONN)
@@ -2718,43 +2672,21 @@ static inline void rx_demux_conn_tx_ack(uint8_t ack_last, uint16_t handle,
27182672
}
27192673
#endif /* CONFIG_BT_CONN || CONFIG_BT_CTLR_ADV_ISO */
27202674

2721-
#if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
2722-
static void ull_done(void *param)
2723-
{
2724-
memq_link_t *link;
2725-
struct node_rx_hdr *done;
2726-
2727-
do {
2728-
link = memq_peek(memq_ull_done.head, memq_ull_done.tail,
2729-
(void **)&done);
2730-
2731-
if (link) {
2732-
/* Process done event */
2733-
(void)memq_dequeue(memq_ull_done.tail,
2734-
&memq_ull_done.head, NULL);
2735-
rx_demux_event_done(link, done);
2736-
}
2737-
} while (link);
2738-
}
2739-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
2740-
27412675
/**
27422676
* @brief Dispatch rx objects
27432677
* @details Rx objects are only peeked, not dequeued yet.
27442678
* Execution context: ULL high priority Mayfly
27452679
*/
2746-
static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
2680+
static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
27472681
{
27482682
/* Demux Rx objects */
27492683
switch (rx->type) {
2750-
#if defined(CONFIG_BT_CTLR_LOW_LAT_ULL)
27512684
case NODE_RX_TYPE_EVENT_DONE:
27522685
{
27532686
(void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL);
27542687
rx_demux_event_done(link, rx);
27552688
}
27562689
break;
2757-
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
27582690

27592691
#if defined(CONFIG_BT_OBSERVER)
27602692
#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)
28372769

28382770
case NODE_RX_TYPE_DC_PDU:
28392771
{
2840-
int nack;
2841-
2842-
nack = ull_conn_rx(link, (void *)&rx);
2843-
if (nack) {
2844-
return nack;
2845-
}
2772+
ull_conn_rx(link, (void *)&rx);
28462773

28472774
(void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL);
28482775

@@ -2922,8 +2849,6 @@ static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
29222849
}
29232850
break;
29242851
}
2925-
2926-
return 0;
29272852
}
29282853

29292854
static inline void rx_demux_event_done(memq_link_t *link,

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void ull_conn_setup(memq_link_t *rx_link, struct node_rx_hdr *rx)
803803
}
804804
}
805805

806-
int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
806+
void ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
807807
{
808808
struct pdu_data *pdu_rx;
809809
struct ll_conn *conn;
@@ -813,7 +813,7 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
813813
/* Mark for buffer for release */
814814
(*rx)->hdr.type = NODE_RX_TYPE_RELEASE;
815815

816-
return 0;
816+
return;
817817
}
818818

819819
ull_cp_tx_ntf(conn);
@@ -828,7 +828,7 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
828828

829829
ull_cp_rx(conn, link, *rx);
830830

831-
return 0;
831+
return;
832832
}
833833

834834
case PDU_DATA_LLID_DATA_CONTINUE:
@@ -860,9 +860,6 @@ int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx)
860860

861861
break;
862862
}
863-
864-
865-
return 0;
866863
}
867864

868865
int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire,

subsys/bluetooth/controller/ll_sw/ull_conn_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bool ull_conn_peer_connected(uint8_t const own_id_addr_type,
2222
uint8_t const peer_id_addr_type,
2323
uint8_t const *const peer_id_addr);
2424
void ull_conn_setup(memq_link_t *rx_link, struct node_rx_hdr *rx);
25-
int ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx);
25+
void ull_conn_rx(memq_link_t *link, struct node_rx_pdu **rx);
2626
int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire,
2727
uint32_t remainder, uint16_t lazy);
2828
void ull_conn_done(struct node_rx_event_done *done);

0 commit comments

Comments
 (0)