zephyr/samples
Johan Hedberg c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
..
basic samples: button: stop the app if device binding fails 2016-11-18 02:01:22 +00:00
bluetooth net: buf: Redesigned pool & buffer allocation API 2016-12-13 21:41:53 +00:00
drivers samples: spi_fram: correct syntax error and update comments 2016-12-11 11:26:57 +00:00
environmental_sensing samples: remove legacy usage and convert to unified APIs 2016-11-30 21:45:21 +00:00
grove samples: grove_lcd: stop the app if device binding fails 2016-11-18 02:07:14 +00:00
hello_world samples: tests: remove obsolete KERNEL_TYPE and kernel variables 2016-11-04 15:47:25 -04:00
ipm samples: ipm: convert sample to use unified APIs 2016-11-13 13:53:53 +00:00
legacy kernel: disable MDEF by default 2016-12-12 20:25:07 +00:00
logger-hook samples/logger-hook: Initialize variable to 0 2016-12-10 02:14:36 +00:00
net net: buf: Redesigned pool & buffer allocation API 2016-12-13 21:41:53 +00:00
nfc/nfc_hello samples/nfc: Update sample app 2016-11-25 16:50:20 +00:00
philosophers samples: configure philosophers with more than 32 priorities 2016-11-18 23:45:35 +00:00
power/power_mgr samples: power_mgmt: Remove platform filtering of testcases 2016-11-16 02:18:27 +00:00
sensor samples: Add thermometer 2016-12-11 11:14:06 +00:00
shell samples: tests: remove obsolete KERNEL_TYPE and kernel variables 2016-11-04 15:47:25 -04:00
static_lib build: Document outputexports 2016-11-12 02:08:08 +00:00
synchronization samples: remove legacy usage and convert to unified APIs 2016-11-30 21:45:21 +00:00
testing net: buf: Redesigned pool & buffer allocation API 2016-12-13 21:41:53 +00:00
usb samples: usb: remove legacy APIs 2016-12-02 15:52:35 +00:00