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 A11C8A04B5; Mon, 26 Oct 2020 06:24:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E8474C6C; Mon, 26 Oct 2020 06:21:46 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id C7C962BFE for ; Mon, 26 Oct 2020 06:21:38 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 7A7ED5C0109; Mon, 26 Oct 2020 01:21:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 26 Oct 2020 01:21:38 -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=ScwslfueaQqIZ fupIKv9+HcQXAbRQ5VOPsC+jRi5fBI=; b=sZObwPJ19icX1lL78DQWgp22mMn7L Y2rhwZVpQtFrU7NEZ3czsAbkzy0dBiZaYemxuLLXmgupS0c9UxIWn9IxUVqpF2kV 3oUo1Q5EEDDyKXJ1W5agOKUq4QDgCHjRcI3APEj2WHnaNQ7/aiKeG5KK7RtgWPvl Er7F+uMbWkx7QUTrnzrh9xenLC6WomV0hS0I8pt7MZcrddz/qjjoOSTnbI6uNjpD 1nWRDLGnMTJOjwdzEUzQTqnmQciLkkB+lfcR3QdTCrXAZCryGMz1QHIeVYoOvrm2 qGGYM4Fu7zfEcyQvv8r80oHj7XdPdri6zrCmP0b/k6Q9PMQRl1y8sYGng== 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=ScwslfueaQqIZfupIKv9+HcQXAbRQ5VOPsC+jRi5fBI=; b=Y/SJTfxH HffleSGa2TauYCOpWuDDbDBY75H66IRZ/yI8Jmd/bKVPCLwyAOYiWIMDldX21Epi 4UfDPdpOCc2UtsfB0+S5IBdv9T+1OQqRQLU+z6em/+W0Vv6/UqlKwsNI8EUZZ0Nz 8DThQH9IZB/h46HYPS7xzLTEfuFyvG3HI//YISU1HczrE/Ynw9xdD0iM7LvykCbp 0UOlJZu9jzQ7rXKpmF3XwUL4+9prz5s3FwhWab6Dt1pnGgXUOCLxkxumUGVe0uLG cE9bNXJwz3FDUCJJoIZUqvOTRhslgPFHXcZayiysSq7yv6cfZhZn/LCafewrihA+ eYd64j1W8JECxw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeehgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeehgfejgefgueevgfevvdekgefffedtkeehgeffjeeigeefueffudff hfelffffudenucffohhmrghinhepfhguihhrrdhiugenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 517A13064610; Mon, 26 Oct 2020 01:21:37 -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, Ajit Khaparde , Somnath Kotur Date: Mon, 26 Oct 2020 06:20:58 +0100 Message-Id: <20201026052105.1561859-9-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 08/15] net/bnxt: switch CFA code 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 CFA code from mark 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 --- drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++ drivers/net/bnxt/bnxt_rxr.c | 5 ++++- drivers/net/bnxt/bnxt_rxr.h | 2 ++ drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1c7d1b758d..e12de94f04 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -31,6 +31,7 @@ #include "bnxt_nvm_defs.h" #include "bnxt_tf_common.h" #include "ulp_flow_db.h" +#include "rte_pmd_bnxt.h" #define DRV_MODULE_NAME "bnxt" static const char bnxt_version[] = @@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = { */ #define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1) +int bnxt_cfa_code_dynfield_offset; + /* * max_num_kflows must be >= 32 * and must be a power-of-2 supported value @@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused) pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF) bp->flags |= BNXT_FLAG_STINGRAY; + if (BNXT_TRUFLOW_EN(bp)) { + /* extra mbuf field is required to store CFA code from mark */ + static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = { + .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME, + .size = sizeof(uint32_t), + .align = __alignof__(uint32_t), + }; + bnxt_cfa_code_dynfield_offset = + rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc); + if (bnxt_cfa_code_dynfield_offset < 0) { + PMD_DRV_LOG(ERR, + "Failed to register mbuf field for TruFlow mark\n"); + return -1; + } + } + rc = bnxt_init_board(eth_dev); if (rc) { PMD_DRV_LOG(ERR, diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index 039217fa60..e913745e91 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -28,6 +28,8 @@ * RX Ring handling */ +int cfa_code_dynfield_offset; + static inline struct rte_mbuf *__bnxt_alloc_rx_data(struct rte_mempool *mb) { struct rte_mbuf *data; @@ -606,7 +608,8 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1, return mark_id; /* Got the mark, write it to the mbuf and return */ mbuf->hash.fdir.hi = mark_id; - mbuf->udata64 = (cfa_code & 0xffffffffull) << 32; + *RTE_MBUF_DYNFIELD(mbuf, bnxt_cfa_code_dynfield_offset, + uint32_t *) = cfa_code & 0xffffffffull; mbuf->hash.fdir.id = rxcmp1->cfa_code; mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; return mark_id; diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h index b874e54a8c..324d5dad50 100644 --- a/drivers/net/bnxt/bnxt_rxr.h +++ b/drivers/net/bnxt/bnxt_rxr.h @@ -95,6 +95,8 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1, struct rte_mbuf *mbuf); +extern int bnxt_cfa_code_dynfield_offset; + #define BNXT_RX_META_CFA_CODE_SHIFT 19 #define BNXT_CFA_CODE_META_SHIFT 16 #define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000 diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 81d0d0e032..8d3303bb0f 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.h +++ b/drivers/net/bnxt/rte_pmd_bnxt.h @@ -9,6 +9,9 @@ #include #include +/* mbuf dynfield where CFA code is stored */ +#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code" + /* * Response sent back to the caller after callback */ -- 2.28.0