aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/broadcom-wl
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2013-11-11 22:03:25 +0000
committerHauke Mehrtens <hauke@openwrt.org>2013-11-11 22:03:25 +0000
commite46232e69a23996e34448b7b5793445e9ec4e9b2 (patch)
tree4311fb94115ed0be393daa6a3245ff5b6594c252 /package/kernel/broadcom-wl
parentdc0ff183163bd7c8173e811b55d49466f7650487 (diff)
downloadupstream-e46232e69a23996e34448b7b5793445e9ec4e9b2.tar.gz
upstream-e46232e69a23996e34448b7b5793445e9ec4e9b2.tar.bz2
upstream-e46232e69a23996e34448b7b5793445e9ec4e9b2.zip
broadcom-wl: support more virtual interfaces
Read the number of virtual interfaces to support from the device capabilities; as some newer devices can support up to 16. Signed-off-by: Nathan Hintz <nlhintz@hotmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38759 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel/broadcom-wl')
-rw-r--r--package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh10
-rw-r--r--package/kernel/broadcom-wl/src/wlc.c45
2 files changed, 53 insertions, 2 deletions
diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index 9416f77b23..614db0cf0b 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -108,12 +108,14 @@ disable_broadcom() {
# make sure all of the devices are disabled in the driver
local ifdown=
- local vif
+ local bssmax=$(wlc ifname "$device" bssmax)
+ local vif=$((${bssmax:-4} - 1))
append ifdown "down" "$N"
append ifdown "wds none" "$N"
- for vif in 3 2 1 0; do
+ while [ $vif -ge 0 ]; do
append ifdown "vif $vif" "$N"
append ifdown "enabled 0" "$N"
+ vif=$(($vif - 1))
done
wlc ifname "$device" stdin <<EOF
@@ -209,8 +211,12 @@ enable_broadcom() {
local nas="$(which nas)"
local if_pre_up if_up nas_cmd
local vif vif_pre_up vif_post_up vif_do_up vif_txpower
+ local bssmax=$(wlc ifname "$device" bssmax)
+ bssmax=${bssmax:-4}
for vif in $vifs; do
+ [ $_c -ge $bssmax ] && break
+
config_get vif_txpower "$vif" txpower
local mode
diff --git a/package/kernel/broadcom-wl/src/wlc.c b/package/kernel/broadcom-wl/src/wlc.c
index 21754a798c..50c40e802f 100644
--- a/package/kernel/broadcom-wl/src/wlc.c
+++ b/package/kernel/broadcom-wl/src/wlc.c
@@ -391,6 +391,37 @@ static int wlc_wsec_key(wlc_param param, void *null, void *value)
return wl_bssiovar_set(interface, "wsec_key", vif, &wsec_key, sizeof(wsec_key));
}
+static int wlc_cap(wlc_param param, void *data, void *value)
+{
+ char *iov = *((char **) data);
+
+ if (param & GET)
+ return wl_iovar_get(interface, iov, value, BUFSIZE);
+
+ return -1;
+}
+
+static int wlc_bssmax(wlc_param param, void *data, void *value)
+{
+ int *val = (int *) value;
+ char *iov = *((char **) data);
+ int ret = -1;
+
+ if (param & GET) {
+ ret = wl_iovar_get(interface, iov, wlbuf, BUFSIZE);
+ if (!ret) {
+ if (strstr(wlbuf, "mbss4"))
+ *val = 4;
+ else if (strstr(wlbuf, "mbss16"))
+ *val = 16;
+ else
+ *val = 1;
+ }
+ }
+
+ return ret;
+}
+
static inline int cw2ecw(int cw)
{
int i;
@@ -954,6 +985,20 @@ static const struct wlc_call wlc_calls[] = {
.handler = wlc_ioctl,
.desc = "Band (0=auto, 1=5Ghz, 2=2.4GHz)"
},
+ {
+ .name = "cap",
+ .param = STRING|NOARG,
+ .handler = wlc_cap,
+ .data.str = "cap",
+ .desc = "Capabilities"
+ },
+ {
+ .name = "bssmax",
+ .param = INT|NOARG,
+ .handler = wlc_bssmax,
+ .data.str = "cap",
+ .desc = "Number of VIF's supported"
+ },
};
#define wlc_calls_size (sizeof(wlc_calls) / sizeof(struct wlc_call))