From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0390D524C2 for ; Thu, 30 Nov 2023 16:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BS/8xhH6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63175C433C8; Thu, 30 Nov 2023 16:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701361602; bh=xfaVrcCdW69x+UyIVWg5cih80tcXR5effRxP4fTm0+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BS/8xhH6Now352SAp4/IyCVYf5HHfg5Cq9YmFjrdae5NZZbodYhm+/SDm2+6xdURc z8rJlLEr0hhDOKBMUcCss0F/k2mjAHWNVIaR9wdMvypYlgRfJ7BIi3353181GUi5Dw pBeb4Jg4uO+3kvvs2jFTNdLP074S1uylf4Nk5hIGFbn7BKOXe6bylXxilvqo8nRB/g ew6cqraztT0M3gH3e5xibPR0SKs8UzNO/zIPBTWO3QoK/lYfSqn+l8o7XCpod4aQTQ nAB/xjijsk+HN07Hj07QFOZySF9z3KE6iInIJGLoqgor6IA4W+1X2gkMiz1FqsvaRh jleaTTJJKDuUw== Date: Thu, 30 Nov 2023 16:26:38 +0000 From: Simon Horman To: Jesse Brandeburg Cc: Tony Nguyen , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Julia Lawall , Marcin Szycik Subject: Re: [PATCH iwl-next v1 13/13] ice: field get conversion Message-ID: <20231130162638.GB32077@kernel.org> References: <20231121211921.19834-1-jesse.brandeburg@intel.com> <20231121211921.19834-14-jesse.brandeburg@intel.com> <20231124110335.GM50352@kernel.org> <7f2f2eaa-ab5b-461f-80ae-fce4133a2c1d@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f2f2eaa-ab5b-461f-80ae-fce4133a2c1d@intel.com> 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 > >> Reviewed-by: Marcin Szycik > >> Signed-off-by: Jesse Brandeburg > > > > Reviewed-by: Simon Horman > > > > 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. > > > > > 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.