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 47A07A04DD; Mon, 26 Oct 2020 23:21:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E4852C2E; Mon, 26 Oct 2020 23:20:38 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id CEAC02BCE for ; Mon, 26 Oct 2020 23:20:31 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 809CF5C00B2; Mon, 26 Oct 2020 18:20:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 26 Oct 2020 18:20:30 -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=RFqf6ib1bucLv noHLGpGkkor/j6NW0GcI4hWYruBQ5Q=; b=f7gNYW+ApcF3pYXspQMzokwi2bwg3 ptVOr1hOmArUTzX2R8GXCgKpQsn5nxq0FXlzcmOklsVs+va89k2f8mjEn/2nYme8 BtiekFv8AYwbGUFpAdiMl70ZJlCiRblaewVtUmvmzErzEK5uQX0x4wuRvAXqiQCT 5g1kZaQBDwFa3+ycD12ioPlyD79I8UyUClNChXLo7XtG4Lsh2pJMQKzPq08QmYKD 4RUiQyyHsGqzaq2U+R3DcagyTBsdLfeODjgvcRw2O1IvIBdYY3UvnVEtyQ8diXnT 6eNptPbQVX+2pHs2fgzbFWVXuNlnC+3RxFy7ybezRuc2uGOCTbq0J2LqA== 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=RFqf6ib1bucLvnoHLGpGkkor/j6NW0GcI4hWYruBQ5Q=; b=ByczOIjP vWeWhyFeysJbPc+89o8JD0DyRxAypdbxtivIsnpQcYx9mbr4Rpao1FjpYYNKJrOf BNnBrrnqXa4aq0axjuGvPhhlz1vCuteB81p0F+wSofIov/8OwjQqAFFVYgpWXpGa jLtxX3GLeUmV2dOUGajit0mnrJGEHlepjjmS7+Dy4/eP79zA5ACDOUILCZLQQVYW Ax/g8be1KCULq/NaQ6FgkV4YuCWn6oYw8g/lxyX9KZqg0Z8g7DJmsHIPzB4Ykq/J yz/OdhTVEt24O+FESmQFMtg0DKuACJ307eJ/99TRZckkltn8XDfrYdGfAH3Y3/6q 9DecgV943V8f5g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeejgdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 4665A306467E; Mon, 26 Oct 2020 18:20:29 -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: Mon, 26 Oct 2020 23:20:02 +0100 Message-Id: <20201026222013.2147904-5-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201026222013.2147904-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201026222013.2147904-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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; + #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 *); } /** -- 2.28.0