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 50127A04B5; Tue, 27 Oct 2020 11:31:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30DE62BD5; Tue, 27 Oct 2020 11:31:29 +0100 (CET) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 7AC3D100C for ; Tue, 27 Oct 2020 11:31:27 +0100 (CET) Received: by mail-wr1-f66.google.com with SMTP id x7so1283396wrl.3 for ; Tue, 27 Oct 2020 03:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yPchQ5Ar4+UMvMNp4onnX2xpwWKZ19PK8mUPgqSwlpo=; b=fADKozoQ49FrSTvCvXsNgW/uyQeG1V2irKrN03JvDyfzaZxHS7RvovTvGDTfjT1PV2 4c8jrZCN0uaB8dzcdidI5xoAy3kitb4v0GijR3FHtb4m7AbSlqJxC5Xw5NfK80AAPXN7 ksyqCGMcqnkQQdMXGsUV92Rs24jgQBq5+BSoKJfy1C8OAVC1OZLcKDdVNTboWHfHZ0Mz 3LafWu708eQ7N4h7dvVEXdQC0xGyb+tK9vbr6cddfqoe75pHNE7+dRNhgGw318coBCRJ HAav1rbfl29Gw97YdSCnIiXJ4dJXgDudPrpmXE0RWx2jmqd/2gsRuIrmaOrRJ2ed9H3E nrlQ== 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:user-agent; bh=yPchQ5Ar4+UMvMNp4onnX2xpwWKZ19PK8mUPgqSwlpo=; b=sONwO3WnVEXIqhgZ0c12J1sU13uXJV26tpbFZ1HX/dgPw0Lb7dcyCPXBIlHnL8nSjG BFG0hizYFtxe/Bej6nN3FjCWSdH7OVWTkOgM2x3W9qGNaZ7Wj1KlhAzC6fIeeRvvbArE t0mDt8V+4TiFhh8xG0uRhbzXkc7CMS+0zFM0oTt3hO+WSbMH+EgkVzmTmXze/50WTWsk Pq9ciHWPabac7QrPUN3SaD6skBncQ07MP+0gc45vTb74wmwr9WBXrS98Lyq23oKiVELu IOYlFD4TGr4StWVhIw1fw0MIVsOh/hDUVHKkPfaFw7j+24CnsUH/Nc2PXoUO28YnxKax RktQ== X-Gm-Message-State: AOAM530Dn9Y9lwxtPJdh+Jj0U9gB34T3CmY/qP4FJBus2ni/TS1QbueS mH0YqVe4hTPVcMBx8ELa8xC1Tw== X-Google-Smtp-Source: ABdhPJy/ZqU3X6TeghUS06o7Fh9o7+Q4o7PotT+B6NUiC6GuZFvg5R0QEaY4mciJJCbkSeV9l9J4yQ== X-Received: by 2002:adf:9282:: with SMTP id 2mr1964984wrn.43.1603794686184; Tue, 27 Oct 2020 03:31:26 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id y201sm1376368wmd.27.2020.10.27.03.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 03:31:25 -0700 (PDT) Date: Tue, 27 Oct 2020 11:31:24 +0100 From: Olivier Matz To: Thomas Monjalon Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Ajit Khaparde , Somnath Kotur Message-ID: <20201027103124.GQ1898@platinum> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201026222013.2147904-1-thomas@monjalon.net> <20201026222013.2147904-9-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026222013.2147904-9-thomas@monjalon.net> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v2 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" On Mon, Oct 26, 2020 at 11:20:06PM +0100, Thomas Monjalon wrote: > 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. > > Note: the new field has 32 bits, smaller than udata64. > > Signed-off-by: Thomas Monjalon How is it used by an application? It seems that the cfa code is not always set. Is there a flag to know when the field is valid? Also, for ice and iavf PMDs, we were discussing what is the better way to export the offset. Note that there is an open discussion about how to export dynamic fields offset for PMDs: http://inbox.dpdk.org/dev/20201025071352.221953-1-haiyue.wang@intel.com/T/#mab79dd5cbb7d199a33515b7456dfe1831cf473bc > --- > drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++ > drivers/net/bnxt/bnxt_rxr.c | 2 +- > drivers/net/bnxt/bnxt_rxr.h | 5 +++++ > 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..1090d28341 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(BNXT_CFA_CODE_DYNFIELD_TYPE), > + .align = __alignof__(BNXT_CFA_CODE_DYNFIELD_TYPE), > + }; > + 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 -rte_errno; > + } > + } > + > 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..7156ce7dd8 100644 > --- a/drivers/net/bnxt/bnxt_rxr.c > +++ b/drivers/net/bnxt/bnxt_rxr.c > @@ -606,7 +606,7 @@ 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; > + BNXT_CFA_CODE_DYNFIELD(mbuf) = 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..e01d3e4f18 100644 > --- a/drivers/net/bnxt/bnxt_rxr.h > +++ b/drivers/net/bnxt/bnxt_rxr.h > @@ -95,6 +95,11 @@ 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_CFA_CODE_DYNFIELD_TYPE uint32_t > +#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \ > + bnxt_cfa_code_dynfield_offset, BNXT_CFA_CODE_DYNFIELD_TYPE *)) > + > #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 >