[dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field
David Marchand
david.marchand at redhat.com
Mon Oct 26 11:40:26 CET 2020
On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas at monjalon.net> wrote:
>
> The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> ---
> lib/librte_node/ip4_lookup.c | 7 +++++++
> lib/librte_node/ip4_rewrite.c | 10 ++++++++++
> lib/librte_node/node_private.h | 12 ++++++++++--
> 3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
> index 8835aab9dd..2cc91c0c67 100644
> --- a/lib/librte_node/ip4_lookup.c
> +++ b/lib/librte_node/ip4_lookup.c
> @@ -21,6 +21,8 @@
>
> #include "node_private.h"
>
> +int node_mbuf_priv1_dynfield_offset;
> +
> #define IPV4_L3FWD_LPM_MAX_RULES 1024
> #define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)
>
> @@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
> RTE_SET_USED(node);
>
> if (!init_once) {
> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
> + &node_mbuf_priv1_dynfield_desc);
> + if (node_mbuf_priv1_dynfield_offset < 0)
> + return -1;
How about return -rte_errno like what is done in setup_lpm()?
> +
> /* Setup LPM tables for all sockets */
> RTE_LCORE_FOREACH(lcore_id)
> {
[snip]
> diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
> index ab7941c12b..bafea3704d 100644
> --- a/lib/librte_node/node_private.h
> +++ b/lib/librte_node/node_private.h
> @@ -8,6 +8,7 @@
> #include <rte_common.h>
> #include <rte_log.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
>
> extern int rte_node_logtype;
> #define NODE_LOG(level, node_name, ...) \
> @@ -21,7 +22,6 @@ extern int rte_node_logtype;
> #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
>
> /**
> - *
> * Node mbuf private data to store next hop, ttl and checksum.
> */
> struct node_mbuf_priv1 {
> @@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
> };
> };
>
> +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> + .name = "rte_node_dynfield_priv1",
> + .size = sizeof(uint64_t),
> + .align = __alignof__(uint64_t),
s/uint64_t/struct node_mbuf_priv1/g ?
> +};
> +extern int node_mbuf_priv1_dynfield_offset;
> +
> /**
> * Node mbuf private area 2.
> */
--
David Marchand
More information about the dev
mailing list