From nobody Tue Feb 10 16:44:07 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 5B705315D3E; Fri, 17 Oct 2025 06:11:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760681469; cv=none; b=dhGS7G2spmiBqCIim6uYaSEwOfn63pt+R4QGQ6A02xHfYn/gIBcQ3iZ2MiSfkzhUIGIQiZnBjJ+SoSbgV3f40Fmzq/iiba2abVDRdKwSxxZF/JMiqps6fSSzwuFTaDfSFULmcj4LM26C2qjGOqw2DtpLclubpN1JaU0S7Nk8tLg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760681469; c=relaxed/simple; bh=GHX9XGzoYHbV+efOaQPFDt79w/pWkW2XpjTN4+TYMg8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Xib1fQIpdYLdtk21zO8PQrvdAlEChyqPooMOvio+u2EDIRVaZpaK9SmzhZIUdDSorz/1u5LYSRa4hAHTQvgRZAtlBY8UpmQhwJLUr16NIqCKC2hu1YyVesUcuGekHbHkLy5Qob4JfVRU7W1Eism6TgCGVpVjSyHn/Ane8LZ0+rE= 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=j2kJmAle; arc=none smtp.client-ip=192.198.163.16 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="j2kJmAle" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760681466; x=1792217466; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=GHX9XGzoYHbV+efOaQPFDt79w/pWkW2XpjTN4+TYMg8=; b=j2kJmAlello/GvQ672WveyRFurW1j9gaUaQ0LT4JxlcccVbYT6pHOWvL lGTU0JXIm1eY91l1ysE5MQq9Vw6XytIgLwVDq7B7Pvgoeb6R+XNpcowk8 OUfLXwsrzSZ7+ixFJjuy8giqRQWs3mTP6lvqz2TjWhF06KC168qQW3Vtw WYJxm/RlUgVlTsfDUWaWja5BSUSeTrJUAlIMowg7mDOsJ1jXVQUn39Npa c6c8Y87c0v147qiqzLYwL+bDMIMeRD/z0AXHDzykA711Mgyvw90I03L80 AVUqVwku4qei6AfOpAQQdt/1wQa7UYzcB0GqnegAA1OyEMs/cDGib7QqK w==; X-CSE-ConnectionGUID: I0BKYFhFRGe9zNkmjZ/U6w== X-CSE-MsgGUID: EHgJWNwYSYethoKA61yLfg== X-IronPort-AV: E=McAfee;i="6800,10657,11584"; a="50454026" X-IronPort-AV: E=Sophos;i="6.19,234,1754982000"; d="scan'208";a="50454026" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2025 23:10:56 -0700 X-CSE-ConnectionGUID: r0y1GzCqRneTwCN+3A3jvQ== X-CSE-MsgGUID: va0MH7wJTZ6j7Id3ahhfSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,234,1754982000"; d="scan'208";a="183059517" Received: from orcnseosdtjek.jf.intel.com (HELO [10.166.28.70]) ([10.166.28.70]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2025 23:10:55 -0700 From: Jacob Keller Date: Thu, 16 Oct 2025 23:08:42 -0700 Subject: [PATCH net-next v2 13/14] ixgbe: preserve RSS indirection table across admin down/up Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-jk-iwl-next-2025-10-15-v2-13-ff3a390d9fc6@intel.com> References: <20251016-jk-iwl-next-2025-10-15-v2-0-ff3a390d9fc6@intel.com> In-Reply-To: <20251016-jk-iwl-next-2025-10-15-v2-0-ff3a390d9fc6@intel.com> To: Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Tony Nguyen , Przemek Kitszel , Andrew Lunn , Alexander Lobakin Cc: netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Keller , Kohei Enju , Rinitha S X-Mailer: b4 0.15-dev-f4b34 X-Developer-Signature: v=1; a=openpgp-sha256; l=5694; i=jacob.e.keller@intel.com; h=from:subject:message-id; bh=ODOOBdu0kAiTLa1wXdSWZWwSNB1fSPxm2XzuZqSEXgU=; b=owGbwMvMwCWWNS3WLp9f4wXjabUkhoyPd1/G8fXtWRul//V4CsckeVW9/pVPK6xfRhX5i7xku yDhlOnVUcrCIMbFICumyKLgELLyuvGEMK03znIwc1iZQIYwcHEKwET8FBn+e+/xiKvrNdeNTJ38 ONTumlylXND1L8sa3x42dxRK3DItjOGvxBXXN25xyw93yDwye3GjVubXopUMumfv/W+d216/acU mbgA= X-Developer-Key: i=jacob.e.keller@intel.com; a=openpgp; fpr=204054A9D73390562AEC431E6A965D3E6F0F28E8 From: Kohei Enju Currently, the RSS indirection table configured by user via ethtool is reinitialized to default values during interface resets (e.g., admin down/up, MTU change). As for RSS hash key, commit 3dfbfc7ebb95 ("ixgbe: Check for RSS key before setting value") made it persistent across interface resets. Adopt the same approach used in igc and igb drivers which reinitializes the RSS indirection table only when the queue count changes. Since the number of RETA entries can also change in ixgbe, let's make user configuration persistent as long as both queue count and the number of RETA entries remain unchanged. Tested on Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection. Test: Set custom indirection table and check the value after interface down/up # ethtool --set-rxfh-indir ens5 equal 2 # ethtool --show-rxfh-indir ens5 | head -5 RX flow hash indirection table for ens5 with 12 RX ring(s): 0: 0 1 0 1 0 1 0 1 8: 0 1 0 1 0 1 0 1 16: 0 1 0 1 0 1 0 1 # ip link set dev ens5 down && ip link set dev ens5 up Without patch: # ethtool --show-rxfh-indir ens5 | head -5 RX flow hash indirection table for ens5 with 12 RX ring(s): 0: 0 1 2 3 4 5 6 7 8: 8 9 10 11 0 1 2 3 16: 4 5 6 7 8 9 10 11 With patch: # ethtool --show-rxfh-indir ens5 | head -5 RX flow hash indirection table for ens5 with 12 RX ring(s): 0: 0 1 0 1 0 1 0 1 8: 0 1 0 1 0 1 0 1 16: 0 1 0 1 0 1 0 1 Signed-off-by: Kohei Enju Tested-by: Rinitha S Reviewed-by: Simon Horman Signed-off-by: Jacob Keller --- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 ++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 45 ++++++++++++++++++-----= ---- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/etherne= t/intel/ixgbe/ixgbe.h index 14d275270123..3553bf659d42 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -838,6 +838,8 @@ struct ixgbe_adapter { */ #define IXGBE_MAX_RETA_ENTRIES 512 u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES]; + u32 last_reta_entries; + u16 last_rss_indices; =20 #define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ u32 *rss_key; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/et= hernet/intel/ixgbe/ixgbe_main.c index ca1ccc630001..351b6b82fa6b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4309,9 +4309,9 @@ static void ixgbe_store_vfreta(struct ixgbe_adapter *= adapter) =20 static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) { - u32 i, j; u32 reta_entries =3D ixgbe_rss_indir_tbl_entries(adapter); u16 rss_i =3D adapter->ring_feature[RING_F_RSS].indices; + u32 i; =20 /* Program table for at least 4 queues w/ SR-IOV so that VFs can * make full use of any rings they may have. We will use the @@ -4323,14 +4323,21 @@ static void ixgbe_setup_reta(struct ixgbe_adapter *= adapter) /* Fill out hash function seeds */ ixgbe_store_key(adapter); =20 - /* Fill out redirection table */ - memset(adapter->rss_indir_tbl, 0, sizeof(adapter->rss_indir_tbl)); + /* Ensure rss_i is non-zero to avoid division by zero */ + if (!rss_i) + rss_i =3D 1; =20 - for (i =3D 0, j =3D 0; i < reta_entries; i++, j++) { - if (j =3D=3D rss_i) - j =3D 0; + /* Update redirection table in memory on first init, queue count change, + * or reta entries change, otherwise preserve user configurations. Then + * always write to hardware. + */ + if (adapter->last_rss_indices !=3D rss_i || + adapter->last_reta_entries !=3D reta_entries) { + for (i =3D 0; i < reta_entries; i++) + adapter->rss_indir_tbl[i] =3D i % rss_i; =20 - adapter->rss_indir_tbl[i] =3D j; + adapter->last_rss_indices =3D rss_i; + adapter->last_reta_entries =3D reta_entries; } =20 ixgbe_store_reta(adapter); @@ -4338,9 +4345,10 @@ static void ixgbe_setup_reta(struct ixgbe_adapter *a= dapter) =20 static void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter) { - struct ixgbe_hw *hw =3D &adapter->hw; + u32 reta_entries =3D ixgbe_rss_indir_tbl_entries(adapter); u16 rss_i =3D adapter->ring_feature[RING_F_RSS].indices; - int i, j; + struct ixgbe_hw *hw =3D &adapter->hw; + int i; =20 /* Fill out hash function seeds */ for (i =3D 0; i < 10; i++) { @@ -4352,12 +4360,21 @@ static void ixgbe_setup_vfreta(struct ixgbe_adapter= *adapter) *(adapter->rss_key + i)); } =20 - /* Fill out the redirection table */ - for (i =3D 0, j =3D 0; i < 64; i++, j++) { - if (j =3D=3D rss_i) - j =3D 0; + /* Ensure rss_i is non-zero to avoid division by zero */ + if (!rss_i) + rss_i =3D 1; =20 - adapter->rss_indir_tbl[i] =3D j; + /* Update redirection table in memory on first init, queue count change, + * or reta entries change, otherwise preserve user configurations. Then + * always write to hardware. + */ + if (adapter->last_rss_indices !=3D rss_i || + adapter->last_reta_entries !=3D reta_entries) { + for (i =3D 0; i < reta_entries; i++) + adapter->rss_indir_tbl[i] =3D i % rss_i; + + adapter->last_rss_indices =3D rss_i; + adapter->last_reta_entries =3D reta_entries; } =20 ixgbe_store_vfreta(adapter); --=20 2.51.0.rc1.197.g6d975e95c9d7