Skip to content

Commit 10083ae

Browse files
jbrandebanguy11
authored andcommitted
ice: fix receive buffer size miscalculation
The driver is misconfiguring the hardware for some values of MTU such that it could use multiple descriptors to receive a packet when it could have simply used one. Change the driver to use a round-up instead of the result of a shift, as the shift can truncate the lower bits of the size, and result in the problem noted above. It also aligns this driver with similar code in i40e. The insidiousness of this problem is that everything works with the wrong size, it's just not working as well as it could, as some MTU sizes end up using two or more descriptors, and there is no way to tell that is happening without looking at ice_trace or a bus analyzer. Fixes: efc2214 ("ice: Add support for XDP") Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.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>
1 parent d1cdbf6 commit 10083ae

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
435435
/* Receive Packet Data Buffer Size.
436436
* The Packet Data Buffer Size is defined in 128 byte units.
437437
*/
438-
rlan_ctx.dbuf = ring->rx_buf_len >> ICE_RLAN_CTX_DBUF_S;
438+
rlan_ctx.dbuf = DIV_ROUND_UP(ring->rx_buf_len,
439+
BIT_ULL(ICE_RLAN_CTX_DBUF_S));
439440

440441
/* use 32 byte descriptors */
441442
rlan_ctx.dsize = 1;

0 commit comments

Comments
 (0)