Bluetooth: Controller: Deprioritize adv report buffer allocation
Advertising reports are the only HCI events which we can drop if we are low on buffers. Allocate them therefore with K_NO_WAIT rather than K_FOREVER. Change-Id: I0b7c92647f9be54b8746da837037725f8161a452 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
88b620550c
commit
2f191012c2
3 changed files with 21 additions and 3 deletions
|
@ -1367,3 +1367,13 @@ void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num)
|
||||||
hc->handle = sys_cpu_to_le16(handle);
|
hc->handle = sys_cpu_to_le16(handle);
|
||||||
hc->count = sys_cpu_to_le16(num);
|
hc->count = sys_cpu_to_le16(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hci_evt_is_discardable(struct radio_pdu_node_rx *node_rx)
|
||||||
|
{
|
||||||
|
switch (node_rx->hdr.type) {
|
||||||
|
case NODE_RX_TYPE_REPORT:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -236,9 +236,16 @@ static void recv_thread(void *p1, void *p2, void *p3)
|
||||||
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU ||
|
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU ||
|
||||||
pdu_data->ll_id == PDU_DATA_LLID_CTRL) {
|
pdu_data->ll_id == PDU_DATA_LLID_CTRL) {
|
||||||
/* generate a (non-priority) HCI event */
|
/* generate a (non-priority) HCI event */
|
||||||
buf = bt_buf_get_rx(K_FOREVER);
|
if (hci_evt_is_discardable(node_rx)) {
|
||||||
bt_buf_set_type(buf, BT_BUF_EVT);
|
buf = bt_buf_get_rx(K_NO_WAIT);
|
||||||
hci_evt_encode(node_rx, buf);
|
} else {
|
||||||
|
buf = bt_buf_get_rx(K_FOREVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf) {
|
||||||
|
bt_buf_set_type(buf, BT_BUF_EVT);
|
||||||
|
hci_evt_encode(node_rx, buf);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* generate ACL data */
|
/* generate ACL data */
|
||||||
buf = bt_buf_get_rx(K_FOREVER);
|
buf = bt_buf_get_rx(K_FOREVER);
|
||||||
|
|
|
@ -24,4 +24,5 @@ void hci_evt_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
|
||||||
void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
|
void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
|
||||||
void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num);
|
void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num);
|
||||||
void hci_le_rand(void *buf, uint8_t len);
|
void hci_le_rand(void *buf, uint8_t len);
|
||||||
|
bool hci_evt_is_discardable(struct radio_pdu_node_rx *node_rx);
|
||||||
#endif /* _HCI_CONTROLLER_H_ */
|
#endif /* _HCI_CONTROLLER_H_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue