* [PATCH iwl-net v2] ice: fix receive buffer size miscalculation
@ 2023-08-10 23:51 Jesse Brandeburg
2023-08-13 9:03 ` Leon Romanovsky
2023-08-17 5:10 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
0 siblings, 2 replies; 3+ messages in thread
From: Jesse Brandeburg @ 2023-08-10 23:51 UTC (permalink / raw)
To: intel-wired-lan; +Cc: netdev, Jesse Brandeburg, Przemek Kitszel
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: efc2214b6047 ("ice: Add support for XDP")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
v2: added fixes tag pointing to the last time this line was modified in
v5.5 instead of pointing back to the introduction of the driver.
---
drivers/net/ethernet/intel/ice/ice_base.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index b678bdf96f3a..074bf9403cd1 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -435,7 +435,8 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
/* Receive Packet Data Buffer Size.
* The Packet Data Buffer Size is defined in 128 byte units.
*/
- rlan_ctx.dbuf = ring->rx_buf_len >> ICE_RLAN_CTX_DBUF_S;
+ rlan_ctx.dbuf = DIV_ROUND_UP(ring->rx_buf_len,
+ BIT_ULL(ICE_RLAN_CTX_DBUF_S));
/* use 32 byte descriptors */
rlan_ctx.dsize = 1;
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iwl-net v2] ice: fix receive buffer size miscalculation
2023-08-10 23:51 [PATCH iwl-net v2] ice: fix receive buffer size miscalculation Jesse Brandeburg
@ 2023-08-13 9:03 ` Leon Romanovsky
2023-08-17 5:10 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-08-13 9:03 UTC (permalink / raw)
To: Jesse Brandeburg; +Cc: intel-wired-lan, netdev, Przemek Kitszel
On Thu, Aug 10, 2023 at 04:51:10PM -0700, Jesse Brandeburg wrote:
> 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: efc2214b6047 ("ice: Add support for XDP")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> v2: added fixes tag pointing to the last time this line was modified in
> v5.5 instead of pointing back to the introduction of the driver.
> ---
> drivers/net/ethernet/intel/ice/ice_base.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-net v2] ice: fix receive buffer size miscalculation
2023-08-10 23:51 [PATCH iwl-net v2] ice: fix receive buffer size miscalculation Jesse Brandeburg
2023-08-13 9:03 ` Leon Romanovsky
@ 2023-08-17 5:10 ` Pucha, HimasekharX Reddy
1 sibling, 0 replies; 3+ messages in thread
From: Pucha, HimasekharX Reddy @ 2023-08-17 5:10 UTC (permalink / raw)
To: Brandeburg, Jesse, intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, Brandeburg, Jesse, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Jesse Brandeburg
> Sent: Friday, August 11, 2023 5:21 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Brandeburg, Jesse <jesse.brandeburg@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-net v2] 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: efc2214b6047 ("ice: Add support for XDP")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> v2: added fixes tag pointing to the last time this line was modified in
> v5.5 instead of pointing back to the introduction of the driver.
> ---
> drivers/net/ethernet/intel/ice/ice_base.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-17 5:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 23:51 [PATCH iwl-net v2] ice: fix receive buffer size miscalculation Jesse Brandeburg
2023-08-13 9:03 ` Leon Romanovsky
2023-08-17 5:10 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).