Skip to content

Commit 54af281

Browse files
cvinayakmbolivar-nordic
authored andcommitted
[nrf fromtree] Bluetooth: Controller: Fix to use non-discardable buffer
Fix to use non-discardable Rx buffer for handling Extended and Periodic Advertising Report. Regression introduced in commit 18171bc ("Bluetooth: Host: Non-discardable event buffer size is 255 for ext adv"). The default discardable Rx buffer size was reduced causing increased fragmentation and deadlock trying to get more free discardable Rx buffers to generate HCI Extended and Periodic Advertising reports. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]> (cherry picked from commit 230f4f1) (cherry picked from commit 901604f)
1 parent 7d45497 commit 54af281

File tree

1 file changed

+13
-18
lines changed
  • subsys/bluetooth/controller/hci

1 file changed

+13
-18
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ static uint32_t conn_count;
190190
static uint32_t cis_pending_count;
191191
#endif
192192

193-
#if !defined(CONFIG_BT_HCI_RAW) && defined(CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT)
194-
#define ADV_REPORT_EVT_MAX_LEN CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE
195-
#else
196-
#define ADV_REPORT_EVT_MAX_LEN CONFIG_BT_BUF_EVT_RX_SIZE
197-
#endif
198-
199193
/* In HCI event PHY indices start at 1 compare to 0 indexed in aux_ptr field in
200194
* the Common Extended Payload Format in the PDUs.
201195
*/
@@ -6186,7 +6180,7 @@ static void le_ext_adv_report(struct pdu_data *pdu_data,
61866180

61876181
/* HCI fragment */
61886182
evt_buf = buf;
6189-
data_len_max = ADV_REPORT_EVT_MAX_LEN -
6183+
data_len_max = CONFIG_BT_BUF_EVT_RX_SIZE -
61906184
sizeof(struct bt_hci_evt_le_meta_event) -
61916185
sizeof(struct bt_hci_evt_le_ext_advertising_report) -
61926186
sizeof(struct bt_hci_evt_le_ext_advertising_info);
@@ -6535,7 +6529,7 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data,
65356529
accept = ftr->sync_rx_enabled;
65366530
}
65376531

6538-
data_len_max = ADV_REPORT_EVT_MAX_LEN -
6532+
data_len_max = CONFIG_BT_BUF_EVT_RX_SIZE -
65396533
sizeof(struct bt_hci_evt_le_meta_event) -
65406534
sizeof(struct bt_hci_evt_le_per_advertising_report);
65416535
data_len_total = node_rx->hdr.rx_ftr.aux_data_len;
@@ -7668,13 +7662,6 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
76687662
defined(CONFIG_BT_CTLR_PROFILE_ISR)
76697663
#if defined(CONFIG_BT_OBSERVER)
76707664
case NODE_RX_TYPE_REPORT:
7671-
7672-
#if defined(CONFIG_BT_CTLR_ADV_EXT)
7673-
__fallthrough;
7674-
case NODE_RX_TYPE_EXT_1M_REPORT:
7675-
case NODE_RX_TYPE_EXT_2M_REPORT:
7676-
case NODE_RX_TYPE_EXT_CODED_REPORT:
7677-
#endif /* CONFIG_BT_CTLR_ADV_EXT */
76787665
#endif /* CONFIG_BT_OBSERVER */
76797666

76807667
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
@@ -7703,18 +7690,20 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
77037690
#if defined(CONFIG_BT_CTLR_ADV_EXT)
77047691
#if defined(CONFIG_BT_BROADCASTER)
77057692
case NODE_RX_TYPE_EXT_ADV_TERMINATE:
7693+
77067694
#if defined(CONFIG_BT_CTLR_ADV_ISO)
77077695
case NODE_RX_TYPE_BIG_COMPLETE:
77087696
case NODE_RX_TYPE_BIG_TERMINATE:
77097697
#endif /* CONFIG_BT_CTLR_ADV_ISO */
77107698
#endif /* CONFIG_BT_BROADCASTER */
77117699

77127700
#if defined(CONFIG_BT_OBSERVER)
7713-
__fallthrough;
7701+
case NODE_RX_TYPE_EXT_1M_REPORT:
7702+
case NODE_RX_TYPE_EXT_2M_REPORT:
7703+
case NODE_RX_TYPE_EXT_CODED_REPORT:
77147704
case NODE_RX_TYPE_EXT_SCAN_TERMINATE:
77157705

77167706
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
7717-
__fallthrough;
77187707
case NODE_RX_TYPE_SYNC:
77197708
case NODE_RX_TYPE_SYNC_REPORT:
77207709
case NODE_RX_TYPE_SYNC_LOST:
@@ -7724,7 +7713,6 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
77247713
#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */
77257714

77267715
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
7727-
__fallthrough;
77287716
case NODE_RX_TYPE_SYNC_ISO:
77297717
case NODE_RX_TYPE_SYNC_ISO_LOST:
77307718
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
@@ -7744,9 +7732,11 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
77447732
#if defined(CONFIG_BT_CTLR_CONN_ISO)
77457733
case NODE_RX_TYPE_CIS_ESTABLISHED:
77467734
#endif /* CONFIG_BT_CTLR_CONN_ISO */
7735+
77477736
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX)
77487737
case NODE_RX_TYPE_CONN_IQ_SAMPLE_REPORT:
77497738
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */
7739+
77507740
return HCI_CLASS_EVT_REQUIRED;
77517741

77527742
case NODE_RX_TYPE_TERMINATE:
@@ -7759,17 +7749,22 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx)
77597749
#if defined(CONFIG_BT_CTLR_CONN_RSSI_EVENT)
77607750
case NODE_RX_TYPE_RSSI:
77617751
#endif /* CONFIG_BT_CTLR_CONN_RSSI_EVENT */
7752+
77627753
#if defined(CONFIG_BT_CTLR_LE_PING)
77637754
case NODE_RX_TYPE_APTO:
77647755
#endif /* CONFIG_BT_CTLR_LE_PING */
7756+
77657757
#if defined(CONFIG_BT_CTLR_CHAN_SEL_2)
77667758
case NODE_RX_TYPE_CHAN_SEL_ALGO:
77677759
#endif /* CONFIG_BT_CTLR_CHAN_SEL_2 */
7760+
77687761
#if defined(CONFIG_BT_CTLR_PHY)
77697762
case NODE_RX_TYPE_PHY_UPDATE:
77707763
#endif /* CONFIG_BT_CTLR_PHY */
7764+
77717765
return HCI_CLASS_EVT_CONNECTION;
77727766
#endif /* CONFIG_BT_CONN */
7767+
77737768
#if defined(CONFIG_BT_CTLR_SYNC_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
77747769
case NODE_RX_TYPE_ISO_PDU:
77757770
return HCI_CLASS_ISO_DATA;

0 commit comments

Comments
 (0)