From patchwork Mon Feb 26 01:44:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 137180 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 44E4943BDB; Mon, 26 Feb 2024 02:45:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0235142DC9; Mon, 26 Feb 2024 02:45:35 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2097.outbound.protection.outlook.com [40.107.101.97]) by mails.dpdk.org (Postfix) with ESMTP id 643AB42D9F for ; Mon, 26 Feb 2024 02:45:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwbN45t5t9e2nRuz0nWZXDdt2rupPYZJn/3AFLEUJW/FIAqKLBQjaawUQtA59mwmPbQUvWOKkO29NFu82nbxSqsen9qewkiQ5driG4I9F7g2j8fwF6JLgjYYIFGMYbmKVQ7bsih4BHNTDgGLKio9SRhILEnS325Pm1/0dN3alIr08Q7PVETsmLKIyWVZNRYQokzQEyqNUrb1EmPSf7+lDstOzVfqvZ5pjmP41FYxSwSMkp9t/i5hS8yrIFsn8w8unk5ySfS9EttsSZGulSI3msK4vteNFFr06ohPYdITiarB+SdyU8ckhWmWJf1Qln1Ax62WEvX9LzaezFwYLuTe6Q== 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=i3iEGSav/uinilNo5unKyOFDNCeA012G+pfY6yP6SV4=; b=Rgb9u0iVYcPCcRIvArnfRhUHBA0J+UH3Er7tjl+8faeeDA4rD53UqGUJkqT/Jj/p0vEmVfV+EjWir4/QW2ARX/rhZsKCn/HI40Icq2NpfGXBOgYNe9/Q8edgndchIcv/Fub0WdCchJqRo9eg4IdLqLktPwovg+aUr7d3zaqSuQe+RXsK90eUPaibkWHpVJckORE1ryd/FkxtPIR4M8ffVsPXxXkOkYJ2/Q1bXfRQ8HVXGczLY10tNvZ5CcG8iKRnlJOK9qUGbmoXQJ9YUvzlkxJ03p2VZQHQcHafLLrlaWD2mT6+cC4RSIMO8A+WoJ4AXV+Vp8dHO+RZ6QaR7NypZA== 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=i3iEGSav/uinilNo5unKyOFDNCeA012G+pfY6yP6SV4=; b=fOSj2D97T8QpiTD4sPFbHneHOatV3nDNYMVH9SsO2MFUaqk8WlWrVtesxGd0Sf5m0uFAoYLisJNlVp5CpocDSXLbNqDozRwWOmx8pKLsbYz4yraOgCKKKRC06uLadeAQk2Jbfg4nvLC9fSCku8zntZ3xJy807/NkGen4tZ3DAD0= 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 PH0PR13MB5794.namprd13.prod.outlook.com (2603:10b6:510:11d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 01:45:26 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7316.032; Mon, 26 Feb 2024 01:45:26 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH v3 3/4] net/nfp: add representor RSS configuration Date: Mon, 26 Feb 2024 09:44:59 +0800 Message-Id: <20240226014500.3537561-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240226014500.3537561-1-chaoyong.he@corigine.com> References: <20240223024217.3052031-1-chaoyong.he@corigine.com> <20240226014500.3537561-1-chaoyong.he@corigine.com> X-ClientProxiedBy: PH8PR05CA0005.namprd05.prod.outlook.com (2603:10b6:510:2cc::14) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5794:EE_ X-MS-Office365-Filtering-Correlation-Id: 10910b7d-f1c2-4756-7d4d-08dc366c9b15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Brb+GNObQk3+7Oi7ovmP29uX0pNFioc65iks2vPtT66Fdpl60or1kgwyirN3PVkz9if+98qyRE6DFTVVriVh4SGhFLVwMQyuPw1aiylCElRsZ5SMLarishztYlp3YyOMe0K6VjhwJiXihYgGAGFGo5f1x3a7EqQ3rTROoFs1a6AZa5QBxYzaeAbwAi/QMIjfXiyKRQNDIo8R3pgAluDqdLXTmrKQLjpNUidl0SSs3d6w2cgdLrdvxpmFDCoYYPlAYq3Qg7j3yHXHNUI3epjhWtydjRPiwy+hMJIJJUq3BFvNr0eKbKDw2wB5t9SIerH4IkXXdXsPDNBLvnXZOzcKFTWrhdiP7gHselAFGLxDp93wtvM98I6uaG3HNgNKztP5kepdcLXL8WDnuzo1N3dDeDzR+ghroiJMpmIx0UdYRQIX56VbjGsT8UE8/t+571TtSQXN169FYSyXqajB52beCbCam/YzkoDMpXIUuFyZRL4pgnoGqelWKkdFliHw1syIsfitaWI65GO0AdygFnEwZXNUK6tcXMxlweBbdt9BQduryAXM6lZNmQwp+8/gGhGFRqbbyaGBvwsaqrQgUYj0Dh22nAUeASWtE38hE+Ize5Kz/KqFwSGwVVGdR456ekzkgqJUpOYnIPY+dtLRVXXM7k/OGYYCzvzv7bRXbHcGYkBtjrzgMJVjglrXSwVrP344x0y3d6ROwG47YE1fQfeluR6epFTqhrmHwqHytPz4pWY= 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)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KozI3U/16pJ/AugXpkCRUpuI3lHar3X3Y8Y4Xcr7jpIrzMq7zKIgVHAwU7FqWHpEFriXceXW8cRPVMNSCn2L1hfVKYvLlKEbzzcwlagvPhuRqTumYkHtJxQwEwOF+paF/iLalsazLdfoLaTI+mrLYZ76aNk7KjFeAN3m1bp/AW1K2q+q2bB9plgjMojYjLIxw4yZX4YATSucGBYN4FHjVYzkeFlOAWg2cx2Ups0C+Y9VU8TKSPnX3fB1wuRhAh1zQ0u7mkKPkafKa9gWmL8c0K825wZ0IR5FKBoPZ3Dp/1TMgK9mkkmDroVWq+EnvBCMJc3p19QPwxU5h7seMLJFmdzptEf4FrrQI0qeBEQ/QdjV5W3uOKtzgGRjwDaybFOY/28DWOGPR0Zx150hXJRQi8FnOzfuTdwrd1i3Jk69SOAPLLQSq6auLjnuKSzM4UGTyPlYfvjooONIJjB+WBEWCCiIBgG6F0YNLCy7qqk+22/6Arx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ejpp/+IUHJV7hwgi2ZEnDLAvAreyNO1LXEwB6TMu72tdYXw== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10910b7d-f1c2-4756-7d4d-08dc366c9b15 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 01:45:26.8689 (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: 0uYFTF+epRXL27awcJn0lZlScj10DVHidwMuu5uBdVB+K+jipH39mF0z7foRYW9dR0ffutf52pTW2zndAd5P0r8P1mknCnVf8rG6FAB7xhE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5794 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 From: Long Wu Add RSS configuration logics in representor initialization function. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/common/nfp/nfp_common_ctrl.h | 1 + drivers/net/nfp/flower/nfp_flower.c | 12 ++++++++++-- drivers/net/nfp/flower/nfp_flower_representor.c | 13 +++++++++++++ drivers/net/nfp/nfp_net_common.c | 17 ++++++----------- drivers/net/nfp/nfp_net_common.h | 9 +++++++++ 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index 93722bc350..7749ba6459 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -254,6 +254,7 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_RSS_IPV4_SCTP (1 << 14) /* RSS for IPv4/SCTP */ #define NFP_NET_CFG_RSS_IPV6_SCTP (1 << 15) /* RSS for IPv6/SCTP */ #define NFP_NET_CFG_RSS_TOEPLITZ (1 << 24) /* Use Toeplitz hash */ +#define NFP_NET_CFG_RSS_CRC32 (1 << 26) /* Use CRC32 hash */ #define NFP_NET_CFG_RSS_KEY (NFP_NET_CFG_RSS_BASE + 0x4) #define NFP_NET_CFG_RSS_KEY_SZ 0x28 #define NFP_NET_CFG_RSS_ITBL (NFP_NET_CFG_RSS_BASE + 0x4 + \ diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index e84e6ebbff..c6a744e868 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -31,6 +31,8 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) uint32_t new_ctrl; uint32_t update = 0; struct nfp_net_hw *net_hw; + struct rte_eth_conf *dev_conf; + struct rte_eth_rxmode *rxmode; struct nfp_flower_representor *repr; repr = dev->data->dev_private; @@ -48,8 +50,14 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) /* Writing configuration parameters in the device */ nfp_net_params_setup(net_hw); - update |= NFP_NET_CFG_UPDATE_RSS; - new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap); + dev_conf = &dev->data->dev_conf; + rxmode = &dev_conf->rxmode; + + if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) != 0) { + nfp_net_rss_config_default(dev); + update |= NFP_NET_CFG_UPDATE_RSS; + new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap); + } /* Enable device */ new_ctrl |= NFP_NET_CFG_CTRL_ENABLE; diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 4f4df0cd2e..7284a1e84d 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -44,6 +44,12 @@ static int nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { + struct nfp_net_hw *pf_hw; + struct nfp_flower_representor *repr; + + repr = dev->data->dev_private; + pf_hw = repr->app_fw_flower->pf_hw; + /* Hardcoded pktlen and queues for now */ dev_info->max_rx_queues = 1; dev_info->max_tx_queues = 1; @@ -64,6 +70,13 @@ nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev, dev_info->max_mac_addrs = 1; + if ((pf_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 = NFP_NET_RSS_CAP; + dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ; + dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ; + } + return 0; } diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 0ee2811926..26ea4ec92f 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1267,16 +1267,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if ((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 | - RTE_ETH_RSS_NONFRAG_IPV4_TCP | - RTE_ETH_RSS_NONFRAG_IPV4_UDP | - RTE_ETH_RSS_NONFRAG_IPV4_SCTP | - RTE_ETH_RSS_IPV6 | - RTE_ETH_RSS_NONFRAG_IPV6_TCP | - RTE_ETH_RSS_NONFRAG_IPV6_UDP | - RTE_ETH_RSS_NONFRAG_IPV6_SCTP; - + dev_info->flow_type_rss_offloads = NFP_NET_RSS_CAP; dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ; dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ; } @@ -1792,7 +1783,11 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev, cfg_rss_ctrl |= NFP_NET_CFG_RSS_IPV6_SCTP; cfg_rss_ctrl |= NFP_NET_CFG_RSS_MASK; - cfg_rss_ctrl |= NFP_NET_CFG_RSS_TOEPLITZ; + + if (rte_eth_dev_is_repr(dev)) + cfg_rss_ctrl |= NFP_NET_CFG_RSS_CRC32; + else + cfg_rss_ctrl |= NFP_NET_CFG_RSS_TOEPLITZ; /* Configuring where to apply the RSS hash */ nn_cfg_writel(hw, NFP_NET_CFG_RSS_CTRL, cfg_rss_ctrl); diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index e374739022..1c24045b7d 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -41,6 +41,15 @@ #define NFP_BEAT_LENGTH 8 +/* RSS capability*/ +#define NFP_NET_RSS_CAP (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6 | \ + RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \ + RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ + RTE_ETH_RSS_NONFRAG_IPV6_SCTP) + /* * Each PF has corresponding word to beat: * Offset | Usage