[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <39e6aa50-5efa-425d-96ec-2146a0005441@intel.com>
Date: Wed, 20 Aug 2025 16:50:08 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Armen Ratner <armeng@...dia.com>, Mark Bloch <mbloch@...dia.com>
CC: Tariq Toukan <tariqt@...dia.com>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Andrew
Lunn" <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, "Leon
Romanovsky" <leon@...nel.org>, Saeed Mahameed <saeedm@...dia.com>,
<netdev@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Gal Pressman <gal@...dia.com>, Maher Sanalla
<msanalla@...dia.com>, Alexei Lazar <alazar@...dia.com>, Moshe Shemesh
<moshe@...dia.com>
Subject: Re: [PATCH V2 net 8/8] net/mlx5e: Preserve shared buffer capacity
during headroom updates
On 8/20/25 15:32, Mark Bloch wrote:
> From: Armen Ratner <armeng@...dia.com>
>
> When port buffer headroom changes, port_update_shared_buffer()
> recalculates the shared buffer size and splits it in a 3:1 ratio
> (lossy:lossless) - Currently, the calculation is:
> lossless = shared / 4;
> lossy = (shared / 4) * 3;
>
> Meaning, the calculation dropped the remainder of shared % 4 due to
> integer division, unintentionally reducing the total shared buffer
> by up to three cells on each update. Over time, this could shrink
> the buffer below usable size.
>
> Fix it by changing the calculation to:
> lossless = shared / 4;
> lossy = shared - lossless;
>
> This retains all buffer cells while still approximating the
> intended 3:1 split, preventing capacity loss over time.
very nice fix and a good story :)
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
>
> While at it, perform headroom calculations in units of cells rather than
> in bytes for more accurate calculations avoiding extra divisions.
nit: next time I would split that into two commits
Powered by blists - more mailing lists