Skip to contentSkip to conversation

net: drop_monitor: make drop_monitor built-in

PATCH In review Masahiro Yamada 1 participant 2 messages Mar 11, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: drop_monitor: make drop_monitor built-in

In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.

The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR from being 'm' when NET_DEVLINK=y.

With the planned Kconfig change that relaxes the 'imply', the combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed, causing a link error of vmlinux.

As far as I see the mainline code, NET_DROP_MONITOR=m does not provide any useful case.

The call-site of net_dm_hw_report() only exists in net/core/devlink.c, which is always built-in since NET_DEVLINK is a bool type option.

So, NET_DROP_MONITOR=m causes a build error, or creates an unused module at best.

Make NET_DROP_MONITOR a bool option, and remove the module exit code. I also unexported net_dm_hw_report because I see no other call-site in upstream.

---

This build error was reported in linux-next.
https://lkml.org/lkml/2020/3/10/1936

A less invasive change would be to change IS_ENABLED(CONFIG_NET_DROP_MONITOR) in include/net/drop_monitor.h to IS_REACHABLE(CONFIG_NET_DROP_MONITOR).

If you want to keep this modular, it is fine too.

If this patch is acceptable,
I'd like to get Ack from the maintainers,
and insert this patch before my Kconfig change.

 include/net/drop_monitor.h |  2 +-
 net/Kconfig                |  2 +-
 net/core/drop_monitor.c    | 56 ++------------------------------------
 3 files changed, 4 insertions(+), 56 deletions(-)
include/net/drop_monitor.h +1 -1
index 2ab668461463..aa775f243b61 100644
@@ -19,7 +19,7 @@ struct net_dm_hw_metadata {
 	struct net_device *input_dev;
 };
 
-#if IS_ENABLED(CONFIG_NET_DROP_MONITOR)
+#ifdef CONFIG_NET_DROP_MONITOR
 void net_dm_hw_report(struct sk_buff *skb,
 		      const struct net_dm_hw_metadata *hw_metadata);
 #else
net/Kconfig +1 -1
index 2eeb0e55f7c9..6ad5d3e95be6 100644
@@ -347,7 +347,7 @@ config NET_PKTGEN
 	  module will be called pktgen.
 
 config NET_DROP_MONITOR
-	tristate "Network packet drop alerting service"
+	bool "Network packet drop alerting service"
 	depends on INET && TRACEPOINTS
 	---help---
 	  This feature provides an alerting service to userspace in the
net/core/drop_monitor.c +2 -54

95 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw
Quoted 19 lines · Masahiro Yamada

In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.

The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR from being 'm' when NET_DEVLINK=y.

With the planned Kconfig change that relaxes the 'imply', the combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed, causing a link error of vmlinux.

As far as I see the mainline code, NET_DROP_MONITOR=m does not provide any useful case.

The call-site of net_dm_hw_report() only exists in net/core/devlink.c, which is always built-in since NET_DEVLINK is a bool type option.

So, NET_DROP_MONITOR=m causes a build error, or creates an unused module at best.

Quoted 6 lines

Make NET_DROP_MONITOR a bool option, and remove the module exit code. I also unexported net_dm_hw_report because I see no other call-site in upstream.

Sorry, I take this back.
This is probably not the right fix.

I just sent an alternative patch.
( Replace IS_ENABLE with IS_REACHABLE )

Signature · 2 lines
Best Regards
Masahiro Yamada