Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a88e586 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

rmnet_ctl: Support IPA EP



Support QMAP commands from dedicated IPA EP.

Change-Id: Ic5e489d2b33223b2af2fb471d20611bc5a0d7d58
Acked-by: default avatarWeiyi Chen <weiyic@qti.qualcomm.com>
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 5fd6051c
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -33,5 +33,26 @@ KBUILD_OPTIONS := $(RMNET_BLD_DIR)
$(warning $(DLKM_DIR))
include $(DLKM_DIR)/AndroidKernelModule.mk

######## Create RMNET_CTL DLKM ########
include $(CLEAR_VARS)

LOCAL_CFLAGS := -Wno-macro-redefined -Wno-unused-function -Wall -Werror
LOCAL_CLANG :=true

LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
LOCAL_MODULE := rmnet_ctl.ko

LOCAL_SRC_FILES := \
	rmnet_ctl_client.c \
	rmnet_ctl_ipa.c

RMNET_BLD_DIR := ../../vendor/qcom/opensource/datarmnet/core
DLKM_DIR := $(TOP)/device/qcom/common/dlkm

KBUILD_OPTIONS := $(RMNET_BLD_DIR)

$(warning $(DLKM_DIR))
include $(DLKM_DIR)/AndroidKernelModule.mk

endif #End of Check for target
endif #End of Check for qssi target
+2 −0
Original line number Diff line number Diff line
obj-m += rmnet_core.o
obj-m += rmnet_ctl.o
rmnet_core-y := rmnet_config.o rmnet_handlers.o rmnet_descriptor.o \
	rmnet_genl.o rmnet_map_command.o rmnet_map_data.o rmnet_vnd.o\
	qmi_rmnet.o wda_qmi.o dfc_qmi.o dfc_qmap.o
rmnet_ctl-y := rmnet_ctl_client.o rmnet_ctl_ipa.o

+6 −0
Original line number Diff line number Diff line
@@ -10,3 +10,9 @@ menuconfig RMNET_CORE
	  for handling data in the multiplexing and aggregation protocol (MAP)
	  format in the embedded data path. RMNET devices can be attached to
	  any IP mode physical device.

menuconfig RMNET_CTL
	default m
	---help---
	  Enable the RMNET CTL module which is used for handling QMAP commands
	  for flow control purposes.
+2 −0
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@

#include <linux/skbuff.h>

#define CONFIG_RMNET_CTL 1

enum rmnet_ctl_log_lvl {
	RMNET_CTL_LOG_CRIT,
	RMNET_CTL_LOG_ERR,
+44 −15
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ struct rmnet_ctl_endpoint {
	void *ipc_log;
};

#if defined(CONFIG_IPA_DEBUG) || defined(CONFIG_MHI_DEBUG)
#define CONFIG_RMNET_CTL_DEBUG 1
#endif

#ifdef CONFIG_RMNET_CTL_DEBUG
static u8 ipc_log_lvl = RMNET_CTL_LOG_DEBUG;
#else
@@ -35,13 +39,13 @@ static u8 ipc_log_lvl = RMNET_CTL_LOG_ERR;
static DEFINE_SPINLOCK(client_lock);
static struct rmnet_ctl_endpoint ctl_ep;

void rmnet_ctl_endpoint_setdev(const struct rmnet_ctl_dev *dev)
void rmnet_ctl_set_dbgfs(bool enable)
{
	rcu_assign_pointer(ctl_ep.dev, dev);

	if (dev) {
	if (enable) {
		if (IS_ERR_OR_NULL(ctl_ep.dbgfs_dir))
			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,
@@ -52,9 +56,18 @@ void rmnet_ctl_endpoint_setdev(const struct rmnet_ctl_dev *dev)
				RMNET_CTL_LOG_PAGE, RMNET_CTL_LOG_NAME, 0);
	} else {
		debugfs_remove_recursive(ctl_ep.dbgfs_dir);
		ipc_log_context_destroy(ctl_ep.ipc_log);
		ctl_ep.dbgfs_dir = NULL;
		ctl_ep.dbgfs_loglvl = NULL;
		ctl_ep.ipc_log = NULL;
	}
}

void rmnet_ctl_endpoint_setdev(const struct rmnet_ctl_dev *dev)
{
	rcu_assign_pointer(ctl_ep.dev, dev);
}

void rmnet_ctl_endpoint_post(const void *data, size_t len)
{
	struct rmnet_ctl_client *client;
@@ -63,12 +76,27 @@ void rmnet_ctl_endpoint_post(const void *data, size_t len)
	if (unlikely(!data || !len))
		return;

	rmnet_ctl_log_info("RX", data, len);
	if (len == 0xFFFFFFFF) {
		skb = (struct sk_buff *)data;
		rmnet_ctl_log_info("RX", skb->data, skb->len);

		rcu_read_lock();

		client = rcu_dereference(ctl_ep.client);
		if (client && client->hooks.ctl_dl_client_hook) {
			skb->protocol = htons(ETH_P_MAP);
			client->hooks.ctl_dl_client_hook(skb);
		} else {
			kfree(skb);
		}

		rcu_read_unlock();
	} else {
		rmnet_ctl_log_info("RX", data, len);

		rcu_read_lock();

		client = rcu_dereference(ctl_ep.client);
		if (client && client->hooks.ctl_dl_client_hook) {
			skb = alloc_skb(len, GFP_ATOMIC);
			if (skb) {
@@ -80,6 +108,7 @@ void rmnet_ctl_endpoint_post(const void *data, size_t len)

		rcu_read_unlock();
	}
}

void *rmnet_ctl_register_client(struct rmnet_ctl_client_hooks *hook)
{
Loading