On Wed, Nov 29, 2023 at 02:31:53PM -0800, Jesse Brandeburg wrote:
> On 11/24/2023 3:03 AM, Simon Horman wrote:
> > On Tue, Nov 21, 2023 at 01:19:21PM -0800, Jesse Brandeburg wrote:
> >> Refactor the ice driver to use FIELD_GET() for mask and shift reads,
> >> which reduces lines of code and adds clarity of intent.
> >>
> >> This code was generated by the following coccinelle/spatch script and
> >> then manually repaired.
> >>
> >> @get@
> >> constant shift,mask;
> >> type T;
> >> expression a;
> >> @@
> >> -(((T)(a) & mask) >> shift)
> >> +FIELD_GET(mask, a)
> >>
> >> and applied via:
> >> spatch --sp-file field_prep.cocci --in-place --dir \
> >>  drivers/net/ethernet/intel/
> >>
> >> Cc: Julia Lawall <julia.law...@inria.fr>
> >> Reviewed-by: Marcin Szycik <marcin.szy...@linux.intel.com>
> >> Signed-off-by: Jesse Brandeburg <jesse.brandeb...@intel.com>
> > 
> > Reviewed-by: Simon Horman <ho...@kernel.org>
> > 
> 
> thanks for the review Simon! I wanted to note here, I found a small fix
> was needed to the code while doing further review and testing on this patch.
> 
> <pasted as quote below>
> 
> > 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.
> >          *
> 
> I'll work with Tony to get the fixes above applied before he relays the
> patch upstream as a pull request.

Thanks Jesse,

for the record this is fine by me.
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reply via email to