DPDK 25.07.0
rte_node_mbuf_dynfield.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2025 Marvell International Ltd.
3 */
4
5#ifndef _RTE_GRAPH_MBUF_DYNFIELD_H_
6#define _RTE_GRAPH_MBUF_DYNFIELD_H_
7
8#include <rte_common.h>
9#include <rte_mbuf.h>
10#include <rte_mbuf_dyn.h>
11
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#ifndef RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE
29#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE (0)
30#endif /* !RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE */
31
32#ifndef RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE
34#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE (8)
35#endif /* !RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE */
36
38#define RTE_NODE_MBUF_DYNFIELD_SIZE \
39 (RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE + RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE)
40
49 union {
50 /* Following fields used by ip[4|6]-lookup -> ip[4|6]-rewrite nodes */
51 union {
52 struct {
53 uint16_t nh;
54 uint16_t ttl;
55 uint32_t cksum;
56 };
57 uint64_t u;
58 };
60 };
62
71typedef struct rte_node_mbuf_dynfield {
72#if RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE > 0
79 union {
80 uint8_t persistent_data[RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE];
81 };
82#endif
94
105__rte_experimental
107rte_node_mbuf_dynfield_get(struct rte_mbuf *m, const int offset)
108{
109 return RTE_MBUF_DYNFIELD(m, offset, struct rte_node_mbuf_dynfield *);
110}
111
123__rte_experimental
125rte_node_mbuf_overload_fields_get(struct rte_mbuf *m, const int offset)
126{
127 rte_node_mbuf_dynfield_t *f = NULL;
128
130
131 return &(f->overloadable_data);
132}
133
151__rte_experimental
153
154#ifdef __cplusplus
155}
156#endif
157
158#endif /* _RTE_GRAPH_MBUF_DYNFIELD_H_ */
#define __rte_always_inline
Definition: rte_common.h:490
#define RTE_MBUF_DYNFIELD(m, offset, type)
Definition: rte_mbuf_dyn.h:227
#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE
struct rte_node_mbuf_overload_fields rte_node_mbuf_overload_fields_t
__rte_experimental int rte_node_mbuf_dynfield_register(void)
#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE
static __rte_experimental __rte_always_inline rte_node_mbuf_dynfield_t * rte_node_mbuf_dynfield_get(struct rte_mbuf *m, const int offset)
struct rte_node_mbuf_dynfield rte_node_mbuf_dynfield_t
static __rte_experimental __rte_always_inline rte_node_mbuf_overload_fields_t * rte_node_mbuf_overload_fields_get(struct rte_mbuf *m, const int offset)
rte_node_mbuf_overload_fields_t overloadable_data