From f123585faf1040a4fac1d1486d18549e6e83638b Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Wed, 23 Nov 2022 09:58:00 +0530 Subject: [PATCH] Added change to handle the case of controllers supporting Buffer Size larger than 251. Current memory allocation for buffers is limited to 251 size and hence fragmentation is needed in case buffer size is larger. --- nimble/host/src/ble_hs_hci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nimble/host/src/ble_hs_hci.c b/nimble/host/src/ble_hs_hci.c index 352273230..f8a64e931 100644 --- a/nimble/host/src/ble_hs_hci.c +++ b/nimble/host/src/ble_hs_hci.c @@ -413,6 +413,7 @@ ble_hs_hci_rx_evt(uint8_t *hci_ev, void *arg) return 0; } +#if !(SOC_ESP_NIMBLE_CONTROLLER) /** * Calculates the largest ACL payload that the controller can accept. */ @@ -426,6 +427,7 @@ ble_hs_hci_max_acl_payload_sz(void) */ return ble_hs_hci_buf_sz; } +#endif /** * Allocates an mbuf to contain an outgoing ACL data fragment. @@ -534,8 +536,11 @@ ble_hs_hci_acl_tx_now(struct ble_hs_conn *conn, struct os_mbuf **om) /* Send fragments until the entire packet has been sent. */ while (txom != NULL && ble_hs_hci_avail_pkts > 0) { - frag = mem_split_frag(&txom, ble_hs_hci_max_acl_payload_sz(), - ble_hs_hci_frag_alloc, NULL); +#if SOC_ESP_NIMBLE_CONTROLLER + frag = mem_split_frag(&txom, BLE_ACL_MAX_PKT_SIZE, ble_hs_hci_frag_alloc, NULL); +#else + frag = mem_split_frag(&txom, ble_hs_hci_max_acl_payload_sz(), ble_hs_hci_frag_alloc, NULL); +#endif if (frag == NULL) { *om = txom; return BLE_HS_EAGAIN;