diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2016-12-14 08:33:50 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2016-12-15 09:58:02 +0200 |
commit | 71c7c018192b995b9f03bf9c14b164d78909420b (patch) | |
tree | 02ee3ebffd7a00f86321980745ff0eaae82855fd /doc | |
parent | 45bc46d42e28a0a74e2cfb68548bcaa49a919a09 (diff) |
net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.
Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/subsystems/networking/buffers.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/subsystems/networking/buffers.rst b/doc/subsystems/networking/buffers.rst index 5b9696405..634c024d8 100644 --- a/doc/subsystems/networking/buffers.rst +++ b/doc/subsystems/networking/buffers.rst @@ -14,18 +14,18 @@ Network buffers are created by first defining a pool of them: NET_BUF_POOL_DEFINE(pool_name, buf_count, buf_size, user_data_size, NULL); -Before operating on the pool it also needs to be initialized at runtime: +The pool is a static variable, so if it's needed to be exported to +another module a separate pointer is needed. -.. code-block:: c - - net_buf_pool_init(&pool_name); - -Once the pool has been initialized the available buffers are managed -with the help of a nano_fifo object and can be acquired with: +Once the pool has been defined, buffers can be allocated from it with: .. code-block:: c - buf = net_buf_alloc(&pool_name); + buf = net_buf_alloc(&pool_name, timeout); + +There is no explicit initialization function for the pool or its +buffers, rather this is done implicitly as :c:func:`net_buf_alloc` gets +called. If there is a need to reserve space in the buffer for protocol headers to be prependend later, it's possible to reserve this headroom with: |