Skip to content
Commit 58cb4557 authored by Reto Schneider's avatar Reto Schneider Committed by Carles Cufí
Browse files

net: ppp: Optimize memory allocation



net_pkt_alloc_buffer() deducts the free space from the requested number
of bytes.

As ppp_save_byte() calls net_pkt_alloc_buffer() when the packet has one
byte available still, this causes all but the first net_buf in the
packet to be of size CONFIG_NET_BUF_DATA_SIZE - 1.

Consequences:
 - With CONFIG_NET_BUF_FIXED_DATA_SIZE enabled, one byte per net_buf
   gets wasted.
 - CONFIG_NET_BUF_DATA_SIZE has typically an even, likely even a power
   of two value. Using exactly one byte less per buffer causes
   operations that require aligned memory (e.g. DMA) to become
   inefficient or to not work at all.

Signed-off-by: default avatarReto Schneider <reto.schneider@husqvarnagroup.com>
parent 641b77b7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment