From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 163F343204; Thu, 26 Oct 2023 08:44:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1102D427E6; Thu, 26 Oct 2023 08:44:01 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2098.outbound.protection.outlook.com [40.107.244.98]) by mails.dpdk.org (Postfix) with ESMTP id 8D4B040DCE for ; Thu, 26 Oct 2023 08:43:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eu5KH3KAn2cydj4luWn1nKSUL/CN9EfYKuetZsjLFLJFCzc6Diw/dCkhOoL+OYjD7pCEnxNd03fj7XFEx3kjTNapsDShafh3k9Ew25T4wmC0mvSYoOSITw88T/c5Ur5JfJGdqCi1/V5AeVGFX0iMScab1mgrpnOfwj2SXa9KXA09MvTUcAFc8iNvYfSi/5FXwG2Ipj3aC8yfmjCWdInBHDfAPkPhA1e3YBWNsegrXlc5heLqUGnIzXFSCucGV6Z6dSl54qMT2f8H1kvI+D8ejxxYKXIlXi8o401Z2wY2CNl3tRA0uEOOIvBQqhaabjrCTH1qP69/JTzaLO4bOiQQlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3QXwIG/Tzg1MQePm65MtZHJed7p8BFPj4TtvJaABFwI=; b=KvlOFGlVwXSxHls3oXrsSgKky4KBEHri9OXZpwFIDRIwjd/FcdCZplwhGtnNnLJfttNyvtpnbpDAdk1AZE6htljJRIa1fX0FXNoEC0215+zBn5YeKqT5x47wy2xJDiKFx7sE27oQjoZi/8T+V69MzKHHTV4A2msGjfRl0FU79kxNfSyKpc7EW2g3p2GgW4yUXZ9Litg5ru46NnYcIukudpsETZBcdlnYZqD8TM/9NZA20/82UnMmqnPHfcetC89xSjUDn9jGk9m6Eh4IA6eHJ4AA/OJXfKXqd0x1pqdGRuKDjaB3KWa7Ab/dilH5+PUP9vHqdqSWj1fJ47gQaOT71w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3QXwIG/Tzg1MQePm65MtZHJed7p8BFPj4TtvJaABFwI=; b=FsUh7siTpwQrD7EeXiQ4236bm+qIAMfKzL9CGKM9n7ToaJyILyACxFnjNMj89YtbHdaAhlv7a1SZCuWPA5N5vX9Xt9F12HblorY8z7MyJ2L6Ki33kc7vXI9VrduUHLQotUL+EHOC07DebaDjY4P7R/Jx70wfavp8cefmw5apwtA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SJ0PR13MB5965.namprd13.prod.outlook.com (2603:10b6:a03:43d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Thu, 26 Oct 2023 06:43:53 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.6933.022; Thu, 26 Oct 2023 06:43:53 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v3 05/25] net/nfp: extract the cap data field Date: Thu, 26 Oct 2023 14:43:04 +0800 Message-Id: <20231026064324.177531-6-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231026064324.177531-1-chaoyong.he@corigine.com> References: <20231024022849.3092506-1-chaoyong.he@corigine.com> <20231026064324.177531-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR07CA0034.namprd07.prod.outlook.com (2603:10b6:a02:bc::47) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5965:EE_ X-MS-Office365-Filtering-Correlation-Id: 9405dd12-ea7c-43e1-ab7a-08dbd5eeeb80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m7m4wfICJeT5D0PEfaBerWUxHS9kmxEj0KCLJaQbeF4s+OZMDwRy3X6h0T9EsxVyqIOpBlbOhTzb/vH+Uj5JQAiGkLCsi/1nHTpoIcwF6i5+va7P10vslNgc6O/4SuM6WKIaHHlNPMOK5HfsZahHaCE6GzpPioU2JtFD6kiklyAoDSXvcn6Y3TEh6HXiTryxgxTIbKxkFl6hTzaXhVpNgdsEVxwxEbtuZeJWSIZPAdaqFFC9+139Ika3U+wOGNhWSbYdZ0P3N3RJElx2i1ByjxbcxB55eFJMGrP0pZFZvlhMPtoKX8clHwPccphrmby/CFrAvw2Q308X6sVOc5GYyNVxSSldABhT+fMfmA+Sg0TVavFHxR7GPdiW6av99hvsYw9PH+Qq5aS6sapWcJCxh+yKo5APDECSWFFwJ3JlPkIN3hS346MDONJRyVOE7aHPir3ggusFz9++Tl+GK021bWSFyxMzkwfYn+1VQ2Yg/+kVmhOMDv1gC+jh0+XWgrJdc84nkx6y/BImevzi0TGNd+v00o0NAi/AaeKSYAN+7EcTY4z1qgfuHVhuz/azjrWEcp1Na92IA8hIPQMyUVCw7x4dMZiUkJizUHxi4k0t4QF0ktAgtkQfRsqmUuLL9B++uPfiUqDOOL6AExaypuOIvFauY0Lu8TkQMe4dZqFtFiw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(39830400003)(136003)(366004)(376002)(396003)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(6512007)(478600001)(6506007)(52116002)(2616005)(8676002)(83380400001)(107886003)(30864003)(41300700001)(26005)(1076003)(6486002)(5660300002)(6666004)(44832011)(6916009)(316002)(66556008)(54906003)(66476007)(66946007)(2906002)(4326008)(8936002)(38350700005)(38100700002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vtBg6isgm98Xca4N1VKDEHSIW8xK5VTBFmNo7HGSD0oiT87/ZGu2Ef7mpfit?= =?us-ascii?Q?W6yDTde8hG9CzEmBXjOhB5cFyHFv2Ijn/w0ln8ety6Oy+hzOhTg7DnzLVupn?= =?us-ascii?Q?/JG7OqKLaSADzm+CB8u0aZjKhNdsYF6Sla6c9m05hqdJuMgUKhUjWPjpqG7s?= =?us-ascii?Q?LAS12bXCzvWuYRPd6oGaSgLMSaa8+C/AyO9P5aMrCUt7dyfWGo8xGXnPrnvM?= =?us-ascii?Q?fMvTxId92G6bz3jdOfSDZUATbW5+v2J3JYh3ZmmcbC6FUwk4lGu1CZ1FNiw8?= =?us-ascii?Q?23I0waZ7hgTOirM9PEWafeXEVYvR5SH2c8f3nbsh/HzpsJYn1M7doQmjOUi7?= =?us-ascii?Q?9XInIgWEFl9ttPovFCZQc5RGBlPImw5W7ewrEIlYemMyoNWtYYAcRzCtNp9U?= =?us-ascii?Q?6zH5QYLIHxcl4Vg9mhchxTO7nf8ED85KEh6FR0bV01MXPQhcadVtT5OSjIZb?= =?us-ascii?Q?KG4DlHSDPx/2/5pDwR8+07RmRTKA9jluB/TzNLWY9XOyXylTNxeo1S2rbIuS?= =?us-ascii?Q?2GMO7fWVecQAxm/8grlqKeYL6USW4jNlEaEhHifsEyF4JofXpNIutie6qvBe?= =?us-ascii?Q?uyIacnqAFQbGLe53gA4lSsB0t2GXLFBIRyuR9oapiBwphld96FMDlk/qH//O?= =?us-ascii?Q?0/G7MvM8YB/TVVXdRhknydcAjccHAEghmuzALDSjyK82SxniF37V+WbvMWT8?= =?us-ascii?Q?YKTFELUbRT8vq2OPuSUklsJhemE2rNpVB4z0kAX4Ys1Rp6IbH+YDKmRQaXWC?= =?us-ascii?Q?Hd7z+rNVHhQcvRrN/bmByYwBwUcn414+JW/yKq7EX7Qe4mtnA+iASSQyCXaU?= =?us-ascii?Q?xuiHdBmndvOYV9bwHp6IP4E/7lIHfyw+NolTu8AY9ZtNfEMJkb1j5Yg07JLZ?= =?us-ascii?Q?KH5RshT4mUKIDQluSvM2vvxp0gXyUck9wwyKc5snjGQHUBNvt/qVoAhV/vGw?= =?us-ascii?Q?0pfLBZfzPR4Q9UeETrzVzScjd3MuYaT66fa2E44Qwe2Ct5h6ai0EfNXETB6d?= =?us-ascii?Q?dJBJVZrC+7q7a54Xo1ccycChkqbSQMjnBWzoZlKnYamq6799rfCH+sB5xQKM?= =?us-ascii?Q?oS9Yd9CRPnUndKjr/nHc1AQD2V/OBXt7hjvws07kcP7+hCE1EZlD6KWmVpJw?= =?us-ascii?Q?mPJLnB+aXcis0cepAOUx9EFuAgw4peBVHgzYdWKm6Fx+3EMLZFo+4O0B7XuN?= =?us-ascii?Q?KbPvKXFSei36SIifNuJQwOqypBoYe5BslRjQE22o2szRv7cfoIHatJSyz3vS?= =?us-ascii?Q?5NkOu37LzKBsSbI+0tx1Mt0+Y+kJrf/NYKeHZ7q9qdlGNEg133s0fnzAgVEq?= =?us-ascii?Q?I9FKeDOUzrnSWzeVcCwC5IwSoZjWZlO91h0dd5VwqJcWHMz2FuC+j3JsGFfE?= =?us-ascii?Q?hcdhzUdpQ1tMC8mwheVykdGUM6tJKmmrT9TbDNXxGJ0j1Iv4gI+EVnFXumRR?= =?us-ascii?Q?k5ATLPEsuwR+KfR2Sm4Ug8ibad018evj8opO3GMwljT/GOoea9UelOoFSL1H?= =?us-ascii?Q?8js6AvdpPno+0qqCVJdK3llXYzrMCmusSlE1knBxYQ3qncGQbH9L+SZtyZDY?= =?us-ascii?Q?KvCDoLHR7aizdbO880xpocVVuGUAlKOad3d7g8PNrlGRXYh40korWTofYzVK?= =?us-ascii?Q?Tg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9405dd12-ea7c-43e1-ab7a-08dbd5eeeb80 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2023 06:43:53.5740 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8d0GAYwclyDIOvbVM+B2kRLMBvajmAcFm+IiEb5X2q/hCzG2/QcPEUK2KoNfUZIdu1yA/fpiaQdnJbBEGfHv3mUAy9to/0aB3OiHLFBfwcU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5965 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Extract the 'cap' and 'cap_ext' data field into the super class, ready for the upcoming common library. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 6 +- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 12 ++-- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 14 ++--- drivers/net/nfp/nfp_ethdev.c | 14 ++--- drivers/net/nfp/nfp_ethdev_vf.c | 10 +-- drivers/net/nfp/nfp_ipsec.c | 4 +- drivers/net/nfp/nfp_net_common.c | 98 +++++++++++++++-------------- drivers/net/nfp/nfp_net_common.h | 10 ++- drivers/net/nfp/nfp_rxtx.c | 2 +- 9 files changed, 89 insertions(+), 81 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 60d843451e..453080f521 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -65,7 +65,7 @@ nfp_pf_repr_disable_queues(struct rte_eth_dev *dev) update = NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING | NFP_NET_CFG_UPDATE_MSIX; - if (hw->cap & NFP_NET_CFG_CTRL_RINGCFG) + if (hw->super.cap & NFP_NET_CFG_CTRL_RINGCFG) new_ctrl &= ~NFP_NET_CFG_CTRL_RINGCFG; /* If an error when reconfig we avoid to change hw state */ @@ -101,7 +101,7 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) update |= NFP_NET_CFG_UPDATE_RSS; - if ((hw->cap & NFP_NET_CFG_CTRL_RSS2) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RSS2) != 0) new_ctrl |= NFP_NET_CFG_CTRL_RSS2; else new_ctrl |= NFP_NET_CFG_CTRL_RSS; @@ -111,7 +111,7 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING; - if ((hw->cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG; nn_cfg_writel(hw, NFP_NET_CFG_CTRL, new_ctrl); diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index b64dbaca0d..bbf4530ae9 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -30,7 +30,7 @@ nfp_net_nfd3_tx_tso(struct nfp_net_txq *txq, uint64_t ol_flags; struct nfp_net_hw *hw = txq->hw; - if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0) goto clean_txd; ol_flags = mb->ol_flags; @@ -69,7 +69,7 @@ nfp_net_nfd3_tx_cksum(struct nfp_net_txq *txq, uint64_t ol_flags; struct nfp_net_hw *hw = txq->hw; - if ((hw->cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) return; ol_flags = mb->ol_flags; @@ -127,8 +127,8 @@ nfp_net_nfd3_tx_vlan(struct nfp_net_txq *txq, { struct nfp_net_hw *hw = txq->hw; - if ((hw->cap & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0 || - (hw->cap & NFP_NET_CFG_CTRL_TXVLAN) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0 || + (hw->super.cap & NFP_NET_CFG_CTRL_TXVLAN) == 0) return; if ((mb->ol_flags & RTE_MBUF_F_TX_VLAN) != 0) { @@ -151,7 +151,7 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data, uint8_t ipsec_layer = 0; hw = txq->hw; - cap_extend = hw->cap_ext; + cap_extend = hw->super.cap_ext; if ((pkt->ol_flags & RTE_MBUF_F_TX_VLAN) != 0 && (hw->ctrl & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) { @@ -278,7 +278,7 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue, } if (unlikely(pkt->nb_segs > 1 && - (hw->cap & NFP_NET_CFG_CTRL_GATHER) == 0)) { + (hw->super.cap & NFP_NET_CFG_CTRL_GATHER) == 0)) { PMD_TX_LOG(ERR, "Multisegment packet not supported"); goto xmit_end; } diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index 259039964a..807666686f 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -23,7 +23,7 @@ nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, uint64_t ol_flags; struct nfp_net_hw *hw = txq->hw; - if ((hw->cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) return flags; ol_flags = mb->ol_flags; @@ -57,7 +57,7 @@ nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, txd.raw = 0; - if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO_ANY) == 0) return txd.raw; ol_flags = mb->ol_flags; @@ -146,7 +146,7 @@ nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, return -EINVAL; /* Count TSO descriptor */ - if ((txq->hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0 && + if ((txq->hw->super.cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0 && (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) n_descs++; @@ -184,7 +184,7 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, memset(&meta_data, 0, sizeof(meta_data)); hw = txq->hw; - cap_extend = hw->cap_ext; + cap_extend = hw->super.cap_ext; if ((pkt->ol_flags & RTE_MBUF_F_TX_VLAN) != 0 && (hw->ctrl & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) { @@ -322,7 +322,7 @@ nfp_net_nfdk_xmit_pkts_common(void *tx_queue, nfp_net_nfdk_set_meta_data(pkt, txq, &metadata); if (unlikely(pkt->nb_segs > 1 && - (hw->cap & NFP_NET_CFG_CTRL_GATHER) == 0)) { + (hw->super.cap & NFP_NET_CFG_CTRL_GATHER) == 0)) { PMD_TX_LOG(ERR, "Multisegment packet not supported"); goto xmit_end; } @@ -332,7 +332,7 @@ nfp_net_nfdk_xmit_pkts_common(void *tx_queue, * multisegment packet, but TSO info needs to be in all of them. */ dma_len = pkt->data_len; - if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0 && + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0 && (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) { type = NFDK_DESC_TX_TYPE_TSO; } else if (pkt->next == NULL && dma_len <= NFDK_TX_MAX_DATA_PER_HEAD) { @@ -405,7 +405,7 @@ nfp_net_nfdk_xmit_pkts_common(void *tx_queue, ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_cksum(txq, temp_pkt, metadata)); ktxds++; - if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0 && + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0 && (temp_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) { ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_tso(txq, temp_pkt)); ktxds++; diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index d32a82210c..8ac2acea7b 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -119,7 +119,7 @@ nfp_net_start(struct rte_eth_dev *dev) if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS) != 0) { nfp_net_rss_config_default(dev); update |= NFP_NET_CFG_UPDATE_RSS; - new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap); + new_ctrl |= nfp_net_cfg_ctrl_rss(hw->super.cap); } /* Enable device */ @@ -128,19 +128,19 @@ nfp_net_start(struct rte_eth_dev *dev) update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING; /* Enable vxlan */ - if ((hw->cap & NFP_NET_CFG_CTRL_VXLAN) != 0) { + if ((hw->super.cap & NFP_NET_CFG_CTRL_VXLAN) != 0) { new_ctrl |= NFP_NET_CFG_CTRL_VXLAN; update |= NFP_NET_CFG_UPDATE_VXLAN; } - if ((hw->cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG; if (nfp_net_reconfig(hw, new_ctrl, update) != 0) return -EIO; /* Enable packet type offload by extend ctrl word1. */ - cap_extend = hw->cap_ext; + cap_extend = hw->super.cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0) ctrl_extend = NFP_NET_CFG_CTRL_PKT_TYPE; @@ -579,8 +579,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) hw->mtu = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ - if ((hw->cap & NFP_NET_CFG_CTRL_LSO2) != 0) - hw->cap &= ~NFP_NET_CFG_CTRL_TXVLAN; + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO2) != 0) + hw->super.cap &= ~NFP_NET_CFG_CTRL_TXVLAN; nfp_net_log_device_information(hw); @@ -608,7 +608,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) /* Copying mac address to DPDK eth_dev struct */ rte_ether_addr_copy(&hw->mac_addr, eth_dev->data->mac_addrs); - if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR; eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 51c474275e..293d1ed53c 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -86,7 +86,7 @@ nfp_netvf_start(struct rte_eth_dev *dev) if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS) != 0) { nfp_net_rss_config_default(dev); update |= NFP_NET_CFG_UPDATE_RSS; - new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap); + new_ctrl |= nfp_net_cfg_ctrl_rss(hw->super.cap); } /* Enable device */ @@ -94,7 +94,7 @@ nfp_netvf_start(struct rte_eth_dev *dev) update |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING; - if ((hw->cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) new_ctrl |= NFP_NET_CFG_CTRL_RINGCFG; nn_cfg_writel(hw, NFP_NET_CFG_CTRL, new_ctrl); @@ -314,8 +314,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw->mtu = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ - if ((hw->cap & NFP_NET_CFG_CTRL_LSO2) != 0) - hw->cap &= ~NFP_NET_CFG_CTRL_TXVLAN; + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO2) != 0) + hw->super.cap &= ~NFP_NET_CFG_CTRL_TXVLAN; nfp_net_log_device_information(hw); @@ -341,7 +341,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) /* Copying mac address to DPDK eth_dev struct */ rte_ether_addr_copy(&hw->mac_addr, eth_dev->data->mac_addrs); - if ((hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) eth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR; eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/nfp/nfp_ipsec.c b/drivers/net/nfp/nfp_ipsec.c index af85e8575c..e080e71db2 100644 --- a/drivers/net/nfp/nfp_ipsec.c +++ b/drivers/net/nfp/nfp_ipsec.c @@ -1382,7 +1382,7 @@ nfp_ipsec_init(struct rte_eth_dev *dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - cap_extend = hw->cap_ext; + cap_extend = hw->super.cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) { PMD_INIT_LOG(INFO, "Unsupported IPsec extend capability"); return 0; @@ -1429,7 +1429,7 @@ nfp_ipsec_uninit(struct rte_eth_dev *dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - cap_extend = hw->cap_ext; + cap_extend = hw->super.cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) { PMD_INIT_LOG(INFO, "Unsupported IPsec extend capability"); return; diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 189f81bbb6..77c0652642 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -408,7 +408,7 @@ nfp_net_configure(struct rte_eth_dev *dev) /* Checking RX mode */ if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) != 0 && - (hw->cap & NFP_NET_CFG_CTRL_RSS_ANY) == 0) { + (hw->super.cap & NFP_NET_CFG_CTRL_RSS_ANY) == 0) { PMD_DRV_LOG(ERR, "RSS not supported"); return -EINVAL; } @@ -426,27 +426,29 @@ nfp_net_configure(struct rte_eth_dev *dev) void nfp_net_log_device_information(const struct nfp_net_hw *hw) { + uint32_t cap = hw->super.cap; + PMD_INIT_LOG(INFO, "VER: %u.%u, Maximum supported MTU: %d", hw->ver.major, hw->ver.minor, hw->max_mtu); - PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", hw->cap, - hw->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "", - hw->cap & NFP_NET_CFG_CTRL_L2BC ? "L2BCFILT " : "", - hw->cap & NFP_NET_CFG_CTRL_L2MC ? "L2MCFILT " : "", - hw->cap & NFP_NET_CFG_CTRL_RXCSUM ? "RXCSUM " : "", - hw->cap & NFP_NET_CFG_CTRL_TXCSUM ? "TXCSUM " : "", - hw->cap & NFP_NET_CFG_CTRL_RXVLAN ? "RXVLAN " : "", - hw->cap & NFP_NET_CFG_CTRL_TXVLAN ? "TXVLAN " : "", - hw->cap & NFP_NET_CFG_CTRL_RXVLAN_V2 ? "RXVLANv2 " : "", - hw->cap & NFP_NET_CFG_CTRL_TXVLAN_V2 ? "TXVLANv2 " : "", - hw->cap & NFP_NET_CFG_CTRL_RXQINQ ? "RXQINQ " : "", - hw->cap & NFP_NET_CFG_CTRL_SCATTER ? "SCATTER " : "", - hw->cap & NFP_NET_CFG_CTRL_GATHER ? "GATHER " : "", - hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR ? "LIVE_ADDR " : "", - hw->cap & NFP_NET_CFG_CTRL_LSO ? "TSO " : "", - hw->cap & NFP_NET_CFG_CTRL_LSO2 ? "TSOv2 " : "", - hw->cap & NFP_NET_CFG_CTRL_RSS ? "RSS " : "", - hw->cap & NFP_NET_CFG_CTRL_RSS2 ? "RSSv2 " : ""); + PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", cap, + cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "", + cap & NFP_NET_CFG_CTRL_L2BC ? "L2BCFILT " : "", + cap & NFP_NET_CFG_CTRL_L2MC ? "L2MCFILT " : "", + cap & NFP_NET_CFG_CTRL_RXCSUM ? "RXCSUM " : "", + cap & NFP_NET_CFG_CTRL_TXCSUM ? "TXCSUM " : "", + cap & NFP_NET_CFG_CTRL_RXVLAN ? "RXVLAN " : "", + cap & NFP_NET_CFG_CTRL_TXVLAN ? "TXVLAN " : "", + cap & NFP_NET_CFG_CTRL_RXVLAN_V2 ? "RXVLANv2 " : "", + cap & NFP_NET_CFG_CTRL_TXVLAN_V2 ? "TXVLANv2 " : "", + cap & NFP_NET_CFG_CTRL_RXQINQ ? "RXQINQ " : "", + cap & NFP_NET_CFG_CTRL_SCATTER ? "SCATTER " : "", + cap & NFP_NET_CFG_CTRL_GATHER ? "GATHER " : "", + cap & NFP_NET_CFG_CTRL_LIVE_ADDR ? "LIVE_ADDR " : "", + cap & NFP_NET_CFG_CTRL_LSO ? "TSO " : "", + cap & NFP_NET_CFG_CTRL_LSO2 ? "TSOv2 " : "", + cap & NFP_NET_CFG_CTRL_RSS ? "RSS " : "", + cap & NFP_NET_CFG_CTRL_RSS2 ? "RSSv2 " : ""); PMD_INIT_LOG(INFO, "max_rx_queues: %u, max_tx_queues: %u", hw->max_rx_queues, hw->max_tx_queues); @@ -456,9 +458,9 @@ static inline void nfp_net_enable_rxvlan_cap(struct nfp_net_hw *hw, uint32_t *ctrl) { - if ((hw->cap & NFP_NET_CFG_CTRL_RXVLAN_V2) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RXVLAN_V2) != 0) *ctrl |= NFP_NET_CFG_CTRL_RXVLAN_V2; - else if ((hw->cap & NFP_NET_CFG_CTRL_RXVLAN) != 0) + else if ((hw->super.cap & NFP_NET_CFG_CTRL_RXVLAN) != 0) *ctrl |= NFP_NET_CFG_CTRL_RXVLAN; } @@ -503,7 +505,7 @@ nfp_net_disable_queues(struct rte_eth_dev *dev) NFP_NET_CFG_UPDATE_RING | NFP_NET_CFG_UPDATE_MSIX; - if ((hw->cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RINGCFG) != 0) new_ctrl &= ~NFP_NET_CFG_CTRL_RINGCFG; /* If an error when reconfig we avoid to change hw state */ @@ -552,7 +554,7 @@ nfp_net_set_mac_addr(struct rte_eth_dev *dev, hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) != 0 && - (hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) { + (hw->super.cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) { PMD_DRV_LOG(ERR, "MAC address unable to change when port enabled"); return -EBUSY; } @@ -563,7 +565,7 @@ nfp_net_set_mac_addr(struct rte_eth_dev *dev, update = NFP_NET_CFG_UPDATE_MACADDR; ctrl = hw->ctrl; if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) != 0 && - (hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) != 0) + (hw->super.cap & NFP_NET_CFG_CTRL_LIVE_ADDR) != 0) ctrl |= NFP_NET_CFG_CTRL_LIVE_ADDR; /* Signal the NIC about the change */ @@ -631,7 +633,7 @@ nfp_check_offloads(struct rte_eth_dev *dev) tx_offload = dev_conf->txmode.offloads; if ((rx_offload & RTE_ETH_RX_OFFLOAD_IPV4_CKSUM) != 0) { - if ((hw->cap & NFP_NET_CFG_CTRL_RXCSUM) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RXCSUM) != 0) ctrl |= NFP_NET_CFG_CTRL_RXCSUM; } @@ -639,25 +641,25 @@ nfp_check_offloads(struct rte_eth_dev *dev) nfp_net_enable_rxvlan_cap(hw, &ctrl); if ((rx_offload & RTE_ETH_RX_OFFLOAD_QINQ_STRIP) != 0) { - if ((hw->cap & NFP_NET_CFG_CTRL_RXQINQ) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RXQINQ) != 0) ctrl |= NFP_NET_CFG_CTRL_RXQINQ; } hw->mtu = dev->data->mtu; if ((tx_offload & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) != 0) { - if ((hw->cap & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) ctrl |= NFP_NET_CFG_CTRL_TXVLAN_V2; - else if ((hw->cap & NFP_NET_CFG_CTRL_TXVLAN) != 0) + else if ((hw->super.cap & NFP_NET_CFG_CTRL_TXVLAN) != 0) ctrl |= NFP_NET_CFG_CTRL_TXVLAN; } /* L2 broadcast */ - if ((hw->cap & NFP_NET_CFG_CTRL_L2BC) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_L2BC) != 0) ctrl |= NFP_NET_CFG_CTRL_L2BC; /* L2 multicast */ - if ((hw->cap & NFP_NET_CFG_CTRL_L2MC) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_L2MC) != 0) ctrl |= NFP_NET_CFG_CTRL_L2MC; /* TX checksum offload */ @@ -669,7 +671,7 @@ nfp_check_offloads(struct rte_eth_dev *dev) /* LSO offload */ if ((tx_offload & RTE_ETH_TX_OFFLOAD_TCP_TSO) != 0 || (tx_offload & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO) != 0) { - if ((hw->cap & NFP_NET_CFG_CTRL_LSO) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO) != 0) ctrl |= NFP_NET_CFG_CTRL_LSO; else ctrl |= NFP_NET_CFG_CTRL_LSO2; @@ -698,7 +700,7 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); } - if ((hw->cap & NFP_NET_CFG_CTRL_PROMISC) == 0) { + if ((hw->super.cap & NFP_NET_CFG_CTRL_PROMISC) == 0) { PMD_DRV_LOG(ERR, "Promiscuous mode not supported"); return -ENOTSUP; } @@ -1213,35 +1215,35 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) /* Next should change when PF support is implemented */ dev_info->max_mac_addrs = 1; - if ((hw->cap & (NFP_NET_CFG_CTRL_RXVLAN | NFP_NET_CFG_CTRL_RXVLAN_V2)) != 0) + if ((hw->super.cap & (NFP_NET_CFG_CTRL_RXVLAN | NFP_NET_CFG_CTRL_RXVLAN_V2)) != 0) dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_VLAN_STRIP; - if ((hw->cap & NFP_NET_CFG_CTRL_RXQINQ) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RXQINQ) != 0) dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_QINQ_STRIP; - if ((hw->cap & NFP_NET_CFG_CTRL_RXCSUM) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_RXCSUM) != 0) dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | RTE_ETH_RX_OFFLOAD_UDP_CKSUM | RTE_ETH_RX_OFFLOAD_TCP_CKSUM; - if ((hw->cap & (NFP_NET_CFG_CTRL_TXVLAN | NFP_NET_CFG_CTRL_TXVLAN_V2)) != 0) + if ((hw->super.cap & (NFP_NET_CFG_CTRL_TXVLAN | NFP_NET_CFG_CTRL_TXVLAN_V2)) != 0) dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_VLAN_INSERT; - if ((hw->cap & NFP_NET_CFG_CTRL_TXCSUM) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXCSUM) != 0) dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM; - if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0) { + if ((hw->super.cap & NFP_NET_CFG_CTRL_LSO_ANY) != 0) { dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_TCP_TSO; - if ((hw->cap & NFP_NET_CFG_CTRL_VXLAN) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_VXLAN) != 0) dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO; } - if ((hw->cap & NFP_NET_CFG_CTRL_GATHER) != 0) + if ((hw->super.cap & NFP_NET_CFG_CTRL_GATHER) != 0) dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS; - cap_extend = hw->cap_ext; + cap_extend = hw->super.cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) != 0) { dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_SECURITY; dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SECURITY; @@ -1281,7 +1283,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG, }; - if ((hw->cap & NFP_NET_CFG_CTRL_RSS_ANY) != 0) { + if ((hw->super.cap & NFP_NET_CFG_CTRL_RSS_ANY) != 0) { dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH; dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 | @@ -1334,8 +1336,8 @@ nfp_net_common_init(struct rte_pci_device *pci_dev, return -ENODEV; /* Get some of the read-only fields from the config BAR */ - hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); - hw->cap_ext = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + hw->super.cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); + hw->super.cap_ext = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->flbufsz = DEFAULT_FLBUF_SIZE; @@ -2025,14 +2027,14 @@ nfp_net_init_metadata_format(struct nfp_net_hw *hw) */ if (hw->ver.major == 4) { hw->meta_format = NFP_NET_METAFORMAT_CHAINED; - } else if ((hw->cap & NFP_NET_CFG_CTRL_CHAIN_META) != 0) { + } else if ((hw->super.cap & NFP_NET_CFG_CTRL_CHAIN_META) != 0) { hw->meta_format = NFP_NET_METAFORMAT_CHAINED; /* - * RSS is incompatible with chained metadata. hw->cap just represents + * RSS is incompatible with chained metadata. hw->super.cap just represents * firmware's ability rather than the firmware's configuration. We decide - * to reduce the confusion to allow us can use hw->cap to identify RSS later. + * to reduce the confusion to allow us can use hw->super.cap to identify RSS later. */ - hw->cap &= ~NFP_NET_CFG_CTRL_RSS; + hw->super.cap &= ~NFP_NET_CFG_CTRL_RSS; } else { hw->meta_format = NFP_NET_METAFORMAT_SINGLE; } diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 8a02911c45..7bcdd9295f 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -112,7 +112,15 @@ struct nfp_app_fw_nic { uint8_t total_phyports; }; +struct nfp_hw { + uint32_t cap; + uint32_t cap_ext; +}; + struct nfp_net_hw { + /** The parent class */ + struct nfp_hw super; + /** Backpointer to the PF this port belongs to */ struct nfp_pf_dev *pf_dev; @@ -120,9 +128,7 @@ struct nfp_net_hw { struct rte_eth_dev *eth_dev; /** Info from the firmware */ - uint32_t cap_ext; struct nfp_net_fw_ver ver; - uint32_t cap; uint32_t max_mtu; uint32_t mtu; uint32_t rx_offset; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index efdca7fccf..a0c7e0e9b5 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -386,7 +386,7 @@ nfp_net_parse_meta_qinq(const struct nfp_meta_parsed *meta, struct nfp_net_hw *hw = rxq->hw; if ((hw->ctrl & NFP_NET_CFG_CTRL_RXQINQ) == 0 || - (hw->cap & NFP_NET_CFG_CTRL_RXQINQ) == 0) + (hw->super.cap & NFP_NET_CFG_CTRL_RXQINQ) == 0) return; if (meta->vlan_layer < NFP_META_MAX_VLANS) -- 2.39.1