From 40712dd0bbce4222d3c2b4f77f01f28939a623ce Mon Sep 17 00:00:00 2001 From: Diogo Ferreira Date: Fri, 15 Apr 2016 18:34:08 +0100 Subject: [PATCH] Add an option to multiplex AP and STA on wlan0 This adds CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT which, when enabled, allows ap and wlan to co-exist in the same interface, as Android expects. Most of this functionality is also available (albeit not compilable broken) under CFG_TC1_FEATURE but that has larger implications around the radio and usb stack that we do not want to adopt. Change-Id: Ib1d1be40566f1bb9ccc7be45b49ec8d1f3b3ba58 Ticket: PORRIDGE-30 --- arch/arm/configs/ttab_defconfig | 1 + drivers/misc/mediatek/Kconfig | 4 ++++ .../conn_soc/common/linux/pub/wmt_chrdev_wifi.c | 10 +++++----- .../conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_init.c | 4 ++-- .../drv_wlan/mt_wifi/wlan/os/linux/gl_p2p_init.c | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/arm/configs/ttab_defconfig b/arch/arm/configs/ttab_defconfig index 9a062cb73924..f0606cf55da3 100644 --- a/arch/arm/configs/ttab_defconfig +++ b/arch/arm/configs/ttab_defconfig @@ -1178,6 +1178,7 @@ CONFIG_CUSTOM_KERNEL_SSW="ssw_single" CONFIG_MTK_HIBERNATION=y # CONFIG_CUSTOM_KERNEL_CHARGEPUMP is not set # CONFIG_MTK_TC1_FEATURE is not set +CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT=y # # Kernel Configurations diff --git a/drivers/misc/mediatek/Kconfig b/drivers/misc/mediatek/Kconfig index 30b49a86c034..2e6688b3b0f2 100644 --- a/drivers/misc/mediatek/Kconfig +++ b/drivers/misc/mediatek/Kconfig @@ -399,6 +399,10 @@ config MTK_TC1_FEATURE bool "MTK_TC1_FEATURE" default n +config MTK_COMBO_AOSP_TETHERING_SUPPORT + bool "Multiplex wlan0 for both AP and STA" + default n + source "drivers/misc/mediatek/Kconfig.kernel" source "drivers/misc/mediatek/Kconfig.drivers" source "drivers/misc/mediatek/smartpa/Kconfig" diff --git a/drivers/misc/mediatek/connectivity/conn_soc/common/linux/pub/wmt_chrdev_wifi.c b/drivers/misc/mediatek/connectivity/conn_soc/common/linux/pub/wmt_chrdev_wifi.c index 77c251f50ca2..db7b653df52f 100644 --- a/drivers/misc/mediatek/connectivity/conn_soc/common/linux/pub/wmt_chrdev_wifi.c +++ b/drivers/misc/mediatek/connectivity/conn_soc/common/linux/pub/wmt_chrdev_wifi.c @@ -62,7 +62,7 @@ UINT32 gDbgLevel = WIFI_LOG_DBG; #define WLAN_IFACE_NAME "wlan0" -#if CFG_TC1_FEATURE +#if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) #define LEGACY_IFACE_NAME "legacy0" #endif @@ -75,7 +75,7 @@ enum { static INT32 wlan_mode = WLAN_MODE_HALT; static INT32 powered = 0; static INT8 *ifname = WLAN_IFACE_NAME; -#if CFG_TC1_FEATURE +#if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) volatile INT32 wlan_if_changed = 0; EXPORT_SYMBOL(wlan_if_changed); #endif @@ -380,7 +380,7 @@ ssize_t WIFI_write(struct file *filp, const char __user *buf, size_t count, loff powered = 0; retval = count; wlan_mode = WLAN_MODE_HALT; - #if CFG_TC1_FEATURE + #if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) ifname = WLAN_IFACE_NAME; wlan_if_changed = 0; #endif @@ -538,7 +538,7 @@ ssize_t WIFI_write(struct file *filp, const char __user *buf, size_t count, loff } if (local[0] == 'S' || local[0] == 'P'){ - #if CFG_TC1_FEATURE + #if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) /* Restore NIC name to wlan0 */ rtnl_lock(); if (strcmp(ifname, WLAN_IFACE_NAME) != 0){ @@ -566,7 +566,7 @@ ssize_t WIFI_write(struct file *filp, const char __user *buf, size_t count, loff retval = count; } } else if (local[0] == 'A'){ - #if CFG_TC1_FEATURE + #if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) /* Change NIC name to legacy0, since wlan0 is used for AP */ rtnl_lock(); if (strcmp(ifname, LEGACY_IFACE_NAME) != 0){ diff --git a/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_init.c b/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_init.c index 014baa737aa9..deac41f0b3ea 100644 --- a/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_init.c +++ b/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_init.c @@ -708,7 +708,7 @@ MODULE_SUPPORTED_DEVICE(NIC_NAME); MODULE_LICENSE("GPL"); #define NIC_INF_NAME "wlan%d" /* interface name */ -#if CFG_TC1_FEATURE +#if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) #define NIC_INF_NAME_IN_AP_MODE "legacy%d" extern volatile int wlan_if_changed; #endif @@ -2308,7 +2308,7 @@ wlanNetCreate( //4 <3> Initial Glue structure //4 <3.1> Create net device -#if CFG_TC1_FEATURE +#if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) if (wlan_if_changed) { prGlueInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), NIC_INF_NAME_IN_AP_MODE, ether_setup, CFG_MAX_TXQ_NUM); } else { diff --git a/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_p2p_init.c b/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_p2p_init.c index 1817d491b53c..28684f246645 100644 --- a/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_p2p_init.c +++ b/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_p2p_init.c @@ -44,7 +44,7 @@ */ #define P2P_MODE_INF_NAME "p2p%d"; -#if CFG_TC1_FEATURE +#if CFG_TC1_FEATURE || defined(CONFIG_MTK_COMBO_AOSP_TETHERING_SUPPORT) #define AP_MODE_INF_NAME "wlan%d"; #else #define AP_MODE_INF_NAME "ap%d"; -- 2.20.1