Map type BPF_MAP_TYPE_QUEUE
The queue map type is a generic map type, resembling a FIFO (First-In First-Out) queue.
Usage
This map type has no keys, only values. The size and type of the values can be specified by the user to fit a large variety of use cases. The typical use-case for this map type is to keep track of a pool of elements such as available network ports when implementing NAT (network address translation).
As opposed to most map types, this map type uses a custom set of helpers to pop, peek and push elements, noted in the helper functions section below.
Attributes
While the value_size
is essentially unrestricted, the key_size
must always be 0
since this map type has no keys.
Syscall commands
The following syscall commands work with this map type:
Note
The BPF_MAP_LOOKUP_ELEM
syscall command acts as peek
, BPF_MAP_LOOKUP_AND_DELETE_ELEM
as pop
, and BPF_MAP_UPDATE_ELEM
as push
.
Helper functions
Flags
BPF_F_NUMA_NODE
When set, the numa_node
attribute is respected during map creation.
BPF_F_RDONLY
Setting this flag will make it so the map can only be read via the syscall interface, but not written to.
For details please check the generic description.
BPF_F_WRONLY
Setting this flag will make it so the map can only be written to via the syscall interface, but not read from.
BPF_F_RDONLY_PROG
Setting this flag will make it so the map can only be read via helper functions, but not written to.
For details please check the generic description.
BPF_F_WRONLY_PROG
Setting this flag will make it so the map can only be written to via helper functions, but not read from.
For details please check the generic description.