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 A3C81A04B5; Mon, 26 Oct 2020 06:22:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 048B52C15; Mon, 26 Oct 2020 06:21:35 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 86EBE2BE1 for ; Mon, 26 Oct 2020 06:21:28 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 3947B5C0113; Mon, 26 Oct 2020 01:21:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 26 Oct 2020 01:21:27 -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=gEuJnVlDEl5Z1 7oyUizyNxAipFStp/F4aZfCHXOBwGM=; b=qfqmUyZKrr9Aq5Rf5ty5TbN41X4OK b6N7H1uc1oA2LrIYEsQlkV15rbD+6XyDXSd9Pqo818honzkaXsuvOAYxOmYFmt4i zHotGI2cJd4wX0NURzMgmRTEqqTHR9l4T890T18V5sPV0fMEm0UEjIi4AibbgLZ/ gckACXUsdeWiXTqG1y4+nG7DKYxGdsTqN2MvleQlS+xo4SCwpn6mZnLwo0XiTUHI kblYBqRC7x0PSKlIC6f1yALuzqfn/AyMCUCr+/QUD+KzZQNgrrQiYDN1E5iYqKJe 8pqkvu64sKwp/Kxsw3oanIG7z+bYMahQFsGvJQbhcYdLKJ7N/H7CCt1vg== 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=gEuJnVlDEl5Z17oyUizyNxAipFStp/F4aZfCHXOBwGM=; b=Of4cIkxN jMY9aAJe8BT12ZlyvTIhvhgBhFQRhzW1ApltmUBnbyJlR91WCg3EOSeipWpb2/GW DuYlJB0K39c8JaByKM5UZMYQZzeLlzAjzHO+8vF44jpJNHM9oHTtplteRaLfZMjb F0SwEUuDmpHdnf8BHDVAajtbdMnRU4XMdHg1/tErm1NdLBp5hNyKY8XK0PE3Z7o7 QwBWAdlf8QKfwEuEXOtFRXepkMNbo3mCPW8Eg8/o8MUNajrG84lPCWqT3KXRp/aw vYOpx2WSxM97WFBawRJr9zC3UP2w7ScZC71rnd9CJ6YDyIurTx8H9AYNOLOmlckD trTWOoQZ5Q3VfA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeehgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 1EE783064610; Mon, 26 Oct 2020 01:21:26 -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 06:20:54 +0100 Message-Id: <20201026052105.1561859-5-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201026052105.1561859-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 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..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; + /* 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..2ffb3f4340 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 -1; + 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..bafea3704d 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(uint64_t), + .align = __alignof__(uint64_t), +}; +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