DPDK
20.08.0
|
#include <sys/types.h>
Go to the source code of this file.
Data Structures | |
struct | rte_mbuf_dynfield |
struct | rte_mbuf_dynflag |
Macros | |
#define | RTE_MBUF_DYN_NAMESIZE 64 |
#define | RTE_MBUF_DYNFIELD(m, offset, type) ((type)((uintptr_t)(m) + (offset))) |
#define | RTE_MBUF_DYNFIELD_TIMESTAMP_NAME "rte_dynfield_timestamp" |
#define | RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME "rte_dynflag_tx_timestamp" |
Functions | |
__rte_experimental int | rte_mbuf_dynfield_register (const struct rte_mbuf_dynfield *params) |
__rte_experimental int | rte_mbuf_dynfield_register_offset (const struct rte_mbuf_dynfield *params, size_t offset) |
__rte_experimental int | rte_mbuf_dynfield_lookup (const char *name, struct rte_mbuf_dynfield *params) |
__rte_experimental int | rte_mbuf_dynflag_register (const struct rte_mbuf_dynflag *params) |
__rte_experimental int | rte_mbuf_dynflag_register_bitnum (const struct rte_mbuf_dynflag *params, unsigned int bitnum) |
__rte_experimental int | rte_mbuf_dynflag_lookup (const char *name, struct rte_mbuf_dynflag *params) |
__rte_experimental void | rte_mbuf_dyn_dump (FILE *out) |
RTE Mbuf dynamic fields and flags
Many DPDK features require to store data inside the mbuf. As the room in mbuf structure is limited, it is not possible to have a field for each feature. Also, changing fields in the mbuf structure can break the API or ABI.
This module addresses this issue, by enabling the dynamic registration of fields or flags:
The placement of the field or flag can be automatic, in this case the zones that have the smallest size and alignment constraint are selected in priority. Else, a specific field offset or flag bit number can be requested through the API.
The typical use case is when a specific offload feature requires to register a dedicated offload field in the mbuf structure, and adding a static field or flag is not justified.
Example of use:
To avoid wasting space, the dynamic fields or flags must only be reserved on demand, when an application asks for the related feature.
The registration can be done at any moment, but it is not possible to unregister fields or flags for now.
A dynamic field can be reserved and used by an application only. It can for instance be a packet mark.
To avoid namespace collisions, the dynamic mbuf field or flag names have to be chosen with care. It is advised to use the same conventions than function names in dpdk:
Definition in file rte_mbuf_dyn.h.
#define RTE_MBUF_DYN_NAMESIZE 64 |
Maximum length of the dynamic field or flag string.
Definition at line 73 of file rte_mbuf_dyn.h.
#define RTE_MBUF_DYNFIELD | ( | m, | |
offset, | |||
type | |||
) | ((type)((uintptr_t)(m) + (offset))) |
Helper macro to access to a dynamic field.
Definition at line 226 of file rte_mbuf_dyn.h.
#define RTE_MBUF_DYNFIELD_TIMESTAMP_NAME "rte_dynfield_timestamp" |
The timestamp dynamic field provides some timing information, the units and time references (initial phase) are not explicitly defined but are maintained always the same for a given port. Some devices allow to query rte_eth_read_clock() that will return the current device timestamp. The dynamic Tx timestamp flag tells whether the field contains actual timestamp value for the packets being sent, this value can be used by PMD to schedule packet sending.
After PKT_RX_TIMESTAMP flag and fixed timestamp field deprecation and obsoleting, the dedicated Rx timestamp flag is supposed to be introduced and the shared dynamic timestamp field will be used to handle the timestamps on receiving datapath as well.
Definition at line 267 of file rte_mbuf_dyn.h.
#define RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME "rte_dynflag_tx_timestamp" |
When PMD sees the RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME flag set on the packet being sent it tries to synchronize the time of packet appearing on the wire with the specified packet timestamp. If the specified one is in the past it should be ignored, if one is in the distant future it should be capped with some reasonable value (in range of seconds).
There is no any packet reordering according to timestamps is supposed, neither for packet within the burst, nor for the whole bursts, it is an entirely application responsibility to generate packets and its timestamps in desired order. The timestamps might be put only in the first packet in the burst providing the entire burst scheduling.
Definition at line 282 of file rte_mbuf_dyn.h.
__rte_experimental int rte_mbuf_dynfield_register | ( | const struct rte_mbuf_dynfield * | params | ) |
Register space for a dynamic field in the mbuf structure.
If the field is already registered (same name and parameters), its offset is returned.
params | A structure containing the requested parameters (name, size, alignment constraint and flags). |
__rte_experimental int rte_mbuf_dynfield_register_offset | ( | const struct rte_mbuf_dynfield * | params, |
size_t | offset | ||
) |
Register space for a dynamic field in the mbuf structure at offset.
If the field is already registered (same name, parameters and offset), the offset is returned.
params | A structure containing the requested parameters (name, size, alignment constraint and flags). |
offset | The requested offset. Ignored if SIZE_MAX is passed. |
__rte_experimental int rte_mbuf_dynfield_lookup | ( | const char * | name, |
struct rte_mbuf_dynfield * | params | ||
) |
Lookup for a registered dynamic mbuf field.
name | A string identifying the dynamic field. |
params | If not NULL, and if the lookup is successful, the structure is filled with the parameters of the dynamic field. |
__rte_experimental int rte_mbuf_dynflag_register | ( | const struct rte_mbuf_dynflag * | params | ) |
Register a dynamic flag in the mbuf structure.
If the flag is already registered (same name and parameters), its bitnum is returned.
params | A structure containing the requested parameters of the dynamic flag (name and options). |
__rte_experimental int rte_mbuf_dynflag_register_bitnum | ( | const struct rte_mbuf_dynflag * | params, |
unsigned int | bitnum | ||
) |
Register a dynamic flag in the mbuf structure specifying bitnum.
If the flag is already registered (same name, parameters and bitnum), the bitnum is returned.
params | A structure containing the requested parameters of the dynamic flag (name and options). |
bitnum | The requested bitnum. Ignored if UINT_MAX is passed. |
__rte_experimental int rte_mbuf_dynflag_lookup | ( | const char * | name, |
struct rte_mbuf_dynflag * | params | ||
) |
Lookup for a registered dynamic mbuf flag.
name | A string identifying the dynamic flag. |
params | If not NULL, and if the lookup is successful, the structure is filled with the parameters of the dynamic flag. |
__rte_experimental void rte_mbuf_dyn_dump | ( | FILE * | out | ) |
Dump the status of dynamic fields and flags.
out | The stream where the status is displayed. |