Add an option to multiplex AP and STA on wlan0
authorDiogo Ferreira <defer@cyngn.com>
Fri, 15 Apr 2016 17:34:08 +0000 (18:34 +0100)
committerStricted <info@stricted.net>
Mon, 19 Mar 2018 16:28:48 +0000 (17:28 +0100)
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
drivers/misc/mediatek/Kconfig
drivers/misc/mediatek/connectivity/conn_soc/common/linux/pub/wmt_chrdev_wifi.c
drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_init.c
drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/gl_p2p_init.c

index 9a062cb73924e4c3d1c9467b3e314d108bafce65..f0606cf55da3b81279729fe6c54b43ed3bf37c3d 100644 (file)
@@ -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
index 30b49a86c034d473fa79336b5fd9462207818a23..2e6688b3b0f27148730a9513905a76ffaf88fec7 100644 (file)
@@ -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"
index 77c251f50ca2e6a181914ad763e6464b97fe1696..db7b653df52f89842e9594584dc34fbaf1077993 100644 (file)
@@ -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){
index 014baa737aa93811fe33fb007708fba864246f5f..deac41f0b3ea562bb7a27aa4132482422c285145 100644 (file)
@@ -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 {
index 1817d491b53c8df581213d4de3c3fd7d53f46329..28684f24664590e4053c7ea6299e158d5234fa98 100644 (file)
@@ -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";