From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 9DA053B6C1B for ; Thu, 12 Mar 2026 09:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773307868; cv=none; b=e0W0JS62aQwfEId0cMehrswNp5IpZOg1UXcYCqnmQ4OKfxvm8zpbigQtt5OomgrqL0NA6s65nWViDXkx+JWOXKlj9NZPwpxM394AEEiaB+psvYv7bVrRTEa/yS5nMeFYsqyhXfoZ0RLwzVBqA0V375Tu6e8aJX1tJY2n5S7x9LI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773307868; c=relaxed/simple; bh=LFsIqutAzBuS+JuknBp9P19J4pCJ4Mbz6dWagWkuRNI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CKwhBiGmyOYzQLG3B4s8mtHZD5CTupGbYb5S9EpkMk8r7GfLayW3leblH3kLcwzeqll0kFexY/iWHGGeluf3Ar90r6H6+hbu83cLhUlFTcvafvxyxHtZADX2JY9Ey8SqbDrGFXXVcC5giaJx8oEPISlqOXgdtlQgwgJ/T7XqVW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iL5mfP+K; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iL5mfP+K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773307867; x=1804843867; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=LFsIqutAzBuS+JuknBp9P19J4pCJ4Mbz6dWagWkuRNI=; b=iL5mfP+KioZSaJK92Ak5Zb1N8X0NnNiqdnxGgypzTpNFT8KYqlTayd/Z yt1jY241vvVydBcvLe/r+GFxmOQdlbbliY0p0baZSrdXwQlApAT0Im5Ou kZtZhgREyZ0i/ha2+cO8zXkjwuPJfGbcCA3hs9ztnewZXVa3W16AMgNha 4ROxYdrDjkt+IYAIfmJ44x5UfiPBE8l0mg0fsFnIZcppHz7UyNVIWtiNh 1F5G5Q3NoKP2Do5+iy3n3sCKS/gc6GsMN2uHCy9CQ5QmNA7rM382adFcF 7zvCgPSBCi1VjjUuZQWcKqdIJgIolX14mCey8QH5PAFV+GE5xVZi9suDQ w==; X-CSE-ConnectionGUID: IPx+QWjMSOS5wb4jbEXe0Q== X-CSE-MsgGUID: ZbEzeREKRZurXUTRVVwLxQ== X-IronPort-AV: E=McAfee;i="6800,10657,11726"; a="85868902" X-IronPort-AV: E=Sophos;i="6.23,116,1770624000"; d="scan'208";a="85868902" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2026 02:31:07 -0700 X-CSE-ConnectionGUID: Vh/QX/GRQsChbLpfa6z2WQ== X-CSE-MsgGUID: THDLKwKxSj2rd7wX+UxaBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,116,1770624000"; d="scan'208";a="223230614" Received: from amlin-019-225.igk.intel.com ([10.102.19.225]) by fmviesa004.fm.intel.com with ESMTP; 12 Mar 2026 02:31:05 -0700 From: Aleksandr Loktionov To: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, anthony.l.nguyen@intel.com, aleksandr.loktionov@intel.com Subject: [PATCH iwl-next v4 2/2] ice: implement symmetric RSS hash configuration Date: Thu, 12 Mar 2026 10:31:01 +0100 Message-ID: <20260312093101.1589970-3-aleksandr.loktionov@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260312093101.1589970-1-aleksandr.loktionov@intel.com> References: <20260312093101.1589970-1-aleksandr.loktionov@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The driver advertises symmetric RSS support via supported_input_xfrm but ice_set_rxfh() always programmed plain Toeplitz regardless of the requested input_xfrm, making it impossible to actually enable symmetric hashing. Fix ice_set_rxfh() to honour rxfh->input_xfrm: program symmetric Toeplitz (ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ) when RXH_XFRM_SYM_XOR is requested, revert to plain Toeplitz when the transform is cleared, and skip the hardware write when the function has not changed. Make ice_set_rss_vsi_ctx() non-static and export it so ice_set_rxfh() can reprogram the VSI context directly. Change it to preserve vsi->rss_hfunc across VSI reinitialisation instead of always resetting to plain Toeplitz, which would silently undo any previously configured symmetric hash function. Fix ice_get_rxfh_fields() to report the hash fields actually programmed in hardware. When the hardware hashes on only one half of an L3 or L4 pair, complete the pair in the reported bitmap to satisfy the kernel's symmetry validator. For GTP flow types, report RXH_GTP_TEID honestly; ethtool_rxfh_config_is_sym() now accepts TEID as an intrinsically symmetric field (see preceding patch). Tested with tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py Signed-off-by: Aleksandr Loktionov --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 40 ++++++++++++++++---- drivers/net/ethernet/intel/ice/ice_lib.c | 7 ++-- drivers/net/ethernet/intel/ice/ice_lib.h | 1 + 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index c6bc29c..6ccfe36 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -3008,14 +3008,17 @@ ice_set_rxfh_fields(struct net_device *netdev, return 0; } +#define ICE_RSS_L3_PAIR (RXH_IP_SRC | RXH_IP_DST) +#define ICE_RSS_L4_PAIR (RXH_L4_B_0_1 | RXH_L4_B_2_3) + static int ice_get_rxfh_fields(struct net_device *netdev, struct ethtool_rxfh_fields *nfc) { struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_vsi *vsi = np->vsi; struct ice_pf *pf = vsi->back; + u64 l3, l4, hash_flds; struct device *dev; - u64 hash_flds; bool symm; u32 hdrs; @@ -3067,6 +3070,13 @@ ice_get_rxfh_fields(struct net_device *netdev, struct ethtool_rxfh_fields *nfc) hash_flds & ICE_FLOW_HASH_FLD_GTPU_DWN_TEID) nfc->data |= (u64)RXH_GTP_TEID; + l3 = nfc->data & ICE_RSS_L3_PAIR; + l4 = nfc->data & ICE_RSS_L4_PAIR; + if (l3 && l3 != ICE_RSS_L3_PAIR) + nfc->data |= ICE_RSS_L3_PAIR; + if (l4 && l4 != ICE_RSS_L4_PAIR) + nfc->data |= ICE_RSS_L4_PAIR; + return 0; } @@ -3667,7 +3677,6 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh, struct netlink_ext_ack *extack) { struct ice_netdev_priv *np = netdev_priv(netdev); - u8 hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; struct ice_vsi *vsi = np->vsi; struct ice_pf *pf = vsi->back; struct device *dev; @@ -3689,13 +3698,28 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh, return -EOPNOTSUPP; } - /* Update the VSI's hash function */ - if (rxfh->input_xfrm & RXH_XFRM_SYM_XOR) - hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ; + /* Handle RSS symmetric hash transformation */ + if (rxfh->input_xfrm != RXH_XFRM_NO_CHANGE) { + u8 new_hfunc; - err = ice_set_rss_hfunc(vsi, hfunc); - if (err) - return err; + if (rxfh->input_xfrm == RXH_XFRM_SYM_XOR) + new_hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ; + else if (!rxfh->input_xfrm) + new_hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; + else + return -EOPNOTSUPP; + + if (new_hfunc != vsi->rss_hfunc) { + err = ice_set_rss_hfunc(vsi, new_hfunc); + if (err) { + netdev_err(netdev, "Failed to set RSS hash function\n"); + return err; + } + netdev_dbg(netdev, "RSS hash function: %sToeplitz\n", + new_hfunc == ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ ? + "Symmetric " : ""); + } + } if (rxfh->key) { if (!vsi->rss_hkey_user) { diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index d921269..5b1934b 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -1155,7 +1155,7 @@ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) * @ctxt: the VSI context being set * @vsi: the VSI being configured */ -static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) +void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) { u8 lut_type, hash_type; struct device *dev; @@ -1181,8 +1181,9 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) return; } - hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; - vsi->rss_hfunc = hash_type; + if (!vsi->rss_hfunc) + vsi->rss_hfunc = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ; + hash_type = vsi->rss_hfunc; ctxt->info.q_opt_rss = FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_LUT_M, lut_type) | diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h index 49454d98..29ba335 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_lib.h @@ -46,6 +46,7 @@ void ice_vsi_delete(struct ice_vsi *vsi); int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc); int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi); +void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi); void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc); -- 2.52.0