Gage Eads 05d3b5283c stack: introduce stack library
The rte_stack library provides an API for configuration and use of a
bounded stack of pointers. Push and pop operations are MT-safe, allowing
concurrent access, and the interface supports pushing and popping multiple
pointers at a time.

The library's interface is modeled after another DPDK data structure,
rte_ring, and its lock-based implementation is derived from the stack
mempool handler. An upcoming commit will migrate the stack mempool handler
to rte_stack.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2019-04-04 22:06:16 +02:00

29 lines
804 B
ReStructuredText

.. SPDX-License-Identifier: BSD-3-Clause
Copyright(c) 2019 Intel Corporation.
Stack Library
=============
DPDK's stack library provides an API for configuration and use of a bounded
stack of pointers.
The stack library provides the following basic operations:
* Create a uniquely named stack of a user-specified size and using a
user-specified socket.
* Push and pop a burst of one or more stack objects (pointers). These function
are multi-threading safe.
* Free a previously created stack.
* Lookup a pointer to a stack by its name.
* Query a stack's current depth and number of free entries.
Implementation
~~~~~~~~~~~~~~
The stack consists of a contiguous array of pointers, a current index, and a
spinlock. Accesses to the stack are made multi-thread safe by the spinlock.