linux/drivers/net/ethernet
Armen Ratner 8b0587a885 net/mlx5e: Preserve shared buffer capacity during headroom updates
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.

While at it, perform headroom calculations in units of cells rather than
in bytes for more accurate calculations avoiding extra divisions.

Fixes: a440030d89 ("net/mlx5e: Update shared buffer along with device buffer changes")
Signed-off-by: Armen Ratner <armeng@nvidia.com>
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Alexei Lazar <alazar@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20250820133209.389065-9-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-08-21 07:58:33 -07:00
..
3com treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
8390 treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
actions
adaptec
adi
aeroflex
agere et131x: Add missing check after DMA map 2025-07-17 19:02:55 -07:00
airoha net: airoha: ppe: Do not invalid PPE entries in case of SW hash collision 2025-08-21 11:25:11 +02:00
alacritech
allwinner
alteon
altera
amazon net: Fix typos 2025-07-25 10:29:07 -07:00
amd A treewide cleanup of struct cycle_counter const annotations: 2025-07-29 14:02:53 -07:00
apm
apple treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
aquantia net: atlantic: Rename PCI driver struct to end in _driver 2025-07-01 19:35:58 -07:00
arc
asix
atheros net: Use netif_threaded_enable instead of netif_set_threaded in drivers 2025-07-24 18:34:55 -07:00
broadcom bnxt_en: Fix lockdep warning during rmmod 2025-08-18 17:51:22 -07:00
brocade treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
cadence Revert "net: cadence: macb: sama7g5_emac: Remove USARIO CLKEN flag" 2025-08-20 19:33:42 -07:00
calxeda
cavium Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
chelsio net: Fix typos 2025-07-25 10:29:07 -07:00
cirrus
cisco Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-07-04 08:03:18 +02:00
cortina
davicom
dec net: Fix typos 2025-07-25 10:29:07 -07:00
dlink Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-06-12 10:09:10 -07:00
emulex benet: fix BUG when creating VFs 2025-08-04 17:17:31 -07:00
engleder
ezchip
faraday net: ftgmac100: fix potential NULL pointer access in ftgmac100_phy_disconnect 2025-08-05 16:00:53 -07:00
freescale net: gianfar: fix device leak when querying time stamp info 2025-07-30 18:02:47 -07:00
fujitsu
fungible
google gve: prevent ethtool ops after shutdown 2025-08-19 18:04:07 -07:00
hisilicon net: hibmcge: fix the np_link_fail error reporting issue 2025-08-08 11:48:49 -07:00
huawei net: Fix typos 2025-07-25 10:29:07 -07:00
i825xx
ibm ibmveth: Add multi buffers rx replenishment hcall support 2025-07-22 15:08:23 +02:00
intel igc: fix disabling L1.2 PCI-E link substate on I226 on init 2025-08-20 18:46:30 -07:00
litex
marvell Octeontx2-af: Skip overlap check for SPI field 2025-08-21 07:52:54 -07:00
mediatek net: ethernet: mtk_ppe: add RCU lock around dev_fill_forward_path 2025-08-19 11:25:32 +02:00
mellanox net/mlx5e: Preserve shared buffer capacity during headroom updates 2025-08-21 07:58:33 -07:00
meta eth: fbnic: Lock the tx_dropped update 2025-08-05 16:01:45 -07:00
micrel net: Fix typos 2025-07-25 10:29:07 -07:00
microchip microchip: lan865x: fix missing Timer Increment config for Rev.B0/B1 2025-08-19 19:38:25 -07:00
microsoft Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-07-24 11:10:46 -07:00
moxa
mscc
myricom treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
natsemi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
neterion net: Fix typos 2025-07-25 10:29:07 -07:00
netronome Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
ni
nvidia treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
nxp
oki-semi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
packetengines treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
pasemi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
pensando Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
qlogic Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
qualcomm net: Fix typos 2025-07-25 10:29:07 -07:00
rdc
realtek rtase: Fix Rx descriptor CRC error bit definition 2025-08-14 17:53:12 -07:00
renesas net: Use netif_threaded_enable instead of netif_set_threaded in drivers 2025-07-24 18:34:55 -07:00
rocker treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
samsung eth: sxgbe: migrate to new RXFH callbacks 2025-06-18 13:19:01 -07:00
seeq treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
sfc sfc: unfix not-a-typo in comment 2025-08-01 14:16:33 -07:00
sgi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
silan
sis treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
smsc net: Fix typos 2025-07-25 10:29:07 -07:00
socionext
stmicro net: stmmac: thead: Enable TX clock before MAC initialization 2025-08-19 18:15:53 -07:00
sun net: Fix typos 2025-07-25 10:29:07 -07:00
sunplus
synopsys treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
tehuti net: Fix typos 2025-07-25 10:29:07 -07:00
ti net: ti: icssg-prueth: Fix HSR and switch offload Enablement during firwmare reload. 2025-08-19 12:26:18 +02:00
toshiba
tundra treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
vertexcom
via
wangxun net: libwx: Fix the size in RSS hash key population 2025-08-15 12:38:53 -07:00
wiznet
xilinx net: xilinx: axienet: Fix RX skb ring management in DMAengine mode 2025-08-14 17:38:44 -07:00
xircom
xscale
Kconfig
Makefile
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
jme.c
jme.h
korina.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
lantiq_etop.c
lantiq_xrx200.c
oa_tc6.c