> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of Jacob 
> Keller
> Sent: Tuesday, February 27, 2024 5:45 AM
> To: Intel Wired LAN <[email protected]>
> Cc: Keller, Jacob E <[email protected]>; Kitszel, Przemyslaw 
> <[email protected]>; Nguyen, Anthony L <[email protected]>
> Subject: [Intel-wired-lan] [PATCH iwl-next 2/3] ice: use GENMASK instead of 
> BIT(n) - 1 in pack functions
>
> The functions used to pack the Tx and Rx context into the hardware format
> rely on using BIT() and then subtracting 1 to get a bitmask. These
> functions even have a comment about how x86 machines can't use this method
> for certain widths because the SHL instructions will not work properly.
>
> The Linux kernel already provides the GENMASK macro for generating a
> suitable bitmask. Further, GENMASK is capable of generating the mask
> including the shift_width. Since width is the total field width, take care
> to subtract one to get the final bit position.
>
> Since we now include the shifted bits as part of the mask, shift the source
> value first before applying the mask.
>
> Signed-off-by: Jacob Keller <[email protected]>
> Reviewed-by: Przemek Kitszel <[email protected]>
> ---
>  drivers/net/ethernet/intel/ice/ice_common.c | 44 ++++-----------------
>  1 file changed, 8 insertions(+), 36 deletions(-)
>

Tested-by: Pucha Himasekhar Reddy <[email protected]> (A 
Contingent worker at Intel)

Reply via email to