Skip to content

Commit c323a8a

Browse files
jbrandebroxanan1996
authored andcommitted
ice: fix pre-shifted bit usage
BugLink: https://bugs.launchpad.net/bugs/2059284 [ Upstream commit 7173be2 ] 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> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent d5989d6 commit c323a8a

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ struct ice_aqc_vsi_props {
416416
#define ICE_AQ_VSI_INNER_VLAN_INSERT_PVID BIT(2)
417417
#define ICE_AQ_VSI_INNER_VLAN_EMODE_S 3
418418
#define ICE_AQ_VSI_INNER_VLAN_EMODE_M (0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
419-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH (0x0 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
420-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP (0x1 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
421-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR (0x2 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
422-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING (0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
419+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH 0x0U
420+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP 0x1U
421+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR 0x2U
422+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING 0x3U
423423
u8 inner_vlan_reserved2[3];
424424
/* ingress egress up sections */
425425
__le32 ingress_table; /* bitmap, 3 bits per up */
@@ -485,7 +485,7 @@ struct ice_aqc_vsi_props {
485485
#define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S 2
486486
#define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
487487
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_S 6
488-
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
488+
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M GENMASK(7, 6)
489489
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ 0x0U
490490
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ 0x1U
491491
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR 0x2U

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
979979
*/
980980
if (ice_is_dvm_ena(hw)) {
981981
ctxt->info.inner_vlan_flags |=
982-
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
982+
FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
983+
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
983984
ctxt->info.outer_vlan_flags =
984985
(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL <<
985986
ICE_AQ_VSI_OUTER_VLAN_TX_MODE_S) &

drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
131131
{
132132
struct ice_hw *hw = &vsi->back->hw;
133133
struct ice_vsi_ctx *ctxt;
134+
u8 *ivf;
134135
int err;
135136

136137
/* 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)
143144
if (!ctxt)
144145
return -ENOMEM;
145146

147+
ivf = &ctxt->info.inner_vlan_flags;
148+
146149
/* Here we are configuring what the VSI should do with the VLAN tag in
147150
* the Rx packet. We can either leave the tag in the packet or put it in
148151
* the Rx descriptor.
149152
*/
150-
if (ena)
153+
if (ena) {
151154
/* Strip VLAN tag from Rx packet and put it in the desc */
152-
ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH;
153-
else
155+
*ivf = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
156+
ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH);
157+
} else {
154158
/* Disable stripping. Leave tag in packet */
155-
ctxt->info.inner_vlan_flags = ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
159+
*ivf = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
160+
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
161+
}
156162

157163
/* Allow all packets untagged/tagged */
158-
ctxt->info.inner_vlan_flags |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
164+
*ivf |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
159165

160166
ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
161167

0 commit comments

Comments
 (0)