1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/wwan/iosm/iosm_ipc_trace.h
Sergey Ryazanov 283e6f5a81 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: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Acked-by: M Chetan Kumar <m.chetan.kumar@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-12-08 17:58:59 -08:00

74 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (C) 2020-2021 Intel Corporation.
*/
#ifndef IOSM_IPC_TRACE_H
#define IOSM_IPC_TRACE_H
#include <linux/debugfs.h>
#include <linux/relay.h>
#include "iosm_ipc_chnl_cfg.h"
#include "iosm_ipc_imem_ops.h"
/**
* enum trace_ctrl_mode - State of trace channel
* @TRACE_DISABLE: mode for disable trace
* @TRACE_ENABLE: mode for enable trace
*/
enum trace_ctrl_mode {
TRACE_DISABLE = 0,
TRACE_ENABLE,
};
/**
* struct iosm_trace - Struct for trace interface
* @ipc_rchan: Pointer to relay channel
* @ctrl_file: Pointer to trace control file
* @ipc_imem: Imem instance
* @dev: Pointer to device struct
* @channel: Channel instance
* @chl_id: Channel Indentifier
* @trc_mutex: Mutex used for read and write mode
* @mode: Mode for enable and disable trace
*/
struct iosm_trace {
struct rchan *ipc_rchan;
struct dentry *ctrl_file;
struct iosm_imem *ipc_imem;
struct device *dev;
struct ipc_mem_channel *channel;
enum ipc_channel_id chl_id;
struct mutex trc_mutex; /* Mutex used for read and write mode */
enum trace_ctrl_mode mode;
};
#ifdef CONFIG_WWAN_DEBUGFS
static inline bool ipc_is_trace_channel(struct iosm_imem *ipc_mem, u16 chl_id)
{
return ipc_mem->trace && ipc_mem->trace->chl_id == chl_id;
}
struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem);
void ipc_trace_deinit(struct iosm_trace *ipc_trace);
void ipc_trace_port_rx(struct iosm_imem *ipc_imem, struct sk_buff *skb);
#else
static inline bool ipc_is_trace_channel(struct iosm_imem *ipc_mem, u16 chl_id)
{
return false;
}
static inline void ipc_trace_port_rx(struct iosm_imem *ipc_imem,
struct sk_buff *skb)
{
dev_kfree_skb(skb);
}
#endif
#endif