mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-22 06:45:03 +04:00
The legacy debugfs implementation selects private diagnostic registers by family at read time. Move these switch-wide counters into stats.c and select immutable counter descriptors through priv->r->drop_desc. Keep an explicit register offset for each of the 246 retained counters. Omit the RTL838x bridge learned-entry discard counter at 0x6a9c and the four reserved slots on RTL930x/RTL931x. All retained counters are 16-bit, so a single OTTO_DROP macro and a common read path suffice. Correct two RTL930x counter labels. Expose a read-only realtek_otto_stats/drop_counters file. Serialize register reads with reg_mutex, propagate regmap failures, and remove the debugfs interface before switch teardown. A devm action also covers resource cleanup; unavailable debugfs does not prevent switch operation. The fixed root is owned by one device and is never reused by another instance. Remove the legacy drop-counter data, reader and registrations. Other legacy debugfs features and existing MIB exports are unchanged. Assisted-by: ChatGPT (OpenAI GPT-6 Astra) Link: https://github.com/openwrt/openwrt/pull/25931 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>