Loading arch/arm64/configs/vendor/kona_defconfig +1 −0 Original line number Diff line number Diff line Loading @@ -585,6 +585,7 @@ CONFIG_QCOM_QMI_HELPERS=y CONFIG_QCOM_QMI_RMNET=y CONFIG_QCOM_QMI_DFC=y CONFIG_RMNET_CTL=y CONFIG_RMNET_CTL_DEBUG=y CONFIG_QCOM_QMI_POWER_COLLAPSE=y CONFIG_QCOM_RPMH=y CONFIG_QCOM_SMEM=y Loading drivers/soc/qcom/dfc_qmap.c +2 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ static void dfc_qmap_send_inband_ack(struct dfc_qmi_data *dfc, skb->protocol = htons(ETH_P_MAP); skb->dev = rmnet_get_real_dev(dfc->rmnet_port); rmnet_ctl_log_debug("TXI", skb->data, skb->len); trace_dfc_qmap(skb->data, skb->len, false); dev_queue_xmit(skb); } Loading Loading @@ -433,6 +434,7 @@ static void dfc_qmap_send_end_marker_cnf(struct qos_info *qos, skb->dev = qos->real_dev; /* This cmd needs to be sent in-band */ rmnet_ctl_log_info("TXI", skb->data, skb->len); trace_dfc_qmap(skb->data, skb->len, false); rmnet_map_tx_qmap_cmd(skb); } Loading drivers/soc/qcom/rmnet_ctl/Kconfig +6 −0 Original line number Diff line number Diff line Loading @@ -10,3 +10,9 @@ menuconfig RMNET_CTL Enable the RMNET CTL module which is used for communicating with device via map command protocol. This module will receive QMAP control commands via MHI. menuconfig RMNET_CTL_DEBUG bool "RmNet Control debug" depends on RMNET_CTL help Enable RMNET CTL IPC debug loggings. drivers/soc/qcom/rmnet_ctl/rmnet_ctl_client.c +51 −0 Original line number Diff line number Diff line Loading @@ -6,8 +6,14 @@ */ #include <soc/qcom/rmnet_ctl.h> #include <linux/debugfs.h> #include <linux/ipc_logging.h> #include "rmnet_ctl_client.h" #define RMNET_CTL_LOG_PAGE 10 #define RMNET_CTL_LOG_NAME "rmnet_ctl" #define RMNET_CTL_LOG_LVL "ipc_log_lvl" struct rmnet_ctl_client { struct rmnet_ctl_client_hooks hooks; }; Loading @@ -15,14 +21,38 @@ struct rmnet_ctl_client { struct rmnet_ctl_endpoint { struct rmnet_ctl_dev __rcu *dev; struct rmnet_ctl_client __rcu *client; struct dentry *dbgfs_dir; struct dentry *dbgfs_loglvl; void *ipc_log; }; #ifdef CONFIG_RMNET_CTL_DEBUG static u8 ipc_log_lvl = RMNET_CTL_LOG_DEBUG; #else static u8 ipc_log_lvl = RMNET_CTL_LOG_ERR; #endif static DEFINE_SPINLOCK(client_lock); static struct rmnet_ctl_endpoint ctl_ep; void rmnet_ctl_endpoint_setdev(const struct rmnet_ctl_dev *dev) { rcu_assign_pointer(ctl_ep.dev, dev); if (dev) { ctl_ep.dbgfs_dir = debugfs_create_dir( RMNET_CTL_LOG_NAME, NULL); if (!IS_ERR_OR_NULL(ctl_ep.dbgfs_dir)) ctl_ep.dbgfs_loglvl = debugfs_create_u8( RMNET_CTL_LOG_LVL, 0644, ctl_ep.dbgfs_dir, &ipc_log_lvl); if (!ctl_ep.ipc_log) ctl_ep.ipc_log = ipc_log_context_create( RMNET_CTL_LOG_PAGE, RMNET_CTL_LOG_NAME, 0); } else { debugfs_remove_recursive(ctl_ep.dbgfs_dir); } } void rmnet_ctl_endpoint_post(const void *data, size_t len) Loading @@ -33,6 +63,8 @@ void rmnet_ctl_endpoint_post(const void *data, size_t len) if (unlikely(!data || !len)) return; rmnet_ctl_log_info("RX", data, len); rcu_read_lock(); client = rcu_dereference(ctl_ep.client); Loading Loading @@ -109,6 +141,8 @@ int rmnet_ctl_send_client(void *handle, struct sk_buff *skb) if (client != rcu_dereference(ctl_ep.client)) return rc; rmnet_ctl_log_info("TX", skb->data, skb->len); rcu_read_lock(); dev = rcu_dereference(ctl_ep.dev); Loading @@ -117,6 +151,23 @@ int rmnet_ctl_send_client(void *handle, struct sk_buff *skb) rcu_read_unlock(); if (rc) rmnet_ctl_log_err("TXE", rc, skb->data, skb->len); return rc; } EXPORT_SYMBOL(rmnet_ctl_send_client); void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg, int rc, const void *data, unsigned int len) { if (lvl <= ipc_log_lvl && ctl_ep.ipc_log) { if (data == NULL || len == 0) ipc_log_string(ctl_ep.ipc_log, "%3s(%d): (null)\n", msg, rc); else ipc_log_string(ctl_ep.ipc_log, "%3s(%d): %*ph\n", msg, rc, len > 32 ? 32 : len, data); } } EXPORT_SYMBOL(rmnet_ctl_log); drivers/soc/qcom/rmnet_ctl/rmnet_ctl_mhi.c +22 −3 Original line number Diff line number Diff line Loading @@ -10,9 +10,10 @@ #include <linux/of.h> #include <linux/skbuff.h> #include <linux/mhi.h> #include <soc/qcom/rmnet_ctl.h> #include "rmnet_ctl_client.h" #define RMNET_CTL_DEFAULT_MRU 1024 #define RMNET_CTL_DEFAULT_MRU 256 struct rmnet_ctl_mhi_dev { struct mhi_device *mhi_dev; Loading Loading @@ -51,6 +52,12 @@ static void rmnet_ctl_alloc_buffers(struct rmnet_ctl_mhi_dev *ctl_dev, int no_tre, i, rc; no_tre = mhi_get_no_free_descriptors(mhi_dev, DMA_FROM_DEVICE); if (!no_tre && free_buf) { kfree(free_buf); return; } for (i = 0; i < no_tre; i++) { if (free_buf) { buf = free_buf; Loading Loading @@ -79,7 +86,12 @@ static void rmnet_ctl_dl_callback(struct mhi_device *mhi_dev, { struct rmnet_ctl_mhi_dev *ctl_dev = dev_get_drvdata(&mhi_dev->dev); if (mhi_res->transaction_status || !mhi_res->buf_addr) { if (mhi_res->transaction_status == -ENOTCONN) { kfree(mhi_res->buf_addr); return; } else if (mhi_res->transaction_status || !mhi_res->buf_addr || !mhi_res->bytes_xferd) { rmnet_ctl_log_err("RXE", mhi_res->transaction_status, NULL, 0); ctl_dev->dev.stats.rx_err++; } else { ctl_dev->dev.stats.rx_pkts++; Loading @@ -98,7 +110,14 @@ static void rmnet_ctl_ul_callback(struct mhi_device *mhi_dev, struct sk_buff *skb = (struct sk_buff *)mhi_res->buf_addr; if (skb) { if (mhi_res->transaction_status) { rmnet_ctl_log_err("TXE", mhi_res->transaction_status, skb->data, skb->len); ctl_dev->dev.stats.tx_err++; } else { rmnet_ctl_log_debug("TXC", skb->data, skb->len); ctl_dev->dev.stats.tx_complete++; } kfree_skb(skb); } } Loading Loading
arch/arm64/configs/vendor/kona_defconfig +1 −0 Original line number Diff line number Diff line Loading @@ -585,6 +585,7 @@ CONFIG_QCOM_QMI_HELPERS=y CONFIG_QCOM_QMI_RMNET=y CONFIG_QCOM_QMI_DFC=y CONFIG_RMNET_CTL=y CONFIG_RMNET_CTL_DEBUG=y CONFIG_QCOM_QMI_POWER_COLLAPSE=y CONFIG_QCOM_RPMH=y CONFIG_QCOM_SMEM=y Loading
drivers/soc/qcom/dfc_qmap.c +2 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ static void dfc_qmap_send_inband_ack(struct dfc_qmi_data *dfc, skb->protocol = htons(ETH_P_MAP); skb->dev = rmnet_get_real_dev(dfc->rmnet_port); rmnet_ctl_log_debug("TXI", skb->data, skb->len); trace_dfc_qmap(skb->data, skb->len, false); dev_queue_xmit(skb); } Loading Loading @@ -433,6 +434,7 @@ static void dfc_qmap_send_end_marker_cnf(struct qos_info *qos, skb->dev = qos->real_dev; /* This cmd needs to be sent in-band */ rmnet_ctl_log_info("TXI", skb->data, skb->len); trace_dfc_qmap(skb->data, skb->len, false); rmnet_map_tx_qmap_cmd(skb); } Loading
drivers/soc/qcom/rmnet_ctl/Kconfig +6 −0 Original line number Diff line number Diff line Loading @@ -10,3 +10,9 @@ menuconfig RMNET_CTL Enable the RMNET CTL module which is used for communicating with device via map command protocol. This module will receive QMAP control commands via MHI. menuconfig RMNET_CTL_DEBUG bool "RmNet Control debug" depends on RMNET_CTL help Enable RMNET CTL IPC debug loggings.
drivers/soc/qcom/rmnet_ctl/rmnet_ctl_client.c +51 −0 Original line number Diff line number Diff line Loading @@ -6,8 +6,14 @@ */ #include <soc/qcom/rmnet_ctl.h> #include <linux/debugfs.h> #include <linux/ipc_logging.h> #include "rmnet_ctl_client.h" #define RMNET_CTL_LOG_PAGE 10 #define RMNET_CTL_LOG_NAME "rmnet_ctl" #define RMNET_CTL_LOG_LVL "ipc_log_lvl" struct rmnet_ctl_client { struct rmnet_ctl_client_hooks hooks; }; Loading @@ -15,14 +21,38 @@ struct rmnet_ctl_client { struct rmnet_ctl_endpoint { struct rmnet_ctl_dev __rcu *dev; struct rmnet_ctl_client __rcu *client; struct dentry *dbgfs_dir; struct dentry *dbgfs_loglvl; void *ipc_log; }; #ifdef CONFIG_RMNET_CTL_DEBUG static u8 ipc_log_lvl = RMNET_CTL_LOG_DEBUG; #else static u8 ipc_log_lvl = RMNET_CTL_LOG_ERR; #endif static DEFINE_SPINLOCK(client_lock); static struct rmnet_ctl_endpoint ctl_ep; void rmnet_ctl_endpoint_setdev(const struct rmnet_ctl_dev *dev) { rcu_assign_pointer(ctl_ep.dev, dev); if (dev) { ctl_ep.dbgfs_dir = debugfs_create_dir( RMNET_CTL_LOG_NAME, NULL); if (!IS_ERR_OR_NULL(ctl_ep.dbgfs_dir)) ctl_ep.dbgfs_loglvl = debugfs_create_u8( RMNET_CTL_LOG_LVL, 0644, ctl_ep.dbgfs_dir, &ipc_log_lvl); if (!ctl_ep.ipc_log) ctl_ep.ipc_log = ipc_log_context_create( RMNET_CTL_LOG_PAGE, RMNET_CTL_LOG_NAME, 0); } else { debugfs_remove_recursive(ctl_ep.dbgfs_dir); } } void rmnet_ctl_endpoint_post(const void *data, size_t len) Loading @@ -33,6 +63,8 @@ void rmnet_ctl_endpoint_post(const void *data, size_t len) if (unlikely(!data || !len)) return; rmnet_ctl_log_info("RX", data, len); rcu_read_lock(); client = rcu_dereference(ctl_ep.client); Loading Loading @@ -109,6 +141,8 @@ int rmnet_ctl_send_client(void *handle, struct sk_buff *skb) if (client != rcu_dereference(ctl_ep.client)) return rc; rmnet_ctl_log_info("TX", skb->data, skb->len); rcu_read_lock(); dev = rcu_dereference(ctl_ep.dev); Loading @@ -117,6 +151,23 @@ int rmnet_ctl_send_client(void *handle, struct sk_buff *skb) rcu_read_unlock(); if (rc) rmnet_ctl_log_err("TXE", rc, skb->data, skb->len); return rc; } EXPORT_SYMBOL(rmnet_ctl_send_client); void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg, int rc, const void *data, unsigned int len) { if (lvl <= ipc_log_lvl && ctl_ep.ipc_log) { if (data == NULL || len == 0) ipc_log_string(ctl_ep.ipc_log, "%3s(%d): (null)\n", msg, rc); else ipc_log_string(ctl_ep.ipc_log, "%3s(%d): %*ph\n", msg, rc, len > 32 ? 32 : len, data); } } EXPORT_SYMBOL(rmnet_ctl_log);
drivers/soc/qcom/rmnet_ctl/rmnet_ctl_mhi.c +22 −3 Original line number Diff line number Diff line Loading @@ -10,9 +10,10 @@ #include <linux/of.h> #include <linux/skbuff.h> #include <linux/mhi.h> #include <soc/qcom/rmnet_ctl.h> #include "rmnet_ctl_client.h" #define RMNET_CTL_DEFAULT_MRU 1024 #define RMNET_CTL_DEFAULT_MRU 256 struct rmnet_ctl_mhi_dev { struct mhi_device *mhi_dev; Loading Loading @@ -51,6 +52,12 @@ static void rmnet_ctl_alloc_buffers(struct rmnet_ctl_mhi_dev *ctl_dev, int no_tre, i, rc; no_tre = mhi_get_no_free_descriptors(mhi_dev, DMA_FROM_DEVICE); if (!no_tre && free_buf) { kfree(free_buf); return; } for (i = 0; i < no_tre; i++) { if (free_buf) { buf = free_buf; Loading Loading @@ -79,7 +86,12 @@ static void rmnet_ctl_dl_callback(struct mhi_device *mhi_dev, { struct rmnet_ctl_mhi_dev *ctl_dev = dev_get_drvdata(&mhi_dev->dev); if (mhi_res->transaction_status || !mhi_res->buf_addr) { if (mhi_res->transaction_status == -ENOTCONN) { kfree(mhi_res->buf_addr); return; } else if (mhi_res->transaction_status || !mhi_res->buf_addr || !mhi_res->bytes_xferd) { rmnet_ctl_log_err("RXE", mhi_res->transaction_status, NULL, 0); ctl_dev->dev.stats.rx_err++; } else { ctl_dev->dev.stats.rx_pkts++; Loading @@ -98,7 +110,14 @@ static void rmnet_ctl_ul_callback(struct mhi_device *mhi_dev, struct sk_buff *skb = (struct sk_buff *)mhi_res->buf_addr; if (skb) { if (mhi_res->transaction_status) { rmnet_ctl_log_err("TXE", mhi_res->transaction_status, skb->data, skb->len); ctl_dev->dev.stats.tx_err++; } else { rmnet_ctl_log_debug("TXC", skb->data, skb->len); ctl_dev->dev.stats.tx_complete++; } kfree_skb(skb); } } Loading