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 CDBE243B91; Fri, 23 Feb 2024 03:43:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F41F410E3; Fri, 23 Feb 2024 03:42:53 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2115.outbound.protection.outlook.com [40.107.244.115]) by mails.dpdk.org (Postfix) with ESMTP id 1624240EAB for ; Fri, 23 Feb 2024 03:42:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BYPnXD0pwD5cVwJpzEtgMQT3ixMXxO4oqBR0pB9raWD1ULGLdXJ7CDsi1QQTjwasVOieMQTrjeJrq2p/FVGXOu+ZXC2hMQOk0LGLQOHWoFW55L0W4I52dRlDZ8DzPxs3kM2ZmIwyW13/mJHW4pK6OVuQnW5Hn+zjLLN9d+ObZNzXTzhh5mKypiF+wlZkcXYCjjpnoW6MMaTqKYJbRJkol/0eN9S2bpfIAw9jsBZwNObS8UdepriceDem8yK0WcOwJvfjghlzU+060VrCQ8bss2DUYUHgTR0EhD+KS1ez8va0c15gJkd3ar7tJCZpyqloFO0pWhkPgmVNWqAOZes0zg== 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=FBsBR5KSZuAssMk3Ufe+p2BCWBrVc94k+YmIxdTeerOzAW5Npd9uco3LBGldeFMdRndoeCWwTvDRdQDlTk72mfTlSgWCl2Xlf0JUQP7asrJ22Bh/bsylWkbGSDICGHIzHFBD/VMJRuVJJ+b59l9BcETBdag1VlE0snH1XHMwS+ZM4JqQeyg1lsZHi6GnR1ATPW8bsBM8ezj68pjeXHawTSB+5I5e+4oylohIuaA5x2Yae+vFejyelcff2xYkb+ULvT7YU1FO01wjVNWnXFJZkqwk0A4oF8mryGOpkFVgpZmAHaZb1GIRTXLBV4OlPN2Bx/qpfhOvk0FOHmwQwommOg== 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=kgkZA4jdt8T5rTrX50PdqYQDYpuCsnWb6U/dz32FQbfl59ER18l4nFZ7rqQsYgCoidSDELLVhdByBnXsr22JFp4d2WjIIxdQW4XCyZpjI2RYGCRyqdjyHokmroRSqcHlExA1PVBdAqmdL3DlbqFJlxbb/D9UTtajXi905Ov+3+c= 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 SA1PR13MB6645.namprd13.prod.outlook.com (2603:10b6:806:3e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Fri, 23 Feb 2024 02:42:42 +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.023; Fri, 23 Feb 2024 02:42:42 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH v2 3/4] net/nfp: add representor RSS configuration Date: Fri, 23 Feb 2024 10:42:16 +0800 Message-Id: <20240223024217.3052031-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240223024217.3052031-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> <20240223024217.3052031-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0040.namprd13.prod.outlook.com (2603:10b6:a03:2c2::15) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB6645:EE_ X-MS-Office365-Filtering-Correlation-Id: d8931ee9-e019-450d-1270-08dc34191b7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NQgmKu+PMXQ5sEQIGtwOYwflFgJw/jghxy/DbMVmF7+vkrjOG24MUWXjZGkeI3B3M7FwFpt918355u+0mcgSGGVp33qjh/wdfnz6JH+iX8kARxvpFcOZeSz1+i/AVVtqNEeIy88MUpLFcxzsdi6UFeBqiCUVbyj1XTQg7LT2NsOyNtFZj1H3A83KU670phBbUZxZOkp8i5X//s7WUksSN/A8g2aMQS74xaDjPbUtSqzHVnuU+dGbO/yuf4XCNAjbkUVVSxmYAm78R5zbFvRvz/C2hAyqdCoNrmXS5AGqZmfKJUSZCuczJlt7ksLq3NF8q0TpSnLyBOCDqHMEEKAPoC6rbKYQbM8yMzyI8KW83bQKDyM7IVV2cHX3FdKbZ625eCp/OGFhbkRRrRpbZVpzqB3kUmeG9S+UkoqL/muHOYzwBWwzGm2Ai3r1ZxxvdRtzyyqqglPbNsBpxRwFjBRAx9t3RpGzDUjP3L6O22AfAhqILwGH9UnS7ayVg4o2hPWBpnWbiH7LQLjfV+Xn0+Dl3H9y4UslOpBkapjDiHquCRiZo19XG4sufbNWTBScVHAlqS1YkVd+86DrfFBIJQ2habJ/7LbC6yaKCKkEmpyyb0/Ajxj767qQx4FRvsX+ulqS 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: =?us-ascii?Q?A54N4lpypGlTXfh1KYgnJO//xEBJ23hK8zNYAxpaaGmsStfWW/NdzrTc7jCa?= =?us-ascii?Q?yxwRPG6/G/XI1iqYMyBeo6L3kOupOFPKgdSeK7MDLdUSa2loPzrscAgCYpkV?= =?us-ascii?Q?Lba5pRNIqI0sochXIGitVL2dC+SEfvWeWMjrpdcc3oYNBSpk7SNlb4XIFSPS?= =?us-ascii?Q?5GOGliNBDYFoJpyz+TMUMTN0NPzBmfKx7d4gMc9fRuc7qkUiMme+zM3oR3wT?= =?us-ascii?Q?NyU/Vrqh411SBD2a5g+nD4skQiIyfcXCJp1bp2eAlXO8XWvmXOOH6jN3PDyW?= =?us-ascii?Q?FcnnujGjKHZVDgzOPbaazQTJl/fdQ/3f7eoFxbr24Ri04TSSVtn3g1pn67C3?= =?us-ascii?Q?S2pMA1mxHB4fIApnpOlEXFwKIeVfrLUJ5lPIqFk0CGssSFOm56F1ip0F0pvj?= =?us-ascii?Q?8+/+d2kM301jebQJREUf8JflJkP5vsbOd4CDmLB9U9peals3nmNxySYodCbc?= =?us-ascii?Q?a0OpExenUSK7yLELx/ymAT28eh0RM0o0EHpMjggz4iLgp9SNRDvChzHvubFa?= =?us-ascii?Q?lL3/qLgBiMagLBzKN4juTYEwenVGI0wg+c7gSQvwZvLs2eSK2OK39NgD5R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UGg/yPkKUJu8enjQQfpoWT/jfsJ?= =?us-ascii?Q?iDQDTl8Q47O93PQ1C3Fg4brglrUDrxNumxGfhABdCgJWAkz2kf/SfMBICfti?= =?us-ascii?Q?vVVbYIHAaaIblG5rmR4gmw8KPRUBDDimWuIztledWp61/lu2aH4Ok3uB0ZcI?= =?us-ascii?Q?UQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8931ee9-e019-450d-1270-08dc34191b7b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 02:42:42.2511 (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: /z73fB8cWoOHGZGGO1AHCooJkvoAOqtClOW6tQbBpIt0Yq1H0NS4+gVgqUH8ZXWY4SmaHJG8jSv5PYz0wbUTndzgo/bxjamiSRj7IjGw4lQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB6645 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 -- 2.39.1