mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-14 05:00:06 +00:00
nimble/ll: Add helper to copy from "flat" mbuf
This helper can be used when we know that payload is stored in single mbuf (not chained) and starts at offset 0. This silly optimization can save some CPU cycles which does make difference when trying to send CONNECT_REQ on nRF51.
This commit is contained in:
@@ -451,6 +451,7 @@ int ble_ll_rx_end(uint8_t *rxbuf, struct ble_mbuf_hdr *rxhdr);
|
||||
|
||||
/* Helper callback to tx mbuf using ble_phy_tx() */
|
||||
uint8_t ble_ll_tx_mbuf_pducb(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte);
|
||||
uint8_t ble_ll_tx_flat_mbuf_pducb(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte);
|
||||
|
||||
/*--- Controller API ---*/
|
||||
void ble_ll_mbuf_init(struct os_mbuf *m, uint8_t pdulen, uint8_t hdr);
|
||||
|
||||
@@ -1017,6 +1017,23 @@ ble_ll_tx_mbuf_pducb(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
|
||||
return ble_hdr->txinfo.pyld_len;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
ble_ll_tx_flat_mbuf_pducb(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
|
||||
{
|
||||
struct os_mbuf *txpdu;
|
||||
struct ble_mbuf_hdr *ble_hdr;
|
||||
|
||||
txpdu = pducb_arg;
|
||||
BLE_LL_ASSERT(txpdu);
|
||||
ble_hdr = BLE_MBUF_HDR_PTR(txpdu);
|
||||
|
||||
memcpy(dptr, txpdu->om_data, ble_hdr->txinfo.pyld_len);
|
||||
|
||||
*hdr_byte = ble_hdr->txinfo.hdr_byte;
|
||||
|
||||
return ble_hdr->txinfo.pyld_len;
|
||||
}
|
||||
|
||||
static void
|
||||
ble_ll_event_rx_pkt(struct ble_npl_event *ev)
|
||||
{
|
||||
|
||||
@@ -2868,7 +2868,7 @@ ble_ll_conn_request_send(uint8_t addr_type, uint8_t *adva, uint16_t txoffset,
|
||||
} else {
|
||||
ble_phy_set_txend_cb(ble_ll_conn_req_txend_init, NULL);
|
||||
}
|
||||
rc = ble_phy_tx(ble_ll_tx_mbuf_pducb, m, end_trans);
|
||||
rc = ble_phy_tx(ble_ll_tx_flat_mbuf_pducb, m, end_trans);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user