zephyr/include/net
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
..
arp.h net: Refactored ARP packet header handling 2016-12-02 12:40:10 +02:00
buf.h net: buf: Redesigned pool & buffer allocation API 2016-12-13 21:41:53 +00:00
dhcpv4.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
ethernet.h net: Add utility func to return eth broadcast addr 2016-12-02 12:40:10 +02:00
ieee802154_radio.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
ieee802154.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
mii.h net: Definitions for IEEE 802.3, Section 2 MII compatible PHY transceivers 2016-12-02 12:41:05 +02:00
nbuf.h net: nbuf: Provide metadata info for sent TCP buf 2016-12-02 12:41:19 +02:00
net_context.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
net_core.h net: Fix stack info collector in net shell 2016-12-02 12:41:18 +02:00
net_event.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
net_if.h net: Fix stack info collector in net shell 2016-12-02 12:41:18 +02:00
net_ip.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
net_l2.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
net_linkaddr.h net: Add ll address checker function 2016-12-02 12:40:19 +02:00
net_mgmt.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
net_stats.h net: rpl: Initial commit 2016-12-02 12:41:00 +02:00
offload_ip.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00
tinydtls.h checkpatch: error - trailing_whitespace 2016-02-05 20:24:33 -05:00
trickle.h net: Make native IP stack the default 2016-12-02 12:41:17 +02:00