Enhance observability of netconsole. Packet sends can fail. Start tracking at least two failure possibilities: ENOMEM and NET_XMIT_DROP for every target. Stats are exposed via an additional attribute in CONFIGFS. The exposed statistics allows easier debugging of cases when netconsole messages were not seen by receivers, eliminating the guesswork if the sender thinks that messages in question were sent out. Stats are not reset on enable/disable/change remote ip/etc, they belong to the netcons target itself. Reported-by: Breno Leitao <leitao@xxxxxxxxxx> Closes: https://lore.kernel.org/all/ZsWoUzyK5du9Ffl+@xxxxxxxxx/ Signed-off-by: Maksym Kutsevol <max@xxxxxxxxxxxx> --- Changelog: v4: * Rebased after https://lore.kernel.org/netdev/20241017095028.3131508-1-leitao@xxxxxxxxxx/ was merged * cc doc maintainers. * adhere to 80 columns. Learn that checkpatch defaults to 100. Okay :) v3: * https://lore.kernel.org/netdev/20240912173608.1821083-2-max@xxxxxxxxxxxx/ * cleanup the accidental slip of debugging addons. * use IS_ENABLED() instead of #ifdef. Always have stats field. v2: * https://lore.kernel.org/netdev/20240828214524.1867954-2-max@xxxxxxxxxxxx/ * fixed commit message wording and reported-by reference. * not hiding netconsole_target_stats when CONFIG_NETCONSOLE_DYNAMIC is not enabled. * rename stats attribute in configfs to transmit_errors and make it a single u64 value, which is a sum of errors that occured. * make a wrapper function to count errors instead of a return result classifier one. * use u64_stats_sync.h to manage stats. v1: * https://lore.kernel.org/netdev/20240824215130.2134153-2-max@xxxxxxxxxxxx/ --- Maksym Kutsevol (2): netpoll: Make netpoll_send_udp return status instead of void netcons: Add udp send fail statistics to netconsole Documentation/networking/netconsole.rst | 5 +-- drivers/net/netconsole.c | 61 +++++++++++++++++++++++++++++++-- include/linux/netpoll.h | 2 +- net/core/netpoll.c | 6 ++-- 4 files changed, 65 insertions(+), 9 deletions(-) --- base-commit: 03fc07a24735e0be8646563913abf5f5cb71ad19 change-id: 20241027-netcons-add-udp-send-fail-statistics-to-netconsole-dc9a5a9f9139 Best regards, -- Maksym Kutsevol <max@xxxxxxxxxxxx>