linux/drivers/net/ethernet
Vladimir Oltean ec6cd79c4e net: mscc: ocelot: fix stats region batching
[ Upstream commit 6acc72a43e ]

The blamed commit changed struct ocelot_stat_layout :: "u32 offset" to
"u32 reg".

However, "u32 reg" is not quite a register address, but an enum
ocelot_reg, which in itself encodes an enum ocelot_target target in the
upper bits, and an index into the ocelot->map[target][] array in the
lower bits.

So, whereas the previous code comparison between stats_layout[i].offset
and last + 1 was correct (because those "offsets" at the time were
32-bit relative addresses), the new code, comparing layout[i].reg to
last + 4 is not correct, because the "reg" here is an enum/index, not an
actual register address.

What we want to compare are indeed register addresses, but to do that,
we need to actually go through the same motions as
__ocelot_bulk_read_ix() itself.

With this bug, all statistics counters are deemed by
ocelot_prepare_stats_regions() as constituting their own region.
(Truncated) log on VSC9959 (Felix) below (prints added by me):

Before:

region of 1 contiguous counters starting with SYS:STAT:CNT[0x000]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x001]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x002]
...
region of 1 contiguous counters starting with SYS:STAT:CNT[0x041]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x042]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x080]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x081]
...
region of 1 contiguous counters starting with SYS:STAT:CNT[0x0ac]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x100]
region of 1 contiguous counters starting with SYS:STAT:CNT[0x101]
...
region of 1 contiguous counters starting with SYS:STAT:CNT[0x111]

After:

region of 67 contiguous counters starting with SYS:STAT:CNT[0x000]
region of 45 contiguous counters starting with SYS:STAT:CNT[0x080]
region of 18 contiguous counters starting with SYS:STAT:CNT[0x100]

Since commit d87b1c08f3 ("net: mscc: ocelot: use bulk reads for
stats") intended bulking as a performance improvement, and since now,
with trivial-sized regions, performance is even worse than without
bulking at all, this could easily qualify as a performance regression.

Fixes: d4c3676507 ("net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Colin Foster <colin.foster@in-advantage.com>
Tested-by: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-06 12:10:37 +02:00
..
3com
8390
actions
adaptec
adi net: ethernet: adi: adin1110: Fix multicast offloading 2023-02-01 08:34:45 +01:00
aeroflex ethernet: aeroflex: fix potential skb leak in greth_init_rings() 2022-12-07 11:45:52 +01:00
agere
alacritech
allwinner
alteon
altera net: altera_tse: release phylink resources in tse_shutdown() 2022-11-24 09:34:43 +01:00
amazon net: ena: Update NUMA TPH hint register upon NUMA node update 2023-01-12 12:02:19 +01:00
amd amd-xgbe: Delay AN timeout during KR training 2023-02-01 08:34:10 +01:00
apm drivers: net: xgene: disable napi when register irq failed in xgene_enet_open() 2022-11-08 15:15:55 +01:00
apple net: apple: bmac: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:27 +01:00
aquantia net: atlantic: Fix crash when XDP is enabled but no program is loaded 2023-03-22 13:33:50 +01:00
arc
asix
atheros net: ag71xx: call phylink_disconnect_phy if ag71xx_hw_enable() fail in ag71xx_open() 2022-11-15 20:22:12 -08:00
broadcom bnxt_en: Avoid order-5 memory allocation for TPA data 2023-03-17 08:50:25 +01:00
brocade
cadence net: macb: Perform zynqmp dynamic configuration only for SGMII interface 2023-02-14 19:11:44 +01:00
calxeda
cavium net: thunderx: Fix missing destroy_workqueue of nicvf_rx_mode_wq 2022-12-06 12:41:46 +01:00
chelsio cxgb4vf: shut down the adapter when t4vf_update_port_info() failed in cxgb4vf_open() 2022-11-09 19:30:30 -08:00
cirrus
cisco
cortina
davicom net: dm9051: Fix missing dev_kfree_skb() in dm9051_loop_rx() 2022-11-23 12:43:14 +00:00
dec
dlink
emulex
engleder tsnep: Fix TX queue stop/wake for multiple queues 2023-02-01 08:34:48 +01:00
ezchip
faraday
freescale dpaa2-eth: execute xdp_do_flush() before napi_complete_done() 2023-02-09 11:28:05 +01:00
fujitsu
fungible
google gve: Cache link_speed value from device 2023-03-30 12:49:11 +02:00
hisilicon net: hns3: fix wrong use of rss size during VF rss config 2023-01-18 11:58:32 +01:00
huawei net: hinic: Fix error handling in hinic_module_init() 2022-11-11 19:57:37 -08:00
i825xx i825xx: sni_82596: use eth_hw_addr_set() 2023-03-22 13:33:50 +01:00
ibm ibmveth: Reduce default tx queues to 8 2022-11-08 17:46:24 -08:00
intel igb: revert rtnl_lock() that causes deadlock 2023-03-30 12:49:23 +02:00
litex
marvell octeontx2-vf: Add missing free for alloc_percpu 2023-03-30 12:49:07 +02:00
mediatek net: ethernet: mtk_eth_soc: fix RX data corruption issue 2023-03-17 08:50:26 +01:00
mellanox mlxsw: spectrum_fid: Fix incorrect local port type 2023-03-30 12:49:09 +02:00
micrel net: ksz884x: fix missing pci_disable_device() on error in pcidev_init() 2022-10-25 19:46:35 -07:00
microchip net: lan966x: Fix port police support using tc-matchall 2023-03-17 08:50:23 +01:00
microsoft net: mana: Fix IRQ name - add PCI and queue number 2023-02-01 08:34:42 +01:00
moxa
mscc net: mscc: ocelot: fix stats region batching 2023-04-06 12:10:37 +02:00
myricom myri10ge: Fix an error handling path in myri10ge_probe() 2022-12-31 13:32:56 +01:00
natsemi net/sonic: use dma_mapping_error() for error check 2023-03-30 12:49:09 +02:00
neterion ethernet: s2io: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:26 +01:00
netronome nfp: ethtool: fix the bug of setting unsupported port speed 2023-02-25 11:25:41 +01:00
ni net: ethernet: nixge: fix NULL dereference 2022-11-28 11:09:51 +00:00
nvidia
nxp
oki-semi net: pch_gbe: fix pci device refcount leak while module exiting 2022-11-18 19:40:14 -08:00
packetengines
pasemi
pensando ionic: missed doorbell workaround 2023-02-14 19:11:44 +01:00
qlogic qed/qed_sriov: guard against NULL derefs from qed_iov_get_vf_info 2023-03-30 12:49:04 +02:00
qualcomm net: qcom/emac: Fix use after free bug in emac_remove due to race condition 2023-03-30 12:49:06 +02:00
rdc r6040: Fix kmemleak in probe and remove 2022-12-31 13:32:54 +01:00
realtek r8169: fix dmar pte write access is not set error 2023-01-24 07:24:31 +01:00
renesas sh_eth: avoid PHY being resumed when interface is not up 2023-03-22 13:33:50 +01:00
rocker treewide: use get_random_bytes() when possible 2022-10-11 17:42:58 -06:00
samsung
seeq
sfc sfc: correctly advertise tunneled IPv6 segmentation 2023-02-09 11:28:05 +01:00
sgi
silan
sis
smsc
socionext net: ethernet: ave: Fix MAC to be in charge of PHY PM 2022-10-26 20:21:34 -07:00
stmicro net: stmmac: Fix for mismatched host/device DMA address width 2023-03-30 12:49:05 +02:00
sun ethernet: sun: add check for the mdesc_grab() 2023-03-22 13:33:51 +01:00
sunplus eth: sp7021: drop free_netdev() from spl2sw_init_netdev() 2022-11-10 16:27:33 -08:00
synopsys
tehuti
ti net: ethernet: ti: am65-cpsw/cpts: Fix CPTS release action 2023-04-06 12:10:35 +02:00
toshiba net/ps3_gelic_net: Use dma_mapping_error 2023-03-30 12:49:07 +02:00
tundra ethernet: tundra: free irq when alloc ring failed in tsi108_open() 2022-11-10 15:39:08 +01:00
vertexcom
via
wangxun
wiznet
xilinx net: emaclite: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:27 +01:00
xircom xirc2ps_cs: Fix use after free bug in xirc2ps_detach 2023-03-30 12:49:04 +02:00
xscale
dnet.c net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:27 +01:00
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c
jme.h
Kconfig
korina.c
lantiq_etop.c net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY 2022-10-24 13:02:18 +01:00
lantiq_xrx200.c
Makefile