Просмотр исходного кода

rmnet_core: Enable datarmnet compilation for taro

Port and adjust code as needed to enable compilation
of rmnet_core.ko and rmnet_ctl.ko for taro.

Change-Id: I1ef4ea71115827f49dc3bd49aaf516eff91c2138
Signed-off-by: Conner Huff <[email protected]>
Conner Huff 4 лет назад
Родитель
Сommit
33c18a13cc
7 измененных файлов с 28 добавлено и 49 удалено
  1. 5 31
      core/Android.mk
  2. 4 0
      core/Kbuild
  3. 0 9
      core/Kconfig
  4. 4 3
      core/Makefile
  5. 10 1
      core/rmnet_ctl_client.c
  6. 4 5
      core/rmnet_genl.c
  7. 1 0
      datarmnet_dlkm_vendor_board.mk

+ 5 - 31
core/Android.mk

@@ -1,5 +1,6 @@
 ifneq ($(TARGET_PRODUCT),qssi)
 RMNET_CORE_DLKM_PLATFORMS_LIST := lahaina
+RMNET_CORE_DLKM_PLATFORMS_LIST += taro
 
 ifeq ($(call is-board-platform-in-list, $(RMNET_CORE_DLKM_PLATFORMS_LIST)),true)
 #Make file to create RMNET_CORE DLKM
@@ -8,51 +9,24 @@ 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_core.ko
-
-LOCAL_SRC_FILES := \
-	rmnet_config.c \
-	rmnet_descriptor.c \
-	rmnet_genl.c \
-	rmnet_handlers.c \
-	rmnet_map_command.c \
-	rmnet_map_data.c \
-	rmnet_vnd.c \
-	dfc_qmap.c \
-	dfc_qmi.c \
-	qmi_rmnet.c \
-	wda_qmi.c
-
-RMNET_BLD_DIR := ../../vendor/qcom/opensource/datarmnet/core
+LOCAL_SRC_FILES   := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
 DLKM_DIR := $(TOP)/device/qcom/common/dlkm
-
-KBUILD_OPTIONS := $(RMNET_BLD_DIR)
-
 $(warning $(DLKM_DIR))
-include $(DLKM_DIR)/AndroidKernelModule.mk
+include $(DLKM_DIR)/Build_external_kernelmodule.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
+LOCAL_SRC_FILES   := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
 DLKM_DIR := $(TOP)/device/qcom/common/dlkm
-
-KBUILD_OPTIONS := $(RMNET_BLD_DIR)
-
 $(warning $(DLKM_DIR))
-include $(DLKM_DIR)/AndroidKernelModule.mk
+include $(DLKM_DIR)/Build_external_kernelmodule.mk
 
 endif #End of Check for target
 endif #End of Check for qssi target

+ 4 - 0
core/Kbuild

@@ -1,3 +1,7 @@
+ifneq (, $(filter y, $(CONFIG_ARCH_LAHAINA) $(CONFIG_ARCH_WAIPIO)))
+ccflags-y	+= -DRMNET_LA_PLATFORM
+endif
+
 obj-m += rmnet_core.o
 obj-m += rmnet_ctl.o
 rmnet_core-y := rmnet_config.o rmnet_handlers.o rmnet_descriptor.o \

+ 0 - 9
core/Kconfig

@@ -5,7 +5,6 @@
 menuconfig RMNET_CORE
 	default m 
 	select GRO_CELLS
-	select RMNET_LA_PLATFORM
 	---help---
 	  If you select this, you will enable the RMNET module which is used
 	  for handling data in the multiplexing and aggregation protocol (MAP)
@@ -17,11 +16,3 @@ menuconfig RMNET_CTL
 	---help---
 	  Enable the RMNET CTL module which is used for handling QMAP commands
 	  for flow control purposes.
-
-config RMNET_LA_PLATFORM
-	bool "Rmnet LA Platform Setting"
-	depends on CONFIG_ARCH_LAHAINA
-	default y
-	---help---
-	  Say Y here if you want rmnet_core to be able to include android
-	  specific header file locations

+ 4 - 3
core/Makefile

@@ -9,6 +9,7 @@ else
 CCFLAGS += -m32
 endif
 
+M ?= $(shell pwd)
 #obj-m := rmnet_core.o rmnet_ctl.o
 
 rmnet_core-y += 	rmnet_config.o \
@@ -30,10 +31,10 @@ rmnet_ctl-y += 		rmnet_ctl_client.o \
 KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
 
 all:
-	$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
+	$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
 
 modules_install:
-	$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules_install
+	$(MAKE) -C $(KERNEL_SRC) M=$(M) modules_install
 
 clean:
-	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
+	$(MAKE) -C $(KERNEL_SRC) M=$(M) clean

+ 10 - 1
core/rmnet_ctl_client.c

@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
  *
  * RMNET_CTL client handlers
  *
@@ -7,6 +7,7 @@
 
 #include <linux/debugfs.h>
 #include <linux/ipc_logging.h>
+#include <linux/version.h>
 #include "rmnet_ctl.h"
 #include "rmnet_ctl_client.h"
 
@@ -47,9 +48,17 @@ void rmnet_ctl_set_dbgfs(bool enable)
 				RMNET_CTL_LOG_NAME, NULL);
 
 		if (!IS_ERR_OR_NULL(ctl_ep.dbgfs_dir))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
 			ctl_ep.dbgfs_loglvl = debugfs_create_u8(
 				RMNET_CTL_LOG_LVL, 0644, ctl_ep.dbgfs_dir,
 				&ipc_log_lvl);
+#else
+			debugfs_create_u8((const char *) RMNET_CTL_LOG_LVL,
+					  (umode_t) 0644,
+					  (struct dentry *) ctl_ep.dbgfs_dir,
+					  (u8 *) &ipc_log_lvl);
+#endif
+
 
 		if (!ctl_ep.ipc_log)
 			ctl_ep.ipc_log = ipc_log_context_create(

+ 4 - 5
core/rmnet_genl.c

@@ -8,6 +8,7 @@
 #include "rmnet_genl.h"
 #include <net/sock.h>
 #include <linux/skbuff.h>
+#include <linux/ktime.h>
 
 #define RMNET_CORE_GENL_MAX_STR_LEN	255
 
@@ -15,10 +16,8 @@
 static struct nla_policy rmnet_genl_attr_policy[RMNET_CORE_GENL_ATTR_MAX +
 						1] = {
 	[RMNET_CORE_GENL_ATTR_INT]  = { .type = NLA_S32 },
-	[RMNET_CORE_GENL_ATTR_PID_BPS] = { .type = NLA_EXACT_LEN, .len =
-				sizeof(struct rmnet_core_pid_bps_resp) },
-	[RMNET_CORE_GENL_ATTR_PID_BOOST] = { .type = NLA_EXACT_LEN, .len =
-				sizeof(struct rmnet_core_pid_boost_req) },
+	[RMNET_CORE_GENL_ATTR_PID_BPS] = NLA_POLICY_EXACT_LEN(sizeof(struct rmnet_core_pid_bps_resp)),
+	[RMNET_CORE_GENL_ATTR_PID_BOOST] = NLA_POLICY_EXACT_LEN(sizeof(struct rmnet_core_pid_boost_req)),
 	[RMNET_CORE_GENL_ATTR_STR]  = { .type = NLA_NUL_STRING, .len =
 				RMNET_CORE_GENL_MAX_STR_LEN },
 };
@@ -69,7 +68,7 @@ int rmnet_core_userspace_connected;
 
 struct rmnet_pid_node_s {
 	struct hlist_node list;
-	time_t timstamp_last_query;
+	ktime_t timstamp_last_query;
 	u64 tx_bytes;
 	u64 tx_bytes_last_query;
 	u64 tx_bps;

+ 1 - 0
datarmnet_dlkm_vendor_board.mk

@@ -1,5 +1,6 @@
 #Build rmnet core
 DATA_DLKM_BOARD_PLATFORMS_LIST := lahaina
+DATA_DLKM_BOARD_PLATFORMS_LIST += taro
 ifneq ($(TARGET_BOARD_AUTO),true)
 ifeq ($(call is-board-platform-in-list,$(DATA_DLKM_BOARD_PLATFORMS_LIST)),true)
 BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/rmnet_core.ko