Commit 283e6f5a authored by Sergey Ryazanov's avatar Sergey Ryazanov Committed by Jakub Kicinski
Browse files

net: wwan: make debugfs optional



Debugfs interface is optional for the regular modem use. Some distros
and users will want to disable this feature for security or kernel
size reasons. So add a configuration option that allows to completely
disable the debugfs interface of the WWAN devices.

A primary considered use case for this option was embedded firmwares.
For example, in OpenWrt, you can not completely disable debugfs, as a
lot of wireless stuff can only be configured and monitored with the
debugfs knobs. At the same time, reducing the size of a kernel and
modules is an essential task in the world of embedded software.
Disabling the WWAN and IOSM debugfs interfaces allows us to save 50K
(x86-64 build) of space for module storage. Not much, but already
considerable when you only have 16MB of storage.

So it is hard to just disable whole debugfs. Users need some fine
grained set of options to control which debugfs interface is important
and should be available and which is not.

The new configuration symbol is enabled by default and is hidden under
the EXPERT option. So a regular user would not be bothered by another
one configuration question. While an embedded distro maintainer will be
able to a little more reduce the final image size.

Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Acked-by: default avatarM Chetan Kumar <m.chetan.kumar@intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cf90098d
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -16,6 +16,17 @@ config WWAN

if WWAN

config WWAN_DEBUGFS
	bool "WWAN devices debugfs interface" if EXPERT
	depends on DEBUG_FS
	default y
	help
	  Enables debugfs infrastructure for the WWAN core and device drivers.

	  If this option is selected, then you can find the debug interface
	  elements for each WWAN device in a directory that is corresponding to
	  the device name: debugfs/wwan/wwanX.

config WWAN_HWSIM
	tristate "Simulated WWAN device"
	help
@@ -85,7 +96,7 @@ config IOSM
	tristate "IOSM Driver for Intel M.2 WWAN Device"
	depends on INTEL_IOMMU
	select NET_DEVLINK
	select RELAY
	select RELAY if WWAN_DEBUGFS
	help
	  This driver enables Intel M.2 WWAN Device communication.

+3 −1
Original line number Diff line number Diff line
@@ -21,7 +21,9 @@ iosm-y = \
	iosm_ipc_mux_codec.o		\
	iosm_ipc_devlink.o		\
	iosm_ipc_flash.o		\
	iosm_ipc_coredump.o		\
	iosm_ipc_coredump.o

iosm-$(CONFIG_WWAN_DEBUGFS) += \
	iosm_ipc_debugfs.o		\
	iosm_ipc_trace.o

+5 −0
Original line number Diff line number Diff line
@@ -6,7 +6,12 @@
#ifndef IOSM_IPC_DEBUGFS_H
#define IOSM_IPC_DEBUGFS_H

#ifdef CONFIG_WWAN_DEBUGFS
void ipc_debugfs_init(struct iosm_imem *ipc_imem);
void ipc_debugfs_deinit(struct iosm_imem *ipc_imem);
#else
static inline void ipc_debugfs_init(struct iosm_imem *ipc_imem) {}
static inline void ipc_debugfs_deinit(struct iosm_imem *ipc_imem) {}
#endif

#endif
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ static void ipc_imem_dl_skb_process(struct iosm_imem *ipc_imem,
			ipc_imem_sys_devlink_notify_rx(ipc_imem->ipc_devlink,
						       skb);
		else if (ipc_is_trace_channel(ipc_imem, port_id))
			ipc_trace_port_rx(ipc_imem->trace, skb);
			ipc_trace_port_rx(ipc_imem, skb);
		else
			wwan_port_rx(ipc_imem->ipc_port[port_id]->iosm_port,
				     skb);
+4 −0
Original line number Diff line number Diff line
@@ -351,7 +351,9 @@ struct iosm_imem {
	struct iosm_mux *mux;
	struct iosm_cdev *ipc_port[IPC_MEM_MAX_CHANNELS];
	struct iosm_pcie *pcie;
#ifdef CONFIG_WWAN_DEBUGFS
	struct iosm_trace *trace;
#endif
	struct device *dev;
	enum ipc_mem_device_ipc_state ipc_requested_state;
	struct ipc_mem_channel channels[IPC_MEM_MAX_CHANNELS];
@@ -381,7 +383,9 @@ struct iosm_imem {
	   ev_mux_net_transmit_pending:1,
	   reset_det_n:1,
	   pcie_wake_n:1;
#ifdef CONFIG_WWAN_DEBUGFS
	struct dentry *debugfs_dir;
#endif
};

/**
Loading