From patchwork Wed Feb 5 13:53:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 13961117 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2051.outbound.protection.outlook.com [40.107.93.51]) (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 55955142E86; Wed, 5 Feb 2025 13:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738763669; cv=fail; b=HgfKIPk3oaJ3oJKGdNMQgA38cuACwZ/sMkm66WYfuNz/G92zPwKtlxP9nMf9ZcnMDorV7Yw4keyfDhKcWSHuXqLN/kmZZ4Xn027QTB8khB2e1s+bCrRzi09aexAVUVfKOM/gJ6PQ4GHZDEe9nOb6zxIdfkaCYVzxEaY9sak3LsU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738763669; c=relaxed/simple; bh=OuKjFk66bOEHRa1Lo+XGMBUh5Wb3Sa7etoSnxk2nVdE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HqMD7Il0nXt/ilUoIupuDHIifGrldfTvv85kl/goUeB4Z+q+siWiOYagrFFeWPspjNBmh+OzRQsLlKhueTk3eR84i6ngjhG6gfAgzOvQzP+yGNqIIO3hMZwxoiY5eepzuRlZken0B7SKwAEkLvSwc2yeBYqNELnMt38F5+EUCJw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=unCykXic; arc=fail smtp.client-ip=40.107.93.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="unCykXic" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xOJZ9O0YM/EnGwG2ZZH3Yf06a+MHsTZzq02B2bzTQvHxaNc2s/Kjk0c2PcMY9x4ftDVJ861pF84/ruEVJX1gWP5EcNyHqkCjEh5fUHt7aT372Uh8zQBhPIEAaSNBUzjxaAlF1rWtTJOVlTpxKrjT/aWKTn7zz32w0GOskGVqe3obeqTCNzk4v5JQJKcesSa9Wk8fU7CWn3HkRpC60MoE1/bpB8GIALgdWgh8J33JBJULca3iaWpI4e3L/aCviYT9N8MiPjDxtDDPE+jX90TpqRA70qpxpIjptIMcPEhbxZDYmn+ezecahN6XTG5k3L00u2M7Z9dbN2+jxN95UYFgKg== 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=+mRuMijF8SF1Uq8DRGIS7VpVlXWhmSRxWcJXF6rp9Jg=; b=nRlSao4FvrdqfucPlv/QK29q4X31Bwyy0iKeZTPcz3UtadjKTDwDHovHjDEOCYscFqphhfLHZf4FZ9LHScDESSb/d3h0KPiRznPcndn+Ziu0chMgTM6xvDCLfHPicDwXmV582gpmUqQ1TVm0EA/A0gAg1t7ku39SVskQs/FstGAuceowaT/uiS3uvhNnR2fRlXZaclTFQASqpxbn0TYgqipt8FGbVU38jWIe56wQdDAxhuTJV6Vxn5L3FkDj+bCKwATqcOjcmJfSJ4vt8iNReDWZSZX1Aibt+M9JG9LZinNNZERD+RpKagcuTPnT1Cvv3qIkQ/W9EQpT0mVpWYb7xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+mRuMijF8SF1Uq8DRGIS7VpVlXWhmSRxWcJXF6rp9Jg=; b=unCykXicJRIyxrAHzmisnmMqaLSoCd+iKnJ/xPqEvB/wTeOdtorZ4nzXUjea1uVRKRdde7+/g+/KpvoXJmtMsCAEXSD7Ztrp0tlc6ATKlhtff4Y03wzQpUVBarBdPQVkxWbvMe1NkcUEkliWigAauR9NPd++pE6fJ+a2RqParDKiW26G9AtPzQ7Yib5YhAUKCii5QQEUMo//Wk/v7jx/+jj61yWV8nVkBCOJl3Sg+JFua1rrP6tXAPLcVmKbx38Tw/ar2Nnw/JXvSQubIyKUr6YJ9UZY40R7EvYoh9HbWXupZqdXUD5Zqq/Q9kM8YeFy2b55poMOQs5oCo35DLYffg== Received: from CH2PR02CA0008.namprd02.prod.outlook.com (2603:10b6:610:4e::18) by SN7PR12MB7835.namprd12.prod.outlook.com (2603:10b6:806:328::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.11; Wed, 5 Feb 2025 13:54:24 +0000 Received: from CH1PEPF0000A346.namprd04.prod.outlook.com (2603:10b6:610:4e:cafe::35) by CH2PR02CA0008.outlook.office365.com (2603:10b6:610:4e::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.27 via Frontend Transport; Wed, 5 Feb 2025 13:54:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000A346.mail.protection.outlook.com (10.167.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.14 via Frontend Transport; Wed, 5 Feb 2025 13:54:24 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 5 Feb 2025 05:54:02 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 5 Feb 2025 05:54:02 -0800 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 5 Feb 2025 05:53:58 -0800 From: Gal Pressman To: "David S. Miller" , Jakub Kicinski CC: , Eric Dumazet , Paolo Abeni , Simon Horman , Jonathan Corbet , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "Tariq Toukan" , Edward Cree , Ahmed Zaki , , Gal Pressman , Cosmin Ratiu Subject: [PATCH net-next v2 1/2] ethtool: Symmetric OR-XOR RSS hash Date: Wed, 5 Feb 2025 15:53:40 +0200 Message-ID: <20250205135341.542720-2-gal@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20250205135341.542720-1-gal@nvidia.com> References: <20250205135341.542720-1-gal@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A346:EE_|SN7PR12MB7835:EE_ X-MS-Office365-Filtering-Correlation-Id: 635f755a-59ed-4f8f-60e2-08dd45ec993d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: s6ZIL44/UYEdRb0Im45MtQnW/Bs2oc13y2HQOV7lfLOO2PydQcnTdeiyw2MlYgqDpSPcH1g9xt1Q7LrpET8ASDCszRaH4+Ao7GeaBJgXj5bQaUEod2Mn7j3RE7vMbGNY92fmAFkMMu/jj+VUf6ZlLB54gNdV7Wv/uc+2OdN6gjfvAZHxtOxWQ8EZSCZyvJ34GIu880mdQykmSQLNd/fCKEIuUWjZEu6VAm4XfAbesvCqEN2jaII/4HAPPoy+KXxBuEsKaF/EAmv0qmjXzgEBW7qPsv8RNjfgSAJ8TQmp7KYAIKoB+T+G7PE7oldFu1GukTjfDFF0rm1C7uVu+UCIjaL/gbqknIxQOl/hTbvPX+GZ8rfCH3LYunEewIoczMWijybx1bXEdC1Kl2tBskS9ptuxD6PgQHPS2n1EmWTAC0AXE0ljvSfhh0qmCgxYIio+T/35ow2ojr4r6y3+4l9euD4kr4ncgUkwKsNWBBZYrMXKe3QksDmubc+R/bZPERXyRYGW1vbuKxpjW3AGPzFpgFg2Bt74CfmiHu/M4kiFGQSGacGo0AHeObGY8PEaQ4fDy6KQlcGc/CMXx1w06fAKT/fF49d/YzC2GasCLMMYhEbs5rq0dno25/nTwK4Jd47xqF0wBLvQG2p6/6ZwBzAEILtM3WSd2WPz+eMc5JzQ55A3rPg+QL9kuZIyfwxvhW1ooZKjqfjJPdUXy1IRRlSZADlVWDn461RqplmhzfT6yMrcpfK3gC34DUZ01Sd23jWbtg+v2bz54w8FdDYiDmz2kaA0MzWsQO6c2SdSuvvESYbdWux7S5IA68zs7wvd3XKdHLAlHDIMa7v6RcpDINxNPYr9AAjlaKlTUosqlkeSo5RaABEbVAOb4Krwz/dBYD6S91GXhP6NiZ29/yI/MAXaEGGGvpUf/dbIi0YJXxNFE1L6dgQL946yhsPLVdx1ifeX/Uh8MlugvGxUnRHqYaAjKSkMZMHekNHq3ARbt09nRtyupNdiyWmjLCp+sgeLdMLf0kz8q2Le7VMMkgZjDzY+M5vivYNOgtrS1LGNlUz2johCLe4rPus0qUIZrsfdgQjeq78gRfraSLv+trvdoNXwJOoZ/msDZgxpHXUq9TU6ieSiUlz5RB8f/D/aXuqz+JbcPECPsOsFkDegDfeiMAfl5lp41PFw8I0sRMHJOcULxafG5hJSvN86OVDAi6dmXOxproqeZEFpuRPCjKh7eMNhrgPsctqnFAfJP3us5V9aD/nSSMmlWw/mBt9xQnFmVyLP7q00YZ+FRACvky4Y2H58zX4w4qevtvkh383rTP4lCK0E0MSBw6G3oyjd+4Gv6wU3QNEDyr59pT/QGD2ieDNQvuLCDgv50+9ts7mKVlJ1SmzshrwXEJ/6PaV8UDgSSmc9J6Nsl2LhvZRoxkIMbahaaf1OpnfEzX6ZtDH18AiyIdz4/PKpqTmr6ZZJ658z2VAa3+GYbxIFWEGKE8SCJ6OQfG2n1NaqPsJ4ggvzgjum9Co= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(7416014)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2025 13:54:24.0294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 635f755a-59ed-4f8f-60e2-08dd45ec993d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000A346.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7835 X-Patchwork-Delegate: kuba@kernel.org Add an additional type of symmetric RSS hash type: OR-XOR. The "Symmetric-OR-XOR" algorithm transforms the input as follows: (SRC_IP | DST_IP, SRC_IP ^ DST_IP, SRC_PORT | DST_PORT, SRC_PORT ^ DST_PORT) Change 'cap_rss_sym_xor_supported' to 'supported_input_xfrm', a bitmap of supported RXH_XFRM_* types. Reviewed-by: Cosmin Ratiu Reviewed-by: Tariq Toukan Signed-off-by: Gal Pressman --- Documentation/networking/ethtool-netlink.rst | 2 +- Documentation/networking/scaling.rst | 14 ++++++++++---- drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- include/linux/ethtool.h | 5 ++--- include/uapi/linux/ethtool.h | 4 ++++ net/ethtool/ioctl.c | 8 ++++---- 7 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index 3770a2294509..b6e9af4d0f1b 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -1934,7 +1934,7 @@ ETHTOOL_A_RSS_INDIR attribute returns RSS indirection table where each byte indicates queue number. ETHTOOL_A_RSS_INPUT_XFRM attribute is a bitmap indicating the type of transformation applied to the input protocol fields before given to the RSS -hfunc. Current supported option is symmetric-xor. +hfunc. Current supported options are symmetric-xor and symmetric-or-xor. PLCA_GET_CFG ============ diff --git a/Documentation/networking/scaling.rst b/Documentation/networking/scaling.rst index 4eb50bcb9d42..d8971ce07628 100644 --- a/Documentation/networking/scaling.rst +++ b/Documentation/networking/scaling.rst @@ -49,14 +49,20 @@ destination address) and TCP/UDP (source port, destination port) tuples are swapped, the computed hash is the same. This is beneficial in some applications that monitor TCP/IP flows (IDS, firewalls, ...etc) and need both directions of the flow to land on the same Rx queue (and CPU). The -"Symmetric-XOR" is a type of RSS algorithms that achieves this hash -symmetry by XORing the input source and destination fields of the IP -and/or L4 protocols. This, however, results in reduced input entropy and -could potentially be exploited. Specifically, the algorithm XORs the input +"Symmetric-XOR" and "Symmetric-OR-XOR" are types of RSS algorithms that +achieve this hash symmetry by XOR/ORing the input source and destination +fields of the IP and/or L4 protocols. This, however, results in reduced +input entropy and could potentially be exploited. + +Specifically, the "Symmetric-XOR" algorithm XORs the input as follows:: # (SRC_IP ^ DST_IP, SRC_IP ^ DST_IP, SRC_PORT ^ DST_PORT, SRC_PORT ^ DST_PORT) +The "Symmetric-OR-XOR" algorithm transforms the input as follows:: + + # (SRC_IP | DST_IP, SRC_IP ^ DST_IP, SRC_PORT | DST_PORT, SRC_PORT ^ DST_PORT) + The result is then fed to the underlying RSS algorithm. Some advanced NICs allow steering packets to queues based on diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c index 74a1e9fe1821..288bb5b2e72e 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c @@ -1808,7 +1808,7 @@ static int iavf_set_rxfh(struct net_device *netdev, static const struct ethtool_ops iavf_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USE_ADAPTIVE, - .cap_rss_sym_xor_supported = true, + .supported_input_xfrm = RXH_XFRM_SYM_XOR, .get_drvinfo = iavf_get_drvinfo, .get_link = ethtool_op_get_link, .get_ringparam = iavf_get_ringparam, diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 3072634bf049..a02ce2cea852 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -4774,7 +4774,7 @@ static const struct ethtool_ops ice_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USE_ADAPTIVE | ETHTOOL_COALESCE_RX_USECS_HIGH, - .cap_rss_sym_xor_supported = true, + .supported_input_xfrm = RXH_XFRM_SYM_XOR, .rxfh_per_ctx_key = true, .get_link_ksettings = ice_get_link_ksettings, .set_link_ksettings = ice_set_link_ksettings, diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 870994cc3ef7..0548745d1c36 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -768,8 +768,7 @@ struct kernel_ethtool_ts_info { * @cap_rss_ctx_supported: indicates if the driver supports RSS * contexts via legacy API, drivers implementing @create_rxfh_context * do not have to set this bit. - * @cap_rss_sym_xor_supported: indicates if the driver supports symmetric-xor - * RSS. + * @supported_input_xfrm: supported types of input xfrm from %RXH_XFRM_*. * @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. @@ -997,7 +996,7 @@ struct kernel_ethtool_ts_info { struct ethtool_ops { u32 cap_link_lanes_supported:1; u32 cap_rss_ctx_supported:1; - u32 cap_rss_sym_xor_supported:1; + u32 supported_input_xfrm:8; u32 rxfh_per_ctx_key:1; u32 cap_rss_rxnfc_adds:1; u32 rxfh_indir_space; diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index d1089b88efc7..2909ac3a3357 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -2269,6 +2269,10 @@ static inline int ethtool_validate_duplex(__u8 duplex) * be exploited to reduce the RSS queue spread. */ #define RXH_XFRM_SYM_XOR (1 << 0) +/* Similar to SYM_XOR, except that one copy of the XOR'ed fields is replaced by + * an OR of the same fields + */ +#define RXH_XFRM_SYM_OR_XOR (1 << 1) #define RXH_XFRM_NO_CHANGE 0xff /* L2-L4 network traffic flow types */ diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 7bb94875a7ec..3829e24f9c4c 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1005,11 +1005,11 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, if (rc) return rc; - /* Sanity check: if symmetric-xor is set, then: + /* Sanity check: if symmetric-xor/symmetric-or-xor is set, then: * 1 - no other fields besides IP src/dst and/or L4 src/dst * 2 - If src is set, dst must also be set */ - if ((rxfh.input_xfrm & RXH_XFRM_SYM_XOR) && + if ((rxfh.input_xfrm & (RXH_XFRM_SYM_XOR | RXH_XFRM_SYM_OR_XOR)) && ((info.data & ~(RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)) || (!!(info.data & RXH_IP_SRC) ^ !!(info.data & RXH_IP_DST)) || @@ -1382,11 +1382,11 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, return -EOPNOTSUPP; /* Check input data transformation capabilities */ if (rxfh.input_xfrm && rxfh.input_xfrm != RXH_XFRM_SYM_XOR && + rxfh.input_xfrm != RXH_XFRM_SYM_OR_XOR && rxfh.input_xfrm != RXH_XFRM_NO_CHANGE) return -EINVAL; if (rxfh.input_xfrm != RXH_XFRM_NO_CHANGE && - (rxfh.input_xfrm & RXH_XFRM_SYM_XOR) && - !ops->cap_rss_sym_xor_supported) + rxfh.input_xfrm & ~ops->supported_input_xfrm) return -EOPNOTSUPP; create = rxfh.rss_context == ETH_RXFH_CONTEXT_ALLOC; From patchwork Wed Feb 5 13:53:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 13961119 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (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 001C8FC0B; Wed, 5 Feb 2025 13:55:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738763715; cv=fail; b=HUx7DGvTORCNw+NHAz3juTY0MnU0NpXmCX3kemUh87RkM5F6sMQrhuE77gq1BEmX0866amZMlm3tgGOCKF3pxe4F3Ki8L1n7a71jEF44fmuDbaO0wLhpWSxxQiXjZdUhKzc0SnVei3XQu62MRVibjF7QzW1iF5LM2x9U8ABdd0c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738763715; c=relaxed/simple; bh=fM/Ynk+nja5vyIfipDE5uP6dPQuISD1Oh14diRA2qbU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uD2pMD/AT6ud5KRexOo7fvC8m7sOO/CltjZkdv0SQFRVsEZ/juk8kmeRiZREKkjJ9x/91jjtvEpZ/8Svi4MKy8o0aUcvikgGGHBIYz71RddNc8cPin6y3TSI6149IyLe77lRPsZwLh/tNKz+bzD3m20JVDMCU7+WOH3en0cg8Ak= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ULGF5RSh; arc=fail smtp.client-ip=40.107.236.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ULGF5RSh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V7ZsZ5I5YcGDUIgSl76eJDfblbTu7Y1o+9S+ZBL3O5f4HeGxscR7IzxHnYskc1KJ1y/t4DspcTZHreLfoHoLAl2MwnkbQ/0TRQCGEu3AmgB4VYQj8UzweNGG/XZ4UJku9e3Irat5a91i5IGk4kldlwV/EtA46jlDDQS+eLvyYrjCL1X5O4qszrmrmUsMolv+UKil1xyx3WDZiFqHKNT5DCeKfSqpHHhn5KsBYVkcNyx54JwNSAr7+toiNrNQRvmWExh4a8HIy2CFpFJEfd08pKqeN3jsuT6C9FnSSrfUAAM2E5FESDAAlWeKAweqNI6D0EA/RsIwnNwg3i9pdl7FoQ== 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=ca58S5zLvWbM81+SBYQ3l91t4WubQWIJWGfAy4cAPv0=; b=TUPbPjGvwI6TXvPyjMpu2zLNnivoskqjiXus6NX8RYLGKQm53FiGeKvTaDDkWg0b+qpUhWLI5YkE+B0eunh+HUfpYCfGkGOgOvmI/E0RB8sGoS+DTQ5K/IyKOOrzZ6/BfMgIgC45gZz+u3MlMfxs4ibK9EkQNHmQxV/7ncGQE1IFRnJC3wCozM71Cs9IC5ONnaQ+FrNFp3RPL4YXx1XG5bnwERHNFRfRBy2EBdM94HFRXJb6GEjt7Eg0GzIrBeEjtn1OHnzxACDV7JNwR+GrRgZujnp7xdK66+SXIO/3LLYCdFosnpUI7nZx4BlOhb3Okq2cCNANkwNGkzXzANUUpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ca58S5zLvWbM81+SBYQ3l91t4WubQWIJWGfAy4cAPv0=; b=ULGF5RShYX1wXNEiIXu3Zd4mYL5Ej5RBiE+bT7gFsYlR2IdDSVebTIlKjfbxK7Jvy1VcYTIkySmP+D/iOPigNUQ4WlX8CIRcA09VL8SFBCBcywCtqzz+R+ZHrKwfss6xnvEVxTi41HSWBt3IsoZ65rVGHvKAevBegKDr+IiY96vjt3T0O1ywNPv5wDBN+oO+19Y6C7/AOzoi1dgFV6UvKUD1iQUg+nUybf1vfTlMfpKcDeb9WgSu64/EaN4iYqEHzEaoQrCKonXBMpe6FP/kBsLKbmJflZ8R8M3/FAHdRbklTw0aViHuBwQXSjQ8hUJdWSh2QKpq10ISt3XNHoiZmA== Received: from SN4PR0501CA0040.namprd05.prod.outlook.com (2603:10b6:803:41::17) by SN7PR12MB6911.namprd12.prod.outlook.com (2603:10b6:806:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.24; Wed, 5 Feb 2025 13:54:29 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:803:41:cafe::5) by SN4PR0501CA0040.outlook.office365.com (2603:10b6:803:41::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.27 via Frontend Transport; Wed, 5 Feb 2025 13:54:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.14 via Frontend Transport; Wed, 5 Feb 2025 13:54:29 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 5 Feb 2025 05:54:06 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 5 Feb 2025 05:54:06 -0800 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 5 Feb 2025 05:54:02 -0800 From: Gal Pressman To: "David S. Miller" , Jakub Kicinski CC: , Eric Dumazet , Paolo Abeni , Simon Horman , Jonathan Corbet , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "Tariq Toukan" , Edward Cree , Ahmed Zaki , , Gal Pressman , Cosmin Ratiu Subject: [PATCH net-next v2 2/2] net/mlx5e: Symmetric OR-XOR RSS hash control Date: Wed, 5 Feb 2025 15:53:41 +0200 Message-ID: <20250205135341.542720-3-gal@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20250205135341.542720-1-gal@nvidia.com> References: <20250205135341.542720-1-gal@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C6:EE_|SN7PR12MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 184d8a33-03b9-4691-5462-08dd45ec9c6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: V04hzqVrdzcsMS+nm5IPUtrAEc07U5b3v9M+nMmlMVOdwjt9AjQKvcUD/gOiL99zetQIQbf/OIKm7OBVClCthe46iApQKpqLeo+B8nfsrLM+ZKMTYrQEgJ5OweFdr3lQiJ0kNNFT1lptxqSRdLVs/WSgqGxqRMRroS6nTdAJR4pJeBOg3QtLXnq29E3haMdqDTdfC+ewqs4VY0vJPO2XFRofFrm+UYDEY9/uFhTX1YQh6GSWUaeE/XXv70JkigltVaFl1CD4UcKb9UAs29YO/ckGWfH5PPb3MUIiLr31AJeKRhc4Nu1QVMpGigxNpemBUGPa9pzk9GcLeSr2+TpSgzQHbjl7SGYUWRv9bX5EqaXB05UccgzJbOh+Ga6nQ96Oe/2TOCzimKRtD757dLZnOoz7yrH3SF9OCV0BWL0cnFRoDNvn5wwKNHRj4H9wlgYRils4hFZTVBYvHkmelSVfnWiCP4/cHlJjwzuVpIYHT7tFmCtZnvqbhCtdL9ooD127d/dt7Ii2ngJLA6qR6YoqGB4okIR40HF5hSviqnkEMwrwMXl/m5eUIOvAf+Ni2aNKG5B2PGMFn5jpobtFR+mZdiJxUvuXAFkC7k7/uuBGGDF+D4BZF0YEtFEbHlojAwSBPPdp0+wtP/Iu4phNHltKWiouoW8jqFzyUGLMO8bn39zqpkZUINrz7hy6mtvfkneMxPLJQJ3M83SrrFbmFDUetnfVCOhvZR6WGiI/hZ5eDGwgtuVaerBkrFZt5m0IeiXCu9cf9UEVAL9Qhs2ecLsbI4GiJusHUWmqb91KPIILCb7j8nk+rT5fZYDUwbfX5DNRz/cBMjBr0QY7FZX0CTg6clZBHolgEgsBZ5/yPENVjIqQV3bwChD54HDhQtARMmNpzKs0YMPoqubQ5DUYFz+JTOp26yxoCdc8Lwx0tMTnyoSt1M77oztnh/vzqtb9YMLR8B9GKxzGevdYWiceKkNhNv+/F9NkFLPVC5u59h0en1aSQo2Lj56WZTEfIaa734JaPlAnRYYU8DH1BqDvQGQMq/p/T6QSIQC/QvXp1E2tPp6BshwlFbmDDNO4I7cRpzM0LJ6aCOkatM+34tTAAAr/vp/S9ooiVaP06W1PgxXdyyx1fAGUmf/UWN/RIyPLnGUB4/9ze42FySB7OVgkpcVg9aggF3YMO2G3c1wxoFC7o3ojcQTSS+e21zR1VKzhAEq+guqOTq2sXxxx/z7+ouLHSx9dHZtDc7fM4gLihCvi4VDvBQWJlul8hq1BMzz5AfMbTa4NqPd3jekZqOZzjEj6VVJVBH9GD5G4PfxtZbC9TztbVX//2cgIFqyelWpOFDr+l54J772vkjL5XK4QuFaF7C6QKJwI0LHnfHSSnM+ZbHDDhFuX0F3bN33QPtIZGSIf67dfxwH5sNveV45lFLwXU2ZjuTQYmB9iyFVvO5UQBxyxm9TLsCEMfg0GJ8CDsrm7L3pbEzx4miM6SLIGPTscoPxLMMrp+b6kfWkElRWBnys= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2025 13:54:29.4237 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 184d8a33-03b9-4691-5462-08dd45ec9c6d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6911 X-Patchwork-Delegate: kuba@kernel.org Allow control over the symmetric RSS hash, which was previously set to enabled by default by the driver. Symmetric OR-XOR RSS can now be queried and controlled using the 'ethtool -x/X' command. Reviewed-by: Cosmin Ratiu Reviewed-by: Tariq Toukan Signed-off-by: Gal Pressman --- .../net/ethernet/mellanox/mlx5/core/en/rss.c | 13 +++++++++++-- .../net/ethernet/mellanox/mlx5/core/en/rss.h | 4 ++-- .../net/ethernet/mellanox/mlx5/core/en/rx_res.c | 11 ++++++----- .../net/ethernet/mellanox/mlx5/core/en/rx_res.h | 5 +++-- .../net/ethernet/mellanox/mlx5/core/en/tir.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en/tir.h | 1 + .../ethernet/mellanox/mlx5/core/en_ethtool.c | 17 ++++++++++++++--- 7 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c index 5f742f896600..71a2d0835974 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c @@ -156,6 +156,7 @@ static void mlx5e_rss_params_init(struct mlx5e_rss *rss) { enum mlx5_traffic_types tt; + rss->hash.symmetric = true; rss->hash.hfunc = ETH_RSS_HASH_TOP; netdev_rss_key_fill(rss->hash.toeplitz_hash_key, sizeof(rss->hash.toeplitz_hash_key)); @@ -551,7 +552,7 @@ int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss, return final_err; } -int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc) +int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc, bool *symmetric) { if (indir) memcpy(indir, rss->indir.table, @@ -564,11 +565,14 @@ int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc) if (hfunc) *hfunc = rss->hash.hfunc; + if (symmetric) + *symmetric = rss->hash.symmetric; + return 0; } int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir, - const u8 *key, const u8 *hfunc, + const u8 *key, const u8 *hfunc, const bool *symmetric, u32 *rqns, u32 *vhca_ids, unsigned int num_rqns) { bool changed_indir = false; @@ -608,6 +612,11 @@ int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir, rss->indir.actual_table_size * sizeof(*rss->indir.table)); } + if (symmetric) { + rss->hash.symmetric = *symmetric; + changed_hash = true; + } + if (changed_indir && rss->enabled) { err = mlx5e_rss_apply(rss, rqns, vhca_ids, num_rqns); if (err) { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h index d0df98963c8d..9e4f50f194db 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h @@ -44,9 +44,9 @@ void mlx5e_rss_disable(struct mlx5e_rss *rss); int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss, struct mlx5e_packet_merge_param *pkt_merge_param); -int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc); +int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc, bool *symmetric); int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir, - const u8 *key, const u8 *hfunc, + const u8 *key, const u8 *hfunc, const bool *symmetric, u32 *rqns, u32 *vhca_ids, unsigned int num_rqns); struct mlx5e_rss_params_hash mlx5e_rss_get_hash(struct mlx5e_rss *rss); u8 mlx5e_rss_get_hash_fields(struct mlx5e_rss *rss, enum mlx5_traffic_types tt); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c index a86eade9a9e0..b64b814ee25c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c @@ -196,7 +196,7 @@ void mlx5e_rx_res_rss_set_indir_uniform(struct mlx5e_rx_res *res, unsigned int n } int mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx, - u32 *indir, u8 *key, u8 *hfunc) + u32 *indir, u8 *key, u8 *hfunc, bool *symmetric) { struct mlx5e_rss *rss; @@ -207,11 +207,12 @@ int mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx, if (!rss) return -ENOENT; - return mlx5e_rss_get_rxfh(rss, indir, key, hfunc); + return mlx5e_rss_get_rxfh(rss, indir, key, hfunc, symmetric); } int mlx5e_rx_res_rss_set_rxfh(struct mlx5e_rx_res *res, u32 rss_idx, - const u32 *indir, const u8 *key, const u8 *hfunc) + const u32 *indir, const u8 *key, const u8 *hfunc, + const bool *symmetric) { u32 *vhca_ids = get_vhca_ids(res, 0); struct mlx5e_rss *rss; @@ -223,8 +224,8 @@ int mlx5e_rx_res_rss_set_rxfh(struct mlx5e_rx_res *res, u32 rss_idx, if (!rss) return -ENOENT; - return mlx5e_rss_set_rxfh(rss, indir, key, hfunc, res->rss_rqns, vhca_ids, - res->rss_nch); + return mlx5e_rss_set_rxfh(rss, indir, key, hfunc, symmetric, + res->rss_rqns, vhca_ids, res->rss_nch); } int mlx5e_rx_res_rss_get_hash_fields(struct mlx5e_rx_res *res, u32 rss_idx, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h index 7b1a9f0f1874..c2f510a2282b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h @@ -44,9 +44,10 @@ void mlx5e_rx_res_xsk_update(struct mlx5e_rx_res *res, struct mlx5e_channels *ch /* Configuration API */ void mlx5e_rx_res_rss_set_indir_uniform(struct mlx5e_rx_res *res, unsigned int nch); int mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx, - u32 *indir, u8 *key, u8 *hfunc); + u32 *indir, u8 *key, u8 *hfunc, bool *symmetric); int mlx5e_rx_res_rss_set_rxfh(struct mlx5e_rx_res *res, u32 rss_idx, - const u32 *indir, const u8 *key, const u8 *hfunc); + const u32 *indir, const u8 *key, const u8 *hfunc, + const bool *symmetric); int mlx5e_rx_res_rss_get_hash_fields(struct mlx5e_rx_res *res, u32 rss_idx, enum mlx5_traffic_types tt); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c index 11f724ad90db..19499072f67f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c @@ -124,7 +124,7 @@ void mlx5e_tir_builder_build_rss(struct mlx5e_tir_builder *builder, const size_t len = MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key); void *rss_key = MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key); - MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); + MLX5_SET(tirc, tirc, rx_hash_symmetric, rss_hash->symmetric); memcpy(rss_key, rss_hash->toeplitz_hash_key, len); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.h index 857a84bcd53a..e8df3aaf6562 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.h @@ -9,6 +9,7 @@ struct mlx5e_rss_params_hash { u8 hfunc; u8 toeplitz_hash_key[40]; + bool symmetric; }; struct mlx5e_rss_params_traffic_type { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index cae39198b4db..2c88b65853f8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1458,18 +1458,27 @@ static int mlx5e_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param * { struct mlx5e_priv *priv = netdev_priv(netdev); u32 rss_context = rxfh->rss_context; + bool symmetric; int err; mutex_lock(&priv->state_lock); err = mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rss_context, - rxfh->indir, rxfh->key, &rxfh->hfunc); + rxfh->indir, rxfh->key, &rxfh->hfunc, &symmetric); mutex_unlock(&priv->state_lock); - return err; + + if (err) + return err; + + if (symmetric) + rxfh->input_xfrm = RXH_XFRM_SYM_OR_XOR; + + return 0; } static int mlx5e_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh, struct netlink_ext_ack *extack) { + bool symmetric = rxfh->input_xfrm == RXH_XFRM_SYM_OR_XOR; struct mlx5e_priv *priv = netdev_priv(dev); u32 *rss_context = &rxfh->rss_context; u8 hfunc = rxfh->hfunc; @@ -1504,7 +1513,8 @@ static int mlx5e_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxf err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, *rss_context, rxfh->indir, rxfh->key, - hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc); + hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc, + rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric); unlock: mutex_unlock(&priv->state_lock); @@ -2613,6 +2623,7 @@ const struct ethtool_ops mlx5e_ethtool_ops = { ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE | ETHTOOL_COALESCE_USE_CQE, + .supported_input_xfrm = RXH_XFRM_SYM_OR_XOR, .get_drvinfo = mlx5e_get_drvinfo, .get_link = ethtool_op_get_link, .get_link_ext_state = mlx5e_get_link_ext_state,