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 E0963A04B5; Tue, 27 Oct 2020 22:02:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF9FD377E; Tue, 27 Oct 2020 22:01:46 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 61A432E1E for ; Tue, 27 Oct 2020 22:01:42 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 13DEA5C0114; Tue, 27 Oct 2020 17:01:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=QJdXpZU2oQc/L yG6lujnevqgmy9iPf8wUnvIRPL1toE=; b=FhMIZiqaG2vgtEFDNUV3y/K5/HMA8 2rhQ8K/bUuOEZQGk8O6o8L0IgdwKTu1aofI4bD3JGCI6VwOWMhQQP8bFcMmN4bXU 2OzpjAseC5qLoHNbJ2KqcwNDiPvueRH1GMiBXfw3bvLZIvFXHC5/yIPGUgWs4zY6 RKkB1NWHgAHat3O5KiFs+aEG11UPip2kR3vUkmpOaFRqxhQaO3otR5LdE1DM34wZ 9zz+AJoCe6aQYky6l0xaU85xDfNYGqBv0r4PCmE0390RprcyRD88aA+JXv3jda6/ xZvYbCfh3G6qAOLsE0ZzPeK7x5E7vdhJzNAukkg+svLIIZBTJo5l9sZwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=QJdXpZU2oQc/LyG6lujnevqgmy9iPf8wUnvIRPL1toE=; b=jr6QAgUW 8CcLucEinl2jOZrtx6OHDbA+Hr+pyWwGpkdQwI9PmpekEcVT+WQ0Ar3HyR/IlW4/ vOfjHRcZBRMQRy/+YtcQTN4cfP9OvchN64qwX2iGBDX75lsX4uUwmPf0eohpKMwv 4PH+zVH+Q3DZJhisVIyzH4Pg7hMsz80zzEytJ+iZ0Cfp2w7OyLMfMsdxSaK+QVSH 2WsY1x0cse9OuHFkjXTG/smvDtCkOuP/M8lBwj8yMqYC8iWvs58i0Gnymo06UxTO u4m1Ct93FOL7eYStBEc9UikzAvEEinTmHIE7JFka0sJ3xa3Rf8rATopuIBplZlcB 1xjQSAymVGhHCw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E04BE328005A; Tue, 27 Oct 2020 17:01:39 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Nithin Dabilpuram , Pavan Nikhilesh Date: Tue, 27 Oct 2020 22:01:04 +0100 Message-Id: <20201027210115.2529025-5-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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" 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. WARNING: this change should be replaced with another solution proposed by Nithin. Waiting for the patch to be integrated. 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..3bd7c179ab 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 = -1; + #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..9258082df0 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 *); } /** -- 2.28.0