summaryrefslogtreecommitdiffstats
path: root/bcm4329/src/wl/sys/wl_iw.c
diff options
context:
space:
mode:
Diffstat (limited to 'bcm4329/src/wl/sys/wl_iw.c')
-rw-r--r--bcm4329/src/wl/sys/wl_iw.c964
1 files changed, 463 insertions, 501 deletions
diff --git a/bcm4329/src/wl/sys/wl_iw.c b/bcm4329/src/wl/sys/wl_iw.c
index d67daf3..e324dd3 100644
--- a/bcm4329/src/wl/sys/wl_iw.c
+++ b/bcm4329/src/wl/sys/wl_iw.c
@@ -56,8 +56,8 @@ typedef const struct si_pub si_t;
#include <wl_iw.h>
-
#include <linux/rtnetlink.h>
+#include <linux/mutex.h>
#define WL_IW_USE_ISCAN 1
#define ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS 1
@@ -68,7 +68,7 @@ static struct net_device *priv_dev;
static bool ap_cfg_running = FALSE;
static bool ap_fw_loaded = FALSE;
static int ap_mode = 0;
-#endif
+#endif
#define WL_IW_IOCTL_CALL(func_call) \
do { \
@@ -76,6 +76,7 @@ static int ap_mode = 0;
} while (0)
static int g_onoff = G_WLAN_SET_ON;
+static struct mutex wl_start_lock;
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
uint32 reason, char* stringBuf, uint buflen);
@@ -147,7 +148,6 @@ int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag);
#define ISCAN_STATE_IDLE 0
#define ISCAN_STATE_SCANING 1
-
#define WLC_IW_ISCAN_MAXLEN 2048
typedef struct iscan_buf {
struct iscan_buf * next;
@@ -172,7 +172,7 @@ typedef struct iscan_info {
char ioctlbuf[WLC_IOCTL_SMLEN];
} iscan_info_t;
-#define COEX_DHCP 1
+#define COEX_DHCP 1
static void wl_iw_bt_flag_set(struct net_device *dev, bool set);
static void wl_iw_bt_release(void);
@@ -267,35 +267,43 @@ dev_wlc_ioctl(
struct ifreq ifr;
wl_ioctl_t ioc;
mm_segment_t fs;
- int ret = -1;
+ int ret = -EINVAL;
if (!dev) {
WL_ERROR(("%s: dev is null\n", __FUNCTION__));
return ret;
}
- WL_TRACE(("\n%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d ,\n",
+ WL_TRACE(("%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d ,\n",
__FUNCTION__, current->pid, cmd, arg, len));
- memset(&ioc, 0, sizeof(ioc));
- ioc.cmd = cmd;
- ioc.buf = arg;
- ioc.len = len;
- strcpy(ifr.ifr_name, dev->name);
- ifr.ifr_data = (caddr_t) &ioc;
+ if (g_onoff == G_WLAN_SET_ON) {
+ memset(&ioc, 0, sizeof(ioc));
+ ioc.cmd = cmd;
+ ioc.buf = arg;
+ ioc.len = len;
-
- dev_open(dev);
+ strcpy(ifr.ifr_name, dev->name);
+ ifr.ifr_data = (caddr_t) &ioc;
- fs = get_fs();
- set_fs(get_ds());
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#else
- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#endif
- set_fs(fs);
+ ret = dev_open(dev);
+ if (ret) {
+ WL_ERROR(("%s: Error dev_open: %d\n", __func__, ret));
+ return ret;
+ }
+ fs = get_fs();
+ set_fs(get_ds());
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31))
+ ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+#else
+ ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+#endif
+ set_fs(fs);
+ }
+ else {
+ WL_TRACE(("%s: call after driver stop\n", __FUNCTION__));
+ }
return ret;
}
@@ -385,11 +393,7 @@ dev_wlc_bufvar_set(
char *name,
char *buf, int len)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
- char ioctlbuf[MAX_WLIW_IOCTL_LEN];
-#else
static char ioctlbuf[MAX_WLIW_IOCTL_LEN];
-#endif
uint buflen;
buflen = bcm_mkiovar(name, buf, len, ioctlbuf, sizeof(ioctlbuf));
@@ -397,7 +401,7 @@ dev_wlc_bufvar_set(
return (dev_wlc_ioctl(dev, WLC_SET_VAR, ioctlbuf, buflen));
}
-#endif
+#endif
static int
@@ -406,11 +410,7 @@ dev_wlc_bufvar_get(
char *name,
char *buf, int buflen)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
- char ioctlbuf[MAX_WLIW_IOCTL_LEN];
-#else
static char ioctlbuf[MAX_WLIW_IOCTL_LEN];
-#endif
int error;
uint len;
@@ -549,9 +549,9 @@ wl_iw_set_country(
int country_offset;
int country_code_size;
+ WL_TRACE(("%s\n", __FUNCTION__));
memset(country_code, 0, sizeof(country_code));
-
country_offset = strcspn(extra, " ");
country_code_size = strlen(extra) - country_offset;
@@ -743,14 +743,19 @@ wl_iw_get_rssi(
if (g_onoff == G_WLAN_SET_ON) {
error = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
+ if (error) {
+ WL_ERROR(("%s: Fails %d\n", __FUNCTION__, error));
+ return error;
+ }
rssi = dtoh32(scb_val.val);
error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid));
-
- ssid.SSID_len = dtoh32(ssid.SSID_len);
+ if (!error) {
+ ssid.SSID_len = dtoh32(ssid.SSID_len);
+ wl_format_ssid(ssidbuf, ssid.SSID, dtoh32(ssid.SSID_len));
+ }
}
- wl_format_ssid(ssidbuf, ssid.SSID, dtoh32(ssid.SSID_len));
p += snprintf(p, MAX_WX_STRING, "%s rssi %d ", ssidbuf, rssi);
wrqu->data.length = p - extra + 1;
@@ -780,18 +785,18 @@ wl_iw_send_priv_event(
return 0;
}
+#ifdef WL_IW_USE_THREAD_WL_OFF
static int
_wl_control_sysioc_thread_wl_off(void *data)
{
struct wl_ctrl *wl_ctl = (struct wl_ctrl *)data;
- wl_iw_t *iw = *(wl_iw_t **)netdev_priv(wl_ctl->dev);
DAEMONIZE("wlcontrol_sysioc");
WL_TRACE(("%s Entered\n", __FUNCTION__));
+ net_os_wake_lock(wl_ctl->dev);
- WAKE_LOCK_INIT(iw->pub, WAKE_LOCK_OFF, "sysioc_thread_wl_off");
- WAKE_LOCK(iw->pub, WAKE_LOCK_OFF);
+ mutex_lock(&wl_start_lock);
while (down_interruptible(&wl_ctl->timer_sem) == 0) {
WL_TRACE(("%s Turning off wifi dev\n", __FUNCTION__));
@@ -805,14 +810,13 @@ _wl_control_sysioc_thread_wl_off(void *data)
dhd_dev_reset(wl_ctl->dev, 1);
#if defined(WL_IW_USE_ISCAN)
-
wl_iw_free_ss_cache();
wl_iw_run_ss_cache_timer(0);
memset(g_scan, 0, G_SCAN_RESULTS);
-
+
g_ss_cache_ctrl.m_link_down = 1;
g_scan_specified_ssid = 0;
-
+
g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE;
#endif
#if defined(BCMLXSDMMC)
@@ -823,17 +827,50 @@ _wl_control_sysioc_thread_wl_off(void *data)
wl_iw_send_priv_event(wl_ctl->dev, "STOP");
+ net_os_wake_lock_timeout_enable(wl_ctl->dev);
break;
}
-
+ mutex_unlock(&wl_start_lock);
WL_TRACE(("%s Exited\n", __FUNCTION__));
- WAKE_UNLOCK(iw->pub, WAKE_LOCK_OFF);
- WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_OFF);
+ net_os_wake_unlock(wl_ctl->dev);
complete_and_exit(&wl_ctl->sysioc_exited, 0);
KILL_PROC(wl_ctl->sysioc_pid, SIGTERM);
}
+#endif
+
+int
+wl_control_wl_start(struct net_device *dev)
+{
+ int ret = 0;
+
+ WL_TRACE(("Enter %s \n", __FUNCTION__));
+
+ mutex_lock(&wl_start_lock);
+ if (g_onoff == G_WLAN_SET_OFF) {
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
+
+#if defined(BCMLXSDMMC)
+ sdioh_start(NULL, 0);
+#endif
+
+ dhd_dev_reset(dev, 0);
+
+#if defined(BCMLXSDMMC)
+ sdioh_start(NULL, 1);
+#endif
+
+ dhd_dev_init_ioctl(dev);
+
+ g_onoff = G_WLAN_SET_ON;
+ }
+ WL_TRACE(("Exited %s \n", __FUNCTION__));
+
+ mutex_unlock(&wl_start_lock);
+ return ret;
+}
+#ifdef WL_IW_USE_THREAD_WL_OFF
static void
wl_iw_stop_timerfunc(ulong data)
{
@@ -841,10 +878,11 @@ wl_iw_stop_timerfunc(ulong data)
WL_TRACE(("%s\n", __FUNCTION__));
- del_timer(wl_ctl->timer);
+ del_timer_sync(wl_ctl->timer);
up(&wl_ctl->timer_sem);
}
+#endif
static int
wl_iw_control_wl_off(
@@ -853,24 +891,23 @@ wl_iw_control_wl_off(
)
{
int ret = 0;
+#ifdef WL_IW_USE_THREAD_WL_OFF
static struct wl_ctrl ctl;
static struct timer_list timer;
-
+#endif
WL_TRACE(("Enter %s\n", __FUNCTION__));
#ifdef SOFTAP
ap_mode = 0;
ap_cfg_running = FALSE;
-#endif
+#endif
-
-
+#ifdef WL_IW_USE_THREAD_WL_OFF
ctl.timer = &timer;
ctl.dev = dev;
sema_init(&ctl.timer_sem, 0);
init_completion(&ctl.sysioc_exited);
-
ctl.sysioc_pid = kernel_thread(_wl_control_sysioc_thread_wl_off, &ctl, 0);
timer.data = (ulong)&ctl;
@@ -878,7 +915,39 @@ wl_iw_control_wl_off(
init_timer(&timer);
timer.expires = jiffies + 2000 * HZ / 1000;
add_timer(&timer);
+#else
+ mutex_lock(&wl_start_lock);
+ if (g_onoff == G_WLAN_SET_ON) {
+ g_onoff = G_WLAN_SET_OFF;
+#if defined(WL_IW_USE_ISCAN)
+ g_iscan->iscan_state = ISCAN_STATE_IDLE;
+#endif
+ dhd_dev_reset(dev, 1);
+
+#if defined(WL_IW_USE_ISCAN)
+ wl_iw_free_ss_cache();
+ wl_iw_run_ss_cache_timer(0);
+ memset(g_scan, 0, G_SCAN_RESULTS);
+
+ g_ss_cache_ctrl.m_link_down = 1;
+ g_scan_specified_ssid = 0;
+
+ g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE;
+#endif
+
+#if defined(BCMLXSDMMC)
+ sdioh_stop(NULL);
+#endif
+
+ dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+
+ wl_iw_send_priv_event(dev, "STOP");
+
+ net_os_wake_lock_timeout_enable(dev);
+ }
+ mutex_unlock(&wl_start_lock);
+#endif
WL_TRACE(("Exited %s\n", __FUNCTION__));
return ret;
@@ -894,34 +963,19 @@ wl_iw_control_wl_on(
WL_TRACE(("Enter %s \n", __FUNCTION__));
- if (g_onoff == G_WLAN_SET_OFF) {
- dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
-
-#if defined(BCMLXSDMMC)
- sdioh_start(NULL, 0);
-#endif
-
- dhd_dev_reset(dev, 0);
-
-#if defined(BCMLXSDMMC)
- sdioh_start(NULL, 1);
-#endif
-
- dhd_dev_init_ioctl(dev);
-
- g_onoff = G_WLAN_SET_ON;
- }
+ ret = wl_control_wl_start(dev);
wl_iw_send_priv_event(dev, "START");
#ifdef SOFTAP
- if (!ap_fw_loaded) {
+ if (!ap_fw_loaded) {
wl_iw_iscan_set_scan_broadcast_prep(dev, 0);
}
#else
- wl_iw_iscan_set_scan_broadcast_prep(dev, 0);
-#endif
+ wl_iw_iscan_set_scan_broadcast_prep(dev, 0);
+#endif
+ net_os_wake_lock_timeout_enable(dev);
WL_TRACE(("Exited %s \n", __FUNCTION__));
@@ -930,18 +984,18 @@ wl_iw_control_wl_on(
#ifdef SOFTAP
static struct ap_profile my_ap;
-static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap);
+static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap);
static int get_assoc_sta_list(struct net_device *dev, char *buf, int len);
static int set_ap_mac_list(struct net_device *dev, char *buf);
-#define PTYPE_STRING 0
-#define PTYPE_INTDEC 1
-#define PTYPE_INTHEX 2
-#define PTYPE_STR_HEX 3
+#define PTYPE_STRING 0
+#define PTYPE_INTDEC 1
+#define PTYPE_INTHEX 2
+#define PTYPE_STR_HEX 3
int get_parmeter_from_string(
char **str_ptr, const char *token, int param_type, void *dst, int param_max_len);
-#endif
+#endif
int hex2num(char c)
{
@@ -997,18 +1051,15 @@ int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg)
memset(sub_cmd, 0, sizeof(sub_cmd));
memset(ap_cfg, 0, sizeof(struct ap_profile));
-
if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=",
PTYPE_STRING, sub_cmd, SSID_LEN) != 0) {
- return -1;
+ return -1;
}
if (strncmp(sub_cmd, "AP_CFG", 6)) {
- WL_ERROR(("ERROR: sub_cmd:%s != 'AP_CFG'!\n", sub_cmd));
+ WL_ERROR(("ERROR: sub_cmd:%s != 'AP_CFG'!\n", sub_cmd));
return -1;
}
-
-
ret = get_parmeter_from_string(&str_ptr, "SSID=", PTYPE_STRING, ap_cfg->ssid, SSID_LEN);
ret |= get_parmeter_from_string(&str_ptr, "SEC=", PTYPE_STRING, ap_cfg->sec, SEC_LEN);
@@ -1023,15 +1074,14 @@ int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg)
return ret;
}
-#endif
-
+#endif
#ifdef SOFTAP
static int iwpriv_set_ap_config(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *ext)
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *ext)
{
int res = 0;
char *extra = NULL;
@@ -1041,7 +1091,6 @@ static int iwpriv_set_ap_config(struct net_device *dev,
info->cmd, info->flags,
wrqu->data.pointer, wrqu->data.length));
-
if (wrqu->data.length != 0) {
char *str_ptr;
@@ -1059,33 +1108,51 @@ static int iwpriv_set_ap_config(struct net_device *dev,
memset(ap_cfg, 0, sizeof(struct ap_profile));
-
-
str_ptr = extra;
init_ap_profile_from_string(extra, ap_cfg);
} else {
-
- WL_ERROR(("IWPRIV argument len = 0 \n"));
- return -1;
+ WL_ERROR(("IWPRIV argument len = 0 \n"));
+ return -1;
}
- res |= set_ap_cfg(dev, ap_cfg);
+ set_ap_cfg(dev, ap_cfg);
kfree(extra);
return res;
}
-#endif
-
+#endif
#ifdef SOFTAP
+void print_buf(void *pbuf, int len, int bytes_per_line)
+{
+ int i, j = 0;
+ unsigned char *buf = pbuf;
+
+ if (bytes_per_line == 0) {
+ bytes_per_line = len;
+ }
+
+ for (i = 0; i < len; i++) {
+ WL_SOFTAP(("%2.2x", *buf++));
+ j++;
+ if (j == bytes_per_line) {
+ WL_SOFTAP(("\n"));
+ j = 0;
+ } else {
+ WL_SOFTAP((":"));
+ }
+ }
+ WL_SOFTAP(("\n"));
+}
+
static int iwpriv_get_assoc_list(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *p_iwrq,
- char *extra)
+ struct iw_request_info *info,
+ union iwreq_data *p_iwrq,
+ char *extra)
{
int i, ret = 0;
char mac_buf[256];
@@ -1109,17 +1176,15 @@ static int iwpriv_get_assoc_list(struct net_device *dev,
get_assoc_sta_list(dev, mac_buf, 256);
WL_TRACE((" got %d stations\n", sta_maclist->count));
-
memset(mac_lst, 0, sizeof(mac_lst));
p_mac_str = mac_lst;
for (i = 0; i < 8; i++) {
- struct ether_addr * id = &sta_maclist->ea[i];
+ struct ether_addr *id = &sta_maclist->ea[i];
WL_SOFTAP(("dhd_drv>> sta_mac[%d] :", i));
print_buf((unsigned char *)&sta_maclist->ea[i], 6, 0);
-
p_mac_str += snprintf(p_mac_str, MAX_WX_STRING,
"Mac[%d]=%02X:%02X:%02X:%02X:%02X:%02X\n", i,
id->octet[0], id->octet[1], id->octet[2],
@@ -1142,20 +1207,20 @@ static int iwpriv_get_assoc_list(struct net_device *dev,
WL_TRACE(("Exited %s \n", __FUNCTION__));
return ret;
}
-#endif
+#endif
#ifdef SOFTAP
static int iwpriv_set_mac_filters(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *ext)
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *ext)
{
int i, ret = -1;
- char * extra = NULL;
+ char *extra = NULL;
u8 macfilt[8][6];
- int mac_cnt = 0;
+ int mac_cnt = 0;
char sub_cmd[16];
WL_TRACE((">>> Got IWPRIV SET_MAC_FILTER IOCTL: info->cmd:%x, \
@@ -1181,18 +1246,16 @@ static int iwpriv_set_mac_filters(struct net_device *dev,
memset(macfilt, 0, sizeof(macfilt));
memset(sub_cmd, 0, sizeof(sub_cmd));
-
str_ptr = extra;
-
- if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", PTYPE_STRING, sub_cmd, 15) != 0) {
- goto exit_proc;
- }
+ if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", PTYPE_STRING, sub_cmd, 15) != 0) {
+ goto exit_proc;
+ }
#define MAC_FILT_MAX 8
-
+
if (strncmp(sub_cmd, "MAC_FLT_W", strlen("MAC_FLT_W"))) {
- WL_ERROR(("ERROR: sub_cmd:%s != 'MAC_FLT_W'!\n", sub_cmd));
+ WL_ERROR(("ERROR: sub_cmd:%s != 'MAC_FLT_W'!\n", sub_cmd));
goto exit_proc;
}
@@ -1207,36 +1270,35 @@ static int iwpriv_set_mac_filters(struct net_device *dev,
goto exit_proc;
}
- for (i=0; i< mac_cnt; i++)
- if (get_parmeter_from_string(&str_ptr, "MAC=",
- PTYPE_STR_HEX, macfilt[i], 12) != 0) {
- WL_ERROR(("ERROR: MAC_filter[%d] is missing !\n", i));
- goto exit_proc;
+ for (i = 0; i < mac_cnt; i++) {
+ if (get_parmeter_from_string(&str_ptr, "MAC=",
+ PTYPE_STR_HEX, macfilt[i], 12) != 0) {
+ WL_ERROR(("ERROR: MAC_filter[%d] is missing !\n", i));
+ goto exit_proc;
+ }
}
for (i = 0; i < mac_cnt; i++) {
- WL_SOFTAP(("mac_filt[%d]:", i));
- print_buf(macfilt[i], 6, 0);
+ WL_SOFTAP(("mac_filt[%d]:", i));
+ print_buf(macfilt[i], 6, 0);
}
-
wrqu->data.pointer = NULL;
wrqu->data.length = 0;
ret = 0;
} else {
-
- WL_ERROR(("IWPRIV argument len is 0\n"));
- return -1;
+ WL_ERROR(("IWPRIV argument len is 0\n"));
+ return -1;
}
exit_proc:
kfree(extra);
return ret;
}
-#endif
+#endif
-#endif
+#endif
#if WIRELESS_EXT < 13
struct iw_request_info
@@ -1246,9 +1308,9 @@ struct iw_request_info
};
typedef int (*iw_handler)(struct net_device *dev,
- struct iw_request_info *info,
- void *wrqu,
- char *extra);
+ struct iw_request_info *info,
+ void *wrqu,
+ char *extra);
#endif
static int
@@ -1308,7 +1370,7 @@ wl_iw_set_freq(
int error, chan;
uint sf = 0;
- WL_TRACE(("\n %s %s: SIOCSIWFREQ\n", __FUNCTION__, dev->name));
+ WL_TRACE(("%s %s: SIOCSIWFREQ\n", __FUNCTION__, dev->name));
#if defined(SOFTAP)
if (ap_cfg_running) {
@@ -1977,6 +2039,8 @@ wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action)
wl_iscan_params_t *params;
int err = 0;
+ WL_TRACE(("%s: start\n", __func__));
+
if (ssid && ssid->SSID_len) {
params_size += sizeof(wlc_ssid_t);
}
@@ -2092,13 +2156,12 @@ static void wl_iw_force_specific_scan(iscan_info_t *iscan)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_lock();
#endif
-
(void) dev_wlc_ioctl(iscan->dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid));
-
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_unlock();
#endif
}
+
static void wl_iw_send_scan_complete(iscan_info_t *iscan)
{
#ifndef SANDGATE2G
@@ -2106,34 +2169,36 @@ static void wl_iw_send_scan_complete(iscan_info_t *iscan)
memset(&wrqu, 0, sizeof(wrqu));
-
wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL);
- if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED)
- g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_READY;
- WL_TRACE(("Send Event ISCAN complete\n"));
+ if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED)
+ g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_READY;
+ WL_TRACE(("Send Event ISCAN complete\n"));
#endif
}
+
static int
_iscan_sysioc_thread(void *data)
{
uint32 status;
iscan_info_t *iscan = (iscan_info_t *)data;
static bool iscan_pass_abort = FALSE;
+
DAEMONIZE("iscan_sysioc");
status = WL_SCAN_RESULTS_PARTIAL;
while (down_interruptible(&iscan->sysioc_sem) == 0) {
-#if defined(SOFTAP)
-
+#ifdef SOFTAP
if (ap_cfg_running) {
- WL_TRACE(("%s skipping SCAN ops in AP mode !!!\n", __FUNCTION__));
- continue;
+ WL_TRACE(("%s skipping SCAN ops in AP mode !!!\n", __FUNCTION__));
+ continue;
}
-#endif
+#endif
+ net_os_wake_lock(iscan->dev);
+
if (iscan->timer_on) {
- del_timer(&iscan->timer);
iscan->timer_on = 0;
+ del_timer_sync(&iscan->timer);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
@@ -2143,8 +2208,9 @@ _iscan_sysioc_thread(void *data)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_unlock();
#endif
- if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) {
- WL_TRACE(("%s Get results from specific scan status=%d\n", __FUNCTION__, status));
+
+ if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) {
+ WL_TRACE(("%s Get results from specific scan status=%d\n", __FUNCTION__, status));
wl_iw_send_scan_complete(iscan);
iscan_pass_abort = FALSE;
status = -1;
@@ -2156,12 +2222,12 @@ _iscan_sysioc_thread(void *data)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_lock();
#endif
-
+
wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
rtnl_unlock();
#endif
-
+
mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
iscan->timer_on = 1;
break;
@@ -2172,7 +2238,7 @@ _iscan_sysioc_thread(void *data)
break;
case WL_SCAN_RESULTS_PENDING:
WL_TRACE(("iscanresults pending\n"));
-
+
mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
iscan->timer_on = 1;
break;
@@ -2193,13 +2259,16 @@ _iscan_sysioc_thread(void *data)
default:
WL_TRACE(("iscanresults returned unknown status %d\n", status));
break;
- }
+ }
+
+ net_os_wake_unlock(iscan->dev);
}
if (iscan->timer_on) {
- del_timer(&iscan->timer);
iscan->timer_on = 0;
+ del_timer_sync(&iscan->timer);
}
+
complete_and_exit(&iscan->sysioc_exited, 0);
}
#endif
@@ -2464,24 +2533,20 @@ wl_iw_set_scan(
)
{
int error;
- WL_TRACE(("\n:%s dev:%s: SIOCSIWSCAN : SCAN\n", __FUNCTION__, dev->name));
+ WL_TRACE(("%s dev:%s: SIOCSIWSCAN : SCAN\n", __FUNCTION__, dev->name));
#if defined(SOFTAP)
-
if (ap_cfg_running) {
WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__));
return 0;
}
-#endif
+#endif
-
if (g_onoff == G_WLAN_SET_OFF)
return 0;
-
memset(&g_specific_ssid, 0, sizeof(g_specific_ssid));
#ifndef WL_IW_USE_ISCAN
-
g_scan_specified_ssid = 0;
#endif
@@ -2491,7 +2556,6 @@ wl_iw_set_scan(
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
struct iw_scan_req *req = (struct iw_scan_req *)extra;
if (g_first_broadcast_scan != BROADCAST_SCAN_FIRST_RESULT_CONSUMED) {
-
WL_TRACE(("%s Ignoring SC %s first BC is not done = %d\n", \
__FUNCTION__, req->essid, \
g_first_broadcast_scan));
@@ -2500,7 +2564,6 @@ wl_iw_set_scan(
if (g_scan_specified_ssid) {
WL_TRACE(("%s Specific SCAN is not done ignore scan for = %s \n", \
__FUNCTION__, req->essid));
-
return -EBUSY;
}
else {
@@ -2518,8 +2581,7 @@ wl_iw_set_scan(
if ((error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)))) {
WL_TRACE(("#### Set SCAN for %s failed with %d\n", g_specific_ssid.SSID, error));
-
- g_scan_specified_ssid = 0;
+ g_scan_specified_ssid = 0; /* Clean to allow future ISCAN */
return -EBUSY;
}
@@ -2533,7 +2595,6 @@ wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag)
wlc_ssid_t ssid;
iscan_info_t *iscan = g_iscan;
-
if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_IDLE) {
g_first_broadcast_scan = BROADCAST_SCAN_FIRST_STARTED;
WL_TRACE(("%s: First Brodcast scan was forced\n", __FUNCTION__));
@@ -2543,7 +2604,6 @@ wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag)
return 0;
}
-
memset(&ssid, 0, sizeof(ssid));
iscan->list_cur = iscan->list_hdr;
@@ -2585,20 +2645,18 @@ wl_iw_iscan_set_scan(
WL_TRACE(("%s: SIOCSIWSCAN : ISCAN\n", dev->name));
-
#if defined(SOFTAP)
if (ap_cfg_running) {
WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__));
return 0;
}
#endif
-
+
if (g_onoff == G_WLAN_SET_OFF) {
WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__));
return 0;
}
-
if ((!iscan) || (iscan->sysioc_pid < 0)) {
WL_TRACE(("%s use backup if iscan thread is not successful\n", \
__FUNCTION__));
@@ -2611,7 +2669,6 @@ wl_iw_iscan_set_scan(
return EBUSY;
}
-
memset(&ssid, 0, sizeof(ssid));
#if WIRELESS_EXT > 17
@@ -2621,7 +2678,6 @@ wl_iw_iscan_set_scan(
int as = 0;
struct iw_scan_req *req = (struct iw_scan_req *)extra;
if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_CONSUMED) {
-
WL_TRACE(("%s First ISCAN in progress : ignoring SC = %s\n", \
__FUNCTION__, req->essid));
return -EBUSY;
@@ -2654,17 +2710,13 @@ wl_iw_iscan_set_scan(
static bool
ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len)
{
-
-
uint8 *ie = *wpaie;
-
if ((ie[1] >= 6) &&
!bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) {
return TRUE;
}
-
ie += ie[1] + 2;
*tlvs_len -= (int)(ie - *tlvs);
@@ -2676,17 +2728,13 @@ ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len)
static bool
ie_is_wps_ie(uint8 **wpsie, uint8 **tlvs, int *tlvs_len)
{
-
-
uint8 *ie = *wpsie;
-
if ((ie[1] >= 4) &&
!bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) {
return TRUE;
}
-
ie += ie[1] + 2;
*tlvs_len -= (int)(ie - *tlvs);
@@ -2764,8 +2812,6 @@ wl_iw_get_scan_prep(
ASSERT(list);
-
-
for (i = 0; i < list->count && i < IW_MAX_AP; i++)
{
if (list->version != WL_BSS_INFO_VERSION) {
@@ -2778,7 +2824,6 @@ wl_iw_get_scan_prep(
WL_TRACE(("%s : %s\n", __FUNCTION__, bi->SSID));
-
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN);
@@ -2814,10 +2859,8 @@ wl_iw_get_scan_prep(
iwe.u.qual.noise = 0x100 + bi->phy_noise;
event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_QUAL_LEN);
-
- wl_iw_handle_scanresults_ies(&event, end, info, bi);
+ wl_iw_handle_scanresults_ies(&event, end, info, bi);
-
iwe.cmd = SIOCGIWENCODE;
if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY)
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
@@ -2831,11 +2874,10 @@ wl_iw_get_scan_prep(
if (((event -extra) + IW_EV_LCP_LEN) <= (uintptr)end) {
value = event + IW_EV_LCP_LEN;
iwe.cmd = SIOCGIWRATE;
-
+
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) {
- iwe.u.bitrate.value =
- (bi->rateset.rates[j] & 0x7f) * 500000;
+ iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000;
value = IWE_STREAM_ADD_VALUE(info, event, value, end, &iwe,
IW_EV_PARAM_LEN);
}
@@ -2872,7 +2914,7 @@ wl_iw_get_scan(
iscan_info_t *iscan = g_iscan;
iscan_buf_t * p_buf;
uint32 counter = 0;
-#endif
+#endif
WL_TRACE(("%s: buflen_from_user %d: \n", dev->name, buflen_from_user));
@@ -2907,7 +2949,6 @@ wl_iw_get_scan(
}
-
if (g_scan_specified_ssid) {
list = kmalloc(len, GFP_KERNEL);
@@ -2931,10 +2972,9 @@ wl_iw_get_scan(
list->version = dtoh32(list->version);
list->count = dtoh32(list->count);
-
if (list->version != WL_BSS_INFO_VERSION) {
- WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
- __FUNCTION__, list->version));
+ WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n",
+ __FUNCTION__, list->version));
if (g_scan_specified_ssid) {
g_scan_specified_ssid = 0;
kfree(list);
@@ -2959,14 +2999,14 @@ wl_iw_get_scan(
counter += list_merge->count;
if (list_merge->count > 0)
len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info,
- extra+len_ret, buflen_from_user -len_ret);
+ extra+len_ret, buflen_from_user -len_ret);
p_buf = p_buf->next;
}
WL_TRACE(("%s merged with total Bcast APs=%d\n", __FUNCTION__, counter));
#else
list_merge = (wl_scan_results_t *) g_scan;
len_ret = (__u16) wl_iw_get_scan_prep(list_merge, info, extra, buflen_from_user);
-#endif
+#endif
if (g_ss_cache_ctrl.m_link_down) {
wl_iw_delete_bss_from_ss_cache(g_ss_cache_ctrl.m_active_bssid);
@@ -3068,10 +3108,10 @@ wl_iw_iscan_get_scan(
while (p_buf != iscan->list_cur) {
list = &((wl_iscan_results_t*)p_buf->iscan_buf)->results;
- counter += list->count;
+ counter += list->count;
if (list->version != WL_BSS_INFO_VERSION) {
- WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \
+ WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n",
__FUNCTION__, list->version));
return -EINVAL;
}
@@ -3986,7 +4026,6 @@ wl_iw_set_pmksa(
char eabuf[ETHER_ADDR_STR_LEN];
WL_WSEC(("%s: SIOCSIWPMKSA\n", dev->name));
-
CHECK_EXTRA_FOR_NULL(extra);
iwpmksa = (struct iw_pmksa *)extra;
@@ -4003,8 +4042,7 @@ wl_iw_set_pmksa(
uint j;
pmkidptr = &pmkid;
- bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, \
- ETHER_ADDR_LEN);
+ bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, ETHER_ADDR_LEN);
bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID, WPA2_PMKID_LEN);
WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_REMOVE - PMKID: %s = ",
@@ -4052,6 +4090,7 @@ wl_iw_set_pmksa(
}
else
ret = -EINVAL;
+
{
uint j;
uint k;
@@ -4064,7 +4103,7 @@ wl_iw_set_pmksa(
WL_WSEC(("\n"));
}
}
- WL_WSEC(("PRINTING pmkid LIST - No of elements %d\n", pmkid_list.pmkids.npmkid));
+ WL_WSEC(("PRINTING pmkid LIST - No of elements %d, ret = %d\n", pmkid_list.pmkids.npmkid, ret));
for (i = 0; i < pmkid_list.pmkids.npmkid; i++) {
uint j;
WL_WSEC(("PMKID[%d]: %s = ", i,
@@ -4077,8 +4116,7 @@ wl_iw_set_pmksa(
WL_WSEC(("\n"));
if (!ret)
- ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, \
- sizeof(pmkid_list));
+ ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, sizeof(pmkid_list));
return ret;
}
#endif
@@ -4240,8 +4278,19 @@ wl_iw_set_wpaauth(
break;
case IW_AUTH_PRIVACY_INVOKED:
WL_INFORM(("%s: IW_AUTH_PRIVACY_INVOKED\n", __FUNCTION__));
+ /* if paramval is zero, allow association to AP with encryption while
+ * wsec is not set in the driver. If set to 1, restore default wsec_restrict value
+ */
+ WL_INFORM(("%s: IW_AUTH_PRIVACY_INVOKED %u\n", __FUNCTION__,
+ paramval));
+
+ if ((error = dev_wlc_intvar_set(dev, "wsec_restrict", !paramval))) {
+ WL_ERROR(("%s: FAILED IW_AUTH_PRIVACY_INVOKED %u\n", __FUNCTION__,
+ paramval));
+ return error;
+ }
break;
-#endif
+#endif
default:
break;
}
@@ -4356,7 +4405,7 @@ wl_iw_get_wpaauth(
vwrq->value = paramval;
return 0;
}
-#endif
+#endif
#ifdef SOFTAP
@@ -4380,12 +4429,10 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key)
case 28:
case 34:
case 66:
-
if (!strnicmp(keystr, "0x", 2))
keystr += 2;
else
return -1;
-
case 10:
case 26:
case 32:
@@ -4409,7 +4456,6 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key)
key->algo = CRYPTO_ALGO_WEP128;
break;
case 16:
-
key->algo = CRYPTO_ALGO_AES_CCM;
break;
case 32:
@@ -4419,7 +4465,6 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key)
return -1;
}
-
key->flags |= WL_PRIMARY_KEY;
return 0;
@@ -4427,14 +4472,14 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key)
#ifdef EXT_WPA_CRYPTO
#define SHA1HashSize 20
-extern void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, \
- int iterations, u8 *buf, size_t buflen);
+extern void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
+ int iterations, u8 *buf, size_t buflen);
#else
#define SHA1HashSize 20
-int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, \
- int iterations, u8 *buf, size_t buflen)
+int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
+ int iterations, u8 *buf, size_t buflen)
{
WL_ERROR(("WARNING: %s is not implemented !!!\n", __FUNCTION__));
return -1;
@@ -4473,37 +4518,32 @@ static int wl_bssiovar_mkbuf(
int *perr)
{
const char *prefix = "bsscfg:";
- int8* p;
+ int8 *p;
uint prefixlen;
uint namelen;
uint iolen;
- prefixlen = strlen(prefix);
- namelen = strlen(iovar) + 1;
+ prefixlen = strlen(prefix);
+ namelen = strlen(iovar) + 1;
iolen = prefixlen + namelen + sizeof(int) + paramlen;
-
if (buflen < 0 || iolen > (uint)buflen) {
*perr = BCME_BUFTOOSHORT;
return 0;
}
- p = (int8*)bufptr;
+ p = (int8 *)bufptr;
-
memcpy(p, prefix, prefixlen);
p += prefixlen;
-
memcpy(p, iovar, namelen);
p += namelen;
-
bssidx = htod32(bssidx);
memcpy(p, &bssidx, sizeof(int32));
p += sizeof(int32);
-
if (paramlen)
memcpy(p, param, paramlen);
@@ -4512,8 +4552,6 @@ static int wl_bssiovar_mkbuf(
}
-
-
int get_user_params(char *user_params, struct iw_point *dwrq)
{
int ret = 0;
@@ -4557,12 +4595,11 @@ static int thr_wait_for_2nd_eth_dev(void *data)
WL_TRACE(("\n>%s: Thread:'softap ethdev IF:%s is detected !!!'\n\n",
__FUNCTION__, ap_net_dev->name));
- ap_mode = 1;
+ ap_mode = 1;
ap_cfg_running = TRUE;
- bcm_mdelay(500);
+ bcm_mdelay(500);
-
wl_iw_send_priv_event(priv_dev, "ASCII_CMD=AP_BSS_START");
WL_TRACE(("\n>%s, thread completed\n", __FUNCTION__));
@@ -4579,7 +4616,7 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
wlc_ssid_t ap_ssid;
wlc_ssid_t null_ssid;
int max_assoc = 8;
- int mpc = 0;
+ int mpc = 0;
int res = 0;
int apsta_var = 0;
@@ -4599,10 +4636,8 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
WL_SOFTAP((" channel = %d\n", ap->channel));
WL_SOFTAP((" max scb = %d\n", ap->max_scb));
-
if (!ap_cfg_running) {
-
sema_init(&ap_eth_sema, 0);
mpc = 0;
@@ -4611,9 +4646,7 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
updown = 0;
res |= dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown));
-
#ifdef AP_ONLY
-
apsta_var = 0;
res | = dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var));
@@ -4621,62 +4654,60 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
res |= dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var));
res |= dev_wlc_ioctl(dev, WLC_GET_AP, &apsta_var, sizeof(apsta_var));
#else
-
apsta_var = 1;
- iolen = wl_bssiovar_mkbuf("apsta",
- bsscfg_index, &apsta_var, sizeof(apsta_var)+4,
- buf, sizeof(buf), &mkvar_err);
+ iolen = wl_bssiovar_mkbuf("apsta", bsscfg_index, &apsta_var,
+ sizeof(apsta_var)+4, buf, sizeof(buf), &mkvar_err);
ASSERT(iolen);
res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen);
WL_TRACE(("\n>in %s: apsta set result: %d \n", __FUNCTION__, res));
-#endif
+#endif
updown = 1;
res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown));
WL_TRACE(("\n:%s >>>> dev_wlc_ioctl(WLC_UP) updown:%d, \n", __FUNCTION__, updown));
} else {
-
+
res |= dev_iw_write_cfg1_bss_var(dev, 0);
}
-
if (ap->channel == 0) {
- int chosen = 0;
- wl_uint32_list_t request;
- int rescan = 0;
- int retry = 0;
- int ret = 0;
- res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown));
- res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &null_ssid, sizeof(null_ssid));
-
- auto_channel_retry:
- request.count = htod32(0);
- ret = dev_wlc_ioctl(dev, WLC_START_CHANNEL_SEL, &request, sizeof(request));
- if (ret < 0) {
- WL_ERROR(("can't start auto channel scan\n"));
- return -1;
- }
+ int chosen = 0;
+ wl_uint32_list_t request;
+ int rescan = 0;
+ int retry = 0;
+ int ret = 0;
- get_channel_retry:
- bcm_mdelay(500);
+ res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown));
+ res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &null_ssid, sizeof(null_ssid));
- ret = dev_wlc_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen));
- if (ret < 0 || dtoh32(chosen) == 0) {
- if (retry++ < 3)
- goto get_channel_retry;
- else {
- WL_ERROR(("can't get auto channel sel, err = %d, \
- chosen = %d\n", ret, chosen));
- return -1;
- }
+auto_channel_retry:
+ request.count = htod32(0);
+ ret = dev_wlc_ioctl(dev, WLC_START_CHANNEL_SEL, &request, sizeof(request));
+ if (ret < 0) {
+ WL_ERROR(("can't start auto channel scan\n"));
+ return -1;
+ }
+
+get_channel_retry:
+ bcm_mdelay(500);
+
+ ret = dev_wlc_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen));
+ if (ret < 0 || dtoh32(chosen) == 0) {
+ if (retry++ < 3)
+ goto get_channel_retry;
+ else {
+ WL_ERROR(("can't get auto channel sel, err = %d, \
+ chosen = %d\n", ret, chosen));
+ return -1;
}
- if ((chosen == 1) && (!rescan++))
- goto auto_channel_retry;
- WL_SOFTAP(("Set auto channel = %d\n", chosen));
- ap->channel = chosen;
- dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown));
- }
+ }
+ if ((chosen == 1) && (!rescan++))
+ goto auto_channel_retry;
+ WL_SOFTAP(("Set auto channel = %d\n", chosen));
+ ap->channel = chosen;
+ dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown));
+ }
channel = ap->channel;
res |= dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &channel, sizeof(channel));
@@ -4692,32 +4723,20 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
ap_ssid.SSID_len = strlen(ap->ssid);
strncpy(ap_ssid.SSID, ap->ssid, ap_ssid.SSID_len);
-
iolen = wl_bssiovar_mkbuf("ssid", bsscfg_index, (char *)(&ap_ssid),
ap_ssid.SSID_len+4, buf, sizeof(buf), &mkvar_err);
ASSERT(iolen);
res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen);
if (!ap_cfg_running) {
-
kernel_thread(thr_wait_for_2nd_eth_dev, 0, 0);
} else {
-
-
-
WL_TRACE(("%s: Configure security & restart AP bss \n", __FUNCTION__));
-
-
res |= wl_iw_set_ap_security(dev, &my_ap);
-
-
res |= dev_iw_write_cfg1_bss_var(dev, 1);
}
-
return res;
}
-#endif
-
static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
@@ -4737,10 +4756,7 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
WL_SOFTAP((" channel = %d\n", ap->channel));
WL_SOFTAP((" max scb = %d\n", ap->max_scb));
-
if (strnicmp(ap->sec, "open", strlen("open")) == 0) {
-
-
wsec = 0;
res = dev_wlc_intvar_set(dev, "wsec", wsec);
wpa_auth = WPA_AUTH_DISABLED;
@@ -4752,7 +4768,6 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
} else if (strnicmp(ap->sec, "wep", strlen("wep")) == 0) {
-
wl_wsec_key_t key;
memset(&key, 0, sizeof(key));
@@ -4780,9 +4795,6 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
WL_SOFTAP(("=====================\n"));
} else if (strnicmp(ap->sec, "wpa2-psk", strlen("wpa2-psk")) == 0) {
-
-
-
wsec_pmk_t psk;
size_t key_len;
@@ -4796,18 +4808,15 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
return -1;
}
-
if (key_len < WSEC_MAX_PSK_LEN) {
unsigned char output[2*SHA1HashSize];
char key_str_buf[WSEC_MAX_PSK_LEN+1];
-
memset(output, 0, sizeof(output));
pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32);
-
+
ptr = key_str_buf;
for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) {
-
sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \
(uint)output[i*4+1], (uint)output[i*4+2], \
(uint)output[i*4+3]);
@@ -4829,7 +4838,6 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
} else if (strnicmp(ap->sec, "wpa-psk", strlen("wpa-psk")) == 0) {
-
wsec_pmk_t psk;
size_t key_len;
@@ -4843,25 +4851,24 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap)
return -1;
}
-
if (key_len < WSEC_MAX_PSK_LEN) {
unsigned char output[2*SHA1HashSize];
char key_str_buf[WSEC_MAX_PSK_LEN+1];
WL_SOFTAP(("%s: do passhash...\n", __FUNCTION__));
-
+
pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32);
-
+
ptr = key_str_buf;
for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) {
- WL_SOFTAP(("[%02d]: %08x\n", i, *((unsigned int*)&output[i*4])));
-
- sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \
- (uint)output[i*4+1], (uint)output[i*4+2], \
- (uint)output[i*4+3]);
+ WL_SOFTAP(("[%02d]: %08x\n", i, *((unsigned int *)&output[i*4])));
+
+ sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4],
+ (uint)output[i*4+1], (uint)output[i*4+2],
+ (uint)output[i*4+3]);
ptr += 8;
}
- printk("%s: passphase = %s\n", __FUNCTION__, key_str_buf);
+ WL_SOFTAP(("%s: passphase = %s\n", __FUNCTION__, key_str_buf));
psk.key_len = htod16((ushort)WSEC_MAX_PSK_LEN);
memcpy(psk.key, key_str_buf, psk.key_len);
@@ -4896,15 +4903,14 @@ int get_parmeter_from_string(
if (!strncmp(*str_ptr, token, strlen(token))) {
- strsep(str_ptr, "=,");
+ strsep(str_ptr, "=,");
param_str_begin = *str_ptr;
- strsep(str_ptr, "=,");
+ strsep(str_ptr, "=,");
if (*str_ptr == NULL) {
-
parm_str_len = strlen(param_str_begin);
} else {
- param_str_end = *str_ptr-1;
+ param_str_end = *str_ptr-1;
parm_str_len = param_str_end - param_str_begin;
}
@@ -4919,35 +4925,33 @@ int get_parmeter_from_string(
switch (param_type) {
- case PTYPE_INTDEC: {
-
- int *pdst_int = dst;
- char *eptr;
- if (parm_str_len > sizeof(int_str))
- parm_str_len = sizeof(int_str);
+ case PTYPE_INTDEC: {
+ int *pdst_int = dst;
+ char *eptr;
- memcpy(int_str, param_str_begin, parm_str_len);
+ if (parm_str_len > sizeof(int_str))
+ parm_str_len = sizeof(int_str);
- *pdst_int = simple_strtoul(int_str, &eptr, 10);
+ memcpy(int_str, param_str_begin, parm_str_len);
- WL_TRACE((" written as integer:%d\n", *pdst_int));
+ *pdst_int = simple_strtoul(int_str, &eptr, 10);
+
+ WL_TRACE((" written as integer:%d\n", *pdst_int));
}
break;
- case PTYPE_STR_HEX: {
- u8 *buf = dst;
-
- param_max_len = param_max_len >> 1;
- hstr_2_buf(param_str_begin, buf, param_max_len);
- print_buf(buf, param_max_len, 0);
+ case PTYPE_STR_HEX: {
+ u8 *buf = dst;
+
+ param_max_len = param_max_len >> 1;
+ hstr_2_buf(param_str_begin, buf, param_max_len);
+ print_buf(buf, param_max_len, 0);
}
break;
- default:
-
- memcpy(dst, param_str_begin, parm_str_len);
- *((char *)dst + parm_str_len) = 0;
- WL_TRACE((" written as a string:%s\n", (char *)dst));
+ default:
+ memcpy(dst, param_str_begin, parm_str_len);
+ *((char *)dst + parm_str_len) = 0;
+ WL_TRACE((" written as a string:%s\n", (char *)dst));
break;
-
}
return 0;
@@ -4955,7 +4959,7 @@ int get_parmeter_from_string(
WL_ERROR(("\n %s: ERROR: can't find token:%s in str:%s \n",
__FUNCTION__, token, orig_str));
- return -1;
+ return -1;
}
}
@@ -4969,11 +4973,9 @@ static int iwpriv_softap_stop(struct net_device *dev,
WL_SOFTAP((" iw_handler SOFTAP_STP \n"));
-
ap_mode = 0;
ap_cfg_running = FALSE;
-
res = dev_iw_write_cfg1_bss_var(dev, 2);
wrqu->data.length = 0;
@@ -4982,16 +4984,14 @@ static int iwpriv_softap_stop(struct net_device *dev,
}
-
static int iwpriv_fw_reload(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *ext)
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *ext)
{
-
int ret = -1;
char extra[256];
- char *fwstr = fw_path ;
+ char *fwstr = fw_path;
WL_SOFTAP(("current firmware_path[]=%s\n", fwstr));
@@ -5011,7 +5011,6 @@ static int iwpriv_fw_reload(struct net_device *dev,
goto exit_proc;
}
-
extra[wrqu->data.length] = 8;
str_ptr = extra;
@@ -5020,9 +5019,9 @@ static int iwpriv_fw_reload(struct net_device *dev,
goto exit_proc;
}
- if (strstr(fwstr, "apsta") != NULL) {
- WL_SOFTAP(("GOT APSTA FIRMWARE\n"));
- ap_fw_loaded = TRUE;
+ if (strstr(fwstr, "apsta") != NULL) {
+ WL_SOFTAP(("GOT APSTA FIRMWARE\n"));
+ ap_fw_loaded = TRUE;
} else {
WL_SOFTAP(("GOT STA FIRMWARE\n"));
ap_fw_loaded = FALSE;
@@ -5037,11 +5036,13 @@ static int iwpriv_fw_reload(struct net_device *dev,
exit_proc:
return ret;
}
+#endif
+
#ifdef SOFTAP
static int iwpriv_wpasupp_loop_tst(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *ext)
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *ext)
{
int res = 0;
char *params = NULL;
@@ -5056,7 +5057,6 @@ static int iwpriv_wpasupp_loop_tst(struct net_device *dev,
if (!(params = kmalloc(wrqu->data.length+1, GFP_KERNEL)))
return -ENOMEM;
-
if (copy_from_user(params, wrqu->data.pointer, wrqu->data.length)) {
kfree(params);
return -EFAULT;
@@ -5069,17 +5069,16 @@ static int iwpriv_wpasupp_loop_tst(struct net_device *dev,
return -EFAULT;
}
-
res = wl_iw_send_priv_event(dev, params);
kfree(params);
return res;
}
-#endif
+#endif
static int
- iwpriv_en_ap_bss(
+iwpriv_en_ap_bss(
struct net_device *dev,
struct iw_request_info *info,
void *wrqu,
@@ -5088,12 +5087,10 @@ static int
int res = 0;
WL_TRACE(("%s: rcvd IWPRIV IOCTL: for dev:%s\n", __FUNCTION__, dev->name));
-
if (wl_iw_set_ap_security(dev, &my_ap) != 0) {
- WL_ERROR(("!!!!:ERROR setting SOFTAP security in :%s\n", __FUNCTION__));
+ WL_ERROR(("!!!!:ERROR setting SOFTAP security in :%s\n", __FUNCTION__));
};
-
dev_iw_write_cfg1_bss_var(dev, 1);
return res;
}
@@ -5101,7 +5098,6 @@ static int
static int
get_assoc_sta_list(struct net_device *dev, char *buf, int len)
{
-
WL_TRACE(("calling dev_wlc_ioctl(dev:%p, cmd:%d, buf:%p, len:%d)\n",
dev, WLC_GET_ASSOCLIST, buf, len));
@@ -5123,10 +5119,9 @@ set_ap_mac_list(struct net_device *dev, char *buf)
ap_macmode = mac_mode;
if (mac_mode == MACLIST_MODE_DISABLED) {
-
+
bzero(&ap_black_list, sizeof(struct mflist));
-
dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode));
} else {
scb_val_t scbval;
@@ -5134,38 +5129,35 @@ set_ap_mac_list(struct net_device *dev, char *buf)
struct maclist *assoc_maclist = (struct maclist *) mac_buf;
mac_mode = MACLIST_MODE_ALLOW;
-
+
dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode));
-
length = sizeof(white_maclist->count)+white_maclist->count*ETHER_ADDR_LEN;
dev_wlc_ioctl(dev, WLC_SET_MACLIST, white_maclist, length);
WL_SOFTAP(("White List, length %d:\n", length));
for (i = 0; i < white_maclist->count; i++)
WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n",
- i, white_maclist->ea[i].octet[0], white_maclist->ea[i].octet[1], \
- white_maclist->ea[i].octet[2], \
- white_maclist->ea[i].octet[3], white_maclist->ea[i].octet[4], \
+ i, white_maclist->ea[i].octet[0], white_maclist->ea[i].octet[1],
+ white_maclist->ea[i].octet[2],
+ white_maclist->ea[i].octet[3], white_maclist->ea[i].octet[4],
white_maclist->ea[i].octet[5]));
-
bcopy(black_maclist, &ap_black_list, sizeof(ap_black_list));
WL_SOFTAP(("Black List, size %d:\n", sizeof(ap_black_list)));
for (i = 0; i < ap_black_list.count; i++)
WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n",
- i, ap_black_list.ea[i].octet[0], ap_black_list.ea[i].octet[1], \
- ap_black_list.ea[i].octet[2], \
- ap_black_list.ea[i].octet[3], \
+ i, ap_black_list.ea[i].octet[0], ap_black_list.ea[i].octet[1],
+ ap_black_list.ea[i].octet[2],
+ ap_black_list.ea[i].octet[3],
ap_black_list.ea[i].octet[4], ap_black_list.ea[i].octet[5]));
-
dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist, 256);
if (assoc_maclist->count) {
int j;
for (i = 0; i < assoc_maclist->count; i++) {
for (j = 0; j < white_maclist->count; j++) {
- if (!bcmp(&assoc_maclist->ea[i], &white_maclist->ea[j], \
+ if (!bcmp(&assoc_maclist->ea[i], &white_maclist->ea[j],
ETHER_ADDR_LEN)) {
WL_SOFTAP(("match allow, let it be\n"));
break;
@@ -5174,9 +5166,9 @@ set_ap_mac_list(struct net_device *dev, char *buf)
if (j == white_maclist->count) {
WL_SOFTAP(("match black, deauth it\n"));
scbval.val = htod32(1);
- bcopy(&assoc_maclist->ea[i], &scbval.ea, \
- ETHER_ADDR_LEN);
- dev_wlc_ioctl(dev, \
+ bcopy(&assoc_maclist->ea[i], &scbval.ea,
+ ETHER_ADDR_LEN);
+ dev_wlc_ioctl(dev,
WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval,
sizeof(scb_val_t));
}
@@ -5185,7 +5177,7 @@ set_ap_mac_list(struct net_device *dev, char *buf)
}
return 0;
}
-#endif
+#endif
#ifdef SOFTAP
@@ -5217,10 +5209,9 @@ int wl_iw_process_private_ascii_cmd(
ap_mode = 0;
-
if (init_ap_profile_from_string(cmd_str+PROFILE_OFFSET, &my_ap) != 0) {
- WL_ERROR(("ERROR: SoftAP CFG prams !\n"));
- ret = -1;
+ WL_ERROR(("ERROR: SoftAP CFG prams !\n"));
+ ret = -1;
} else {
set_ap_cfg(dev, &my_ap);
}
@@ -5229,30 +5220,25 @@ int wl_iw_process_private_ascii_cmd(
WL_SOFTAP(("\n SOFTAP - ENABLE BSS \n"));
-
WL_SOFTAP(("\n!!! got 'WL_AP_EN_BSS' from WPA supplicant, dev:%s\n", dev->name));
if (ap_net_dev == NULL) {
- printf("\n ERROR: SOFTAP net_dev* is NULL !!!\n");
+ printf("\n ERROR: SOFTAP net_dev* is NULL !!!\n");
} else {
-
iwpriv_en_ap_bss(ap_net_dev, info, dwrq, cmd_str);
}
} else if (strnicmp(sub_cmd, "ASSOC_LST", strlen("ASSOC_LST")) == 0) {
-
-
-
+ /* no code yet */
} else if (strnicmp(sub_cmd, "AP_BSS_STOP", strlen("AP_BSS_STOP")) == 0) {
-
WL_SOFTAP((" \n temp DOWN SOFTAP\n"));
ret = dev_iw_write_cfg1_bss_var(dev, 0);
}
return ret;
-
}
-#endif
+#endif
+
static int wl_iw_set_priv(
struct net_device *dev,
struct iw_request_info *info,
@@ -5263,7 +5249,6 @@ static int wl_iw_set_priv(
int ret = 0;
char * extra;
- wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev);
if (!(extra = kmalloc(dwrq->length, GFP_KERNEL)))
return -ENOMEM;
@@ -5275,76 +5260,69 @@ static int wl_iw_set_priv(
WL_TRACE(("%s: SIOCSIWPRIV request %s, info->cmd:%x, info->flags:%d\n dwrq->length:%d",
dev->name, extra, info->cmd, info->flags, dwrq->length));
+ net_os_wake_lock(dev);
if (dwrq->length && extra) {
- WAKE_LOCK_INIT(iw->pub, WAKE_LOCK_PRIV, "wl_iw_set_priv");
- WAKE_LOCK(iw->pub, WAKE_LOCK_PRIV);
+ if (strnicmp(extra, "START", strlen("START")) == 0) {
+ wl_iw_control_wl_on(dev, info);
+ WL_TRACE(("%s, Received regular START command\n", __FUNCTION__));
+ }
if (g_onoff == G_WLAN_SET_OFF) {
- if (strnicmp(extra, "START", strlen("START")) != 0) {
- WL_ERROR(("%s First IOCTL after stop is NOT START \n", \
- __FUNCTION__));
- WAKE_UNLOCK(iw->pub, WAKE_LOCK_PRIV);
- WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_PRIV);
- kfree(extra);
- return -EFAULT;
- } else {
- wl_iw_control_wl_on(dev, info);
- WL_TRACE(("%s, Received regular START command\n", __FUNCTION__));
- }
+ WL_TRACE(("%s, missing START, Fail\n", __FUNCTION__));
+ kfree(extra);
+ net_os_wake_unlock(dev);
+ return -EFAULT;
}
- if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) {
+ if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) {
#ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS
WL_TRACE(("%s: active scan setting suppressed\n", dev->name));
#else
ret = wl_iw_set_active_scan(dev, info, (union iwreq_data *)dwrq, extra);
-#endif
- }
- else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0)
+#endif
+ } else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0)
#ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS
WL_TRACE(("%s: passive scan setting suppressed\n", dev->name));
#else
ret = wl_iw_set_passive_scan(dev, info, (union iwreq_data *)dwrq, extra);
-#endif
- else if (strnicmp(extra, "RSSI", strlen("RSSI")) == 0)
+#endif
+ else if (strnicmp(extra, "RSSI", strlen("RSSI")) == 0)
ret = wl_iw_get_rssi(dev, info, (union iwreq_data *)dwrq, extra);
- else if (strnicmp(extra, "LINKSPEED", strlen("LINKSPEED")) == 0)
+ else if (strnicmp(extra, "LINKSPEED", strlen("LINKSPEED")) == 0)
ret = wl_iw_get_link_speed(dev, info, (union iwreq_data *)dwrq, extra);
- else if (strnicmp(extra, "MACADDR", strlen("MACADDR")) == 0)
+ else if (strnicmp(extra, "MACADDR", strlen("MACADDR")) == 0)
ret = wl_iw_get_macaddr(dev, info, (union iwreq_data *)dwrq, extra);
- else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0)
+ else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0)
ret = wl_iw_set_country(dev, info, (union iwreq_data *)dwrq, extra);
- else if (strnicmp(extra, "STOP", strlen("STOP")) == 0)
+ else if (strnicmp(extra, "STOP", strlen("STOP")) == 0)
ret = wl_iw_control_wl_off(dev, info);
- else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
+ else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra);
#ifdef SOFTAP
- else if (strnicmp(extra, "ASCII_CMD", strlen("ASCII_CMD")) == 0) {
-
- wl_iw_process_private_ascii_cmd(dev, info, (union iwreq_data *)dwrq, extra);
- }
- else if (strnicmp(extra, "AP_MAC_LIST_SET", strlen("AP_MAC_LIST_SET")) == 0) {
+ else if (strnicmp(extra, "ASCII_CMD", strlen("ASCII_CMD")) == 0) {
+ wl_iw_process_private_ascii_cmd(dev, info, (union iwreq_data *)dwrq, extra);
+ } else if (strnicmp(extra, "AP_MAC_LIST_SET", strlen("AP_MAC_LIST_SET")) == 0) {
WL_SOFTAP(("penguin, set AP_MAC_LIST_SET\n"));
set_ap_mac_list(dev, (extra + PROFILE_OFFSET));
- }
-#endif
- else {
+ }
+#endif
+ else {
+ WL_TRACE(("Unknown PRIVATE command: %s: ignored\n", extra));
snprintf(extra, MAX_WX_STRING, "OK");
dwrq->length = strlen("OK") + 1;
- WL_ERROR(("Unkown PRIVATE command , ignored\n"));
}
- WAKE_UNLOCK(iw->pub, WAKE_LOCK_PRIV);
- WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_PRIV);
}
+ net_os_wake_unlock(dev);
+
if (extra) {
- if (copy_to_user(dwrq->pointer, extra, dwrq->length)) {
+ if (copy_to_user(dwrq->pointer, extra, dwrq->length)) {
kfree(extra);
return -EFAULT;
- }
+ }
- kfree(extra);
+ kfree(extra);
}
return ret;
@@ -5360,12 +5338,12 @@ static const iw_handler wl_iw_handler[] =
(iw_handler) wl_iw_get_freq,
(iw_handler) wl_iw_set_mode,
(iw_handler) wl_iw_get_mode,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) NULL,
- (iw_handler) wl_iw_get_range,
- (iw_handler) wl_iw_set_priv,
- (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) NULL,
+ (iw_handler) wl_iw_get_range,
+ (iw_handler) wl_iw_set_priv,
+ (iw_handler) NULL,
(iw_handler) NULL,
(iw_handler) NULL,
(iw_handler) wl_iw_set_spy,
@@ -5398,7 +5376,7 @@ static const iw_handler wl_iw_handler[] =
#endif
(iw_handler) wl_iw_set_essid,
(iw_handler) wl_iw_get_essid,
- (iw_handler) wl_iw_set_nick,
+ (iw_handler) wl_iw_set_nick,
(iw_handler) wl_iw_get_nick,
(iw_handler) NULL,
(iw_handler) NULL,
@@ -5449,40 +5427,32 @@ static const iw_handler wl_iw_priv_handler[] = {
(iw_handler)wl_iw_control_wl_off,
NULL,
(iw_handler)wl_iw_control_wl_on,
-#ifdef SOFTAP
-
-
+#ifdef SOFTAP
NULL,
(iw_handler)iwpriv_set_ap_config,
-
-
NULL,
(iw_handler)iwpriv_get_assoc_list,
-
NULL,
(iw_handler)iwpriv_set_mac_filters,
-
NULL,
(iw_handler)iwpriv_en_ap_bss,
-
NULL,
(iw_handler)iwpriv_wpasupp_loop_tst,
-
+
NULL,
(iw_handler)iwpriv_softap_stop,
-
+
NULL,
(iw_handler)iwpriv_fw_reload
-#endif
+#endif
};
-static const struct iw_priv_args wl_iw_priv_args[] =
-{
- {
+static const struct iw_priv_args wl_iw_priv_args[] = {
+ {
WL_IW_SET_ACTIVE_SCAN,
0,
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
@@ -5526,30 +5496,28 @@ static const struct iw_priv_args wl_iw_priv_args[] =
},
#ifdef SOFTAP
-
-
{
WL_SET_AP_CFG,
- IW_PRIV_TYPE_CHAR | 256,
+ IW_PRIV_TYPE_CHAR | 256,
0,
"AP_SET_CFG"
},
{
WL_AP_STA_LIST,
- 0,
- IW_PRIV_TYPE_CHAR | 0,
+ 0,
+ IW_PRIV_TYPE_CHAR | 0,
"AP_GET_STA_LIST"
},
{
WL_AP_MAC_FLTR,
- IW_PRIV_TYPE_CHAR | 256,
- IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
+ IW_PRIV_TYPE_CHAR | 256,
+ IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
"AP_SET_MAC_FLTR"
},
- {
+ {
WL_AP_BSS_START,
0,
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
@@ -5558,25 +5526,26 @@ static const struct iw_priv_args wl_iw_priv_args[] =
{
AP_LPB_CMD,
- IW_PRIV_TYPE_CHAR | 256,
- IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
+ IW_PRIV_TYPE_CHAR | 256,
+ IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
"AP_LPB_CMD"
},
- {
+ {
WL_AP_STOP,
- IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
- IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
+ IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
+ IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
"AP_BSS_STOP"
},
- {
+
+ {
WL_FW_RELOAD,
IW_PRIV_TYPE_CHAR | 256,
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0,
"WL_FW_RELOAD"
},
-#endif
- };
+#endif
+};
const struct iw_handler_def wl_iw_handler_def =
{
@@ -5590,11 +5559,10 @@ const struct iw_handler_def wl_iw_handler_def =
#if WIRELESS_EXT >= 19
get_wireless_stats: dhd_get_wireless_stats,
#endif
- };
+};
#endif
-
int wl_iw_ioctl(
struct net_device *dev,
struct ifreq *rq,
@@ -5607,7 +5575,7 @@ int wl_iw_ioctl(
char *extra = NULL;
int token_size = 1, max_tokens = 0, ret = 0;
- WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", __FUNCTION__, cmd));
+ WL_TRACE(("%s: cmd:%x alled via dhd->do_ioctl()entry point\n", __FUNCTION__, cmd));
if (cmd < SIOCIWFIRST ||
IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler) ||
!(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)])) {
@@ -5634,7 +5602,6 @@ int wl_iw_ioctl(
break;
case SIOCGIWRANGE:
-
max_tokens = sizeof(struct iw_range) + 500;
break;
@@ -5800,11 +5767,11 @@ wl_iw_check_conn_fail(wl_event_msg_t *e, char* stringBuf, uint buflen)
else
return FALSE;
}
-#endif
+#endif
#ifndef IW_CUSTOM_MAX
#define IW_CUSTOM_MAX 256
-#endif
+#endif
void
wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
@@ -5817,23 +5784,18 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
uint16 flags = ntoh16(e->flags);
uint32 datalen = ntoh32(e->datalen);
uint32 status = ntoh32(e->status);
- wl_iw_t *iw;
uint32 toto;
memset(&wrqu, 0, sizeof(wrqu));
memset(extra, 0, sizeof(extra));
- iw = 0;
if (!dev) {
WL_ERROR(("%s: dev is null\n", __FUNCTION__));
return;
}
- iw = *(wl_iw_t **)netdev_priv(dev);
-
WL_TRACE(("%s: dev=%s event=%d \n", __FUNCTION__, dev->name, event_type));
-
switch (event_type) {
#if defined(SOFTAP)
case WLC_E_PRUNE:
@@ -5843,9 +5805,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
macaddr[0], macaddr[1], macaddr[2], macaddr[3], \
macaddr[4], macaddr[5]));
-
- if (ap_macmode)
- {
+ if (ap_macmode) {
int i;
for (i = 0; i < ap_black_list.count; i++) {
if (!bcmp(macaddr, &ap_black_list.ea[i], \
@@ -5856,7 +5816,6 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
}
if (i == ap_black_list.count) {
-
char mac_buf[32] = {0};
sprintf(mac_buf, "STA_BLOCK %02X:%02X:%02X:%02X:%02X:%02X",
macaddr[0], macaddr[1], macaddr[2],
@@ -5866,7 +5825,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
}
}
break;
-#endif
+#endif
case WLC_E_TXFAIL:
cmd = IWEVTXDROP;
memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN);
@@ -5882,7 +5841,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
wl_iw_send_priv_event(priv_dev, "STA_JOIN");
return;
}
-#endif
+#endif
memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN);
wrqu.addr.sa_family = ARPHRD_ETHER;
cmd = IWEVREGISTERED;
@@ -5895,7 +5854,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
wl_iw_send_priv_event(priv_dev, "STA_LEAVE");
return;
}
-#endif
+#endif
cmd = SIOCGIWAP;
bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN);
wrqu.addr.sa_family = ARPHRD_ETHER;
@@ -5905,25 +5864,21 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
case WLC_E_NDIS_LINK:
cmd = SIOCGIWAP;
if (!(flags & WLC_EVENT_MSG_LINK)) {
-
-
#ifdef SOFTAP
- if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) {
-
- WL_SOFTAP(("AP DOWN %d\n", event_type));
- wl_iw_send_priv_event(priv_dev, "AP_DOWN");
- } else {
- WL_TRACE(("STA_Link Down\n"));
+ if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) {
+ WL_SOFTAP(("AP DOWN %d\n", event_type));
+ wl_iw_send_priv_event(priv_dev, "AP_DOWN");
+ } else {
+ WL_TRACE(("STA_Link Down\n"));
+ g_ss_cache_ctrl.m_link_down = 1;
+ }
+#else
g_ss_cache_ctrl.m_link_down = 1;
- }
-#else
- g_ss_cache_ctrl.m_link_down = 1;
#endif
WL_TRACE(("Link Down\n"));
bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN);
bzero(&extra, ETHER_ADDR_LEN);
- WAKE_LOCK_TIMEOUT(iw->pub, WAKE_LOCK_LINK_DOWN_TMOUT, 20 * HZ);
}
else {
@@ -5931,17 +5886,15 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
g_ss_cache_ctrl.m_link_down = 0;
memcpy(g_ss_cache_ctrl.m_active_bssid, &e->addr, ETHER_ADDR_LEN);
-#ifdef SOFTAP
+#ifdef SOFTAP
if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) {
-
WL_SOFTAP(("AP UP %d\n", event_type));
wl_iw_send_priv_event(priv_dev, "AP_UP");
} else {
WL_TRACE(("STA_LINK_UP\n"));
}
-#else
-#endif
+#endif
WL_TRACE(("Link UP\n"));
}
@@ -6032,7 +5985,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
wrqu.data.length = strlen(extra);
WL_TRACE(("Event WLC_E_SCAN_COMPLETE\n"));
#endif
- break;
+ break;
default:
@@ -6040,8 +5993,14 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
break;
}
#ifndef SANDGATE2G
- if (cmd)
- wireless_send_event(dev, cmd, &wrqu, extra);
+ if (cmd) {
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
+ if (cmd == SIOCGIWSCAN)
+ wireless_send_event(dev, cmd, &wrqu, NULL);
+ else
+#endif
+ wireless_send_event(dev, cmd, &wrqu, extra);
+ }
#endif
#if WIRELESS_EXT > 14
@@ -6074,7 +6033,7 @@ int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstat
phy_noise = dtoh32(phy_noise);
WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise));
- scb_val.val = 0;
+ bzero(&scb_val, sizeof(scb_val_t));
if ((res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t))))
goto done;
@@ -6186,17 +6145,19 @@ _bt_dhcp_sysioc_thread(void *data)
DAEMONIZE("dhcp_sysioc");
while (down_interruptible(&g_bt->bt_sem) == 0) {
+
+ net_os_wake_lock(g_bt->dev);
+
if (g_bt->timer_on) {
- del_timer(&g_bt->timer);
g_bt->timer_on = 0;
+ del_timer_sync(&g_bt->timer);
}
switch (g_bt->bt_state) {
case BT_DHCP_START:
g_bt->bt_state = BT_DHCP_OPPORTUNITY_WINDOW;
- mod_timer(&g_bt->timer, jiffies + \
- BT_DHCP_OPPORTUNITY_WINDOW_TIEM*HZ/1000);
+ mod_timer(&g_bt->timer, jiffies + BT_DHCP_OPPORTUNITY_WINDOW_TIEM*HZ/1000);
g_bt->timer_on = 1;
break;
case BT_DHCP_OPPORTUNITY_WINDOW:
@@ -6225,12 +6186,15 @@ _bt_dhcp_sysioc_thread(void *data)
g_bt->timer_on = 0;
break;
}
+
+ net_os_wake_unlock(g_bt->dev);
}
if (g_bt->timer_on) {
- del_timer(&g_bt->timer);
g_bt->timer_on = 0;
+ del_timer_sync(&g_bt->timer);
}
+
complete_and_exit(&g_bt->bt_exited, 0);
}
@@ -6316,6 +6280,7 @@ int wl_iw_attach(struct net_device *dev, void * dhdp)
if (iscan->sysioc_pid < 0)
return -ENOMEM;
#endif
+ mutex_init(&wl_start_lock);
iw = *(wl_iw_t **)netdev_priv(dev);
iw->pub = (dhd_pub_t *)dhdp;
@@ -6329,15 +6294,13 @@ int wl_iw_attach(struct net_device *dev, void * dhdp)
memset(g_scan, 0, G_SCAN_RESULTS);
g_scan_specified_ssid = 0;
-
wl_iw_init_ss_cache_ctrl();
wl_iw_bt_init(dev);
#ifdef SOFTAP
priv_dev = dev;
-#endif
-
+#endif
return 0;
}
@@ -6362,7 +6325,7 @@ void wl_iw_detach(void)
}
kfree(iscan);
g_iscan = NULL;
-#endif
+#endif
if (g_scan)
kfree(g_scan);
@@ -6374,7 +6337,6 @@ void wl_iw_detach(void)
#ifdef SOFTAP
if (ap_mode) {
WL_TRACE(("\n%s AP is going down\n", __FUNCTION__));
-
wl_iw_send_priv_event(priv_dev, "AP_DOWN");
}
#endif