From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4AF71A04B5; Tue, 27 Oct 2020 15:23:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 52197592C; Tue, 27 Oct 2020 15:23:43 +0100 (CET) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 02EED592B for ; Tue, 27 Oct 2020 15:23:41 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id x13so875565pgp.7 for ; Tue, 27 Oct 2020 07:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S7ONhg5R4egsCSAMZbj5Lk9qS79ZzleM06x5ns+aVZs=; b=ky6CjQjw6iGfRqrzq4Q7ifKU1hc9iOPu1rK1ZgMMcMHXNBc+wWJuh/6dmU3tMDHR8w 1Ihi1FuaV4eqBazxM2ba9+n3Iy4qi66gHvLnZTs/nrYXM4k+4YRZNIe89P9P22jlhGot OG33M1lztIYWBv7v5L/YRGgEmpzKQ/cJf0GEj5r0heP4qK4HKwyjtIKZRq3yMPL6ewhy Iz7PPU2KPYxfYRlepeRKTvISxIqi8i653Xo3+oF19/xppEl79G5faygMpaFGSZ+GsGXD VYLJ6iiXBS1aX2kFAqaGDzMUomCh6ZMGF5XXL+2lJpCtJzEehW31KF1gj2r2jfD2uGwa qvJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S7ONhg5R4egsCSAMZbj5Lk9qS79ZzleM06x5ns+aVZs=; b=iMFKN8FSCPpzMioXBh6/31dEU9LjwFg+KBiYTvGF7nLHxOmsJCGuYeQ0iU7xUUAMTk v5ryZxjwFQpuCVXH/rypIcIS57+OggiN95syJH1mVqZnmRCdW6t6uaaMGvf/v1H3a4sv GZD1Eg4L9Cs5F3464I/ukFO6TRgMDd6uoER3rnpOZZ8yL2mfA8I/S9n9oxT2kHW1qVLt 2X2sp7mrVX6PvbdS5x8mZwP9Its8+am5K2J/fBRUKu9GBanPHv9ZABCapBgTK4GpECPI x7ei/OYhYlcrwJ8wFG042lSMed8lV1MT7UQPIJTNSLilaZ/IXA4rOjLxer8r0qijRRg6 6bgg== X-Gm-Message-State: AOAM532DisBXZAL3UM5Qk+Lri1cQQQ+1V+FUQUYoXdAiips7Ie6kn8UO wF19mA7/oA9jjlg0n5E1Xpo= X-Google-Smtp-Source: ABdhPJypqM3T3zY00LpHH79FTrJV3QDwKxJcnI7tXhBOueZU2jjcG6jPVAl+DNFe/7qH5dLLNieEqg== X-Received: by 2002:aa7:9e4a:0:b029:152:54d1:bffa with SMTP id z10-20020aa79e4a0000b029015254d1bffamr2436468pfq.6.1603808620000; Tue, 27 Oct 2020 07:23:40 -0700 (PDT) Received: from gmail.com ([1.6.215.26]) by smtp.gmail.com with ESMTPSA id ca5sm2394222pjb.27.2020.10.27.07.23.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2020 07:23:39 -0700 (PDT) Date: Tue, 27 Oct 2020 19:53:32 +0530 From: Nithin Dabilpuram To: Thomas Monjalon Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Pavan Nikhilesh Message-ID: References: <20201026052105.1561859-1-thomas@monjalon.net> <20201026222013.2147904-1-thomas@monjalon.net> <20201026222013.2147904-5-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026222013.2147904-5-thomas@monjalon.net> Subject: Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon 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 > --- > 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..c2f6d653f9 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; > + This change doesn't work in secondary as it is process local memory. > #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 -rte_errno; > + > /* Setup LPM tables for all sockets */ > RTE_LCORE_FOREACH(lcore_id) > { > diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c > index bb7f671b5c..1c4e51968c 100644 > --- a/lib/librte_node/ip4_rewrite.c > +++ b/lib/librte_node/ip4_rewrite.c > @@ -248,9 +248,19 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, > static int > ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node) > { > + static bool init_once; > > RTE_SET_USED(graph); > 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 -rte_errno; > + init_once = true; > + } > + > node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized"); > > return 0; > diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h > index ab7941c12b..359b40faed 100644 > --- a/lib/librte_node/node_private.h > +++ b/lib/librte_node/node_private.h > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > > 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(struct node_mbuf_priv1 *), > + .align = __alignof__(struct node_mbuf_priv1 *), > +}; > +extern int node_mbuf_priv1_dynfield_offset; > + > /** > * Node mbuf private area 2. > */ > @@ -60,7 +67,8 @@ struct node_mbuf_priv2 { > static __rte_always_inline struct node_mbuf_priv1 * > node_mbuf_priv1(struct rte_mbuf *m) > { > - return (struct node_mbuf_priv1 *)&m->udata64; > + return RTE_MBUF_DYNFIELD(m, > + node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *); There is a performance regression of ~1.4% in our platform (Octeontx2) because of this change. > } > > /** > -- > 2.28.0 >