summaryrefslogtreecommitdiff
path: root/drivers/staging/brcm80211/brcmfmac/wl_iw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/brcm80211/brcmfmac/wl_iw.c')
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_iw.c161
1 files changed, 56 insertions, 105 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
index b49957fb7586..929ceaf363be 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
@@ -69,8 +69,6 @@ uint wl_msg_level = WL_ERROR_VAL;
#define MAX_WLIW_IOCTL_LEN 1024
#ifdef CONFIG_WIRELESS_EXT
-
-extern struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
extern int dhd_wait_pend8021x(struct net_device *dev);
#endif
@@ -119,6 +117,9 @@ iscan_info_t *g_iscan;
static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
+/* Global ASSERT type flag */
+u32 g_assert_type;
+
static void wl_iw_timerfunc(unsigned long data);
static void wl_iw_set_event_mask(struct net_device *dev);
static int wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, u16 action);
@@ -372,7 +373,7 @@ wl_iw_set_freq(struct net_device *dev,
if (fwrq->m > 4000 && fwrq->m < 5000)
sf = WF_CHAN_FACTOR_4_G;
- chan = wf_mhz2channel(fwrq->m, sf);
+ chan = bcm_mhz2channel(fwrq->m, sf);
}
chan = cpu_to_le32(chan);
@@ -495,9 +496,7 @@ wl_iw_get_range(struct net_device *dev,
list = (wl_u32_list_t *) channels;
dwrq->length = sizeof(struct iw_range);
- memset(range, 0, sizeof(range));
-
- range->min_nwid = range->max_nwid = 0;
+ memset(range, 0, sizeof(*range));
list->count = cpu_to_le32(MAXCHANNEL);
error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels,
@@ -3131,7 +3130,7 @@ const struct iw_handler_def wl_iw_handler_def = {
.private_args = 0,
#if WIRELESS_EXT >= 19
- .get_wireless_stats = dhd_get_wireless_stats,
+ .get_wireless_stats = NULL,
#endif
};
#endif /* WIRELESS_EXT > 12 */
@@ -3548,103 +3547,6 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
#endif /* WIRELESS_EXT > 13 */
}
-int
-wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats)
-{
- int res = 0;
- struct wl_cnt cnt;
- int phy_noise;
- int rssi;
- scb_val_t scb_val;
-
- phy_noise = 0;
- res = dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise,
- sizeof(phy_noise));
- if (res)
- goto done;
-
- phy_noise = le32_to_cpu(phy_noise);
- WL_TRACE("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise);
-
- memset(&scb_val, 0, sizeof(scb_val_t));
- res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
- if (res)
- goto done;
-
- rssi = le32_to_cpu(scb_val.val);
- WL_TRACE("wl_iw_get_wireless_stats rssi=%d\n", rssi);
- if (rssi <= WL_IW_RSSI_NO_SIGNAL)
- wstats->qual.qual = 0;
- else if (rssi <= WL_IW_RSSI_VERY_LOW)
- wstats->qual.qual = 1;
- else if (rssi <= WL_IW_RSSI_LOW)
- wstats->qual.qual = 2;
- else if (rssi <= WL_IW_RSSI_GOOD)
- wstats->qual.qual = 3;
- else if (rssi <= WL_IW_RSSI_VERY_GOOD)
- wstats->qual.qual = 4;
- else
- wstats->qual.qual = 5;
-
- wstats->qual.level = 0x100 + rssi;
- wstats->qual.noise = 0x100 + phy_noise;
-#if WIRELESS_EXT > 18
- wstats->qual.updated |= (IW_QUAL_ALL_UPDATED | IW_QUAL_DBM);
-#else
- wstats->qual.updated |= 7;
-#endif
-
-#if WIRELESS_EXT > 11
- WL_TRACE("wl_iw_get_wireless_stats counters=%zu\n",
- sizeof(struct wl_cnt));
-
- memset(&cnt, 0, sizeof(struct wl_cnt));
- res =
- dev_wlc_bufvar_get(dev, "counters", (char *)&cnt,
- sizeof(struct wl_cnt));
- if (res) {
- WL_ERROR("wl_iw_get_wireless_stats counters failed error=%d\n",
- res);
- goto done;
- }
-
- cnt.version = le16_to_cpu(cnt.version);
- if (cnt.version != WL_CNT_T_VERSION) {
- WL_TRACE("\tIncorrect counter version: expected %d; got %d\n",
- WL_CNT_T_VERSION, cnt.version);
- goto done;
- }
-
- wstats->discard.nwid = 0;
- wstats->discard.code = le32_to_cpu(cnt.rxundec);
- wstats->discard.fragment = le32_to_cpu(cnt.rxfragerr);
- wstats->discard.retries = le32_to_cpu(cnt.txfail);
- wstats->discard.misc = le32_to_cpu(cnt.rxrunt) +
- le32_to_cpu(cnt.rxgiant);
- wstats->miss.beacon = 0;
-
- WL_TRACE("wl_iw_get_wireless_stats counters txframe=%d txbyte=%d\n",
- le32_to_cpu(cnt.txframe), le32_to_cpu(cnt.txbyte));
- WL_TRACE("wl_iw_get_wireless_stats counters rxfrmtoolong=%d\n",
- le32_to_cpu(cnt.rxfrmtoolong));
- WL_TRACE("wl_iw_get_wireless_stats counters rxbadplcp=%d\n",
- le32_to_cpu(cnt.rxbadplcp));
- WL_TRACE("wl_iw_get_wireless_stats counters rxundec=%d\n",
- le32_to_cpu(cnt.rxundec));
- WL_TRACE("wl_iw_get_wireless_stats counters rxfragerr=%d\n",
- le32_to_cpu(cnt.rxfragerr));
- WL_TRACE("wl_iw_get_wireless_stats counters txfail=%d\n",
- le32_to_cpu(cnt.txfail));
- WL_TRACE("wl_iw_get_wireless_stats counters rxrunt=%d\n",
- le32_to_cpu(cnt.rxrunt));
- WL_TRACE("wl_iw_get_wireless_stats counters rxgiant=%d\n",
- le32_to_cpu(cnt.rxgiant));
-#endif /* WIRELESS_EXT > 11 */
-
-done:
- return res;
-}
-
int wl_iw_attach(struct net_device *dev, void *dhdp)
{
int params_size;
@@ -3672,8 +3574,10 @@ int wl_iw_attach(struct net_device *dev, void *dhdp)
return -ENOMEM;
iscan->iscan_ex_params_p = kmalloc(params_size, GFP_KERNEL);
- if (!iscan->iscan_ex_params_p)
+ if (!iscan->iscan_ex_params_p) {
+ kfree(iscan);
return -ENOMEM;
+ }
iscan->iscan_ex_param_size = params_size;
iscan->sysioc_tsk = NULL;
@@ -3742,3 +3646,50 @@ void wl_iw_detach(void)
g_scan = NULL;
}
+
+#if defined(BCMDBG)
+void osl_assert(char *exp, char *file, int line)
+{
+ char tempbuf[256];
+ char *basename;
+
+ basename = strrchr(file, '/');
+ /* skip the '/' */
+ if (basename)
+ basename++;
+
+ if (!basename)
+ basename = file;
+
+ snprintf(tempbuf, 256,
+ "assertion \"%s\" failed: file \"%s\", line %d\n", exp,
+ basename, line);
+
+ /*
+ * Print assert message and give it time to
+ * be written to /var/log/messages
+ */
+ if (!in_interrupt()) {
+ const int delay = 3;
+ printk(KERN_ERR "%s", tempbuf);
+ printk(KERN_ERR "panic in %d seconds\n", delay);
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(delay * HZ);
+ }
+
+ switch (g_assert_type) {
+ case 0:
+ panic(KERN_ERR "%s", tempbuf);
+ break;
+ case 1:
+ printk(KERN_ERR "%s", tempbuf);
+ BUG();
+ break;
+ case 2:
+ printk(KERN_ERR "%s", tempbuf);
+ break;
+ default:
+ break;
+ }
+}
+#endif /* defined(BCMDBG) */