diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2024-02-26 16:14:55 -0800 |
---|---|---|
committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2024-03-04 10:26:57 -0800 |
commit | a45d1bf516c097bb7ae4983d3128ebf139be952c (patch) | |
tree | f330139f9f25346f51c2862c376a126a5b7a433f /drivers/net/ethernet/intel/ice/ice_lib.c | |
parent | 1260b45dbe2dbc415f3bc1e841c6c098083bcfb8 (diff) |
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 <jacob.e.keller@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@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>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_lib.c')
0 files changed, 0 insertions, 0 deletions