This patch brings in support for device trace collection. It implements relayfs interface for pushing device trace from kernel space to user space. Driver gets the debugfs base directory associated to WWAN Device and creates trace_control and trace debugfs for device tracing. Both trace_control & trace debugfs are created under /sys/kernel/debug/wwan/wwan0/. In order to collect device trace on trace0 interface, user need to write 1 to trace_ctl interface. Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
52 lines
1.3 KiB
C
52 lines
1.3 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;
|
|
};
|
|
|
|
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_trace *ipc_trace, struct sk_buff *skb);
|
|
#endif
|