mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-17 07:20:01 +00:00
nimble/host: Use os_mbuf_pack_chains
if BLE_L2CAP_JOIN_RX_FRAGS is set to 1, use the new API to pack mbuf chains instead of previous method. This new API will do more copying (possibly) but will better utilize memory in that it will use the entire data buffer of each mbuf in the chain.
This commit is contained in:
committed by
Prasad Alatkar
parent
6cf591f60e
commit
204c3482b4
@@ -188,17 +188,13 @@ ble_l2cap_remove_rx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
|
||||
static void
|
||||
ble_l2cap_append_rx(struct ble_l2cap_chan *chan, struct os_mbuf *frag)
|
||||
{
|
||||
int rc;
|
||||
|
||||
(void)rc;
|
||||
|
||||
#if MYNEWT_VAL(BLE_L2CAP_JOIN_RX_FRAGS)
|
||||
struct os_mbuf *m;
|
||||
|
||||
/* Copy the data from the incoming fragment into the packet in progress. */
|
||||
rc = os_mbuf_appendfrom(chan->rx_buf, frag, 0, OS_MBUF_PKTLEN(frag));
|
||||
if (rc == 0) {
|
||||
os_mbuf_free_chain(frag);
|
||||
return;
|
||||
}
|
||||
m = os_mbuf_pack_chains(chan->rx_buf, frag);
|
||||
assert(m);
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Join disabled or append failed due to mbuf shortage. Just attach the
|
||||
|
||||
Reference in New Issue
Block a user