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
This commit is contained in:
Diogo Ferreira
2016-04-15 18:34:08 +01:00
committed by Stricted
parent 58f3798a01
commit 40712dd0bb
5 changed files with 13 additions and 8 deletions
+1
View 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
+4
View 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"
@@ -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){
@@ -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 {
@@ -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";