From patchwork Wed Nov 13 12:13:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: edward.cree@amd.com X-Patchwork-Id: 13873530 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2076.outbound.protection.outlook.com [40.107.223.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D791C1FF615; Wed, 13 Nov 2024 12:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500129; cv=fail; b=oobraOr06VnPfe2Wu0fCrO5MDDUNwwWJ4C2iooDUgqIZ/Qcjo8SShnoiTBv41jxxkgoG3wDW/8NqAXWC2n85z4grz1yf7LCQPf990O0jVg0DGOOTW1Dqt5aaKUEBqAp1PyrFS0FtQBDWf3Kox+gFJcCmNYNQ5/up/M0CQj/c5fw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500129; c=relaxed/simple; bh=GMQOyB4g3L0t/mW31BxtWI3W1IHRbiwhsSG/DSpSoPw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C6/b7fQpuR5nbmwJnhHRK7Cmd8soWtw5tCS6uFuHlIua8bgCMuGhzcafRKqDKUbyOFyW9BOuMN45bKJqge+KkXK5DereqzFu/JL8SBhVmODtaMI7OvhSZSeS5Z5LoOCTEyrtTOyJxoQXgvTvQ/1KqlRuUBgpWLukld+7O5n/5YY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VSfz12xB; arc=fail smtp.client-ip=40.107.223.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VSfz12xB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZdhFOBbWiwtjzmZ/OCY6y07ZGI6QzuER19JtCJmsYRSmzH4tHiSFt8M/OhTDvz6vhd3/Lsyu40E1uueUl2/t3Biy08xI9LHkfsion+wb81lC2wDa4r6LTn6xh52Xahnk4jPd7eW2vW7Efe3gDh/ffV1sKKwYYzs1lQ0xNQPlzIxbVIu75ryA5e9i9JepMx3TwhgqAg1TfGrBFVucTu9kIZnnVPdsqRJd/MBj5FQl27XBNELcAsHXpy0o8/iaOK9w7APq5t20eCHezixqiN1/YinBuzo6xpQSyrGvp0Ag8Ow3th4ZHI7UAoGSDzqBkJUf1c/mmB0sBaXJpRPD68SHfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=OzSFEI9Quo6HWo2lgf0UhkiWYIEjptL00USKT15/Lss=; b=Hj1jl8p+JEXgfGLJ5/AHOC49iOjR5w8XtcRllxyhxHt0VY1JyDezeZiub2RZuvhqyUIUnc1mBJjHaXHJGl5fV5mWIhvv5LxWBOHC5ha3oj1JWnCOP4Bzf3uC4nY3Be+LTte2tjlaHJ2k3FEBfcHphMeH/q5jWiYq7oRfAC3xyxL4Y9KhRPWBhwl+Dq/669Rcw7OxJTnbrSw5+QV5Dpg4cjYj/rpb3ezWs0f4xQnaWPzuq66AjWrmURUNW3uqtz6vq8eAW+K5sEKvhQazaknpjuWO4fIxLPFqZive+TrvtOm0b9X5IM1TQxazmiBrkdfOxuaZsDQ618tUCZ4XiV6jNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OzSFEI9Quo6HWo2lgf0UhkiWYIEjptL00USKT15/Lss=; b=VSfz12xBGdQSfaJx8InDu7bv/kJYLO7il7qxCkcmXmcXI7bl3tAQEHwCLQG80bwxxy0rRIgfgh8+Zbyb90vp1R/aSViy5hwcVIDMTiQHNHYvJwsa0kjUFWa8bZ3ZR6z46cV5sLiKj0+wdcAR82wKa0XAZRamqk/VkVScRht3FoU= Received: from SJ0PR03CA0222.namprd03.prod.outlook.com (2603:10b6:a03:39f::17) by DS7PR12MB6093.namprd12.prod.outlook.com (2603:10b6:8:9e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 12:15:04 +0000 Received: from SJ1PEPF0000231B.namprd03.prod.outlook.com (2603:10b6:a03:39f:cafe::5c) by SJ0PR03CA0222.outlook.office365.com (2603:10b6:a03:39f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28 via Frontend Transport; Wed, 13 Nov 2024 12:15:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF0000231B.mail.protection.outlook.com (10.167.242.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Wed, 13 Nov 2024 12:15:04 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:01 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:01 -0600 Received: from xcbecree42x.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 13 Nov 2024 06:15:00 -0600 From: To: , , , CC: Edward Cree , , , , , , , Subject: [PATCH net-next 1/5] net: ethtool: only allow set_rxnfc with rss + ring_cookie if driver opts in Date: Wed, 13 Nov 2024 12:13:09 +0000 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: edward.cree@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231B:EE_|DS7PR12MB6093:EE_ X-MS-Office365-Filtering-Correlation-Id: 72e13614-3949-44ca-4088-08dd03dcce26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|7416014|1800799024; X-Microsoft-Antispam-Message-Info: dWLTAKk0tM1Ow6WExQNQx2J3DSEkSfZrZmSaejxzIPgFLJ+csCryKj5A6Xcrd1dwAakIQvcNjhRMTIhtIiBR27ldhBglQP02X2LlaJLX13e+E7jKxeChrWLI25kWcY/asvL2TDz1jrHsuj9K9BiDwLk4FJz/NB7UqdAHJNKWCs9T99PrPCtaQUDK+j/VNhBNsRmEM9o1dQ+V2Zd/gRTh3uXLxlvxEHdhKfZgSBmMBd8RtyoFjyyHDjQt7XBXlB74XRnyaBVIWyXdO+VJkf8kQMZ1mb9rLap1ubdN4Rue73JVzL2zmdK9OlaCHG1i6RSSeqgrsI5qQCodXjkvyiSQ5n92+G3WxDsNFXMnQpc9tPiQBPP57ox1d1df8PW8CgRTZJZdN614PnTvVq+D54VRImcWZC6kiH06TcXQY4bUTNdKvllv84SGsasCSn5Lh7w1zFwYSv5YtFLUCUOqLmOZMD5dcjpvEshktMXj7tw6A90ir0jIJBvgGfFdb6dQwAJMZJlkNvPPTt1YcD0WdPrViNWNxCtNadKme5Grnmo/+oQEvFr0ANYXrniPGCuT07ROCwfOajs3JfIo+k5nQnLBomF6pNGQaUAYGA6/50SxaItUhBYinlcmrFRCtezj5Lxp8Ib1cWuCL7ozaS64JtNsbL77xMZDZd/qdqclCSRteFgPjbi7oCxdoGfZbZjDmoioyjBd/Mt6vJjQCKr3w8Ko9odr/fM9FSgQv6Yjzctukf0RbllkOwoc4NUSO/usAHPXLlXbJFkFIjlDP5y76/2SuzGDhdgTSts8EqN4rOHXIw2Xj1FRfnZrcZK+aRtLPAANs7XaPmxLhRrkviI5mt0HEQ+LJFiKvbNOioA2FV2rbQu9w+y6jh6czprHnzb9OQr0G2RrTTDlkHCPPjoFce76M2XvEX/WGLUYBXJdcQkRpHU9ZqDI9Yk3Ay8F+tsnX47fdq09ANYaXdeHnuihyXP8vfUgpkF7ANrDBRJa6zxcbH/RAxLoUw1XThuE2aBJJrT51WuX1k9ciQRLA9MabLdnCbVolNU1xwhQZsRZxLjIl3wtmRbf6O9baIWXKnjhFy1e1CHG4v4iV9eQblO2tHEXQ/NtM7LEeAbjcOq9WriH8UEVELK+HFSvbc9XGOxseviRxbS6AFLqzAniPcoDDjH4Kj9z8oon0xZQEIEbEu+YVy4sSwd/z2+/Q7r31PUt5SaIr6T37B9BmDEcXb4xLC9ExTlvMnf+PrhU+QSxNsNzQSc468pMZ9rv+Ob52N0ZxUqqD94TkzYBsGXlLL7Am4ZEfMfmU5CNUFaEg3eatt66Hu6vnRHCyTFO41t8S3jaCyd+wgmSCyPp87hHeEpXfjLbyEPDQULChnaJ4P26liYArc4CQrEFhRztWGht8NuAd4uQD+dbMVaapil4cPffOdvFcg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 12:15:04.0749 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72e13614-3949-44ca-4088-08dd03dcce26 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6093 X-Patchwork-Delegate: kuba@kernel.org From: Edward Cree Ethtool ntuple filters with FLOW_RSS were originally defined as adding the base queue ID (ring_cookie) to the value from the indirection table, so that the same table could distribute over more than one set of queues when used by different filters. However, some drivers / hardware ignore the ring_cookie, and simply use the indirection table entries as queue IDs directly. Thus, for drivers which have not opted in by setting ethtool_ops.cap_rss_rxnfc_adds to declare that they support the original (addition) semantics, reject in ethtool_set_rxnfc any filter which combines FLOW_RSS and a nonzero ring. (For a ring_cookie of zero, both behaviours are equivalent.) Set the cap bit in sfc, as it is known to support this feature. Signed-off-by: Edward Cree Reviewed-by: Martin Habets --- drivers/net/ethernet/sfc/ef100_ethtool.c | 1 + drivers/net/ethernet/sfc/ethtool.c | 1 + include/linux/ethtool.h | 4 ++++ net/ethtool/ioctl.c | 5 +++++ 4 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/sfc/ef100_ethtool.c b/drivers/net/ethernet/sfc/ef100_ethtool.c index 5c2551369812..6c3b74000d3b 100644 --- a/drivers/net/ethernet/sfc/ef100_ethtool.c +++ b/drivers/net/ethernet/sfc/ef100_ethtool.c @@ -59,6 +59,7 @@ const struct ethtool_ops ef100_ethtool_ops = { .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size, .get_rxfh_key_size = efx_ethtool_get_rxfh_key_size, .rxfh_per_ctx_key = true, + .cap_rss_rxnfc_adds = true, .rxfh_priv_size = sizeof(struct efx_rss_context_priv), .get_rxfh = efx_ethtool_get_rxfh, .set_rxfh = efx_ethtool_set_rxfh, diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index bb1930818beb..83d715544f7f 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c @@ -263,6 +263,7 @@ const struct ethtool_ops efx_ethtool_ops = { .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size, .get_rxfh_key_size = efx_ethtool_get_rxfh_key_size, .rxfh_per_ctx_key = true, + .cap_rss_rxnfc_adds = true, .rxfh_priv_size = sizeof(struct efx_rss_context_priv), .get_rxfh = efx_ethtool_get_rxfh, .set_rxfh = efx_ethtool_set_rxfh, diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 1199e308c8dd..299280c94d07 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -734,6 +734,9 @@ struct kernel_ethtool_ts_info { * @rxfh_per_ctx_key: device supports setting different RSS key for each * additional context. Netlink API should report hfunc, key, and input_xfrm * for every context, not just context 0. + * @cap_rss_rxnfc_adds: device supports nonzero ring_cookie in filters with + * %FLOW_RSS flag; the queue ID from the filter is added to the value from + * the indirection table to determine the delivery queue. * @rxfh_indir_space: max size of RSS indirection tables, if indirection table * size as returned by @get_rxfh_indir_size may change during lifetime * of the device. Leave as 0 if the table size is constant. @@ -956,6 +959,7 @@ struct ethtool_ops { u32 cap_rss_ctx_supported:1; u32 cap_rss_sym_xor_supported:1; u32 rxfh_per_ctx_key:1; + u32 cap_rss_rxnfc_adds:1; u32 rxfh_indir_space; u16 rxfh_key_space; u16 rxfh_priv_size; diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 7da94e26ced6..d86399bcf223 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -992,6 +992,11 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, if (rc) return rc; + /* Nonzero ring with RSS only makes sense if NIC adds them together */ + if (info.flow_type & FLOW_RSS && !ops->cap_rss_rxnfc_adds && + ethtool_get_flow_spec_ring(info.fs.ring_cookie)) + return -EINVAL; + if (ops->get_rxfh) { struct ethtool_rxfh_param rxfh = {}; From patchwork Wed Nov 13 12:13:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: edward.cree@amd.com X-Patchwork-Id: 13873527 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2076.outbound.protection.outlook.com [40.107.95.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C81AF200BA2; Wed, 13 Nov 2024 12:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500110; cv=fail; b=lQ6gTydANCOBqP9Nh4VKqVHu4lj5Mx6rRHIE1VkStP9ChH/Jp/DsYbHfsADDbOUrM4Z7pS/ahjOhTvUIXP45uu3j+p6+nHaB7YW0yxPAVyVaweT8ioEwwWUm99yF7A40tY3la1xm5mLUMxrZUS3+R1OjGzoiIzQsWMXYixQubPs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500110; c=relaxed/simple; bh=ROnCRq3rhIJHktNzI63tNz+5VzBVybrnF4lNFaJMcUo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KcMnI25z72cDAmPzfqvRX+CrszKqe8tDNotro8RUxiTFWZyHU91ebT+PlAWUcUKQigwqiVEm4Tw/KLZRlE1lSHENFjT9eHrWV5yOdsY9mvLZINQ5QyX0zR1O5n1rmSiEgeV4++HCzekkaJHdqJTBgQNza22Z6R6gDBg8+v0bcyE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=wGfCjgyD; arc=fail smtp.client-ip=40.107.95.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="wGfCjgyD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lZlMpfLiYLwhdrOxBSDvHZrkH7bmwI4LY3uRJP/5WBt79xmWBt39Y2uN4ROyfsGxYAQxUKZOkSAQmytyKGsVz4rA0Rebl9H0XNEDcqCfFEHeFQr3ymihzHFErnxfjMJcv1Xjkl5Z5hshOTlClx8ZOOY4aYA2XPK2oHCynLuBQSVxdhbMGwNNvd3SvbBrXEjUA2VuNpgIUNuPie/7n/swmntW1qN2CLqNZmXOS3GJJ3pUyrdwQYu9FGRaQmLsRKVqEhqDb5owvLwYrxuZQgM6lhPf4pCKMnTM4f0s5HCkwNnxmg8a02F3mEDhw+vkAFYlqc9HMVeiHLnMnA6FZ2N0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=2+MPPKYjqNl5bftrtbUU7Xix7feRxOVk21zH7qcZ938=; b=lI09nBv2qH+SPVPxwUvkM+TRkLlUzrbjp5MB4kpci5ZOsjoKE7xdLvewlhBTU0tmVZmINdPvsGsLpztFY0Dl8f+vmWiKlSeDRaRoNujHcXVWVavbJdabmGY5DBWw4xjKdgxer5ipWfPapkiJB4BTlOhTsHsQsiqfVUpya6hFcAI9Qs+DbbippPYh+iDTEIdC8QD5nACpOgllO3mEnFktvrZdtFjSd4UyHNo3XFyRo+0nbR5EGrnCtMXJAAqx2o74UpGBhE2iyEnNRMwPmSVF/x5zDfmxknl0ZwiAll/0eLZAtkUaRhIDe/9PTx+dtzvR8EgMWhi9+vrGiXp/IOEkzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2+MPPKYjqNl5bftrtbUU7Xix7feRxOVk21zH7qcZ938=; b=wGfCjgyDQyXkupUyhYENC2xyHWFtvTLe8GsB6duPEoEqUnT5l7d3qU4u01JPQ29iR45h72euW0BYxwL1YuueVa8muPTnhnR083Dmj3NgDwR8EbtCfYOKMUa5eIbISh4LCh+RSN8mYwQhili3WbyOLf7Wv7GaOVftoDdBK4F7QWU= Received: from SJ0PR03CA0214.namprd03.prod.outlook.com (2603:10b6:a03:39f::9) by DM4PR12MB7767.namprd12.prod.outlook.com (2603:10b6:8:100::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 12:15:05 +0000 Received: from SJ1PEPF0000231B.namprd03.prod.outlook.com (2603:10b6:a03:39f:cafe::cd) by SJ0PR03CA0214.outlook.office365.com (2603:10b6:a03:39f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.16 via Frontend Transport; Wed, 13 Nov 2024 12:15:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF0000231B.mail.protection.outlook.com (10.167.242.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Wed, 13 Nov 2024 12:15:05 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:03 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:02 -0600 Received: from xcbecree42x.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 13 Nov 2024 06:15:01 -0600 From: To: , , , CC: Edward Cree , , , , , Subject: [PATCH net-next 2/5] net: ethtool: account for RSS+RXNFC add semantics when checking channel count Date: Wed, 13 Nov 2024 12:13:10 +0000 Message-ID: <43257d375434bef388e36181492aa4c458b88336.1731499022.git.ecree.xilinx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: edward.cree@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231B:EE_|DM4PR12MB7767:EE_ X-MS-Office365-Filtering-Correlation-Id: a0c0e60a-2636-4fe5-c16b-08dd03dccee9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: eAEqL3LLzuhWYLWxtnMnDEni7sMs7u/DD5ZaAuYqI16A7sjjOwamW4yyqaalslT89Z8nVxrMkclKeI8STh33v3WyRnt392m+tF3fdEX+G2tTSg4I5BwycJeLbm1WTcyg67HDmhbY6LHAKRfUGQOG8WPKOLMAKJyhRxUx92nYuj9KHcHmWkmamHizrvMTUEZAdoTMxVYxCgAZMxYBHHyVXVRPfqAacQohDPs4GNz4bSzT2uW76HuAAv3ZikNu29lw9Nv+gEgy+Q8CRLYq0ooJhNGq6R2wrXwQ5TIjDOMXdyySUb5RKAdofYrwL2wjzE9kpt3d1tWliyvtGDe7fqNuvciuTUw/9NKBt/tDC+y/kdqRZl1xJ/0xqSWNYi6bEmaw4fYxRdTlby9BcNYXCaYYxubm6alxBGwlAPopERgEGdQHTOn+4ujNUY5ae/WPKWHzgJ29I18HlmDt1u1w7xn0jLesUSsxqpfwSkRpPJjep9YRI6CKy0TBpRk6YhMBsCb054gjfyE0KGxS6Fjq3xd5qfcqlbO7WWYvMD5Rb3yKuIPFL/MduAt0nYrKG2eDzKEj/IHyZgaoCMtbOg62iZXcMw/5PqeGZrxxnZcQBrqwMX95nZAVqLb7u6l9XcLP6JvT2teswyANaAzY0/zrD71Z+QMdOpBUosiU9s1VKcIgnLWhc39TN09DTwETCfrXgVqThV6mcgISYSXHU/gknBOWTE24SjwnyixTBOHdu8YdXxHFz4aAj6p/zRo4SY2IntWbW/XyfvsNTWJUvWJU0e9HmEuw3jXqv8SXE4oVAgbOx6i59t8VYBojBJKS+mpJxgOSIMxHrG1lzsgYEDNSnctGmGr76vKAfxJEKdO0wfZyGaNlqIffVzvjms2V788uaPRjp0Wt+lRUOdRX1lhFjnxnOaz7XjufPkVKCAFWk9wWvxf8yP2jWpSh6/9GSB8i/kgJRFz44BLTkRuNnymkb612+tvmpbYdVp9BIYnXKH0rihWLJSdG2FS0TGKjQNnH7VvG+QTYTJWqffK0Wjr6hOBBHQAiTEeOEmwhuW7pZR5w2Wd5OY7xwCaXEZiHttBKIcObuCGLiHHSlJE7+RMpVQAUHUyjaHCMVq3yEonu5kRY3IEZwO820vpw7o4NEHUuhII/tZktr+7KVGjt7gNLP1pnZ1b+ASR8utNeGOGMo5C/zoXSvaEkpTrAxX2r4lDy628lEkCMiWj0MkYhnA4bwmJYlqYaxrOSHQpBZBMckn+I3jg4F0HU65+dNm/Cc1boHzTrrMZ74+kllZXzTvqLc0v4LYI5o6R8b+Fk8i1JRPWQ5nfk8xAqbgL4eCT3Zg++kElHdxaNNW7lNyrQ198Hr55WsZRbA0xVi9AxGfcEqrfe5JOUNMNcxNpDdXBAzdBh4JqAJ78Uj0BtGUUE013/vqiH+g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 12:15:05.2155 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0c0e60a-2636-4fe5-c16b-08dd03dccee9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7767 X-Patchwork-Delegate: kuba@kernel.org From: Edward Cree In ethtool_check_max_channel(), the new RX count must not only cover the max queue indices in RSS indirection tables and RXNFC destinations separately, but must also, for RXNFC rules with FLOW_RSS, cover the sum of the destination queue and the maximum index in the associated RSS context's indirection table, since that is the highest queue that the rule can actually deliver traffic to. It could be argued that the max queue across all custom RSS contexts (ethtool_get_max_rss_ctx_channel()) need no longer be considered, since any context to which packets can actually be delivered will be targeted by some RXNFC rule and its max will thus be allowed for by ethtool_get_max_rxnfc_channel(). For simplicity we keep both checks, so even RSS contexts unused by any RXNFC rule must fit the channel count. Signed-off-by: Edward Cree --- net/ethtool/common.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 0d62363dbd9d..05ce4f8080b3 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -538,6 +538,20 @@ static int ethtool_get_rxnfc_rule_count(struct net_device *dev) return info.rule_cnt; } +/* Max offset for one RSS context */ +static u32 ethtool_get_rss_ctx_max_channel(struct ethtool_rxfh_context *ctx) +{ + u32 max_ring = 0; + u32 i, *tbl; + + if (WARN_ON_ONCE(!ctx)) + return 0; + tbl = ethtool_rxfh_context_indir(ctx); + for (i = 0; i < ctx->indir_size; i++) + max_ring = max(max_ring, tbl[i]); + return max_ring; +} + static int ethtool_get_max_rxnfc_channel(struct net_device *dev, u64 *max) { const struct ethtool_ops *ops = dev->ethtool_ops; @@ -574,10 +588,18 @@ static int ethtool_get_max_rxnfc_channel(struct net_device *dev, u64 *max) if (rule_info.fs.ring_cookie != RX_CLS_FLOW_DISC && rule_info.fs.ring_cookie != RX_CLS_FLOW_WAKE && - !(rule_info.flow_type & FLOW_RSS) && - !ethtool_get_flow_spec_ring_vf(rule_info.fs.ring_cookie)) - max_ring = - max_t(u64, max_ring, rule_info.fs.ring_cookie); + !ethtool_get_flow_spec_ring_vf(rule_info.fs.ring_cookie)) { + u64 ring = rule_info.fs.ring_cookie; + + if (rule_info.flow_type & FLOW_RSS) { + struct ethtool_rxfh_context *ctx; + + ctx = xa_load(&dev->ethtool->rss_ctx, + rule_info.rss_context); + ring += ethtool_get_rss_ctx_max_channel(ctx); + } + max_ring = max_t(u64, max_ring, ring); + } } kvfree(info); @@ -589,6 +611,7 @@ static int ethtool_get_max_rxnfc_channel(struct net_device *dev, u64 *max) return err; } +/* Max offset across all of a device's RSS contexts */ static u32 ethtool_get_max_rss_ctx_channel(struct net_device *dev) { struct ethtool_rxfh_context *ctx; @@ -596,13 +619,8 @@ static u32 ethtool_get_max_rss_ctx_channel(struct net_device *dev) u32 max_ring = 0; mutex_lock(&dev->ethtool->rss_lock); - xa_for_each(&dev->ethtool->rss_ctx, context, ctx) { - u32 i, *tbl; - - tbl = ethtool_rxfh_context_indir(ctx); - for (i = 0; i < ctx->indir_size; i++) - max_ring = max(max_ring, tbl[i]); - } + xa_for_each(&dev->ethtool->rss_ctx, context, ctx) + max_ring = max(max_ring, ethtool_get_rss_ctx_max_channel(ctx)); mutex_unlock(&dev->ethtool->rss_lock); return max_ring; @@ -611,7 +629,7 @@ static u32 ethtool_get_max_rss_ctx_channel(struct net_device *dev) static u32 ethtool_get_max_rxfh_channel(struct net_device *dev) { struct ethtool_rxfh_param rxfh = {}; - u32 dev_size, current_max; + u32 dev_size, current_max = 0; int ret; /* While we do track whether RSS context has an indirection From patchwork Wed Nov 13 12:13:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: edward.cree@amd.com X-Patchwork-Id: 13873528 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2048.outbound.protection.outlook.com [40.107.243.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 823BD1DF250; Wed, 13 Nov 2024 12:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500111; cv=fail; b=KaXTrF879/AgJ2Yj+i0ziOVh+PFePIO1bFEASn5S3NVBT7OShcTbKGE/m0CbnWYBb7xTA9jfVetMF6pJkKSQxeFGFI9BPRPc9Og7YKTeX9sl7vx/kGgTKMshf1VYg7fPj6cOvNFcXT7Aktt0pG0FR2mtK9eghe3+7cYscUN5mfY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500111; c=relaxed/simple; bh=8r8X3nrCuFP8Bs7mNdqs+K2MxN/JzZOKLK2LqlVWIrY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LvRfXsTDxVWznL145DY2yh6Ghq1v+wdc4iMi5Xhjm4tKvpicysQxlmAHkFTG8H7bWnCtPdlBWzfqfj17CeD6fTp/enJoaPi76UiAl06MrAc0dA+wBqmwtudq01DBRhJGVuqWPK3ZatOkQYz0bOaBO/MLq3SNEx/L/CcRW9HoiGM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=ZByUSOHm; arc=fail smtp.client-ip=40.107.243.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ZByUSOHm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y+3suuIgOG7jdjUCb4aA1POnnhRG+yx5krcWrStws0vzVrYUzJH086QeOdHWclh+6tKdM0Z37rsjFxvuQzQBt8EV1KKLlw4N/V4bDhSndqdv34bwTq1g2HApSa/8THwwt5bVOQ866hW5h8u3BwOnGnKIyvAfAsEcxHsd1WfHVJ7TUgF8TrjLtmt9CNK5zIW5UJwIdrB6prY6u5SEAwLhR42lvaWRqqe1oMvW+B8AtW/3AMXo7E/EqQNmMZuftSp1K1jp+KXImb+MQrqWxmxp9odSJWadxrRniCc2o8rp4gzu5nfERsAvqIPEtJiOb0JlNTv0yzUjtq6cnm/FiFtzWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=C5bGs9IifR70SQiam0gYQvSBFf7mfCNBW6Ux+kLEW0o=; b=bxoEfx7b3E/lTdhapW905L5GpvULIFm1k+QcAHV0twpgGRRQx6LJV4u2guoIBeK2Lx7q1pKyD3YL5yjAi8yNuagBeKaRAx9rcLJDCrFJRdVC4Mb6c2XQ44Wf9aB6J8gBVtVeOAiRMCWcE8yG8xuMZjfXAs8ZMti89nXZQUWSy7FlodU10AeLw80EOzLlZKkx2uWJnRbFE37eXpx5OauozMQ3pxVRADeD6S7mt62voxDUlo639KwPpEhvDG17CXRD7j7P6nOsmZiJlVOd1me4w3M6zaZblnSGQpBuDsqLDtcBvdiYbOQ9UNjlBxcfDtTUJZINZ6TezVXPJbC5/gi1Ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C5bGs9IifR70SQiam0gYQvSBFf7mfCNBW6Ux+kLEW0o=; b=ZByUSOHm8HKSZPcBuUiRp0+hmqKZQR8IyFkF+NwU6QalosNOOnXARKsyQPy6XvjiDj8uUmyS11h7RiFjU6m0nVy8Ny6GIODKhzA7igjwPJ+OW6S5E7DmKpcCLO6LLgYRsZAHaonS1uODlHNzFDxhUOxodheH0YEne7gqOrNMtLk= Received: from SJ0PR03CA0238.namprd03.prod.outlook.com (2603:10b6:a03:39f::33) by MW6PR12MB8959.namprd12.prod.outlook.com (2603:10b6:303:23c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17; Wed, 13 Nov 2024 12:15:06 +0000 Received: from SJ1PEPF0000231B.namprd03.prod.outlook.com (2603:10b6:a03:39f:cafe::30) by SJ0PR03CA0238.outlook.office365.com (2603:10b6:a03:39f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28 via Frontend Transport; Wed, 13 Nov 2024 12:15:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF0000231B.mail.protection.outlook.com (10.167.242.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Wed, 13 Nov 2024 12:15:06 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:04 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:04 -0600 Received: from xcbecree42x.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 13 Nov 2024 06:15:03 -0600 From: To: , , , CC: Edward Cree , , , , , , , Subject: [PATCH net-next 3/5] selftest: include dst-ip in ethtool ntuple rules Date: Wed, 13 Nov 2024 12:13:11 +0000 Message-ID: <8e5d23c8f21310c23c080cc7bcd31b76f8fd3096.1731499022.git.ecree.xilinx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: edward.cree@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231B:EE_|MW6PR12MB8959:EE_ X-MS-Office365-Filtering-Correlation-Id: d5a1ef86-4431-4495-592d-08dd03dccf63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: X63lvwI0QMeTpqOL4qKsvsUI5fUuIn7jffwRPXfW+r1wDjwN+uEmx3QVfWshIumPxqKI33DoMhzF2PmsijDrQ1iq+uLjrbevc2VM1bu67G1pusy0bR/oklwh51sIwmkECc6mlsMRV73vm1q5NQnZZa9U3tJmZoifIs0an67A6NwkpUnhxtACJHoffT5wj82NHzm5GnY/UNjbXHK1Ut2eK5sg2KBMztJvLH/QpHs4uFIVOwUeSSb5/ar33RHMAQ0/r7nSr1Po6nX2VKk2mWhzIe5vBgme/yHwHGXLxoI07qBZDaLYIfySqxDrXtUM9A4wvOXwymK430VtsHG/fOvByDHYFLj87NXd15q6gaoO7MAoyPa09dg5ql3SxHXWUIV6kSe86vS1GVayIZojiEuly/EsArHZN4haaZx0F+A6P87/a1C1DbKHu+WxSI075+lz15ktvTSpw5/xer+kTKsCo6qMbSMF7I+tggvV+nK49O9KMsT5c1FVOmyQlDft6u2fAqoVzby/Xwc0zpAk1vDUcR5jQWAWqY33I8FkuKUuFTzo3LjGuofwmjM1btx/bWWfjlWpVpGUzTv4bSmt1n0mAl1I0bQzFKfIOoBod4eaordXw2VNEIxBLgiJK2Mo64IG0/R7i3yiYnaCmU05LK+Jd8+DIFg3zMDSFkQRRHpl+uRIbAcVFqcs7Ez1j7hNg/DLqLUASk0JO45bDUMXCFnKQxiHrXKxeL9n1vPtIhi2D9VYCeisp1C6qssXASmwb3j8MevQWQUptHIpXpb59O1blf52AQvysG26WgHRdB3Y/AYB4Rl6u6qpnbeK1KpbkSlojtNZKdDpP08PxUHPVID/h8aALWCk9QKjsPmosHkMMJk3YkM+1j46mrodym/FWORY4E6hAvIiC+q6x8/wTqAAZuJt+vpRB5ZhKo+iAgVnC0Fn+VeNrMopGKFjTOGAwt3p+c+PXbe8q1i4vdiJ+Fma8/alS+PiaGdMK8FmVGf6Y/YrZSm/+tinm/eIweuO80CwwUi287gdBxBvGh2zeWtczxw2QCY72xgnIzWC5ulCl/sTW5AWi6d5NnMsW8UNQy3wy9/yEjZoGAcCh0a3fMBg3hfIBttu/nT1UwkQg6ZYJ9rv7KmgJ2iMisZVL63abcqpw7feGgBIygl/cTURjvfGhBZsJkj1YilRiwQICi76B8V4hTal8MkcV8ZWeWkduVGSeYPRxg0dAs0ZdqUPMaV8/OnWYpttsOAkmQl4B+Qc/BVj6Y61LPj2AUSs2uAWi5YYfVoWNgQLhnHWFfAn6sWECYAvCRf/DmgpYnIMK0NwiqumCIkDnuCGYDNCzkERFYVMbH9KTqtn7cw5is60BS/GjNC1tEPgpQukXVrCu0xh47s1o7cSla2WnSKrtIIhywSoa0s9A3/3VyYLnDE+OAwnFQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 12:15:06.1686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5a1ef86-4431-4495-592d-08dd03dccf63 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8959 X-Patchwork-Delegate: kuba@kernel.org From: Edward Cree sfc hardware does not support filters with only ipproto + dst-port; adding dst-ip to the flow spec allows the rss_ctx test to be run on these devices. Signed-off-by: Edward Cree Reviewed-by: Martin Habets --- I'm not sure if this change will break the test for other drivers that perhaps support the old filter but not the new one. If so we might need to add an option to cfg to control this choice. tools/testing/selftests/drivers/net/hw/rss_ctx.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py index 29995586993c..fb61dae20fd8 100755 --- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py +++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py @@ -215,7 +215,7 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True): defer(ethtool, f"-X {cfg.ifname} default") else: other_key = 'noise' - flow = f"flow-type tcp{cfg.addr_ipver} dst-port {port} context {ctx_id}" + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}" ntuple = ethtool_create(cfg, "-N", flow) defer(ethtool, f"-N {cfg.ifname} delete {ntuple}") @@ -429,7 +429,7 @@ def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None): ksft_eq(max(data['rss-indirection-table']), 2 + i * 2 + 1, "Unexpected context cfg: " + str(data)) ports.append(rand_port()) - flow = f"flow-type tcp{cfg.addr_ipver} dst-port {ports[i]} context {ctx_id}" + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {ports[i]} context {ctx_id}" ntuple = ethtool_create(cfg, "-N", flow) defer(ethtool, f"-N {cfg.ifname} delete {ntuple}") @@ -516,7 +516,7 @@ def test_rss_context_out_of_order(cfg, ctx_cnt=4): ctx.append(defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")) ports.append(rand_port()) - flow = f"flow-type tcp{cfg.addr_ipver} dst-port {ports[i]} context {ctx_id}" + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {ports[i]} context {ctx_id}" ntuple_id = ethtool_create(cfg, "-N", flow) ntuple.append(defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")) @@ -569,7 +569,7 @@ def test_rss_context_overlap(cfg, other_ctx=0): port = rand_port() if other_ctx: - flow = f"flow-type tcp{cfg.addr_ipver} dst-port {port} context {other_ctx}" + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {other_ctx}" ntuple_id = ethtool_create(cfg, "-N", flow) ntuple = defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}") @@ -587,7 +587,7 @@ def test_rss_context_overlap(cfg, other_ctx=0): # Now create a rule for context 1 and make sure traffic goes to a subset if other_ctx: ntuple.exec() - flow = f"flow-type tcp{cfg.addr_ipver} dst-port {port} context {ctx_id}" + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}" ntuple_id = ethtool_create(cfg, "-N", flow) defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}") @@ -620,7 +620,7 @@ def test_delete_rss_context_busy(cfg): # utilize context from ntuple filter port = rand_port() - flow = f"flow-type tcp{cfg.addr_ipver} dst-port {port} context {ctx_id}" + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}" ntuple_id = ethtool_create(cfg, "-N", flow) defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}") From patchwork Wed Nov 13 12:13:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: edward.cree@amd.com X-Patchwork-Id: 13873531 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2089.outbound.protection.outlook.com [40.107.220.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE805200C86; Wed, 13 Nov 2024 12:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500132; cv=fail; b=VvgXvakwNghTA2+0ERUwWqxadtDjOzNO+N6s152kYtdKm65chJbwDGxZIcX5PTGUGv15meB4L+vpQNnHngNGSgZkn9k2O3he3IAZZbtcHQkYPiqJTfiHBk/85NQmDrqSZbIbb6/g5032ZusB+lT/HbGSsEGwUyzlgftPXb3A1aU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500132; c=relaxed/simple; bh=yyaFvETY31j/Tj0x88Lr2K4RxaOrsbBsyqLP6i8uK6o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IW3HATGw8pXE87pTtqm/gMaIG+lXg4hFNYILsreCV266GFyM+wEKnBqymkjYA+ZqG23mH3NCGJv0rC5oUM1jCLkyl/Ow3iIQLoVCVblIeEqemLYSu280xpG6dOLHzM4S00zEJPTa6Z8GQeEIzW3Wixg8a3izK3bLwfkHXlNqLgc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=O3ZRxL52; arc=fail smtp.client-ip=40.107.220.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="O3ZRxL52" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x8AbhAeCrz7ZKNNw2hcmwOZxVMRKS39Or6iR5gmX+keyM/S/HDI0V4NzuJT7O96PLaq2BwXlAHtf3J0XGsJ+JhX7zJdBbCAV43ywtizN+3NYLFiu0HJDEo8a63E3fbTyvqgo3kP2jBaF0hZ7yLBX4Tx984KAB4BPOQcthcgF7jUkO6nWjO8X3ShGe58XFlxymzn4J15Vl9+Hqi/jYdLUZ3X8ThEEUB+Q4tonz9lFuv6ZiPNrercHMwAK0fJOqUIseTC1YB5ivMvNoB4WqRgqsAnY8CnYOeCZVfyIlDQwEyBXuj3Y9RF+FArdbKbVEYHAtTQTVnM8bUe8H862em4UYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bXnOQQixjOTI3P6ivrB8t7H4/wpb/9uqua9OWD8DVxU=; b=iBawIO2XbUI7bBtyWhjEkLpHlOw3doiiLgB+v2vPOBOxZH74qyhgmP0hm4PEHTFuFyci863OWchlRnjtOsOy/Qpin29q1n1A1NgMKVBkl48IUbd4/nm9c71XbcpEQLKyXfmDNs5zl+hKeEgekKx9Wsjc/7tEE1opxYJyaomBS7HwoMbJV+EeGTBkwX3yqRaHP8IdvKLJdNTTqfgZHQT1kvYnPDbUcQEkWxurF5p1bonOiI5naMXfg7T+dis8iF6kGfpsL8EK5UCFdpfEjkN9lpLd0BT5WjqhSHH27P6mDpvU9VbMeMRy59qla2lTS4cFemRxJlJurcb8yG1rowdtsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bXnOQQixjOTI3P6ivrB8t7H4/wpb/9uqua9OWD8DVxU=; b=O3ZRxL52xum2ESVnb5UICTs0tiaE+3kCK8WVxe1cCnF77jgnbKWeruQAIShAmNh3kRmVHuzNvIaxCkXGOviLFsMLPbG86Vhg6MuVGLvDuFL6pzo9METpBXi9WEdpGmUTbtss+ZsMH/bP7ttcgwXRfGvxO0cdW1/tpGDDBhr9tYI= Received: from SJ0PR03CA0240.namprd03.prod.outlook.com (2603:10b6:a03:39f::35) by DM4PR12MB8559.namprd12.prod.outlook.com (2603:10b6:8:17d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 12:15:07 +0000 Received: from SJ1PEPF0000231B.namprd03.prod.outlook.com (2603:10b6:a03:39f:cafe::e6) by SJ0PR03CA0240.outlook.office365.com (2603:10b6:a03:39f::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.16 via Frontend Transport; Wed, 13 Nov 2024 12:15:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF0000231B.mail.protection.outlook.com (10.167.242.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Wed, 13 Nov 2024 12:15:06 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:06 -0600 Received: from xcbecree42x.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 13 Nov 2024 06:15:04 -0600 From: To: , , , CC: Edward Cree , , , , , Subject: [PATCH net-next 4/5] selftest: validate RSS+ntuple filters with nonzero ring_cookie Date: Wed, 13 Nov 2024 12:13:12 +0000 Message-ID: <114afdf4d2867f72ed27751e8e08fe8b128a8529.1731499022.git.ecree.xilinx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: edward.cree@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231B:EE_|DM4PR12MB8559:EE_ X-MS-Office365-Filtering-Correlation-Id: a5acfda1-dee4-4e42-056e-08dd03dccfd1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: 9ijBl8p5zzixa6hKIy7XJmwnsBdgOB0vfaLu1j3sB9CkzXkbtBiOAyjZHecCILmjRIJwvrzjK5Rdz8ZfHR+loVGao4yLLDWG7IwdIokA8dr5wCxlf6gfaADHnlkTHNoaNyzFPaLtCNjDtrt2CqT7rK+/lD/HIc3z5F4pZiGub+uHQ2fyMRZw/QeK9S/Teq8X3qGKI7iPRFwnJPTGU36WTpDDXRFx8HzOyVd1r2uKngJij710SxSiMqfam4iGpfU7eDjN1+4Ex6qVM/vI/H4j8BIYz/l3DB3PnmiOwqUGRvkh8hGdfMUoD/zZkjg6J8oyxnJDf00M6fqdhf7mhwxZdpbkKpcJUVohJrkyz5jgUSTNiuk4Na9noR3iYESLJhVCbZCm5vgGbiJylTv2L86NWSv2Y/Vyuq6taxvDVSQWrNFm/vLywWw7Cmo2hKNk6rX5dA1jaEV3995iANBjqScS5r+usagMYH9Zw+qSxwV30YQ7QtR/QPdVJjMnKzmoNX9CNmRjE6esnB3EUxJt7Mr5zszfcpN7Hxj2x+XZOQx6mUhtts4J42r1MYX3G0z1wjhfXSKpiFTyM/w6iaqTJXLzKe2P/Op4K7lOUFSu/x4zua6ZgSpLcvo50OD9GCcoTnKVw8CjkCcMmaggguNV5bOuVmaOAAo+DJcohwYPur8hBQDMAOvYQ+o1Ar8TjHY7XcEG6DdI5I200FQX4dvcBdw78gHzVWeb9w8u5PF0d9X4kcjMWxCWAAfs0ih1vq688y6jE3ly5tKgGLmf6zEF7pkYoVk2rlwxOM0qKmFaGURncrlgsb3K+xnj3eZqYa0XQR3N5ZK2YMVrGC/QzwZPhlZJMY1XEk4PhAMIhyY5h3JoqAI7UBbZw/OPThwe9W43xtZYSnwstxLPIuGlx7YCPMqnXRWOuzcKLGxIGmaJ3vlaJqqZCKDC5v+ubVs3uiVWryPnev4ce9j55eqWLk8KPnxYWkWJsXYQQhk6UQ4RgCithnNNv7IwZ9cWRilzaigrsmdQAPGfaHN2D3nnJfYDNzGdKGg1NGiiAZ64WBHf7EagrAoxZqtDYEIgCgZmiPWR4Dy+h//QWdASSJPRzkr7vDUB/bPCwucSYK0pGsA9ttcoKRAvl7Oo2JA/ZYbx/lCY1l+RQTtnVJJ4p8aQF9ueIpb4p3DFUHE5+dXLp9sP+FTZhH5CAdc3oAUi0/+U2YkoC/+2UWwT9gVNLNwyB+b9n7df4NRAsvTpHSdIFjF/d/VrYW3KeZfw/w7o9ncKCWjtQDBCSLXkhmdbUNfjVUuBqFlpR969C8aRAhwTTRW6zPnVWE52RZez9QKMgdc7bPUvg6sPvoJbIPQIZFOBV/XRgPPJyVVw1lFnwgF4xldc0aTxK11OG/gqvJuMzusry9kRILVb0w7E13+40dapRRHn93swWQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 12:15:06.8561 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5acfda1-dee4-4e42-056e-08dd03dccfd1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8559 X-Patchwork-Delegate: kuba@kernel.org From: Edward Cree Test creates an ntuple filter with 'action 2' and an RSS context whose indirection table has entries 0 and 1. Resulting traffic should go to queues 2 and 3; verify that it never hits queues 0 and 1. Signed-off-by: Edward Cree --- .../selftests/drivers/net/hw/rss_ctx.py | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py index fb61dae20fd8..8f62dc29bd26 100755 --- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py +++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py @@ -633,6 +633,45 @@ def test_delete_rss_context_busy(cfg): pass +def test_rss_ntuple_addition(cfg): + """ + Test that the queue offset (ring_cookie) of an ntuple rule is added + to the queue number read from the indirection table. + """ + + require_ntuple(cfg) + + queue_cnt = len(_get_rx_cnts(cfg)) + if queue_cnt < 4: + try: + ksft_pr(f"Increasing queue count {queue_cnt} -> 4") + ethtool(f"-L {cfg.ifname} combined 4") + defer(ethtool, f"-L {cfg.ifname} combined {queue_cnt}") + except: + raise KsftSkipEx("Not enough queues for the test") + + # Use queue 0 for normal traffic + ethtool(f"-X {cfg.ifname} equal 1") + defer(ethtool, f"-X {cfg.ifname} default") + + # create additional rss context + ctx_id = ethtool_create(cfg, "-X", "context new equal 2") + defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete") + + # utilize context from ntuple filter + port = rand_port() + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id} action 2" + try: + ntuple_id = ethtool_create(cfg, "-N", flow) + except CmdExitFailure: + raise KsftSkipEx("Ntuple filter with RSS and nonzero action not supported") + defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}") + + _send_traffic_check(cfg, port, f"context {ctx_id}", { 'target': (2, 3), + 'empty' : (1,), + 'noise' : (0,) }) + + def main() -> None: with NetDrvEpEnv(__file__, nsim_test=False) as cfg: cfg.ethnl = EthtoolFamily() @@ -644,7 +683,7 @@ def main() -> None: test_rss_context_dump, test_rss_context_queue_reconfigure, test_rss_context_overlap, test_rss_context_overlap2, test_rss_context_out_of_order, test_rss_context4_create_with_cfg, - test_delete_rss_context_busy], + test_delete_rss_context_busy, test_rss_ntuple_addition], args=(cfg, )) ksft_exit() From patchwork Wed Nov 13 12:13:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: edward.cree@amd.com X-Patchwork-Id: 13873529 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2062.outbound.protection.outlook.com [40.107.236.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70B99200C82; Wed, 13 Nov 2024 12:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500115; cv=fail; b=W4ydxxVOI5bw/bEa+dbE4X82oeO37K/WANyBnjgelw9yLoMQ+i2z6sH48O9H46iKspHSsJXci6dHoHrjp/G9MZc2Hd1sBOrdX0PJDdyg2z4Z7RISoN5ep6UTa0ulZ6kjnnosUuBS7l+ykNoc+1xPyGX+j+WJf/QWDXU3IERzCtY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731500115; c=relaxed/simple; bh=TpoovN4UHPj7yAx6FOh4cHmawX9HwZ/W7T5mretRXec=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=r1z1IsMUFINJmpeWWnUCeNP7vxUh0yS2eipRXouyTtQ1Y7U0MSgeW+nseP0og2iqys0WzR+9DDezsvA+7TMkY3PuMA77iU6FfPd5CDinGRV07Lv3M6Uh6bAvYyLCzcWYRJi5WFCao0+7SXXZ7FMBXgrEG6tw8wSAcmrq3PpgPlo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=FJAdNuC2; arc=fail smtp.client-ip=40.107.236.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="FJAdNuC2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gVd/wDxvYuGYpM2Iv1XwS8HwpYllXAyXdP48TAmjDaZwQ/Wn1kEacjk77jNL0GeAy9wzAHJwljqW5OFmDQdw7AEG7okJnczIcgQgJgqNkJPIn4Cyppfj48plP9ndQDW9HqVXa7CZ5GCxM+CVAbgu+rmF4j3V+tiS+l839J4D9FgjD8sDaCHw88ig5TgTEia2UHJMluBSCdj6vX0SC4ddd50dM+AFXv7s7yWjlicQ1m8ERbMcm5Poocpi4NxqHIXunVmqo6jrP0yefEyZ8HE8ETh9bJtjbtNM/p3dovECF3bb3b/IioRa1IC2TNYjGigHMJW41bRL/qpZ+2tphSUhVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=exRrZch1YnXkWBCKYEzsFf99k5cEwGMkBlSWs2QbSDI=; b=mJfDD7Hz6Lil3uhLGdNfTCXd/WfgaPkmFMEoF+4uWZo8d3NxGmW66ONao0v2E09W2LGbqGObDNS7Dy8zZkkriUEh2Il5AvULY+2Mfrhr103KkzbL6QHr3C8FQAv7lNIb2PYqVuenfHf/dRtvmtWZ2DVPCPO6iCno95xmmu1PMWVuEkq5lBhS/16KoSdOIvl71gXizZj09yoDrmePMRujUVoFfbbeiSSIYn3I9Bdk4Bvt+8GYV8NleILITpDUU8MQ7a00GJZdB7vRbVFHGTDo3+z6JOhFJlreTgGBlRf/HAn8E3MQi9i92t5fA/3uiqbCpHRPdKZ2F0QfPsC4F4y9HA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=exRrZch1YnXkWBCKYEzsFf99k5cEwGMkBlSWs2QbSDI=; b=FJAdNuC29F/GO4cCeBPsKc/o3nceoO+bJBBTseSfT2DIPlh58fpvOHqC5dnpVLgcWm5Q3YJITgfApMy/SlHyGGmc6C572kyKzGh9SZoQZ1LQsixA/biFRzvCVXa8eXfJ9P43IYVcYSeun7TDyn6qLHUQQhxS2CFImfAm6skXQTY= Received: from BL1PR13CA0145.namprd13.prod.outlook.com (2603:10b6:208:2bb::30) by BY5PR12MB4177.namprd12.prod.outlook.com (2603:10b6:a03:201::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 12:15:09 +0000 Received: from BL6PEPF0001AB77.namprd02.prod.outlook.com (2603:10b6:208:2bb:cafe::dd) by BL1PR13CA0145.outlook.office365.com (2603:10b6:208:2bb::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.15 via Frontend Transport; Wed, 13 Nov 2024 12:15:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL6PEPF0001AB77.mail.protection.outlook.com (10.167.242.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Wed, 13 Nov 2024 12:15:08 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:07 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 13 Nov 2024 06:15:07 -0600 Received: from xcbecree42x.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 13 Nov 2024 06:15:06 -0600 From: To: , , , CC: Edward Cree , , , , , Subject: [PATCH net-next 5/5] selftest: extend test_rss_context_queue_reconfigure for action addition Date: Wed, 13 Nov 2024 12:13:13 +0000 Message-ID: <58276b800ab78c0a79c1918046ccae7fe45ba802.1731499022.git.ecree.xilinx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: edward.cree@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB77:EE_|BY5PR12MB4177:EE_ X-MS-Office365-Filtering-Correlation-Id: cb2cc6f2-606d-4741-97c5-08dd03dcd0c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|7416014|1800799024; X-Microsoft-Antispam-Message-Info: AOfAaDmiUk4aELSPOC+JYNiAb0ouAF+EdeyokcUhtYVz3J5YNbC946W7cGMi9xfxnsONpaBNTbslAJxaBPg1jx13cJ270SFMxBGELURwASyFYK8lK1KA49WCY/23AT4xuTkPkGSJTD7MYX1xbRN+dycqklxqxdhSmY/SC+75mrrVBli7Nh+WJ2Nr2TNMJT6JY4wAVGdwqWMI0E/pWBsGga9CXZ3eXbdqnNYipguZQSC9f9GW7+1GZLRBdLsvRtbqJfVi0uMKoRaQS9egk4vbI8+HOI2j4Q5LuPA1VwB4joQlwGmzo92XuIo7k8aeGNFeoVdo6zd88soe932/pDjYnm0/B/SzP/qXap2PFyrceym4S8qkN3IgiJVZRnJAL4I37IaeFiyO1FgUdueAvJVZq1eNDTgukgU4XnFsXOgLbc++S+69cRy0r62SK8TbvOLcnmLkv9SVw0jwjZeDCDB93nvXRfV0dUBX4Q5paLJepTeGB6wv05knnvkeVgiArPON9niii6fiOjd6abpCA1aVosRxC8DOBDtYF44TB6aZXZ+OYIfN3M5xvXIjkS6tn+M1rGEgCqR3mSBXj96Pbz17DelkondWRcmS60tGesVARjT/fgXzy2OKP7uujTdru/pOozWgbz1/jiJVXZfF+U7opz0xVi2y04AgVTwHJOkc2KfpBrQD506IFyoAqlgNESARmQN6x89DaPWBk/MMi/X5drCxcQBzK1U+KED4pcWDy3sexC70KBhhyh9Nivcv40JREbiZdPuPudxaw+zkQsVaR0iIoOuIyamc9KD1dGUlR9iG5VRuzxZzs9DnniT0SA4kHwN16ZXmLGZWO8yvkBaEDR6upUboi9PKPzZxcSe+V5FHbHjv/HnxB+q3rMkkgfamD7gdAV2R4UQCyu9u8HGbqAuSjq8PiykC70QwJ+gxWLKjWZOLKNK2eDSpYAyVzN6vIp8+uXhA+ZGeKPwq4/BFiG/63eFn+FgP6Hyo2FyZUWn4v8Fq7pGX56WsxoqZ9wf+j0RMTPwE7WKEHAcEU8BznINGjftUKtLR+3O6l4SuOlrLifTc1J+YrwISkjo6HoOD9nxW/GQOOXaWXat1WhDxKVNnnGSXfgxIaAf22ixYis74XdMFXk8+WIcm9k1VS1uTBdNJR5DrYjuMRM+TgMiC6eZhf0lQcNqs1fq/msfMm6sh9LOqCzoQVVwRxqqOPWnuYPwTjL6Bk0qF5n+UPbZlKTih9V2KutskCRQKvj3WwKiiparLdYm6Zbz1thkXGdpcSNt4k3hV1ISyTMfCcZWHEWb+aMUVZagFLZ40j0NlrTSeaV/E5euFSQro4kjQ/3lz/m/sAF+30owe3Fx8qeOH33F1fND2pvnoEnkTN5CrLgdo7+fpiS/J57qFdCBKdJy27sMGazctHdPaGVbipH77vw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 12:15:08.5033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb2cc6f2-606d-4741-97c5-08dd03dcd0c7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB77.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4177 X-Patchwork-Delegate: kuba@kernel.org From: Edward Cree The combination of ntuple action (ring_cookie) and RSS context can cause an ntuple rule to target a higher queue than appears in any RSS indirection table or directly in the ntuple rule, since the two numbers are added together. Verify the logic that prevents reducing the queue count in this case. Signed-off-by: Edward Cree --- I'm not able to run this selftest myself, because sfc doesn't support ethtool set-channels (-L). If someone else can verify that it works on their hardware that would be much appreciated. .../selftests/drivers/net/hw/rss_ctx.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py index 8f62dc29bd26..0b49ce7ae678 100755 --- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py +++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py @@ -238,6 +238,32 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True): else: raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})") + if not main_ctx: + ethtool(f"-L {cfg.ifname} combined 4") + flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id} action 1" + try: + # this targets queue 4, which doesn't exist + ntuple2 = ethtool_create(cfg, "-N", flow) + except CmdExitFailure: + pass + else: + raise Exception(f"Driver didn't prevent us from targeting a nonexistent queue (context {ctx_id})") + # change the table to target queues 0 and 2 + ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 1 0") + # ntuple rule therefore targets queues 1 and 3 + ntuple2 = ethtool_create(cfg, "-N", flow) + # should replace existing filter + ksft_eq(ntuple, ntuple2) + _send_traffic_check(cfg, port, ctx_ref, { 'target': (1, 3), + 'noise' : (0, 2) }) + # Setting queue count to 3 should fail, queue 3 is used + try: + ethtool(f"-L {cfg.ifname} combined 3") + except CmdExitFailure: + pass + else: + raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})") + def test_rss_resize(cfg): """Test resizing of the RSS table.