diff mbox series

[iwl-next,v2,14/15] ice: cleanup inconsistent code

Message ID 20231206010114.2259388-15-jesse.brandeburg@intel.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series intel: use bitfield operations | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply, async

Commit Message

Jesse Brandeburg Dec. 6, 2023, 1:01 a.m. UTC
It was found while doing further testing of the previous commit
fbf32a9bab91 ("ice: field get conversion") that one of the FIELD_GET
conversions should really be a FIELD_PREP. The previous code was styled
as a match to the FIELD_GET conversion, which always worked because the
shift value was 0.  The code makes way more sense as a FIELD_PREP and
was in fact the only FIELD_GET with two constant arguments in this
series.

Didn't squash this patch to make it easier to call out the
(non-impactful) bug.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_dcb.c | 2 +-
 drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Pucha, HimasekharX Reddy Dec. 13, 2023, 2:57 a.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Jesse Brandeburg
> Sent: Wednesday, December 6, 2023 6:31 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Brandeburg, Jesse <jesse.brandeburg@intel.com>; Lobakin, Aleksander <aleksander.lobakin@intel.com>; marcin.szycik@linux.intel.com; horms@kernel.org; netdev@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH iwl-next v2 14/15] ice: cleanup inconsistent code
>
> It was found while doing further testing of the previous commit
> fbf32a9bab91 ("ice: field get conversion") that one of the FIELD_GET
> conversions should really be a FIELD_PREP. The previous code was styled
> as a match to the FIELD_GET conversion, which always worked because the
> shift value was 0.  The code makes way more sense as a FIELD_PREP and
> was in fact the only FIELD_GET with two constant arguments in this
> series.
>
> Didn't squash this patch to make it easier to call out the
> (non-impactful) bug.
>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_dcb.c | 2 +-
>  drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>

Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Kalesh Anakkur Purayil Dec. 13, 2023, 4:06 a.m. UTC | #2
On Wed, Dec 6, 2023 at 6:32 AM Jesse Brandeburg <jesse.brandeburg@intel.com>
wrote:

> It was found while doing further testing of the previous commit
> fbf32a9bab91 ("ice: field get conversion") that one of the FIELD_GET
> conversions should really be a FIELD_PREP. The previous code was styled
> as a match to the FIELD_GET conversion, which always worked because the
> shift value was 0.  The code makes way more sense as a FIELD_PREP and
> was in fact the only FIELD_GET with two constant arguments in this
> series.
>
> Didn't squash this patch to make it easier to call out the
> (non-impactful) bug.
>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_dcb.c | 2 +-
>  drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_dcb.c
> b/drivers/net/ethernet/intel/ice/ice_dcb.c
> index 7f3e00c187b4..74418c445cc4 100644
> --- a/drivers/net/ethernet/intel/ice/ice_dcb.c
> +++ b/drivers/net/ethernet/intel/ice/ice_dcb.c
> @@ -967,7 +967,7 @@ void ice_get_dcb_cfg_from_mib_change(struct
> ice_port_info *pi,
>
>         mib = (struct ice_aqc_lldp_get_mib *)&event->desc.params.raw;
>
> -       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
> +       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
>
[Kalesh]: I did not get what exactly changed here? Is that you just removed
one extra space before mib->type?

>         if (change_type == ICE_AQ_LLDP_MIB_REMOTE)
>                 dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg;
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c
> b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 8cdd53412748..d1c1e53fe15c 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -974,8 +974,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw,
> struct ice_vsi_ctx *ctxt)
>         /* Traffic from VSI can be sent to LAN */
>         ctxt->info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
>         /* allow all untagged/tagged packets by default on Tx */
> -       ctxt->info.inner_vlan_flags =
> FIELD_GET(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
> -
>  ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
> +       ctxt->info.inner_vlan_flags =
> FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
> +
> ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
>         /* SVM - by default bits 3 and 4 in inner_vlan_flags are 0's which
>          * results in legacy behavior (show VLAN, DEI, and UP) in
> descriptor.
>          *
> --
> 2.39.3
>
>
>
Jesse Brandeburg Dec. 13, 2023, 6:27 p.m. UTC | #3
Please don't use HTML email, your reply was likely dropped by most lists
that filter HTML.

On 12/12/2023 8:06 PM, Kalesh Anakkur Purayil wrote:
>     -       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
>     +       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
> 
> [Kalesh]: I did not get what exactly changed here? Is that you just
> removed one extra space before mib->type?

Yes, there was a whitespace change missed in the GET series. I had
caught it only here. If you feel I need to I can resend to add a comment
to the commit message that this was added here.
Kalesh Anakkur Purayil Dec. 14, 2023, 3:26 a.m. UTC | #4
On Wed, Dec 13, 2023 at 11:57 PM Jesse Brandeburg <
jesse.brandeburg@intel.com> wrote:

> Please don't use HTML email, your reply was likely dropped by most lists
> that filter HTML.
>
Sure, I will check.

>
> On 12/12/2023 8:06 PM, Kalesh Anakkur Purayil wrote:
> >     -       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
> >     +       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
> >
> > [Kalesh]: I did not get what exactly changed here? Is that you just
> > removed one extra space before mib->type?
>
> Yes, there was a whitespace change missed in the GET series. I had
> caught it only here. If you feel I need to I can resend to add a comment
> to the commit message that this was added here.
>
No need. I am good here. Thank you.
Przemek Kitszel Dec. 14, 2023, 7:16 a.m. UTC | #5
On 12/13/23 19:27, Jesse Brandeburg wrote:
> Please don't use HTML email, your reply was likely dropped by most lists
> that filter HTML.
> 
> On 12/12/2023 8:06 PM, Kalesh Anakkur Purayil wrote:
>>      -       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
>>      +       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
>>
>> [Kalesh]: I did not get what exactly changed here? Is that you just
>> removed one extra space before mib->type?
> 
> Yes, there was a whitespace change missed in the GET series. I had
> caught it only here. If you feel I need to I can resend to add a comment
> to the commit message that this was added here.
> 
> 

I guess that NOT sending next revision is our only chance to fix this
particular white space error ;)
Simon Horman Dec. 25, 2023, 9:37 a.m. UTC | #6
On Thu, Dec 14, 2023 at 08:16:38AM +0100, Przemek Kitszel wrote:
> On 12/13/23 19:27, Jesse Brandeburg wrote:
> > Please don't use HTML email, your reply was likely dropped by most lists
> > that filter HTML.
> > 
> > On 12/12/2023 8:06 PM, Kalesh Anakkur Purayil wrote:
> > >      -       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
> > >      +       change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
> > > 
> > > [Kalesh]: I did not get what exactly changed here? Is that you just
> > > removed one extra space before mib->type?
> > 
> > Yes, there was a whitespace change missed in the GET series. I had
> > caught it only here. If you feel I need to I can resend to add a comment
> > to the commit message that this was added here.
> > 
> > 
> 
> I guess that NOT sending next revision is our only chance to fix this
> particular white space error ;)

It would be nice if there was a mechanism to fix such problems.

Regardless of this side topic, this patch looks good to me,
with or without the extra space removed.

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_dcb.c b/drivers/net/ethernet/intel/ice/ice_dcb.c
index 7f3e00c187b4..74418c445cc4 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb.c
@@ -967,7 +967,7 @@  void ice_get_dcb_cfg_from_mib_change(struct ice_port_info *pi,
 
 	mib = (struct ice_aqc_lldp_get_mib *)&event->desc.params.raw;
 
-	change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
+	change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
 	if (change_type == ICE_AQ_LLDP_MIB_REMOTE)
 		dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 8cdd53412748..d1c1e53fe15c 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -974,8 +974,8 @@  static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
 	/* Traffic from VSI can be sent to LAN */
 	ctxt->info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
 	/* allow all untagged/tagged packets by default on Tx */
-	ctxt->info.inner_vlan_flags = FIELD_GET(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
-						ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
+	ctxt->info.inner_vlan_flags = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
+						 ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
 	/* SVM - by default bits 3 and 4 in inner_vlan_flags are 0's which
 	 * results in legacy behavior (show VLAN, DEI, and UP) in descriptor.
 	 *