net: wwan: t7xx: Add port for modem logging
PATCH v2 1/1 net: wwan: t7xx: Add port for modem logging
From: Moises Veleta <[email protected]>
The Modem Logging (MDL) port provides an interface to collect modem logs for debugging purposes. MDL is supported by the relay interface, and the mtk_t7xx port infrastructure. MDL allows user-space apps to control logging via mbim command and to collect logs via the relay interface, while port infrastructure facilitates communication between the driver and the modem.
--
v2
* Removed debugfs control port.
* Initialize in Notify function upon handshake completion.
* Remove trace write function, MBIM will send commands.
--- drivers/net/wwan/Kconfig | 1 + drivers/net/wwan/t7xx/Makefile | 3 + drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 2 + drivers/net/wwan/t7xx/t7xx_port.h | 5 ++ drivers/net/wwan/t7xx/t7xx_port_proxy.c | 12 +++ drivers/net/wwan/t7xx/t7xx_port_proxy.h | 4 + drivers/net/wwan/t7xx/t7xx_port_trace.c | 112 ++++++++++++++++++++++++ 7 files changed, 139 insertions(+) create mode 100644 drivers/net/wwan/t7xx/t7xx_port_trace.c
drivers/net/wwan/Kconfig +1 -0
@@ -108,6 +108,7 @@ config IOSM config MTK_T7XX tristate "MediaTek PCIe 5G WWAN modem T7xx device" depends on PCI + select RELAY if WWAN_DEBUGFS help Enables MediaTek PCIe based 5G WWAN modem (T7xx series) device. Adapts WWAN framework and provides network interface like wwan0
drivers/net/wwan/t7xx/Makefile +3 -0
@@ -18,3 +18,6 @@ mtk_t7xx-y:= t7xx_pci.o \ t7xx_hif_dpmaif_rx.o \ t7xx_dpmaif.o \ t7xx_netdev.o + +mtk_t7xx-$(CONFIG_WWAN_DEBUGFS) += \ + t7xx_port_trace.o \
drivers/net/wwan/t7xx/t7xx_hif_cldma.c +2 -0
@@ -1018,6 +1018,8 @@ static int t7xx_cldma_late_init(struct cldma_ctrl *md_ctrl)dev_err (md_ctrl->dev,"control TX ring init fail\n" ); goto err_free_tx_ring; } + + md_ctrl->tx_ring[i].pkt_size =CLDMA_MTU ; }for (j =0 ; j <CLDMA_RXQ_NUM ; j++) {
drivers/net/wwan/t7xx/t7xx_port.h +5 -0
@@ -122,6 +122,11 @@ struct t7xx_port {int rx_length_th;bool chan_enable;struct task_struct *thread; +#ifdef CONFIG_WWAN_DEBUGFS +void *relaych; +struct dentry *debugfs_dir; +struct dentry *debugfs_wwan_dir; +#endif };struct sk_buff *t7xx_port_alloc_skb (int payload);
drivers/net/wwan/t7xx/t7xx_port_proxy.c +12 -0
@@ -70,6 +70,18 @@ static const struct t7xx_port_conf t7xx_md_port_conf[] = { .name = "MBIM", .port_type = WWAN_PORT_MBIM, }, { +#ifdef CONFIG_WWAN_DEBUGFS + .tx_ch = PORT_CH_MD_LOG_TX, + .rx_ch = PORT_CH_MD_LOG_RX, + .txq_index = 7, + .rxq_index = 7, + .txq_exp_index = 7, + .rxq_exp_index = 7, + .path_id = CLDMA_ID_MD, + .ops = &t7xx_trace_port_ops, + .name = "mdlog", + }, { +#endif .tx_ch = PORT_CH_CONTROL_TX, .rx_ch = PORT_CH_CONTROL_RX, .txq_index = Q_IDX_CTRL,
drivers/net/wwan/t7xx/t7xx_port_proxy.h +4 -0
@@ -87,6 +87,10 @@ struct ctrl_msg_header {extern struct port_ops wwan_sub_port_ops;extern struct port_ops ctl_port_ops; +#ifdef CONFIG_WWAN_DEBUGFS +extern struct port_ops t7xx_trace_port_ops; +#endif +void t7xx_port_proxy_reset (struct port_proxy *port_prox);void t7xx_port_proxy_uninit (struct port_proxy *port_prox);int t7xx_port_proxy_init (struct t7xx_modem *md);
drivers/net/wwan/t7xx/t7xx_port_trace.c new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 30 lines · On Fri, 30 Sept 2022 at 15:55, <[email protected]> wrote:
From: Moises Veleta <[email protected]>
The Modem Logging (MDL) port provides an interface to collect modem logs for debugging purposes. MDL is supported by the relay interface, and the
mtk_t7xxport infrastructure. MDL allows user-space apps to control logging via mbim command and to collect logs via the relay interface, while port infrastructure facilitates communication between the driver and the modem.Signed-off-by Moises Veleta <[email protected]>Signed-off-by M Chetan Kumar <[email protected]>Signed-off-by Devegowda Chandrashekar <[email protected]>Acked-by Ricardo Martinez <[email protected]>--
v2
* Removed debugfs control port.
* Initialize in Notify function upon handshake completion.
* Remove trace write function, MBIM will send commands.--- drivers/net/wwan/Kconfig | 1 + drivers/net/wwan/t7xx/Makefile | 3 + drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 2 + drivers/net/wwan/t7xx/t7xx_port.h | 5 ++ drivers/net/wwan/t7xx/t7xx_port_proxy.c | 12 +++ drivers/net/wwan/t7xx/t7xx_port_proxy.h | 4 + drivers/net/wwan/t7xx/t7xx_port_trace.c | 112 ++++++++++++++++++++++++ 7 files changed, 139 insertions(+) create mode 100644 drivers/net/wwan/t7xx/t7xx_port_trace.c
[...]
drivers/net/wwan/t7xx/t7xx_port_trace.c line 85
Quoted 11 lines
drivers/net/wwan/t7xx/t7xx_port_trace.c new file +11
-0+ +static void t7xx_port_trace_md_state_notify (struct t7xx_port *port,unsigned int state) +{ +struct rchan *relaych; + +if (state !=MD_STATE_READY || port->relaych) +return ; + + port->debugfs_wwan_dir =wwan_get_debugfs_dir (port->dev); +if (IS_ERR (port->debugfs_wwan_dir)) + port->debugfs_wwan_dir =NULL ;
Why continuing here despite the error? Is it a possible valid scenario?
drivers/net/wwan/t7xx/t7xx_port_trace.c line 89
Quoted 4 lines
drivers/net/wwan/t7xx/t7xx_port_trace.c new file +4
-0+ + port->debugfs_dir =debugfs_create_dir (KBUILD_MODNAME , port->debugfs_wwan_dir); +if (IS_ERR_OR_NULL (port->debugfs_dir)) { +wwan_put_debugfs_dir (port->debugfs_wwan_dir);
port->debugfs_wwan_dir can be NULL here...
Quoted 5 lines
drivers/net/wwan/t7xx/t7xx_port_trace.c new file +5
-0+dev_err (port->dev,"Unable to create debugfs for trace" ); +return ; + } + + relaych = relay_open("relay_ch", port->debugfs_dir, T7XX_TRC_SUB_BUFF_SIZE,
drivers/net/wwan/t7xx/t7xx_port_trace.c line 104
Quoted 10 lines
drivers/net/wwan/t7xx/t7xx_port_trace.c new file +10
-0+ T7XX_TRC_N_SUB_BUFF, &relay_callbacks, NULL); +if (!relaych) + goto err_rm_debugfs_dir; + + port->relaych = relaych; +return ; + +err_rm_debugfs_dir: +debugfs_remove_recursive (port->debugfs_dir); +wwan_put_debugfs_dir (port->debugfs_wwan_dir);
same here.
Quoted 11 lines
drivers/net/wwan/t7xx/t7xx_port_trace.c new file +8
-1+dev_err (port->dev,"Unable to create trace port %s" , port->port_conf->name); +} + +struct port_ops t7xx_trace_port_ops = { + .recv_skb = t7xx_trace_port_recv_skb, + .uninit = t7xx_trace_port_uninit, + .md_state_notify = t7xx_port_trace_md_state_notify, +}; --2.34.1