aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcmdhd/wl_android.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/bcmdhd/wl_android.c')
-rw-r--r--drivers/net/wireless/bcmdhd/wl_android.c1880
1 files changed, 1508 insertions, 372 deletions
diff --git a/drivers/net/wireless/bcmdhd/wl_android.c b/drivers/net/wireless/bcmdhd/wl_android.c
index 3232e3b..7ac8f56 100644
--- a/drivers/net/wireless/bcmdhd/wl_android.c
+++ b/drivers/net/wireless/bcmdhd/wl_android.c
@@ -1,7 +1,7 @@
/*
* Linux cfg80211 driver - Android related functions
*
- * Copyright (C) 1999-2012, Broadcom Corporation
+ * Copyright (C) 1999-2014, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
@@ -21,11 +21,12 @@
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: wl_android.c 390499 2013-03-12 11:38:47Z $
+ * $Id: wl_android.c 459882 2014-03-05 07:26:15Z $
*/
#include <linux/module.h>
#include <linux/netdevice.h>
+#include <net/netlink.h>
#include <wl_android.h>
#include <wldev_common.h>
@@ -35,18 +36,14 @@
#include <dhd_dbg.h>
#include <dngl_stats.h>
#include <dhd.h>
+#include <proto/bcmip.h>
+#ifdef PNO_SUPPORT
+#include <dhd_pno.h>
+#endif
#include <bcmsdbus.h>
#ifdef WL_CFG80211
#include <wl_cfg80211.h>
#endif
-#if defined(CONFIG_WIFI_CONTROL_FUNC)
-#include <linux/platform_device.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
-#include <linux/wlan_plat.h>
-#else
-#include <linux/wifi_tiwlan.h>
-#endif
-#endif /* CONFIG_WIFI_CONTROL_FUNC */
/*
* Android private command strings, PLEASE define new private commands here
@@ -76,16 +73,22 @@
#define CMD_P2P_SET_NOA "P2P_SET_NOA"
#if !defined WL_ENABLE_P2P_IF
#define CMD_P2P_GET_NOA "P2P_GET_NOA"
-#endif
+#endif /* WL_ENABLE_P2P_IF */
#define CMD_P2P_SD_OFFLOAD "P2P_SD_"
#define CMD_P2P_SET_PS "P2P_SET_PS"
#define CMD_SET_AP_WPS_P2P_IE "SET_AP_WPS_P2P_IE"
-#define CMD_SETROAMMODE "SETROAMMODE"
+#define CMD_SETROAMMODE "SETROAMMODE"
+#define CMD_SETIBSSBEACONOUIDATA "SETIBSSBEACONOUIDATA"
+#define CMD_MIRACAST "MIRACAST"
+
+#if defined(WL_SUPPORT_AUTO_CHANNEL)
+#define CMD_GET_BEST_CHANNELS "GET_BEST_CHANNELS"
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
#ifdef CUSTOMER_HW4
-#ifdef SUPPORT_AUTO_CHANNEL
+#ifdef WL_SUPPORT_AUTO_CHANNEL
#define CMD_SET_HAPD_AUTO_CHANNEL "HAPD_AUTO_CHANNEL"
-#endif /* SUPPORT_AUTO_CHANNEL */
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
#ifdef SUPPORT_HIDDEN_AP
/* Hostapd private command */
#define CMD_SET_HAPD_MAX_NUM_STA "HAPD_MAX_NUM_STA"
@@ -96,12 +99,25 @@
#define CMD_HAPD_STA_DISASSOC "HAPD_STA_DISASSOC"
#endif /* SUPPORT_SOFTAP_SINGL_DISASSOC */
#ifdef SUPPORT_SET_LPC
-#define CMD_HAPD_LPC_ENABLED "HAPD_LPC_ENABLED"
+#define CMD_HAPD_LPC_ENABLED "HAPD_LPC_ENABLED"
#endif /* SUPPORT_SET_LPC */
#ifdef SUPPORT_TRIGGER_HANG_EVENT
#define CMD_TEST_FORCE_HANG "TEST_FORCE_HANG"
#endif /* SUPPORT_TRIGGER_HANG_EVENT */
+#ifdef SUPPORT_LTECX
+#define CMD_LTECX_SET "LTECOEX"
+#endif /* SUPPORT_LTECX */
+#ifdef TEST_TX_POWER_CONTROL
+#define CMD_TEST_SET_TX_POWER "TEST_SET_TX_POWER"
+#define CMD_TEST_GET_TX_POWER "TEST_GET_TX_POWER"
+#endif /* TEST_TX_POWER_CONTROL */
+#define CMD_SARLIMIT_TX_CONTROL "SET_TX_POWER_CALLING"
#endif /* CUSTOMER_HW4 */
+#ifdef WLFBT
+#define CMD_GET_FTKEY "GET_FTKEY"
+#endif
+#define CMD_KEEP_ALIVE "KEEPALIVE"
+
/* CCX Private Commands */
#ifdef BCMCCX
@@ -115,27 +131,25 @@
#define CMD_PNOSETUP_SET "PNOSETUP "
#define CMD_PNOENABLE_SET "PNOFORCE"
#define CMD_PNODEBUG_SET "PNODEBUG"
-
-#define PNO_TLV_PREFIX 'S'
-#define PNO_TLV_VERSION '1'
-#define PNO_TLV_SUBVERSION '2'
-#define PNO_TLV_RESERVED '0'
-#define PNO_TLV_TYPE_SSID_IE 'S'
-#define PNO_TLV_TYPE_TIME 'T'
-#define PNO_TLV_FREQ_REPEAT 'R'
-#define PNO_TLV_FREQ_EXPO_MAX 'M'
-
-typedef struct cmd_tlv {
- char prefix;
- char version;
- char subver;
- char reserved;
-} cmd_tlv_t;
+#define CMD_WLS_BATCHING "WLS_BATCHING"
#endif /* PNO_SUPPORT */
#define CMD_OKC_SET_PMK "SET_PMK"
#define CMD_OKC_ENABLE "OKC_ENABLE"
+#define CMD_HAPD_MAC_FILTER "HAPD_MAC_FILTER"
+/* hostap mac mode */
+#define MACLIST_MODE_DISABLED 0
+#define MACLIST_MODE_DENY 1
+#define MACLIST_MODE_ALLOW 2
+
+/* max number of assoc list */
+#define MAX_NUM_OF_ASSOCLIST 64
+
+/* max number of mac filter list
+ * restrict max number to 10 as maximum cmd string size is 255
+ */
+#define MAX_NUM_MAC_FILT 10
#ifdef CUSTOMER_HW4
@@ -201,15 +215,82 @@ typedef struct android_wifi_af_params {
#define CMD_AMPDU_MPDU "AMPDU_MPDU"
#endif /* SUPPORT_AMPDU_MPDU_CMD */
-#define CMD_CHANGE_RL "CHANGE_RL"
+#define CMD_CHANGE_RL "CHANGE_RL"
#define CMD_RESTORE_RL "RESTORE_RL"
+
+#define CMD_SET_RMC_ENABLE "SETRMCENABLE"
+#define CMD_SET_RMC_TXRATE "SETRMCTXRATE"
+#define CMD_SET_RMC_ACTPERIOD "SETRMCACTIONPERIOD"
+#define CMD_SET_RMC_IDLEPERIOD "SETRMCIDLEPERIOD"
+
+#define CMD_SET_SCSCAN "SETSINGLEANT"
+#define CMD_GET_SCSCAN "GETSINGLEANT"
+
#endif /* CUSTOMER_HW4 */
+
+#ifdef WLAIBSS
+#define CMD_SETIBSSTXFAILEVENT "SETIBSSTXFAILEVENT"
+#define CMD_GET_IBSS_PEER_INFO "GETIBSSPEERINFO"
+#define CMD_GET_IBSS_PEER_INFO_ALL "GETIBSSPEERINFOALL"
+#define CMD_SETIBSSROUTETABLE "SETIBSSROUTETABLE"
+#define CMD_SETIBSSAMPDU "SETIBSSAMPDU"
+#endif /* WLAIBSS */
+
+#define CMD_ROAM_OFFLOAD "SETROAMOFFLOAD"
+
+/* miracast related definition */
+#define MIRACAST_MODE_OFF 0
+#define MIRACAST_MODE_SOURCE 1
+#define MIRACAST_MODE_SINK 2
+
+#ifndef MIRACAST_AMPDU_SIZE
+#define MIRACAST_AMPDU_SIZE 8
+#endif
+
+#ifndef MIRACAST_MCHAN_ALGO
+#define MIRACAST_MCHAN_ALGO 1
+#endif
+
+#ifndef MIRACAST_MCHAN_BW
+#define MIRACAST_MCHAN_BW 25
+#endif
+
+static LIST_HEAD(miracast_resume_list);
+static u8 miracast_cur_mode;
+
+struct io_cfg {
+ s8 *iovar;
+ s32 param;
+ u32 ioctl;
+ void *arg;
+ u32 len;
+ struct list_head list;
+};
+
typedef struct android_wifi_priv_cmd {
- char *buf;
+#ifdef CONFIG_64BIT
+ u64 bufaddr;
+#else
+ char *bufaddr;
+#endif
int used_len;
int total_len;
} android_wifi_priv_cmd;
+#if defined(BCMFW_ROAM_ENABLE)
+#define CMD_SET_ROAMPREF "SET_ROAMPREF"
+
+#define MAX_NUM_SUITES 10
+#define WIDTH_AKM_SUITE 8
+#define JOIN_PREF_RSSI_LEN 0x02
+#define JOIN_PREF_RSSI_SIZE 4 /* RSSI pref header size in bytes */
+#define JOIN_PREF_WPA_HDR_SIZE 4 /* WPA pref header size in bytes */
+#define JOIN_PREF_WPA_TUPLE_SIZE 12 /* Tuple size in bytes */
+#define JOIN_PREF_MAX_WPA_TUPLES 16
+#define MAX_BUF_SIZE (JOIN_PREF_RSSI_SIZE + JOIN_PREF_WPA_HDR_SIZE + \
+ (JOIN_PREF_WPA_TUPLE_SIZE * JOIN_PREF_MAX_WPA_TUPLES))
+#endif /* BCMFW_ROAM_ENABLE */
+
#ifdef WL_GENL
static s32 wl_genl_handle_msg(struct sk_buff *skb, struct genl_info *info);
static int wl_genl_init(void);
@@ -253,16 +334,14 @@ static struct genl_multicast_group wl_genl_mcast = {
/**
* Extern function declarations (TODO: move them to dhd_linux.h)
*/
-void dhd_customer_gpio_wlan_ctrl(int onoff);
-int dhd_dev_reset(struct net_device *dev, uint8 flag);
+int dhd_net_bus_devreset(struct net_device *dev, uint8 flag);
int dhd_dev_init_ioctl(struct net_device *dev);
#ifdef WL_CFG80211
int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr);
-int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command);
+int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, dhd_pub_t *dhd, char *command);
#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
int wl_cfg80211_set_wes_mode(int mode);
int wl_cfg80211_get_wes_mode(void);
-int wl_cfg80211_get_ioctl_version(void);
#endif
#else
int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr)
@@ -274,12 +353,6 @@ int wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len)
int wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len)
{ return 0; }
#endif /* WK_CFG80211 */
-extern int dhd_os_check_if_up(void *dhdp);
-extern void *bcmsdh_get_drvdata(void);
-#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
-extern int dhd_wlfc_init(dhd_pub_t *dhd);
-extern void dhd_wlfc_deinit(dhd_pub_t *dhd);
-#endif
#if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
/* wl_roam.c */
@@ -289,6 +362,9 @@ extern int get_roamscan_channel_list(struct net_device *dev, unsigned char chann
extern int set_roamscan_channel_list(struct net_device *dev, unsigned char n,
unsigned char channels[], int ioctl_ver);
#endif
+#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
+extern void wl_update_roamscan_cache_by_band(struct net_device *dev, int band);
+#endif
#ifdef ENABLE_4335BT_WAR
extern int bcm_bt_lock(int cookie);
@@ -301,9 +377,6 @@ extern bool ap_fw_loaded;
extern char iface_name[IFNAMSIZ];
#endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */
-#ifndef WIFI_TURNOFF_DELAY
-#define WIFI_TURNOFF_DELAY 0
-#endif
/**
* Local (static) functions and variables
*/
@@ -580,7 +653,7 @@ int wl_android_set_country_rev(
DHD_ERROR(("%s: set country '%s/%d' failed code %d\n",
__FUNCTION__, cspec.ccode, cspec.rev, error));
} else {
- dhd_bus_country_set(dev, &cspec);
+ dhd_bus_country_set(dev, &cspec, true);
DHD_INFO(("%s: set country '%s/%d'\n",
__FUNCTION__, cspec.ccode, cspec.rev));
}
@@ -1063,7 +1136,118 @@ int wl_android_set_okc_mode(struct net_device *dev, char *command, int total_len
#endif /* WES_SUPPORT */
#endif /* CUSTOMER_HW4 */
-#if defined(PNO_SUPPORT) && !defined(WL_SCHED_SCAN)
+#ifdef PNO_SUPPORT
+#define PNO_PARAM_SIZE 50
+#define VALUE_SIZE 50
+static int
+wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len)
+{
+ int err = BCME_OK;
+ uint i, tokens;
+ char *pos, *pos2, *token, *token2, *delim;
+ char param[PNO_PARAM_SIZE], value[VALUE_SIZE];
+ struct dhd_pno_batch_params batch_params;
+ DHD_PNO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
+ if (total_len < strlen(CMD_WLS_BATCHING)) {
+ DHD_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len));
+ err = BCME_ERROR;
+ goto exit;
+ }
+ pos = command + strlen(CMD_WLS_BATCHING) + 1;
+ memset(&batch_params, 0, sizeof(struct dhd_pno_batch_params));
+
+ if (!strncmp(pos, PNO_BATCHING_SET, strlen(PNO_BATCHING_SET))) {
+ pos += strlen(PNO_BATCHING_SET) + 1;
+ while ((token = strsep(&pos, PNO_PARAMS_DELIMETER)) != NULL) {
+ memset(param, 0, sizeof(param));
+ memset(value, 0, sizeof(value));
+ if (token == NULL || !*token)
+ break;
+ if (*token == '\0')
+ continue;
+ delim = strchr(token, PNO_PARAM_VALUE_DELLIMETER);
+ if (delim != NULL)
+ *delim = ' ';
+
+ tokens = sscanf(token, "%s %s", param, value);
+ if (!strncmp(param, PNO_PARAM_SCANFREQ, strlen(PNO_PARAM_MSCAN))) {
+ batch_params.scan_fr = simple_strtol(value, NULL, 0);
+ DHD_PNO(("scan_freq : %d\n", batch_params.scan_fr));
+ } else if (!strncmp(param, PNO_PARAM_BESTN, strlen(PNO_PARAM_MSCAN))) {
+ batch_params.bestn = simple_strtol(value, NULL, 0);
+ DHD_PNO(("bestn : %d\n", batch_params.bestn));
+ } else if (!strncmp(param, PNO_PARAM_MSCAN, strlen(PNO_PARAM_MSCAN))) {
+ batch_params.mscan = simple_strtol(value, NULL, 0);
+ DHD_PNO(("mscan : %d\n", batch_params.mscan));
+ } else if (!strncmp(param, PNO_PARAM_CHANNEL, strlen(PNO_PARAM_MSCAN))) {
+ i = 0;
+ pos2 = value;
+ tokens = sscanf(value, "<%s>", value);
+ if (tokens != 1) {
+ err = BCME_ERROR;
+ DHD_ERROR(("%s : invalid format for channel"
+ " <> params\n", __FUNCTION__));
+ goto exit;
+ }
+ while ((token2 = strsep(&pos2,
+ PNO_PARAM_CHANNEL_DELIMETER)) != NULL) {
+ if (token2 == NULL || !*token2)
+ break;
+ if (*token2 == '\0')
+ continue;
+ if (*token2 == 'A' || *token2 == 'B') {
+ batch_params.band = (*token2 == 'A')?
+ WLC_BAND_5G : WLC_BAND_2G;
+ DHD_PNO(("band : %s\n",
+ (*token2 == 'A')? "A" : "B"));
+ } else {
+ batch_params.chan_list[i++] =
+ simple_strtol(token2, NULL, 0);
+ batch_params.nchan++;
+ DHD_PNO(("channel :%d\n",
+ batch_params.chan_list[i-1]));
+ }
+ }
+ } else if (!strncmp(param, PNO_PARAM_RTT, strlen(PNO_PARAM_MSCAN))) {
+ batch_params.rtt = simple_strtol(value, NULL, 0);
+ DHD_PNO(("rtt : %d\n", batch_params.rtt));
+ } else {
+ DHD_ERROR(("%s : unknown param: %s\n", __FUNCTION__, param));
+ err = BCME_ERROR;
+ goto exit;
+ }
+ }
+ err = dhd_dev_pno_set_for_batch(dev, &batch_params);
+ if (err < 0) {
+ DHD_ERROR(("failed to configure batch scan\n"));
+ } else {
+ memset(command, 0, total_len);
+ err = sprintf(command, "%d", err);
+ }
+ } else if (!strncmp(pos, PNO_BATCHING_GET, strlen(PNO_BATCHING_GET))) {
+ err = dhd_dev_pno_get_for_batch(dev, command, total_len);
+ if (err < 0) {
+ DHD_ERROR(("failed to getting batching results\n"));
+ } else {
+ err = strlen(command);
+ }
+ } else if (!strncmp(pos, PNO_BATCHING_STOP, strlen(PNO_BATCHING_STOP))) {
+ err = dhd_dev_pno_stop_for_batch(dev);
+ if (err < 0) {
+ DHD_ERROR(("failed to stop batching scan\n"));
+ } else {
+ memset(command, 0, total_len);
+ err = sprintf(command, "OK");
+ }
+ } else {
+ DHD_ERROR(("%s : unknown command\n", __FUNCTION__));
+ err = BCME_ERROR;
+ goto exit;
+ }
+exit:
+ return err;
+}
+#ifndef WL_SCHED_SCAN
static int wl_android_set_pno_setup(struct net_device *dev, char *command, int total_len)
{
wlc_ssid_t ssids_local[MAX_PFN_LIST_COUNT];
@@ -1096,23 +1280,16 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
0x00
};
#endif /* PNO_SET_DEBUG */
-
- DHD_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
+ DHD_PNO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
if (total_len < (strlen(CMD_PNOSETUP_SET) + sizeof(cmd_tlv_t))) {
DHD_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len));
goto exit_proc;
}
-
-
#ifdef PNO_SET_DEBUG
memcpy(command, pno_in_example, sizeof(pno_in_example));
- for (i = 0; i < sizeof(pno_in_example); i++)
- printf("%02X ", command[i]);
- printf("\n");
total_len = sizeof(pno_in_example);
#endif
-
str_ptr = command + strlen(CMD_PNOSETUP_SET);
tlv_size_left = total_len - strlen(CMD_PNOSETUP_SET);
@@ -1121,7 +1298,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) &&
(cmd_tlv_temp->version == PNO_TLV_VERSION) &&
- (cmd_tlv_temp->subver == PNO_TLV_SUBVERSION)) {
+ (cmd_tlv_temp->subtype == PNO_TLV_SUBTYPE_LEGACY_PNO)) {
str_ptr += sizeof(cmd_tlv_t);
tlv_size_left -= sizeof(cmd_tlv_t);
@@ -1138,7 +1315,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
}
str_ptr++;
pno_time = simple_strtoul(str_ptr, &str_ptr, 16);
- DHD_INFO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
+ DHD_PNO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
if (str_ptr[0] != 0) {
if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
@@ -1148,7 +1325,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
}
str_ptr++;
pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16);
- DHD_INFO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
+ DHD_PNO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) {
DHD_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n",
__FUNCTION__));
@@ -1156,7 +1333,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
}
str_ptr++;
pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16);
- DHD_INFO(("%s: pno_freq_expo_max=%d\n",
+ DHD_PNO(("%s: pno_freq_expo_max=%d\n",
__FUNCTION__, pno_freq_expo_max));
}
}
@@ -1165,12 +1342,13 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t
goto exit_proc;
}
- res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time, pno_repeat, pno_freq_expo_max);
-
+ res = dhd_dev_pno_set_for_ssid(dev, ssids_local, nssid, pno_time, pno_repeat,
+ pno_freq_expo_max, NULL, 0);
exit_proc:
return res;
}
-#endif /* PNO_SUPPORT && !WL_SCHED_SCAN */
+#endif /* !WL_SCHED_SCAN */
+#endif /* PNO_SUPPORT */
static int wl_android_get_p2p_dev_addr(struct net_device *ndev, char *command, int total_len)
{
@@ -1268,6 +1446,131 @@ static int wl_android_get_assoc_res_ies(struct net_device *dev, char *command)
#endif /* BCMCCX */
+static int
+wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist)
+{
+ int i, j, match;
+ int ret = 0;
+ char mac_buf[MAX_NUM_OF_ASSOCLIST *
+ sizeof(struct ether_addr) + sizeof(uint)] = {0};
+ struct maclist *assoc_maclist = (struct maclist *)mac_buf;
+
+ /* set filtering mode */
+ if ((ret = wldev_ioctl(dev, WLC_SET_MACMODE, &macmode, sizeof(macmode), true)) != 0) {
+ DHD_ERROR(("%s : WLC_SET_MACMODE error=%d\n", __FUNCTION__, ret));
+ return ret;
+ }
+ if (macmode != MACLIST_MODE_DISABLED) {
+ /* set the MAC filter list */
+ if ((ret = wldev_ioctl(dev, WLC_SET_MACLIST, maclist,
+ sizeof(int) + sizeof(struct ether_addr) * maclist->count, true)) != 0) {
+ DHD_ERROR(("%s : WLC_SET_MACLIST error=%d\n", __FUNCTION__, ret));
+ return ret;
+ }
+ /* get the current list of associated STAs */
+ assoc_maclist->count = MAX_NUM_OF_ASSOCLIST;
+ if ((ret = wldev_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist,
+ sizeof(mac_buf), false)) != 0) {
+ DHD_ERROR(("%s : WLC_GET_ASSOCLIST error=%d\n", __FUNCTION__, ret));
+ return ret;
+ }
+ /* do we have any STA associated? */
+ if (assoc_maclist->count) {
+ /* iterate each associated STA */
+ for (i = 0; i < assoc_maclist->count; i++) {
+ match = 0;
+ /* compare with each entry */
+ for (j = 0; j < maclist->count; j++) {
+ DHD_INFO(("%s : associated="MACDBG " list="MACDBG "\n",
+ __FUNCTION__, MAC2STRDBG(assoc_maclist->ea[i].octet),
+ MAC2STRDBG(maclist->ea[j].octet)));
+ if (memcmp(assoc_maclist->ea[i].octet,
+ maclist->ea[j].octet, ETHER_ADDR_LEN) == 0) {
+ match = 1;
+ break;
+ }
+ }
+ /* do conditional deauth */
+ /* "if not in the allow list" or "if in the deny list" */
+ if ((macmode == MACLIST_MODE_ALLOW && !match) ||
+ (macmode == MACLIST_MODE_DENY && match)) {
+ scb_val_t scbval;
+
+ scbval.val = htod32(1);
+ memcpy(&scbval.ea, &assoc_maclist->ea[i],
+ ETHER_ADDR_LEN);
+ if ((ret = wldev_ioctl(dev,
+ WLC_SCB_DEAUTHENTICATE_FOR_REASON,
+ &scbval, sizeof(scb_val_t), true)) != 0)
+ DHD_ERROR(("%s WLC_SCB_DEAUTHENTICATE error=%d\n",
+ __FUNCTION__, ret));
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+/*
+ * HAPD_MAC_FILTER mac_mode mac_cnt mac_addr1 mac_addr2
+ *
+ */
+static int
+wl_android_set_mac_address_filter(struct net_device *dev, const char* str)
+{
+ int i;
+ int ret = 0;
+ int macnum = 0;
+ int macmode = MACLIST_MODE_DISABLED;
+ struct maclist *list;
+ char eabuf[ETHER_ADDR_STR_LEN];
+
+ /* string should look like below (macmode/macnum/maclist) */
+ /* 1 2 00:11:22:33:44:55 00:11:22:33:44:ff */
+
+ /* get the MAC filter mode */
+ macmode = bcm_atoi(strsep((char**)&str, " "));
+
+ if (macmode < MACLIST_MODE_DISABLED || macmode > MACLIST_MODE_ALLOW) {
+ DHD_ERROR(("%s : invalid macmode %d\n", __FUNCTION__, macmode));
+ return -1;
+ }
+
+ macnum = bcm_atoi(strsep((char**)&str, " "));
+ if (macnum < 0 || macnum > MAX_NUM_MAC_FILT) {
+ DHD_ERROR(("%s : invalid number of MAC address entries %d\n",
+ __FUNCTION__, macnum));
+ return -1;
+ }
+ /* allocate memory for the MAC list */
+ list = (struct maclist*)kmalloc(sizeof(int) +
+ sizeof(struct ether_addr) * macnum, GFP_KERNEL);
+ if (!list) {
+ DHD_ERROR(("%s : failed to allocate memory\n", __FUNCTION__));
+ return -1;
+ }
+ /* prepare the MAC list */
+ list->count = htod32(macnum);
+ bzero((char *)eabuf, ETHER_ADDR_STR_LEN);
+ for (i = 0; i < list->count; i++) {
+ strncpy(eabuf, strsep((char**)&str, " "), ETHER_ADDR_STR_LEN - 1);
+ if (!(ret = bcm_ether_atoe(eabuf, &list->ea[i]))) {
+ DHD_ERROR(("%s : mac parsing err index=%d, addr=%s\n",
+ __FUNCTION__, i, eabuf));
+ list->count--;
+ break;
+ }
+ DHD_INFO(("%s : %d/%d MACADDR=%s", __FUNCTION__, i, list->count, eabuf));
+ }
+ /* set the list */
+ if ((ret = wl_android_set_ap_mac_list(dev, macmode, list)) != 0)
+ DHD_ERROR(("%s : Setting MAC list failed error=%d\n", __FUNCTION__, ret));
+
+ kfree(list);
+
+ return 0;
+}
+
/**
* Global function definitions (declared in wl_android.h)
*/
@@ -1277,7 +1580,7 @@ int wl_android_wifi_on(struct net_device *dev)
int ret = 0;
int retry = POWERUP_MAX_RETRY;
- printk("%s in\n", __FUNCTION__);
+ DHD_ERROR(("%s in\n", __FUNCTION__));
if (!dev) {
DHD_ERROR(("%s: dev is null\n", __FUNCTION__));
return -EINVAL;
@@ -1286,27 +1589,24 @@ int wl_android_wifi_on(struct net_device *dev)
dhd_net_if_lock(dev);
if (!g_wifi_on) {
do {
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
- ret = sdioh_start(NULL, 0);
+ dhd_net_wifi_platform_set_power(dev, TRUE, WIFI_TURNON_DELAY);
+ ret = dhd_net_bus_resume(dev, 0);
if (ret == 0)
break;
DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
retry+1));
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+ dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY);
} while (retry-- >= 0);
if (ret != 0) {
DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
goto exit;
}
- ret = dhd_dev_reset(dev, FALSE);
- sdioh_start(NULL, 1);
+ ret = dhd_net_bus_devreset(dev, FALSE);
+ dhd_net_bus_resume(dev, 1);
if (!ret) {
if (dhd_dev_init_ioctl(dev) < 0)
ret = -EFAULT;
}
-#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
- dhd_wlfc_init(bcmsdh_get_drvdata());
-#endif
g_wifi_on = TRUE;
}
@@ -1320,7 +1620,7 @@ int wl_android_wifi_off(struct net_device *dev)
{
int ret = 0;
- printk("%s in\n", __FUNCTION__);
+ DHD_ERROR(("%s in\n", __FUNCTION__));
if (!dev) {
DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
return -EINVAL;
@@ -1328,12 +1628,9 @@ int wl_android_wifi_off(struct net_device *dev)
dhd_net_if_lock(dev);
if (g_wifi_on) {
-#if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB)
- dhd_wlfc_deinit(bcmsdh_get_drvdata());
-#endif
- ret = dhd_dev_reset(dev, TRUE);
- sdioh_stop(NULL);
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+ ret = dhd_net_bus_devreset(dev, TRUE);
+ dhd_net_bus_suspend(dev);
+ dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY);
g_wifi_on = FALSE;
}
dhd_net_if_unlock(dev);
@@ -1345,16 +1642,7 @@ static int wl_android_set_fwpath(struct net_device *net, char *command, int tota
{
if ((strlen(command) - strlen(CMD_SETFWPATH)) > MOD_PARAM_PATHLEN)
return -1;
- bcm_strncpy_s(fw_path, sizeof(fw_path),
- command + strlen(CMD_SETFWPATH) + 1, MOD_PARAM_PATHLEN - 1);
- if (strstr(fw_path, "apsta") != NULL) {
- DHD_INFO(("GOT APSTA FIRMWARE\n"));
- ap_fw_loaded = TRUE;
- } else {
- DHD_INFO(("GOT STA FIRMWARE\n"));
- ap_fw_loaded = FALSE;
- }
- return 0;
+ return dhd_net_set_fw_path(net, command + strlen(CMD_SETFWPATH) + 1);
}
@@ -1431,7 +1719,7 @@ wl_android_set_ampdu_mpdu(struct net_device *dev, const char* string_num)
#endif /* SUPPORT_AMPDU_MPDU_CMD */
/* SoftAP feature */
-#ifdef SUPPORT_AUTO_CHANNEL
+#if defined(WL_SUPPORT_AUTO_CHANNEL)
static int
wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
char* command, int total_len)
@@ -1440,26 +1728,30 @@ wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
int chosen = 0;
int retry = 0;
int ret = 0;
-
- /* Restrict channel to 1 - 7: 2GHz, 20MHz BW, No SB */
- u32 req_buf[8] = {7, 0x2B01, 0x2B02, 0x2B03, 0x2B04, 0x2B05, 0x2B06,
- 0x2B07};
-
- /* Auto channel select */
- wl_uint32_list_t request;
+ u32 req_buf[7] = {0};
channel = bcm_atoi(string_num);
DHD_INFO(("%s : HAPD_AUTO_CHANNEL = %d\n", __FUNCTION__, channel));
- if (channel == 20)
- ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&req_buf,
- sizeof(req_buf), true);
- else { /* channel == 0 */
- request.count = htod32(0);
- ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&request,
- sizeof(request), true);
+ if (channel == 20) {
+ /* Restrict channel to 1 - 6: 2GHz, 20MHz BW, No SB */
+ req_buf[0] = 6;
+ for (channel = 1; channel <= 6; channel++) {
+#ifdef D11AC_IOTYPES
+ if (wl_cfg80211_get_ioctl_version() == 1)
+ req_buf[channel] = CH20MHZ_LCHSPEC(channel);
+ else
+ req_buf[channel] = CH20MHZ_CHSPEC(channel);
+#else
+ req_buf[channel] = CH20MHZ_CHSPEC(channel);
+#endif /* D11AC_IOTYPES */
+ DHD_INFO(("%s: channel=%d, chanspec=0x%04X\n",
+ __FUNCTION__, channel, req_buf[channel]));
+ }
}
+ ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&req_buf,
+ sizeof(req_buf), true);
if (ret < 0) {
DHD_ERROR(("%s: can't start auto channel scan, err = %d\n",
__FUNCTION__, ret));
@@ -1468,19 +1760,25 @@ wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
}
/* Wait for auto channel selection, max 2500 ms */
- bcm_mdelay(500);
+ OSL_SLEEP(500);
retry = 10;
while (retry--) {
- ret = wldev_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen),
- false);
+ ret = wldev_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen,
+ sizeof(chosen), false);
if (ret < 0 || dtoh32(chosen) == 0) {
DHD_INFO(("%s: %d tried, ret = %d, chosen = %d\n",
__FUNCTION__, (10 - retry), ret, chosen));
- bcm_mdelay(200);
- }
- else {
- channel = (u16)chosen & 0x00FF;
+ OSL_SLEEP(200);
+ } else {
+#ifdef D11AC_IOTYPES
+ if (wl_cfg80211_get_ioctl_version() == 1)
+ channel = LCHSPEC_CHANNEL((u16)chosen);
+ else
+ channel = CHSPEC_CHANNEL((u16)chosen);
+#else
+ channel = CHSPEC_CHANNEL((u16)chosen);
+#endif /* D11AC_IOTYPES */
DHD_ERROR(("%s: selected channel = %d\n", __FUNCTION__, channel));
break;
}
@@ -1497,7 +1795,7 @@ done:
return 4;
}
-#endif /* SUPPORT_AUTO_CHANNEL */
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
#ifdef SUPPORT_HIDDEN_AP
static int
@@ -1618,6 +1916,171 @@ wl_android_ch_res_rl(struct net_device *dev, bool change)
}
return error;
}
+
+#ifdef SUPPORT_LTECX
+#define DEFAULT_WLANRX_PROT 1
+#define DEFAULT_LTERX_PROT 0
+#define DEFAULT_LTETX_ADV 1200
+
+static int
+wl_android_set_ltecx(struct net_device *dev, const char* string_num)
+{
+ uint16 chan_bitmap;
+ int ret;
+
+ chan_bitmap = bcm_strtoul(string_num, NULL, 16);
+
+ DHD_INFO(("%s : LTECOEX 0x%x\n", __FUNCTION__, chan_bitmap));
+
+ if (chan_bitmap) {
+ ret = wldev_iovar_setint(dev, "mws_coex_bitmap", chan_bitmap);
+ if (ret < 0)
+ DHD_ERROR(("mws_coex_bitmap error %d\n", ret));
+
+ ret = wldev_iovar_setint(dev, "mws_wlanrx_prot", DEFAULT_WLANRX_PROT);
+ if (ret < 0)
+ DHD_ERROR(("mws_wlanrx_prot error %d\n", ret));
+
+ ret = wldev_iovar_setint(dev, "mws_lterx_prot", DEFAULT_LTERX_PROT);
+ if (ret < 0)
+ DHD_ERROR(("mws_lterx_prot error %d\n", ret));
+
+ ret = wldev_iovar_setint(dev, "mws_ltetx_adv", DEFAULT_LTETX_ADV);
+ if (ret < 0)
+ DHD_ERROR(("mws_ltetx_adv error %d\n", ret));
+ } else {
+ ret = wldev_iovar_setint(dev, "mws_coex_bitmap", chan_bitmap);
+ if (ret < 0)
+ DHD_ERROR(("LTECX_CHAN_BITMAP error %d\n", ret));
+ }
+ return 1;
+}
+#endif /* SUPPORT_LTECX */
+
+static int
+wl_android_rmc_enable(struct net_device *net, int rmc_enable)
+{
+ int err;
+
+ err = wldev_iovar_setint(net, "rmc_ackreq", rmc_enable);
+ return err;
+}
+
+int wl_android_get_singlecore_scan(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int bytes_written = 0;
+ int mode = 0;
+
+ error = wldev_iovar_getint(dev, "scan_ps", &mode);
+ if (error) {
+ DHD_ERROR(("%s: Failed to get single core scan Mode, error = %d\n",
+ __FUNCTION__, error));
+ return -1;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d", CMD_GET_SCSCAN, mode);
+
+ return bytes_written;
+}
+
+int wl_android_set_singlecore_scan(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ int mode = 0;
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ error = wldev_iovar_setint(dev, "scan_ps", mode);
+ if (error) {
+ DHD_ERROR(("%s[1]: Failed to set Mode %d, error = %d\n",
+ __FUNCTION__, mode, error));
+ return -1;
+ }
+
+ return error;
+}
+#ifdef TEST_TX_POWER_CONTROL
+static int
+wl_android_set_tx_power(struct net_device *dev, const char* string_num)
+{
+ int err = 0;
+ s32 dbm;
+ enum nl80211_tx_power_setting type;
+
+ dbm = bcm_atoi(string_num);
+
+ if (dbm < -1) {
+ DHD_ERROR(("%s: dbm is negative...\n", __FUNCTION__));
+ return -EINVAL;
+ }
+
+ if (dbm == -1)
+ type = NL80211_TX_POWER_AUTOMATIC;
+ else
+ type = NL80211_TX_POWER_FIXED;
+
+ err = wl_set_tx_power(dev, type, dbm);
+ if (unlikely(err)) {
+ DHD_ERROR(("%s: error (%d)\n", __FUNCTION__, err));
+ return err;
+ }
+
+ return 1;
+}
+
+static int
+wl_android_get_tx_power(struct net_device *dev, char *command, int total_len)
+{
+ int err;
+ int bytes_written;
+ s32 dbm = 0;
+
+ err = wl_get_tx_power(dev, &dbm);
+ if (unlikely(err)) {
+ DHD_ERROR(("%s: error (%d)\n", __FUNCTION__, err));
+ return err;
+ }
+
+ bytes_written = snprintf(command, total_len, "%s %d",
+ CMD_TEST_GET_TX_POWER, dbm);
+
+ DHD_ERROR(("%s: GET_TX_POWER: dBm=%d\n", __FUNCTION__, dbm));
+
+ return bytes_written;
+}
+#endif /* TEST_TX_POWER_CONTROL */
+
+static int
+wl_android_set_sarlimit_txctrl(struct net_device *dev, const char* string_num)
+{
+ int err = 0;
+ int setval = 0;
+ s32 mode = bcm_atoi(string_num);
+
+ /* As Samsung specific and their requirement, '0' means activate sarlimit
+ * and '-1' means back to normal state (deactivate sarlimit)
+ */
+ if (mode == 0) {
+ DHD_INFO(("%s: SAR limit control activated\n", __FUNCTION__));
+ setval = 1;
+ } else if (mode == -1) {
+ DHD_INFO(("%s: SAR limit control deactivated\n", __FUNCTION__));
+ setval = 0;
+ } else {
+ return -EINVAL;
+ }
+
+ err = wldev_iovar_setint(dev, "sar_enable", setval);
+ if (unlikely(err)) {
+ DHD_ERROR(("%s: error (%d)\n", __FUNCTION__, err));
+ return err;
+ }
+ return 1;
+}
#endif /* CUSTOMER_HW4 */
int wl_android_set_roam_mode(struct net_device *dev, char *command, int total_len)
@@ -1642,16 +2105,798 @@ int wl_android_set_roam_mode(struct net_device *dev, char *command, int total_le
return 0;
}
-int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
+int wl_android_set_ibss_beacon_ouidata(struct net_device *dev, char *command, int total_len)
{
-#ifdef CUSTOMER_HW4
-/* DO NOT CHANGE THIS: Samsung JBP branch requires 16KB buffer size */
-#define PRIVATE_COMMAND_MAX_LEN 16384
+ char ie_buf[VNDR_IE_MAX_LEN];
+ char *ioctl_buf = NULL;
+ char hex[] = "XX";
+ char *pcmd = NULL;
+ int ielen = 0, datalen = 0, idx = 0, tot_len = 0;
+ vndr_ie_setbuf_t *vndr_ie = NULL;
+ s32 iecount;
+ uint32 pktflag;
+ u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
+ s32 err = BCME_OK;
+
+ /* Check the VSIE (Vendor Specific IE) which was added.
+ * If exist then send IOVAR to delete it
+ */
+ if (wl_cfg80211_ibss_vsie_delete(dev) != BCME_OK) {
+ return -EINVAL;
+ }
+
+ pcmd = command + strlen(CMD_SETIBSSBEACONOUIDATA) + 1;
+ for (idx = 0; idx < DOT11_OUI_LEN; idx++) {
+ hex[0] = *pcmd++;
+ hex[1] = *pcmd++;
+ ie_buf[idx] = (uint8)simple_strtoul(hex, NULL, 16);
+ }
+ pcmd++;
+ while ((*pcmd != '\0') && (idx < VNDR_IE_MAX_LEN)) {
+ hex[0] = *pcmd++;
+ hex[1] = *pcmd++;
+ ie_buf[idx++] = (uint8)simple_strtoul(hex, NULL, 16);
+ datalen++;
+ }
+ tot_len = sizeof(vndr_ie_setbuf_t) + (datalen - 1);
+ vndr_ie = (vndr_ie_setbuf_t *) kzalloc(tot_len, kflags);
+ if (!vndr_ie) {
+ WL_ERR(("IE memory alloc failed\n"));
+ return -ENOMEM;
+ }
+ /* Copy the vndr_ie SET command ("add"/"del") to the buffer */
+ strncpy(vndr_ie->cmd, "add", VNDR_IE_CMD_LEN - 1);
+ vndr_ie->cmd[VNDR_IE_CMD_LEN - 1] = '\0';
+
+ /* Set the IE count - the buffer contains only 1 IE */
+ iecount = htod32(1);
+ memcpy((void *)&vndr_ie->vndr_ie_buffer.iecount, &iecount, sizeof(s32));
+
+ /* Set packet flag to indicate that BEACON's will contain this IE */
+ pktflag = htod32(VNDR_IE_BEACON_FLAG | VNDR_IE_PRBRSP_FLAG);
+ memcpy((void *)&vndr_ie->vndr_ie_buffer.vndr_ie_list[0].pktflag, &pktflag,
+ sizeof(u32));
+ /* Set the IE ID */
+ vndr_ie->vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.id = (uchar) DOT11_MNG_PROPR_ID;
+
+ memcpy(&vndr_ie->vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.oui, &ie_buf,
+ DOT11_OUI_LEN);
+ memcpy(&vndr_ie->vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.data,
+ &ie_buf[DOT11_OUI_LEN], datalen);
+
+ ielen = DOT11_OUI_LEN + datalen;
+ vndr_ie->vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.len = (uchar) ielen;
+
+ ioctl_buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
+ if (!ioctl_buf) {
+ WL_ERR(("ioctl memory alloc failed\n"));
+ if (vndr_ie) {
+ kfree(vndr_ie);
+ }
+ return -ENOMEM;
+ }
+ memset(ioctl_buf, 0, WLC_IOCTL_MEDLEN); /* init the buffer */
+ err = wldev_iovar_setbuf(dev, "ie", vndr_ie, tot_len, ioctl_buf, WLC_IOCTL_MEDLEN, NULL);
+
+
+ if (err != BCME_OK) {
+ err = -EINVAL;
+ if (vndr_ie) {
+ kfree(vndr_ie);
+ }
+ }
+ else {
+ /* do NOT free 'vndr_ie' for the next process */
+ wl_cfg80211_ibss_vsie_set_buffer(vndr_ie, tot_len);
+ }
+
+ if (ioctl_buf) {
+ kfree(ioctl_buf);
+ }
+
+ return err;
+}
+
+#if defined(BCMFW_ROAM_ENABLE)
+static int
+wl_android_set_roampref(struct net_device *dev, char *command, int total_len)
+{
+ int error = 0;
+ char smbuf[WLC_IOCTL_SMLEN];
+ uint8 buf[MAX_BUF_SIZE];
+ uint8 *pref = buf;
+ char *pcmd;
+ int num_ucipher_suites = 0;
+ int num_akm_suites = 0;
+ wpa_suite_t ucipher_suites[MAX_NUM_SUITES];
+ wpa_suite_t akm_suites[MAX_NUM_SUITES];
+ int num_tuples = 0;
+ int total_bytes = 0;
+ int total_len_left;
+ int i, j;
+ char hex[] = "XX";
+
+ pcmd = command + strlen(CMD_SET_ROAMPREF) + 1;
+ total_len_left = total_len - strlen(CMD_SET_ROAMPREF) + 1;
+
+ num_akm_suites = simple_strtoul(pcmd, NULL, 16);
+ /* Increment for number of AKM suites field + space */
+ pcmd += 3;
+ total_len_left -= 3;
+
+ /* check to make sure pcmd does not overrun */
+ if (total_len_left < (num_akm_suites * WIDTH_AKM_SUITE))
+ return -1;
+
+ memset(buf, 0, sizeof(buf));
+ memset(akm_suites, 0, sizeof(akm_suites));
+ memset(ucipher_suites, 0, sizeof(ucipher_suites));
+
+ /* Save the AKM suites passed in the command */
+ for (i = 0; i < num_akm_suites; i++) {
+ /* Store the MSB first, as required by join_pref */
+ for (j = 0; j < 4; j++) {
+ hex[0] = *pcmd++;
+ hex[1] = *pcmd++;
+ buf[j] = (uint8)simple_strtoul(hex, NULL, 16);
+ }
+ memcpy((uint8 *)&akm_suites[i], buf, sizeof(uint32));
+ }
+
+ total_len_left -= (num_akm_suites * WIDTH_AKM_SUITE);
+ num_ucipher_suites = simple_strtoul(pcmd, NULL, 16);
+ /* Increment for number of cipher suites field + space */
+ pcmd += 3;
+ total_len_left -= 3;
+
+ if (total_len_left < (num_ucipher_suites * WIDTH_AKM_SUITE))
+ return -1;
+
+ /* Save the cipher suites passed in the command */
+ for (i = 0; i < num_ucipher_suites; i++) {
+ /* Store the MSB first, as required by join_pref */
+ for (j = 0; j < 4; j++) {
+ hex[0] = *pcmd++;
+ hex[1] = *pcmd++;
+ buf[j] = (uint8)simple_strtoul(hex, NULL, 16);
+ }
+ memcpy((uint8 *)&ucipher_suites[i], buf, sizeof(uint32));
+ }
+
+ /* Join preference for RSSI
+ * Type : 1 byte (0x01)
+ * Length : 1 byte (0x02)
+ * Value : 2 bytes (reserved)
+ */
+ *pref++ = WL_JOIN_PREF_RSSI;
+ *pref++ = JOIN_PREF_RSSI_LEN;
+ *pref++ = 0;
+ *pref++ = 0;
+
+ /* Join preference for WPA
+ * Type : 1 byte (0x02)
+ * Length : 1 byte (not used)
+ * Value : (variable length)
+ * reserved: 1 byte
+ * count : 1 byte (no of tuples)
+ * Tuple1 : 12 bytes
+ * akm[4]
+ * ucipher[4]
+ * mcipher[4]
+ * Tuple2 : 12 bytes
+ * Tuplen : 12 bytes
+ */
+ num_tuples = num_akm_suites * num_ucipher_suites;
+ if (num_tuples != 0) {
+ if (num_tuples <= JOIN_PREF_MAX_WPA_TUPLES) {
+ *pref++ = WL_JOIN_PREF_WPA;
+ *pref++ = 0;
+ *pref++ = 0;
+ *pref++ = (uint8)num_tuples;
+ total_bytes = JOIN_PREF_RSSI_SIZE + JOIN_PREF_WPA_HDR_SIZE +
+ (JOIN_PREF_WPA_TUPLE_SIZE * num_tuples);
+ } else {
+ DHD_ERROR(("%s: Too many wpa configs for join_pref \n", __FUNCTION__));
+ return -1;
+ }
+ } else {
+ /* No WPA config, configure only RSSI preference */
+ total_bytes = JOIN_PREF_RSSI_SIZE;
+ }
+
+ /* akm-ucipher-mcipher tuples in the format required for join_pref */
+ for (i = 0; i < num_ucipher_suites; i++) {
+ for (j = 0; j < num_akm_suites; j++) {
+ memcpy(pref, (uint8 *)&akm_suites[j], WPA_SUITE_LEN);
+ pref += WPA_SUITE_LEN;
+ memcpy(pref, (uint8 *)&ucipher_suites[i], WPA_SUITE_LEN);
+ pref += WPA_SUITE_LEN;
+ /* Set to 0 to match any available multicast cipher */
+ memset(pref, 0, WPA_SUITE_LEN);
+ pref += WPA_SUITE_LEN;
+ }
+ }
+
+ prhex("join pref", (uint8 *)buf, total_bytes);
+ error = wldev_iovar_setbuf(dev, "join_pref", buf, total_bytes, smbuf, sizeof(smbuf), NULL);
+ if (error) {
+ DHD_ERROR(("Failed to set join_pref, error = %d\n", error));
+ }
+ return error;
+}
+#endif /* defined(BCMFW_ROAM_ENABLE */
+
+static int
+wl_android_iolist_add(struct net_device *dev, struct list_head *head, struct io_cfg *config)
+{
+ struct io_cfg *resume_cfg;
+ s32 ret;
+
+ resume_cfg = kzalloc(sizeof(struct io_cfg), GFP_KERNEL);
+ if (!resume_cfg)
+ return -ENOMEM;
+
+ if (config->iovar) {
+ ret = wldev_iovar_getint(dev, config->iovar, &resume_cfg->param);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to get current %s value\n",
+ __FUNCTION__, config->iovar));
+ goto error;
+ }
+
+ ret = wldev_iovar_setint(dev, config->iovar, config->param);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to set %s to %d\n", __FUNCTION__,
+ config->iovar, config->param));
+ goto error;
+ }
+
+ resume_cfg->iovar = config->iovar;
+ } else {
+ resume_cfg->arg = kzalloc(config->len, GFP_KERNEL);
+ if (!resume_cfg->arg) {
+ ret = -ENOMEM;
+ goto error;
+ }
+ ret = wldev_ioctl(dev, config->ioctl, resume_cfg->arg, config->len, false);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to get ioctl %d\n", __FUNCTION__,
+ config->ioctl));
+ goto error;
+ }
+ ret = wldev_ioctl(dev, config->ioctl + 1, config->arg, config->len, true);
+ if (ret) {
+ DHD_ERROR(("%s: Failed to set %s to %d\n", __FUNCTION__,
+ config->iovar, config->param));
+ goto error;
+ }
+ if (config->ioctl + 1 == WLC_SET_PM)
+ wl_cfg80211_update_power_mode(dev);
+ resume_cfg->ioctl = config->ioctl;
+ resume_cfg->len = config->len;
+ }
+
+ list_add(&resume_cfg->list, head);
+
+ return 0;
+error:
+ kfree(resume_cfg->arg);
+ kfree(resume_cfg);
+ return ret;
+}
+
+static void
+wl_android_iolist_resume(struct net_device *dev, struct list_head *head)
+{
+ struct io_cfg *config;
+ struct list_head *cur, *q;
+ s32 ret = 0;
+
+ list_for_each_safe(cur, q, head) {
+ config = list_entry(cur, struct io_cfg, list);
+ if (config->iovar) {
+ if (!ret)
+ ret = wldev_iovar_setint(dev, config->iovar,
+ config->param);
+ } else {
+ if (!ret)
+ ret = wldev_ioctl(dev, config->ioctl + 1,
+ config->arg, config->len, true);
+ if (config->ioctl + 1 == WLC_SET_PM)
+ wl_cfg80211_update_power_mode(dev);
+ kfree(config->arg);
+ }
+ list_del(cur);
+ kfree(config);
+ }
+}
+
+static int
+wl_android_set_miracast(struct net_device *dev, char *command, int total_len)
+{
+ int mode, val;
+ int ret = 0;
+ struct io_cfg config;
+
+ if (sscanf(command, "%*s %d", &mode) != 1) {
+ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
+ return -1;
+ }
+
+ DHD_INFO(("%s: enter miracast mode %d\n", __FUNCTION__, mode));
+
+ if (miracast_cur_mode == mode)
+ return 0;
+
+ wl_android_iolist_resume(dev, &miracast_resume_list);
+ miracast_cur_mode = MIRACAST_MODE_OFF;
+
+ switch (mode) {
+ case MIRACAST_MODE_SOURCE:
+ /* setting mchan_algo to platform specific value */
+ config.iovar = "mchan_algo";
+
+ ret = wldev_ioctl(dev, WLC_GET_BCNPRD, &val, sizeof(int), false);
+ if (!ret && val > 100) {
+ config.param = 0;
+ DHD_ERROR(("%s: Connected station's beacon interval: "
+ "%d and set mchan_algo to %d \n",
+ __FUNCTION__, val, config.param));
+ }
+ else {
+ config.param = MIRACAST_MCHAN_ALGO;
+ }
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+
+ /* setting mchan_bw to platform specific value */
+ config.iovar = "mchan_bw";
+ config.param = MIRACAST_MCHAN_BW;
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+
+ /* setting apmdu to platform specific value */
+ config.iovar = "ampdu_mpdu";
+ config.param = MIRACAST_AMPDU_SIZE;
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+ /* FALLTROUGH */
+ /* Source mode shares most configurations with sink mode.
+ * Fall through here to avoid code duplication
+ */
+ case MIRACAST_MODE_SINK:
+ /* disable internal roaming */
+ config.iovar = "roam_off";
+ config.param = 1;
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+ /* tunr off pm */
+ val = 0;
+ config.iovar = NULL;
+ config.ioctl = WLC_GET_PM;
+ config.arg = &val;
+ config.len = sizeof(int);
+ ret = wl_android_iolist_add(dev, &miracast_resume_list, &config);
+ if (ret)
+ goto resume;
+
+ break;
+ case MIRACAST_MODE_OFF:
+ default:
+ break;
+ }
+ miracast_cur_mode = mode;
+
+ return 0;
+
+resume:
+ DHD_ERROR(("%s: turnoff miracast mode because of err%d\n", __FUNCTION__, ret));
+ wl_android_iolist_resume(dev, &miracast_resume_list);
+ return ret;
+}
+
+#ifdef WLAIBSS
+#define NETLINK_OXYGEN 30
+#define AIBSS_BEACON_TIMEOUT 10
+
+static struct sock *nl_sk = NULL;
+
+static void wl_netlink_recv(struct sk_buff *skb)
+{
+ WL_ERR(("netlink_recv called\n"));
+}
+
+static int wl_netlink_init(void)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
+ struct netlink_kernel_cfg cfg = {
+ .input = wl_netlink_recv,
+ };
+#endif
+
+ if (nl_sk != NULL) {
+ WL_ERR(("nl_sk already exist\n"));
+ return BCME_ERROR;
+ }
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
+ nl_sk = netlink_kernel_create(&init_net, NETLINK_OXYGEN,
+ 0, wl_netlink_recv, NULL, THIS_MODULE);
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0))
+ nl_sk = netlink_kernel_create(&init_net, NETLINK_OXYGEN, THIS_MODULE, &cfg);
#else
-#define PRIVATE_COMMAND_MAX_LEN 8192
+ nl_sk = netlink_kernel_create(&init_net, NETLINK_OXYGEN, &cfg);
#endif
+
+ if (nl_sk == NULL) {
+ WL_ERR(("nl_sk is not ready\n"));
+ return BCME_ERROR;
+ }
+
+ return BCME_OK;
+}
+
+static void wl_netlink_deinit(void)
+{
+ if (nl_sk) {
+ netlink_kernel_release(nl_sk);
+ nl_sk = NULL;
+ }
+}
+
+s32
+wl_netlink_send_msg(int pid, int seq, void *data, size_t size)
+{
+ struct sk_buff *skb = NULL;
+ struct nlmsghdr *nlh = NULL;
+ int ret = -1;
+
+ if (nl_sk == NULL) {
+ WL_ERR(("nl_sk was not initialized\n"));
+ goto nlmsg_failure;
+ }
+
+ skb = alloc_skb(NLMSG_SPACE(size), GFP_ATOMIC);
+ if (skb == NULL) {
+ WL_ERR(("failed to allocate memory\n"));
+ goto nlmsg_failure;
+ }
+
+ nlh = nlmsg_put(skb, 0, 0, 0, size, 0);
+ if (nlh == NULL) {
+ WL_ERR(("failed to build nlmsg, skb_tailroom:%d, nlmsg_total_size:%d\n",
+ skb_tailroom(skb), nlmsg_total_size(size)));
+ dev_kfree_skb(skb);
+ goto nlmsg_failure;
+ }
+
+ memcpy(nlmsg_data(nlh), data, size);
+ nlh->nlmsg_seq = seq;
+
+ /* netlink_unicast() takes ownership of the skb and frees it itself. */
+ ret = netlink_unicast(nl_sk, skb, pid, 0);
+ WL_DBG(("netlink_unicast() pid=%d, ret=%d\n", pid, ret));
+
+nlmsg_failure:
+ return ret;
+}
+
+static int wl_android_set_ibss_txfail_event(struct net_device *dev, char *command, int total_len)
+{
+ int err = 0;
+ int retry = 0;
+ int pid = 0;
+ aibss_txfail_config_t txfail_config = {0, 0, 0, 0};
+ char smbuf[WLC_IOCTL_SMLEN];
+
+ if (sscanf(command, CMD_SETIBSSTXFAILEVENT " %d %d", &retry, &pid) <= 0) {
+ WL_ERR(("Failed to get Parameter from : %s\n", command));
+ return -1;
+ }
+
+ /* set pid, and if the event was happened, let's send a notification through netlink */
+ wl_cfg80211_set_txfail_pid(pid);
+
+ /* If retry value is 0, it disables the functionality for TX Fail. */
+ if (retry > 0) {
+ txfail_config.max_tx_retry = retry;
+ txfail_config.bcn_timeout = 0; /* 0 : disable tx fail from beacon */
+ }
+ txfail_config.version = AIBSS_TXFAIL_CONFIG_VER_0;
+ txfail_config.len = sizeof(txfail_config);
+
+ err = wldev_iovar_setbuf(dev, "aibss_txfail_config", (void *) &txfail_config,
+ sizeof(aibss_txfail_config_t), smbuf, WLC_IOCTL_SMLEN, NULL);
+ WL_DBG(("retry=%d, pid=%d, err=%d\n", retry, pid, err));
+
+ return ((err == 0)?total_len:err);
+}
+
+static int wl_android_get_ibss_peer_info(struct net_device *dev, char *command,
+ int total_len, bool bAll)
+{
+ int error;
+ int bytes_written = 0;
+ void *buf = NULL;
+ bss_peer_list_info_t peer_list_info;
+ bss_peer_info_t *peer_info;
+ int i;
+ bool found = false;
+ struct ether_addr mac_ea;
+
+ WL_DBG(("get ibss peer info(%s)\n", bAll?"true":"false"));
+
+ if (!bAll) {
+ if (sscanf (command, "GETIBSSPEERINFO %02x:%02x:%02x:%02x:%02x:%02x",
+ (unsigned int *)&mac_ea.octet[0], (unsigned int *)&mac_ea.octet[1],
+ (unsigned int *)&mac_ea.octet[2], (unsigned int *)&mac_ea.octet[3],
+ (unsigned int *)&mac_ea.octet[4], (unsigned int *)&mac_ea.octet[5]) != 6) {
+ WL_DBG(("invalid MAC address\n"));
+ return -1;
+ }
+ }
+
+ if ((buf = kmalloc(WLC_IOCTL_MAXLEN, GFP_KERNEL)) == NULL) {
+ WL_ERR(("kmalloc failed\n"));
+ return -1;
+ }
+
+ error = wldev_iovar_getbuf(dev, "bss_peer_info", NULL, 0, buf, WLC_IOCTL_MAXLEN, NULL);
+ if (unlikely(error)) {
+ WL_ERR(("could not get ibss peer info (%d)\n", error));
+ kfree(buf);
+ return -1;
+ }
+
+ memcpy(&peer_list_info, buf, sizeof(peer_list_info));
+ peer_list_info.version = htod16(peer_list_info.version);
+ peer_list_info.bss_peer_info_len = htod16(peer_list_info.bss_peer_info_len);
+ peer_list_info.count = htod32(peer_list_info.count);
+
+ WL_DBG(("ver:%d, len:%d, count:%d\n", peer_list_info.version,
+ peer_list_info.bss_peer_info_len, peer_list_info.count));
+
+ if (peer_list_info.count > 0) {
+ if (bAll)
+ bytes_written += sprintf(&command[bytes_written], "%u ",
+ peer_list_info.count);
+
+ peer_info = (bss_peer_info_t *) ((void *)buf + BSS_PEER_LIST_INFO_FIXED_LEN);
+
+
+ for (i = 0; i < peer_list_info.count; i++) {
+
+ WL_DBG(("index:%d rssi:%d, tx:%u, rx:%u\n", i, peer_info->rssi,
+ peer_info->tx_rate, peer_info->rx_rate));
+
+ if (!bAll &&
+ memcmp(&mac_ea, &peer_info->ea, sizeof(struct ether_addr)) == 0) {
+ found = true;
+ }
+
+ if (bAll || found) {
+ bytes_written += sprintf(&command[bytes_written], MACF,
+ ETHER_TO_MACF(peer_info->ea));
+ bytes_written += sprintf(&command[bytes_written], " %u %d ",
+ peer_info->tx_rate/1000, peer_info->rssi);
+ }
+
+ if (found)
+ break;
+
+ peer_info = (bss_peer_info_t *)((void *)peer_info+sizeof(bss_peer_info_t));
+ }
+ }
+ else {
+ WL_ERR(("could not get ibss peer info : no item\n"));
+ }
+ bytes_written += sprintf(&command[bytes_written], "%s", "\0");
+
+ WL_DBG(("command(%u):%s\n", total_len, command));
+ WL_DBG(("bytes_written:%d\n", bytes_written));
+
+ kfree(buf);
+ return bytes_written;
+}
+
+int wl_android_set_ibss_routetable(struct net_device *dev, char *command, int total_len)
+{
+
+ char *pcmd = command;
+ char *str = NULL;
+
+ ibss_route_tbl_t *route_tbl = NULL;
+ char *ioctl_buf = NULL;
+ u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
+ s32 err = BCME_OK;
+ uint32 route_tbl_len;
+ uint32 entries;
+ char *endptr;
+ uint32 i = 0;
+ struct ipv4_addr dipaddr;
+ struct ether_addr ea;
+
+ route_tbl_len = sizeof(ibss_route_tbl_t) +
+ (MAX_IBSS_ROUTE_TBL_ENTRY - 1) * sizeof(ibss_route_entry_t);
+ route_tbl = (ibss_route_tbl_t *)kzalloc(route_tbl_len, kflags);
+ if (!route_tbl) {
+ WL_ERR(("Route TBL alloc failed\n"));
+ return -ENOMEM;
+ }
+ ioctl_buf = kzalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
+ if (!ioctl_buf) {
+ WL_ERR(("ioctl memory alloc failed\n"));
+ if (route_tbl) {
+ kfree(route_tbl);
+ }
+ return -ENOMEM;
+ }
+ memset(ioctl_buf, 0, WLC_IOCTL_MEDLEN);
+
+ /* drop command */
+ str = bcmstrtok(&pcmd, " ", NULL);
+
+ /* get count */
+ str = bcmstrtok(&pcmd, " ", NULL);
+ if (!str) {
+ WL_ERR(("Invalid number parameter %s\n", str));
+ err = -EINVAL;
+ goto exit;
+ }
+ entries = bcm_strtoul(str, &endptr, 0);
+ if (*endptr != '\0') {
+ WL_ERR(("Invalid number parameter %s\n", str));
+ err = -EINVAL;
+ goto exit;
+ }
+ WL_INFO(("Routing table count:%d\n", entries));
+ route_tbl->num_entry = entries;
+
+ for (i = 0; i < entries; i++) {
+ str = bcmstrtok(&pcmd, " ", NULL);
+ if (!str || !bcm_atoipv4(str, &dipaddr)) {
+ WL_ERR(("Invalid ip string %s\n", str));
+ err = -EINVAL;
+ goto exit;
+ }
+
+
+ str = bcmstrtok(&pcmd, " ", NULL);
+ if (!str || !bcm_ether_atoe(str, &ea)) {
+ WL_ERR(("Invalid ethernet string %s\n", str));
+ err = -EINVAL;
+ goto exit;
+ }
+ bcopy(&dipaddr, &route_tbl->route_entry[i].ipv4_addr, IPV4_ADDR_LEN);
+ bcopy(&ea, &route_tbl->route_entry[i].nexthop, ETHER_ADDR_LEN);
+ }
+
+ route_tbl_len = sizeof(ibss_route_tbl_t) +
+ ((!entries?0:(entries - 1)) * sizeof(ibss_route_entry_t));
+ err = wldev_iovar_setbuf(dev, "ibss_route_tbl",
+ route_tbl, route_tbl_len, ioctl_buf, WLC_IOCTL_MEDLEN, NULL);
+ if (err != BCME_OK) {
+ WL_ERR(("Fail to set iovar %d\n", err));
+ err = -EINVAL;
+ }
+
+exit:
+ if (route_tbl)
+ kfree(route_tbl);
+ if (ioctl_buf)
+ kfree(ioctl_buf);
+ return err;
+
+}
+
+int wl_android_set_ibss_ampdu(struct net_device *dev, char *command, int total_len)
+{
+ char *pcmd = command;
+ char *str = NULL, *endptr = NULL;
+ int category[4];
+ int tid2category[NUMPRIO] = {2, 3, 3, 2, 1, 1, 0, 0};
+ struct ampdu_tid_control_mode control;
+ char smbuf[WLC_IOCTL_SMLEN];
+ int idx;
+ int err = 0;
+
+ WL_DBG(("set ibss ampdu:%s\n", command));
+
+ /* acquire parameters */
+ /* drop command */
+ str = bcmstrtok(&pcmd, " ", NULL);
+
+ for (idx = 0; idx < 4; idx++) {
+ str = bcmstrtok(&pcmd, " ", NULL);
+ if (!str) {
+ WL_ERR(("Invalid parameter : %s\n", pcmd));
+ return -EINVAL;
+ }
+ category[idx] = bcm_strtoul(str, &endptr, 0);
+ if (*endptr != '\0') {
+ WL_ERR(("Invalid number format %s\n", str));
+ return -EINVAL;
+ }
+ }
+ sprintf(control.mode_name, "AIBSS");
+ for (idx = 0; idx < NUMPRIO; idx++) {
+ control.control[idx].tid = idx;
+ control.control[idx].enable = category[tid2category[idx]];
+ }
+
+ err = wldev_iovar_setbuf(dev, "ampdu_tid_mode", (void *) &control,
+ sizeof(struct ampdu_tid_control_mode), smbuf, WLC_IOCTL_SMLEN, NULL);
+ return ((err == 0)?total_len:err);
+}
+#endif /* WLAIBSS */
+
+int wl_keep_alive_set(struct net_device *dev, char* extra, int total_len)
+{
+ char buf[256];
+ const char *str;
+ wl_mkeep_alive_pkt_t mkeep_alive_pkt;
+ wl_mkeep_alive_pkt_t *mkeep_alive_pktp;
+ int buf_len;
+ int str_len;
+ int res = -1;
+ uint period_msec = 0;
+
+ if (extra == NULL)
+ {
+ DHD_ERROR(("%s: extra is NULL\n", __FUNCTION__));
+ return -1;
+ }
+ if (sscanf(extra, "%d", &period_msec) != 1)
+ {
+ DHD_ERROR(("%s: sscanf error. check period_msec value\n", __FUNCTION__));
+ return -EINVAL;
+ }
+ DHD_ERROR(("%s: period_msec is %d\n", __FUNCTION__, period_msec));
+
+ memset(&mkeep_alive_pkt, 0, sizeof(wl_mkeep_alive_pkt_t));
+
+ str = "mkeep_alive";
+ str_len = strlen(str);
+ strncpy(buf, str, str_len);
+ buf[ str_len ] = '\0';
+ mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) (buf + str_len + 1);
+ mkeep_alive_pkt.period_msec = period_msec;
+ buf_len = str_len + 1;
+ mkeep_alive_pkt.version = htod16(WL_MKEEP_ALIVE_VERSION);
+ mkeep_alive_pkt.length = htod16(WL_MKEEP_ALIVE_FIXED_LEN);
+
+ /* Setup keep alive zero for null packet generation */
+ mkeep_alive_pkt.keep_alive_id = 0;
+ mkeep_alive_pkt.len_bytes = 0;
+ buf_len += WL_MKEEP_ALIVE_FIXED_LEN;
+ /* Keep-alive attributes are set in local variable (mkeep_alive_pkt), and
+ * then memcpy'ed into buffer (mkeep_alive_pktp) since there is no
+ * guarantee that the buffer is properly aligned.
+ */
+ memcpy((char *)mkeep_alive_pktp, &mkeep_alive_pkt, WL_MKEEP_ALIVE_FIXED_LEN);
+
+ if ((res = wldev_ioctl(dev, WLC_SET_VAR, buf, buf_len, TRUE)) < 0)
+ {
+ DHD_ERROR(("%s:keep_alive set failed. res[%d]\n", __FUNCTION__, res));
+ }
+ else
+ {
+ DHD_ERROR(("%s:keep_alive set ok. res[%d]\n", __FUNCTION__, res));
+ }
+
+ return res;
+}
+
+int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
+{
+#define PRIVATE_COMMAND_MAX_LEN 8192
int ret = 0;
char *command = NULL;
+ char *buf = NULL;
int bytes_written = 0;
android_wifi_priv_cmd priv_cmd;
@@ -1678,7 +2923,8 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
ret = -ENOMEM;
goto exit;
}
- if (copy_from_user(command, priv_cmd.buf, priv_cmd.total_len)) {
+ buf = (char *)priv_cmd.bufaddr;
+ if (copy_from_user(command, buf, priv_cmd.total_len)) {
ret = -EFAULT;
goto exit;
}
@@ -1748,7 +2994,8 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
}
else if (strnicmp(command, CMD_BTCOEXMODE, strlen(CMD_BTCOEXMODE)) == 0) {
#ifdef WL_CFG80211
- bytes_written = wl_cfg80211_set_btcoex_dhcp(net, command);
+ void *dhdp = wl_cfg80211_get_dhdp();
+ bytes_written = wl_cfg80211_set_btcoex_dhcp(net, dhdp, command);
#else
#ifdef PKT_FILTER_SUPPORT
uint mode = *(command + strlen(CMD_BTCOEXMODE) + 1) - '0';
@@ -1785,6 +3032,9 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
#else
bytes_written = wldev_set_band(net, band);
#endif /* WL_HOST_BAND_MGMT */
+#if defined(CUSTOMER_HW4) && defined(ROAM_CHANNEL_CACHE)
+ wl_update_roamscan_cache_by_band(net, band);
+#endif
}
else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
bytes_written = wl_android_get_band(net, command, priv_cmd.total_len);
@@ -1794,7 +3044,7 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
/* CUSTOMER_SET_COUNTRY feature is define for only GGSM model */
else if (strnicmp(command, CMD_COUNTRY, strlen(CMD_COUNTRY)) == 0) {
char *country_code = command + strlen(CMD_COUNTRY) + 1;
- bytes_written = wldev_set_country(net, country_code);
+ bytes_written = wldev_set_country(net, country_code, true, true);
}
#endif /* CUSTOMER_SET_COUNTRY */
#endif /* WL_CFG80211 */
@@ -1903,18 +3153,23 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
#endif /* WES_SUPPORT */
#endif /* CUSTOMER_HW4 */
-#if defined(PNO_SUPPORT) && !defined(WL_SCHED_SCAN)
+#ifdef PNO_SUPPORT
else if (strnicmp(command, CMD_PNOSSIDCLR_SET, strlen(CMD_PNOSSIDCLR_SET)) == 0) {
- bytes_written = dhd_dev_pno_reset(net);
+ bytes_written = dhd_dev_pno_stop_for_ssid(net);
}
+#ifndef WL_SCHED_SCAN
else if (strnicmp(command, CMD_PNOSETUP_SET, strlen(CMD_PNOSETUP_SET)) == 0) {
bytes_written = wl_android_set_pno_setup(net, command, priv_cmd.total_len);
}
+#endif /* !WL_SCHED_SCAN */
else if (strnicmp(command, CMD_PNOENABLE_SET, strlen(CMD_PNOENABLE_SET)) == 0) {
- uint pfn_enabled = *(command + strlen(CMD_PNOENABLE_SET) + 1) - '0';
- bytes_written = dhd_dev_pno_enable(net, pfn_enabled);
+ int enable = *(command + strlen(CMD_PNOENABLE_SET) + 1) - '0';
+ bytes_written = (enable)? 0 : dhd_dev_pno_stop_for_ssid(net);
}
-#endif /* PNO_SUPPORT && !WL_SCHED_SCAN */
+ else if (strnicmp(command, CMD_WLS_BATCHING, strlen(CMD_WLS_BATCHING)) == 0) {
+ bytes_written = wls_parse_batching_cmd(net, command, priv_cmd.total_len);
+ }
+#endif /* PNO_SUPPORT */
else if (strnicmp(command, CMD_P2P_DEV_ADDR, strlen(CMD_P2P_DEV_ADDR)) == 0) {
bytes_written = wl_android_get_p2p_dev_addr(net, command, priv_cmd.total_len);
}
@@ -1940,6 +3195,12 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
bytes_written = wl_cfg80211_set_wps_p2p_ie(net, command + skip,
priv_cmd.total_len - skip, *(command + skip - 2) - '0');
}
+#ifdef WLFBT
+ else if (strnicmp(command, CMD_GET_FTKEY, strlen(CMD_GET_FTKEY)) == 0) {
+ wl_cfg80211_get_fbt_key(command);
+ bytes_written = FBT_KEYLEN;
+ }
+#endif /* WLFBT */
#endif /* WL_CFG80211 */
else if (strnicmp(command, CMD_OKC_SET_PMK, strlen(CMD_OKC_SET_PMK)) == 0)
bytes_written = wl_android_set_pmk(net, command, priv_cmd.total_len);
@@ -1956,6 +3217,13 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
bytes_written = wl_android_get_assoc_res_ies(net, command);
}
#endif /* BCMCCX */
+#if defined(WL_SUPPORT_AUTO_CHANNEL)
+ else if (strnicmp(command, CMD_GET_BEST_CHANNELS,
+ strlen(CMD_GET_BEST_CHANNELS)) == 0) {
+ bytes_written = wl_cfg80211_get_best_channels(net, command,
+ priv_cmd.total_len);
+ }
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
#ifdef CUSTOMER_HW4
#ifdef SUPPORT_AMPDU_MPDU_CMD
/* CMD_AMPDU_MPDU */
@@ -1964,15 +3232,15 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
bytes_written = wl_android_set_ampdu_mpdu(net, (const char*)command+skip);
}
#endif /* SUPPORT_AMPDU_MPDU_CMD */
-#ifdef SUPPORT_AUTO_CHANNEL
+#if defined(WL_SUPPORT_AUTO_CHANNEL)
else if (strnicmp(command, CMD_SET_HAPD_AUTO_CHANNEL,
strlen(CMD_SET_HAPD_AUTO_CHANNEL)) == 0) {
int skip = strlen(CMD_SET_HAPD_AUTO_CHANNEL) + 3;
bytes_written = wl_android_set_auto_channel(net, (const char*)command+skip, command,
priv_cmd.total_len);
}
-#endif /* SUPPORT_AUTO_CHANNEL */
-#ifdef SUPPORT_HIDDEN_AP
+#endif /* WL_SUPPORT_AUTO_CHANNEL */
+#if defined(SUPPORT_HIDDEN_AP)
else if (strnicmp(command, CMD_SET_HAPD_MAX_NUM_STA,
strlen(CMD_SET_HAPD_MAX_NUM_STA)) == 0) {
int skip = strlen(CMD_SET_HAPD_MAX_NUM_STA) + 3;
@@ -2013,10 +3281,98 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
bytes_written = wl_android_ch_res_rl(net, true);
else if (strnicmp(command, CMD_RESTORE_RL, strlen(CMD_RESTORE_RL)) == 0)
bytes_written = wl_android_ch_res_rl(net, false);
+#ifdef SUPPORT_LTECX
+ else if (strnicmp(command, CMD_LTECX_SET, strlen(CMD_LTECX_SET)) == 0) {
+ int skip = strlen(CMD_LTECX_SET) + 1;
+ bytes_written = wl_android_set_ltecx(net, (const char*)command+skip);
+ }
+#endif /* SUPPORT_LTECX */
+ else if (strnicmp(command, CMD_SET_RMC_ENABLE, strlen(CMD_SET_RMC_ENABLE)) == 0) {
+ int rmc_enable = *(command + strlen(CMD_SET_RMC_ENABLE) + 1) - '0';
+ bytes_written = wl_android_rmc_enable(net, rmc_enable);
+ }
+ else if (strnicmp(command, CMD_SET_RMC_TXRATE, strlen(CMD_SET_RMC_TXRATE)) == 0) {
+ int rmc_txrate;
+ sscanf(command, "%*s %10d", &rmc_txrate);
+ bytes_written = wldev_iovar_setint(net, "rmc_txrate", rmc_txrate * 2);
+ }
+ else if (strnicmp(command, CMD_SET_RMC_ACTPERIOD, strlen(CMD_SET_RMC_ACTPERIOD)) == 0) {
+ int actperiod;
+ sscanf(command, "%*s %10d", &actperiod);
+ bytes_written = wldev_iovar_setint(net, "rmc_actf_time", actperiod);
+ }
+ else if (strnicmp(command, CMD_SET_RMC_IDLEPERIOD, strlen(CMD_SET_RMC_IDLEPERIOD)) == 0) {
+ int acktimeout;
+ sscanf(command, "%*s %10d", &acktimeout);
+ acktimeout *= 1000;
+ bytes_written = wldev_iovar_setint(net, "rmc_acktmo", acktimeout);
+ }
+ else if (strnicmp(command, CMD_GET_SCSCAN, strlen(CMD_GET_SCSCAN)) == 0) {
+ bytes_written = wl_android_get_singlecore_scan(net, command, priv_cmd.total_len);
+ }
+ else if (strnicmp(command, CMD_SET_SCSCAN, strlen(CMD_SET_SCSCAN)) == 0) {
+ bytes_written = wl_android_set_singlecore_scan(net, command, priv_cmd.total_len);
+ }
+#ifdef TEST_TX_POWER_CONTROL
+ else if (strnicmp(command, CMD_TEST_SET_TX_POWER,
+ strlen(CMD_TEST_SET_TX_POWER)) == 0) {
+ int skip = strlen(CMD_TEST_SET_TX_POWER) + 1;
+ wl_android_set_tx_power(net, (const char*)command+skip);
+ }
+ else if (strnicmp(command, CMD_TEST_GET_TX_POWER,
+ strlen(CMD_TEST_GET_TX_POWER)) == 0) {
+ wl_android_get_tx_power(net, command, priv_cmd.total_len);
+ }
+#endif /* TEST_TX_POWER_CONTROL */
+ else if (strnicmp(command, CMD_SARLIMIT_TX_CONTROL,
+ strlen(CMD_SARLIMIT_TX_CONTROL)) == 0) {
+ int skip = strlen(CMD_SARLIMIT_TX_CONTROL) + 1;
+ wl_android_set_sarlimit_txctrl(net, (const char*)command+skip);
+ }
#endif /* CUSTOMER_HW4 */
+ else if (strnicmp(command, CMD_HAPD_MAC_FILTER, strlen(CMD_HAPD_MAC_FILTER)) == 0) {
+ int skip = strlen(CMD_HAPD_MAC_FILTER) + 1;
+ wl_android_set_mac_address_filter(net, (const char*)command+skip);
+ }
else if (strnicmp(command, CMD_SETROAMMODE, strlen(CMD_SETROAMMODE)) == 0)
bytes_written = wl_android_set_roam_mode(net, command, priv_cmd.total_len);
- else {
+#if defined(BCMFW_ROAM_ENABLE)
+ else if (strnicmp(command, CMD_SET_ROAMPREF, strlen(CMD_SET_ROAMPREF)) == 0) {
+ bytes_written = wl_android_set_roampref(net, command, priv_cmd.total_len);
+ }
+#endif /* BCMFW_ROAM_ENABLE */
+ else if (strnicmp(command, CMD_MIRACAST, strlen(CMD_MIRACAST)) == 0)
+ bytes_written = wl_android_set_miracast(net, command, priv_cmd.total_len);
+ else if (strnicmp(command, CMD_SETIBSSBEACONOUIDATA, strlen(CMD_SETIBSSBEACONOUIDATA)) == 0)
+ bytes_written = wl_android_set_ibss_beacon_ouidata(net,
+ command, priv_cmd.total_len);
+#ifdef WLAIBSS
+ else if (strnicmp(command, CMD_SETIBSSTXFAILEVENT,
+ strlen(CMD_SETIBSSTXFAILEVENT)) == 0)
+ bytes_written = wl_android_set_ibss_txfail_event(net, command, priv_cmd.total_len);
+ else if (strnicmp(command, CMD_GET_IBSS_PEER_INFO_ALL,
+ strlen(CMD_GET_IBSS_PEER_INFO_ALL)) == 0)
+ bytes_written = wl_android_get_ibss_peer_info(net, command, priv_cmd.total_len,
+ TRUE);
+ else if (strnicmp(command, CMD_GET_IBSS_PEER_INFO,
+ strlen(CMD_GET_IBSS_PEER_INFO)) == 0)
+ bytes_written = wl_android_get_ibss_peer_info(net, command, priv_cmd.total_len,
+ FALSE);
+ else if (strnicmp(command, CMD_SETIBSSROUTETABLE,
+ strlen(CMD_SETIBSSROUTETABLE)) == 0)
+ bytes_written = wl_android_set_ibss_routetable(net, command,
+ priv_cmd.total_len);
+ else if (strnicmp(command, CMD_SETIBSSAMPDU, strlen(CMD_SETIBSSAMPDU)) == 0)
+ bytes_written = wl_android_set_ibss_ampdu(net, command, priv_cmd.total_len);
+#endif /* WLAIBSS */
+ else if (strnicmp(command, CMD_KEEP_ALIVE, strlen(CMD_KEEP_ALIVE)) == 0) {
+ int skip = strlen(CMD_KEEP_ALIVE) + 1;
+ bytes_written = wl_keep_alive_set(net, command + skip, priv_cmd.total_len - skip);
+ }
+ else if (strnicmp(command, CMD_ROAM_OFFLOAD, strlen(CMD_ROAM_OFFLOAD)) == 0) {
+ int enable = *(command + strlen(CMD_ROAM_OFFLOAD) + 1) - '0';
+ bytes_written = wl_cfg80211_enable_roam_offload(net, enable);
+ } else {
DHD_ERROR(("Unknown PRIVATE command %s - ignored\n", command));
snprintf(command, 3, "OK");
bytes_written = strlen("OK");
@@ -2032,7 +3388,7 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
bytes_written++;
}
priv_cmd.used_len = bytes_written;
- if (copy_to_user(priv_cmd.buf, command, bytes_written)) {
+ if (copy_to_user(buf, command, bytes_written)) {
DHD_ERROR(("%s: failed to copy data to user buffer\n", __FUNCTION__));
ret = -EFAULT;
}
@@ -2067,6 +3423,9 @@ int wl_android_init(void)
#ifdef WL_GENL
wl_genl_init();
#endif
+#ifdef WLAIBSS
+ wl_netlink_init();
+#endif /* WLAIBSS */
return ret;
}
@@ -2074,26 +3433,33 @@ int wl_android_init(void)
int wl_android_exit(void)
{
int ret = 0;
+ struct io_cfg *cur, *q;
#ifdef WL_GENL
wl_genl_deinit();
#endif /* WL_GENL */
+#ifdef WLAIBSS
+ wl_netlink_deinit();
+#endif /* WLAIBSS */
+
+ list_for_each_entry_safe(cur, q, &miracast_resume_list, list) {
+ list_del(&cur->list);
+ kfree(cur);
+ }
return ret;
}
void wl_android_post_init(void)
{
+
#ifdef ENABLE_4335BT_WAR
bcm_bt_unlock(lock_cookie_wifi);
printk("%s: btlock released\n", __FUNCTION__);
#endif /* ENABLE_4335BT_WAR */
- if (!dhd_download_fw_on_driverload) {
- /* Call customer gpio to turn off power with WL_REG_ON signal */
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
- g_wifi_on = 0;
- }
+ if (!dhd_download_fw_on_driverload)
+ g_wifi_on = FALSE;
}
#ifdef WL_GENL
@@ -2316,245 +3682,15 @@ wl_genl_handle_msg(
return -EINVAL;
} else {
/* Handle the data */
- WL_DBG(("Data received from pid (%d) \n", info->snd_pid));
- }
-
- return 0;
-}
-#endif /* WL_GENL */
-
-/**
- * Functions for Android WiFi card detection
- */
-#if defined(CONFIG_WIFI_CONTROL_FUNC)
-
-bool g_wifi_poweron = FALSE;
-static int g_wifidev_registered = 0;
-static struct semaphore wifi_control_sem;
-static struct wifi_platform_data *wifi_control_data = NULL;
-static struct resource *wifi_irqres = NULL;
-
-static int wifi_add_dev(void);
-static void wifi_del_dev(void);
-
-int wl_android_wifictrl_func_add(void)
-{
- int ret = 0;
- sema_init(&wifi_control_sem, 0);
-
- ret = wifi_add_dev();
- if (ret) {
- DHD_ERROR(("%s: platform_driver_register failed\n", __FUNCTION__));
- return ret;
- }
- g_wifidev_registered = 1;
-
- /* Waiting callback after platform_driver_register is done or exit with error */
- if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) {
- ret = -EINVAL;
- DHD_ERROR(("%s: platform_driver_register timeout\n", __FUNCTION__));
- }
-
- return ret;
-}
-
-void wl_android_wifictrl_func_del(void)
-{
- if (g_wifidev_registered)
- {
- wifi_del_dev();
- g_wifidev_registered = 0;
- }
-}
-
-void* wl_android_prealloc(int section, unsigned long size)
-{
- void *alloc_ptr = NULL;
- if (wifi_control_data && wifi_control_data->mem_prealloc) {
- alloc_ptr = wifi_control_data->mem_prealloc(section, size);
- if (alloc_ptr) {
- DHD_INFO(("success alloc section %d\n", section));
- if (size != 0L)
- bzero(alloc_ptr, size);
- return alloc_ptr;
- }
- }
-
- DHD_ERROR(("can't alloc section %d\n", section));
- return NULL;
-}
-
-int wifi_get_irq_number(unsigned long *irq_flags_ptr)
-{
- if (wifi_irqres) {
- *irq_flags_ptr = wifi_irqres->flags & IRQF_TRIGGER_MASK;
- return (int)wifi_irqres->start;
- }
-#ifdef CUSTOM_OOB_GPIO_NUM
- return CUSTOM_OOB_GPIO_NUM;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)) || defined(WL_COMPAT_WIRELESS)
+ WL_DBG(("%s: Data received from pid (%d) \n", __func__,
+ info->snd_pid));
#else
- return -1;
-#endif
-}
-
-int wifi_set_power(int on, unsigned long msec)
-{
- int ret = 0;
- DHD_ERROR(("%s = %d\n", __FUNCTION__, on));
- if (wifi_control_data && wifi_control_data->set_power) {
-#ifdef ENABLE_4335BT_WAR
- if (on) {
- printk("WiFi: trying to acquire BT lock\n");
- if (bcm_bt_lock(lock_cookie_wifi) != 0)
- printk("** WiFi: timeout in acquiring bt lock**\n");
- printk("%s: btlock acquired\n", __FUNCTION__);
- }
- else {
- /* For a exceptional case, release btlock */
- bcm_bt_unlock(lock_cookie_wifi);
- }
-#endif /* ENABLE_4335BT_WAR */
- ret = wifi_control_data->set_power(on);
- }
-
- if (msec && !ret)
- msleep(msec);
- return ret;
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
-int wifi_get_mac_addr(unsigned char *buf)
-{
- DHD_ERROR(("%s\n", __FUNCTION__));
- if (!buf)
- return -EINVAL;
- if (wifi_control_data && wifi_control_data->get_mac_addr) {
- return wifi_control_data->get_mac_addr(buf);
- }
- return -EOPNOTSUPP;
-}
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) */
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
-void *wifi_get_country_code(char *ccode)
-{
- DHD_TRACE(("%s\n", __FUNCTION__));
- if (!ccode)
- return NULL;
- if (wifi_control_data && wifi_control_data->get_country_code) {
- return wifi_control_data->get_country_code(ccode);
- }
- return NULL;
-}
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) */
-
-static int wifi_set_carddetect(int on)
-{
- DHD_ERROR(("%s = %d\n", __FUNCTION__, on));
- if (wifi_control_data && wifi_control_data->set_carddetect) {
- wifi_control_data->set_carddetect(on);
- }
- return 0;
-}
-
-static int wifi_probe(struct platform_device *pdev)
-{
- int err;
- struct wifi_platform_data *wifi_ctrl =
- (struct wifi_platform_data *)(pdev->dev.platform_data);
-
- wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq");
- if (wifi_irqres == NULL)
- wifi_irqres = platform_get_resource_byname(pdev,
- IORESOURCE_IRQ, "bcm4329_wlan_irq");
- wifi_control_data = wifi_ctrl;
- err = wifi_set_power(1, 200); /* Power On */
- if (unlikely(err)) {
- DHD_ERROR(("%s: set_power failed. err=%d\n", __FUNCTION__, err));
- wifi_set_power(0, WIFI_TURNOFF_DELAY);
- /* WL_REG_ON state unknown, Power off forcely */
- } else {
- wifi_set_carddetect(1); /* CardDetect (0->1) */
- g_wifi_poweron = TRUE;
- }
-
- up(&wifi_control_sem);
- return 0;
-}
-
-static int wifi_remove(struct platform_device *pdev)
-{
- struct wifi_platform_data *wifi_ctrl =
- (struct wifi_platform_data *)(pdev->dev.platform_data);
-
- DHD_ERROR(("## %s\n", __FUNCTION__));
- wifi_control_data = wifi_ctrl;
-
- if (g_wifi_poweron) {
- wifi_set_power(0, WIFI_TURNOFF_DELAY); /* Power Off */
- wifi_set_carddetect(0); /* CardDetect (1->0) */
- g_wifi_poweron = FALSE;
+ WL_DBG(("%s: Data received from pid (%d) \n", __func__,
+ info->snd_portid));
+#endif /* (LINUX_VERSION < VERSION(3, 7, 0) || WL_COMPAT_WIRELESS */
}
- up(&wifi_control_sem);
- return 0;
-}
-
-static int wifi_suspend(struct platform_device *pdev, pm_message_t state)
-{
- DHD_TRACE(("##> %s\n", __FUNCTION__));
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
- bcmsdh_oob_intr_set(0);
-#endif /* (OOB_INTR_ONLY) */
- return 0;
-}
-
-static int wifi_resume(struct platform_device *pdev)
-{
- DHD_TRACE(("##> %s\n", __FUNCTION__));
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 39)) && defined(OOB_INTR_ONLY) && 1
- if (dhd_os_check_if_up(bcmsdh_get_drvdata()))
- bcmsdh_oob_intr_set(1);
-#endif /* (OOB_INTR_ONLY) */
return 0;
}
-
-static struct platform_driver wifi_device = {
- .probe = wifi_probe,
- .remove = wifi_remove,
- .suspend = wifi_suspend,
- .resume = wifi_resume,
- .driver = {
- .name = "bcmdhd_wlan",
- }
-};
-
-static struct platform_driver wifi_device_legacy = {
- .probe = wifi_probe,
- .remove = wifi_remove,
- .suspend = wifi_suspend,
- .resume = wifi_resume,
- .driver = {
- .name = "bcm4329_wlan",
- }
-};
-
-static int wifi_add_dev(void)
-{
- int ret = 0;
- DHD_TRACE(("## Calling platform_driver_register\n"));
- ret = platform_driver_register(&wifi_device);
- if (ret)
- return ret;
-
- ret = platform_driver_register(&wifi_device_legacy);
- return ret;
-}
-
-static void wifi_del_dev(void)
-{
- DHD_TRACE(("## Unregister platform_driver_register\n"));
- platform_driver_unregister(&wifi_device);
- platform_driver_unregister(&wifi_device_legacy);
-}
-#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */
+#endif /* WL_GENL */