zephyr/include
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
..
arch arm: Refactor irq_lock inline asm formatting. 2016-12-05 14:56:37 +00:00
bluetooth net: buf: Redesigned pool & buffer allocation API 2016-12-13 21:41:53 +00:00
display
drivers random: Rewrite sys_rand32_init() with SYS_INIT() 2016-12-11 11:18:18 +00:00
fs fs: expose generic ramdisk/flash disk access functions 2016-11-09 02:45:45 +00:00
iot iot: Add HTTP support for Zephyr 2016-12-02 12:41:20 +02:00
linker net: Declare a macro to define stacks used by networking 2016-12-02 12:41:14 +02:00
misc shell: Add ARG_UNUSED macro to avoid compiler warnings 2016-12-12 20:02:30 +00:00
net net: buf: Redesigned pool & buffer allocation API 2016-12-13 21:41:53 +00:00
toolchain toolchain: Add a popcount macro for GCC 2016-12-12 20:07:53 +00:00
usb usb: Add end-point stall APIs and flow control APIS 2016-11-09 02:45:46 +00:00
adc.h drivers/adc: Make references to driver_api const 2016-10-24 22:22:20 +00:00
aio_comparator.h aio_cmp_qmsi: Add get_pending_int API 2016-11-03 21:30:02 +00:00
atomic.h doc: Various corrections to doxygen info for Kernel APIs 2016-11-16 21:43:16 +00:00
cache.h
clock_control.h drivers/clock_control: Make references to driver_api const 2016-10-24 22:22:21 +00:00
counter.h counter: Fix interface 2016-11-30 14:39:10 +00:00
device.h device: do not set struct as deprecated 2016-12-11 06:36:14 -05:00
disk_access.h include: Add a generic disk interface 2016-11-09 02:45:44 +00:00
dma.h dma.h: add missing includes 2016-11-10 01:04:27 +00:00
eth.h drivers/eth: Make references to driver_api const 2016-10-24 22:22:22 +00:00
flash.h drivers/flash: Make references to driver_api const 2016-10-24 22:22:26 +00:00
fs.h fs: Make API naming adhere to the appropriate namespace 2016-10-31 08:08:10 +02:00
gpio.h gpio: Add doxygen markup for internal only definitions. 2016-11-22 17:01:27 +00:00
i2c.h i2c: Add doxygen markup for internal only definitions. 2016-12-04 12:49:43 +00:00
init.h kernel: deprecate old init levels 2016-11-09 17:59:44 +00:00
ipm.h drivers/ipm: Make references to driver_api const 2016-10-24 22:22:25 +00:00
irq_offload.h
irq.h doc: Fix up API description for IRQ_CONNECT() 2016-11-18 02:31:33 +00:00
kernel_version.h kernel: Allow SYS_KERNEL_VER_MAJOR(), etc. return full range of values. 2016-10-22 10:04:00 +00:00
kernel.h kernel: Introduce new k_delayed_work_remaining_get API 2016-12-12 18:55:40 +00:00
legacy.h kernel: legacy: Fix int overflow in nano_stack_init 2016-12-12 22:03:54 +00:00
linker-defs.h kernel/arch: consolidate tTCS and TNANO definitions 2016-11-12 07:04:52 -05:00
linker-tool-gcc.h x86 link: Specify ALIGN_WITH_INPUT for XIP data sections 2016-10-01 01:41:50 +00:00
linker-tool.h
microkernel.h include: remove old kernel defintions 2016-11-07 11:32:57 -08:00
nanokernel.h include: remove old kernel defintions 2016-11-07 11:32:57 -08:00
pinmux.h drivers/pinmux: Make references to driver_api const 2016-10-24 22:22:24 +00:00
power.h power_mgmt: Rename _sys_soc_resume notification disabling API 2016-11-11 20:40:54 +00:00
pwm.h drivers: pwm: re-design pwm API interfaces 2016-10-31 20:01:04 +00:00
rtc.h rtc_qmsi: Add get_pending_int API 2016-11-03 21:30:21 +00:00
section_tags.h
sections.h
sensor.h drivers/sensor: Make references to driver_api const 2016-10-24 22:22:23 +00:00
shared_irq.h drivers/shared_irq: Make references to driver_api const 2016-10-24 22:22:23 +00:00
spi.h drivers/spi: Make references to driver_api const 2016-10-24 22:22:20 +00:00
sw_isr_table.h nios2: add static interrupt handling code 2016-06-22 16:42:21 +00:00
sys_clock.h doc: Add descriptions for clock-related helper macros 2016-11-18 02:31:35 +00:00
sys_io.h
toolchain.h doc: revert unnamed union/struct workaround in favour of known-issues 2016-07-01 21:53:45 +00:00
uart.h serial: fix up uart_poll_in docstring 2016-11-16 22:57:30 +00:00
watchdog.h drivers/watchdog: Make references to driver_api const. 2016-10-24 22:22:19 +00:00
zephyr.h include: remove old kernel defintions 2016-11-07 11:32:57 -08:00