forked from mirror/openwrt
Some Realtek SoCs do not expose MIB counters as simple registers. Instead, retrieving counters may require blocking operations or take longer than a normal register read. This makes the existing approach of direct reads unsuitable. The existing approach uses spin locks which forbid sleeping inside their context. But some hardware accesses methods (for example table reads) might block (sleep). To handle this, the MIB read path is redesigned with two levels of locking: * A global mutex protects updates of MIB data from the hardware. This is necessary because reads can occur both in the polling workqueue and from ethtool callbacks, also two user threads might call the ethtools callbacks. A global mutex helps to avoid parallel reads of the same hardware data. For table reads, this is not necessarily required because they are already using a table lock. But they are the reason why spin-locks can no longer be used (see above). * A per-port spinlock protects the shared memory region where per-port counters are copied. Avoids reading of half copied values in .get_stats64() As part of this change, MIB reads were removed from .get_stats64() since that callback can be started from an atomic context and must never sleep (block) in this context. A shared memory region is provided which will be updated periodically by MIB workqueue and .get_stats64() will simply return data from the shared memory. Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de> Signed-off-by: Sven Eckelmann <se@simonwunderlich.de> Link: https://github.com/openwrt/openwrt/pull/20631 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> |
||
|---|---|---|
| .. | ||
| airoha | ||
| apm821xx | ||
| armsr | ||
| at91 | ||
| ath79 | ||
| bcm27xx | ||
| bcm47xx | ||
| bcm53xx | ||
| bcm4908 | ||
| bmips | ||
| d1 | ||
| econet | ||
| gemini | ||
| generic | ||
| imx | ||
| ipq40xx | ||
| ipq806x | ||
| ixp4xx | ||
| kirkwood | ||
| lantiq | ||
| layerscape | ||
| loongarch64 | ||
| malta | ||
| mediatek | ||
| mpc85xx | ||
| mvebu | ||
| mxs | ||
| octeon | ||
| omap | ||
| pistachio | ||
| qoriq | ||
| qualcommax | ||
| qualcommbe | ||
| ramips | ||
| realtek | ||
| rockchip | ||
| sifiveu | ||
| siflower | ||
| starfive | ||
| stm32 | ||
| sunxi | ||
| tegra | ||
| uml | ||
| x86 | ||
| zynq | ||
| Makefile | ||