mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Marcin Szycik <marcin.szycik@linux.intel.com>,
	Simon Horman <horms@kernel.org>,
	Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 6.1 54/68] ice: fix pre-shifted bit usage
Date: Tue, 16 Jan 2024 14:53:53 -0500	[thread overview]
Message-ID: <20240116195511.255854-54-sashal@kernel.org> (raw)
In-Reply-To: <20240116195511.255854-1-sashal@kernel.org>

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

[ Upstream commit 7173be21ae29ef50ada42fd4464056a9d3f55bb3 ]

While converting to FIELD_PREP() and FIELD_GET(), it was noticed that
some of the RSS defines had *included* the shift in their definitions.
This is completely outside of normal, such that a developer could easily
make a mistake and shift at the usage site (like when using
FIELD_PREP()).

Rename the defines and set them to the "pre-shifted values" so they
match the template the driver normally uses for masks and the member
bits of the mask, which also allows the driver to use FIELD_PREP
correctly with these values. Use GENMASK() for this changed MASK value.

Do the same for the VLAN EMODE defines as well.

Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h  | 10 +++++-----
 drivers/net/ethernet/intel/ice/ice_lib.c         |  3 ++-
 .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c    | 16 +++++++++++-----
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index a141680f3c1c..fe48164dce1e 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -413,10 +413,10 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_INNER_VLAN_INSERT_PVID	BIT(2)
 #define ICE_AQ_VSI_INNER_VLAN_EMODE_S		3
 #define ICE_AQ_VSI_INNER_VLAN_EMODE_M		(0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH	(0x0 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP	(0x1 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR		(0x2 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING	(0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH	0x0U
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP	0x1U
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR		0x2U
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING	0x3U
 	u8 inner_vlan_reserved2[3];
 	/* ingress egress up sections */
 	__le32 ingress_table; /* bitmap, 3 bits per up */
@@ -482,7 +482,7 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S		2
 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M		(0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S		6
-#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M		(0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M		GENMASK(7, 6)
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ		0x0U
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ	0x1U
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR		0x2U
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index f074a1cf7166..cc6c04a69b28 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -878,7 +878,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
 	 */
 	if (ice_is_dvm_ena(hw)) {
 		ctxt->info.inner_vlan_flags |=
-			ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
+			FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
+				   ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
 		ctxt->info.outer_vlan_flags =
 			(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL <<
 			 ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) &
diff --git a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
index 5b4a0abb4607..239266e9d5f1 100644
--- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
@@ -131,6 +131,7 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
 {
 	struct ice_hw *hw = &vsi->back->hw;
 	struct ice_vsi_ctx *ctxt;
+	u8 *ivf;
 	int err;
 
 	/* do not allow modifying VLAN stripping when a port VLAN is configured
@@ -143,19 +144,24 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
 	if (!ctxt)
 		return -ENOMEM;
 
+	ivf = &ctxt->info.inner_vlan_flags;
+
 	/* Here we are configuring what the VSI should do with the VLAN tag in
 	 * the Rx packet. We can either leave the tag in the packet or put it in
 	 * the Rx descriptor.
 	 */
-	if (ena)
+	if (ena) {
 		/* Strip VLAN tag from Rx packet and put it in the desc */
-		ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH;
-	else
+		*ivf = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
+				  ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH);
+	} else {
 		/* Disable stripping. Leave tag in packet */
-		ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
+		*ivf = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
+				  ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
+	}
 
 	/* Allow all packets untagged/tagged */
-	ctxt->info.inner_vlan_flags |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
+	*ivf |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
 
 	ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
 
-- 
2.43.0


  parent reply	other threads:[~2024-01-16 19:57 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 19:53 [PATCH AUTOSEL 6.1 01/68] wifi: rt2x00: restart beacon queue when hardware reset Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 02/68] selftests/bpf: satisfy compiler by having explicit return in btf test Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 03/68] selftests/bpf: Fix pyperf180 compilation failure with clang18 Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 04/68] wifi: rt2x00: correct wrong BBP register in RxDCOC calibration Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 05/68] selftests/bpf: Fix issues in setup_classid_environment() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 06/68] soc: xilinx: Fix for call trace due to the usage of smp_processor_id() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 07/68] soc: xilinx: fix unhandled SGI warning message Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 08/68] scsi: lpfc: Fix possible file string name overflow when updating firmware Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 09/68] PCI: Add no PM reset quirk for NVIDIA Spectrum devices Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 10/68] bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 11/68] net: usb: ax88179_178a: avoid two consecutive device resets Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 12/68] wifi: ieee80211: fix PV1 frame control field name Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 13/68] scsi: mpi3mr: Add PCI checks where SAS5116 diverges from SAS4116 Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 14/68] scsi: arcmsr: Support new PCI device IDs 1883 and 1886 Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 15/68] ARM: dts: imx7d: Fix coresight funnel ports Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 16/68] ARM: dts: imx7s: Fix lcdif compatible Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 17/68] ARM: dts: imx7s: Fix nand-controller #size-cells Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 18/68] wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 19/68] wifi: ath11k: fix race due to setting ATH11K_FLAG_EXT_IRQ_ENABLED too early Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 20/68] bnxt_en: Add 5760X (P7) PCI IDs Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 21/68] bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 22/68] bpf: Add map and need_defer parameters to .map_fd_put_ptr() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 23/68] bpf: Set need_defer as false when clearing fd array during map free Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 24/68] scsi: libfc: Don't schedule abort twice Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 25/68] scsi: libfc: Fix up timeout error in fc_fcp_rec_error() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 26/68] net: mvmdio: Avoid excessive sleeps in polled mode Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 27/68] net: wangxun: fix changing mac failed when running Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 28/68] bpf: Guard stack limits against 32bit overflow Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 29/68] bpf: Set uattr->batch.count as zero before batched update or deletion Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 30/68] wifi: wfx: fix possible NULL pointer dereference in wfx_set_mfp_ap() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 31/68] ARM: dts: rockchip: fix rk3036 hdmi ports node Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 32/68] ARM: dts: imx25/27-eukrea: Fix RTC node name Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 33/68] ARM: dts: imx: Use flash@0,0 pattern Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 34/68] ARM: dts: imx27: Fix sram node Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 35/68] ARM: dts: imx1: " Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 36/68] net: phy: at803x: fix passing the wrong reference for config_intr Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 37/68] ionic: pass opcode to devcmd_wait Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 38/68] ionic: bypass firmware cmds when stuck in reset Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 39/68] block/rnbd-srv: Check for unlikely string overflow Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 40/68] ARM: dts: imx25: Fix the iim compatible string Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 41/68] ARM: dts: imx25/27: Pass timing0 Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 42/68] ARM: dts: imx27-apf27dev: Fix LED name Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 43/68] ARM: dts: imx23-sansa: Use preferred i2c-gpios properties Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 44/68] ARM: dts: imx23/28: Fix the DMA controller node name Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 45/68] scsi: hisi_sas: Set .phy_attached before notifing phyup event HISI_PHYE_PHY_UP_PM Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 46/68] ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 47/68] net: atlantic: eliminate double free in error handling logic Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 48/68] net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 49/68] block: prevent an integer overflow in bvec_try_merge_hw_page Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 50/68] md: Whenassemble the array, consult the superblock of the freshest device Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 51/68] cfi: Add CFI_NOSEAL() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 52/68] arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 53/68] arm64: dts: qcom: msm8998: Fix 'out-ports' " Sasha Levin
2024-01-16 19:53 ` Sasha Levin [this message]
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 55/68] arm64: dts: amlogic: fix format for s4 uart node Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 56/68] wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 57/68] libbpf: Fix NULL pointer dereference in bpf_object__collect_prog_relos Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 58/68] wifi: rtlwifi: add calculate_bit_shift() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 59/68] wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift() Sasha Levin
2024-01-16 19:53 ` [PATCH AUTOSEL 6.1 60/68] wifi: cfg80211: free beacon_ies when overridden from hidden BSS Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 61/68] Bluetooth: qca: Set both WIDEBAND_SPEECH and LE_STATES quirks for QCA2066 Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 62/68] Bluetooth: hci_sync: fix BR/EDR wakeup bug Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 63/68] Bluetooth: L2CAP: Fix possible multiple reject send Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 64/68] net/smc: disable SEID on non-s390 archs where virtual ISM may be used Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 65/68] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 66/68] i40e: Fix VF disable behavior to block all traffic Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 67/68] octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry Sasha Levin
2024-01-16 19:54 ` [PATCH AUTOSEL 6.1 68/68] net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116195511.255854-54-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=himasekharx.reddy.pucha@intel.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.szycik@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®