Skip to content

Commit 7173be2

Browse files
jbrandebanguy11
authored andcommitted
ice: fix pre-shifted bit usage
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>
1 parent 23eca34 commit 7173be2

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
@@ -422,10 +422,10 @@ struct ice_aqc_vsi_props {
422422
#define ICE_AQ_VSI_INNER_VLAN_INSERT_PVID BIT(2)
423423
#define ICE_AQ_VSI_INNER_VLAN_EMODE_S 3
424424
#define ICE_AQ_VSI_INNER_VLAN_EMODE_M (0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
425-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH (0x0 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
426-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP (0x1 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
427-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR (0x2 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
428-
#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING (0x3 << ICE_AQ_VSI_INNER_VLAN_EMODE_S)
425+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH 0x0U
426+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP 0x1U
427+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR 0x2U
428+
#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING 0x3U
429429
u8 inner_vlan_reserved2[3];
430430
/* ingress egress up sections */
431431
__le32 ingress_table; /* bitmap, 3 bits per up */
@@ -491,7 +491,7 @@ struct ice_aqc_vsi_props {
491491
#define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S 2
492492
#define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
493493
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_S 6
494-
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
494+
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M GENMASK(7, 6)
495495
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ 0x0U
496496
#define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ 0x1U
497497
#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
@@ -984,7 +984,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
984984
*/
985985
if (ice_is_dvm_ena(hw)) {
986986
ctxt->info.inner_vlan_flags |=
987-
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
987+
FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
988+
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
988989
ctxt->info.outer_vlan_flags =
989990
FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M,
990991
ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL);

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)