broadcom-wl: Add 'N' mode support to broadcom-wl
This is partly based on patches sent by Łukasz Kwestarz (See https://lists.openwrt.org/pipermail/openwrt-devel/2012-March/014356.html). Signed-off-by: Nathan Hintz <nlhintz@hotmail.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 37802
This commit is contained in:
		| @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk | |||||||
|  |  | ||||||
| PKG_NAME:=broadcom-wl | PKG_NAME:=broadcom-wl | ||||||
| PKG_VERSION:=5.10.56.27.3 | PKG_VERSION:=5.10.56.27.3 | ||||||
| PKG_RELEASE:=5 | PKG_RELEASE:=6 | ||||||
|  |  | ||||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2 | ||||||
| PKG_SOURCE_URL:=http://downloads.openwrt.org/sources | PKG_SOURCE_URL:=http://downloads.openwrt.org/sources | ||||||
|   | |||||||
| @@ -131,6 +131,7 @@ enable_broadcom() { | |||||||
| 	config_get frag "$device" frag | 	config_get frag "$device" frag | ||||||
| 	config_get rts "$device" rts | 	config_get rts "$device" rts | ||||||
| 	config_get hwmode "$device" hwmode | 	config_get hwmode "$device" hwmode | ||||||
|  | 	config_get htmode "$device" htmode | ||||||
| 	local vif_pre_up vif_post_up vif_do_up vif_txpower | 	local vif_pre_up vif_post_up vif_do_up vif_txpower | ||||||
| 	local doth=0 | 	local doth=0 | ||||||
| 	local wmm=1 | 	local wmm=1 | ||||||
| @@ -161,14 +162,39 @@ enable_broadcom() { | |||||||
| 		;; | 		;; | ||||||
| 	esac | 	esac | ||||||
|  |  | ||||||
|  | 	[ ${channel:-0} -ge 1 -a ${channel:-0} -le 14 ] && band=2 | ||||||
|  | 	[ ${channel:-0} -ge 36 ] && band=1 | ||||||
|  |  | ||||||
| 	case "$hwmode" in | 	case "$hwmode" in | ||||||
| 		*b)   hwmode=0;; | 		*na)	nmode=1; nreqd=0;; | ||||||
| 		*bg)  hwmode=1;; | 		*a)	nmode=0;; | ||||||
| 		*g)   hwmode=2;; | 		*ng)	gmode=1; nmode=1; nreqd=0;; | ||||||
| 		*gst) hwmode=4;; | 		*n)	nmode=1; nreqd=1;; | ||||||
| 		*lrs) hwmode=5;; | 		*b)	gmode=0; nmode=0;; | ||||||
| 		*)    hwmode=1;; | 		*bg)	gmode=1; nmode=0;; | ||||||
|  | 		*g)	gmode=2; nmode=0;; | ||||||
|  | 		*gst)	gmode=4; nmode=0;; | ||||||
|  | 		*lrs)	gmode=5; nmode=0;; | ||||||
|  | 		*)      case "$band" in | ||||||
|  | 				2) gmode=1; nmode=1; nreqd=0;; | ||||||
|  | 				1) nmode=1; nreqd=0;; | ||||||
|  | 				*) gmode=1; nmode=1; nreqd=0;; | ||||||
| 			esac | 			esac | ||||||
|  | 			;; | ||||||
|  | 	esac | ||||||
|  |  | ||||||
|  |         # Use 'nmode' for N-Phy only | ||||||
|  | 	[ "$(wlc ifname $device phytype)" = 4 ] || nmode= | ||||||
|  |  | ||||||
|  | 	# Use 'chanspec' instead of 'channel' for 'N' modes (See bcmwifi.h) | ||||||
|  | 	[ ${nmode:-0} -ne 0 -a -n "$band" ] && { | ||||||
|  | 		case "$htmode" in | ||||||
|  | 			HT40-)	chanspec=$(printf 0x%x%x%02x $band 0xe $(($channel - 2))); channel=;; | ||||||
|  | 			HT40+)	chanspec=$(printf 0x%x%x%02x $band 0xd $(($channel + 2))); channel=;; | ||||||
|  | 			HT20)	chanspec=$(printf 0x%x%x%02x $band 0xb $channel); channel=;; | ||||||
|  | 			*) ;; | ||||||
|  | 		esac | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	for vif in $vifs; do | 	for vif in $vifs; do | ||||||
| 		config_get vif_txpower "$vif" txpower | 		config_get vif_txpower "$vif" txpower | ||||||
| @@ -322,7 +348,10 @@ enable_broadcom() { | |||||||
| 	wlc ifname "$device" stdin <<EOF | 	wlc ifname "$device" stdin <<EOF | ||||||
| $ifdown | $ifdown | ||||||
|  |  | ||||||
| gmode ${hwmode:-1} | ${nmode:+band ${band:-0}} | ||||||
|  | ${nmode:+nmode $nmode} | ||||||
|  | ${nmode:+${nreqd:+nreqd $nreqd}} | ||||||
|  | ${gmode:+gmode $gmode} | ||||||
| apsta $apsta | apsta $apsta | ||||||
| ap $ap | ap $ap | ||||||
| ${mssid:+mssid $mssid} | ${mssid:+mssid $mssid} | ||||||
| @@ -344,6 +373,7 @@ wds none | |||||||
| ${wds:+wds $wds} | ${wds:+wds $wds} | ||||||
| country ${country:-US} | country ${country:-US} | ||||||
| ${channel:+channel $channel} | ${channel:+channel $channel} | ||||||
|  | ${chanspec:+chanspec $chanspec} | ||||||
| maxassoc ${maxassoc:-128} | maxassoc ${maxassoc:-128} | ||||||
| slottime ${slottime:--1} | slottime ${slottime:--1} | ||||||
| ${frameburst:+frameburst $frameburst} | ${frameburst:+frameburst $frameburst} | ||||||
|   | |||||||
| @@ -499,8 +499,8 @@ static int wlc_pmk(wlc_param param, void *data, void *value) | |||||||
| 	/* driver doesn't support GET */ | 	/* driver doesn't support GET */ | ||||||
|  |  | ||||||
| 	if ((param & PARAM_MODE) == SET) { | 	if ((param & PARAM_MODE) == SET) { | ||||||
| 		strncpy(pmk.key, value, WSEC_MAX_PSK_LEN); | 		strncpy(pmk.key, str, WSEC_MAX_PSK_LEN); | ||||||
| 		pmk.key_len = strlen(value); | 		pmk.key_len = strlen(str); | ||||||
|  |  | ||||||
| 		if (pmk.key_len > WSEC_MAX_PSK_LEN) | 		if (pmk.key_len > WSEC_MAX_PSK_LEN) | ||||||
| 			pmk.key_len = WSEC_MAX_PSK_LEN; | 			pmk.key_len = WSEC_MAX_PSK_LEN; | ||||||
| @@ -912,6 +912,41 @@ static const struct wlc_call wlc_calls[] = { | |||||||
| 		.handler = wlc_ioctl, | 		.handler = wlc_ioctl, | ||||||
| 		.desc = "G Mode" | 		.desc = "G Mode" | ||||||
| 	}, | 	}, | ||||||
|  | 	{ | ||||||
|  | 		.name = "phytype", | ||||||
|  | 		.param = INT, | ||||||
|  | 		.data.num = (WLC_GET_PHYTYPE << 16), | ||||||
|  | 		.handler = wlc_ioctl, | ||||||
|  | 		.desc = "PHY Type" | ||||||
|  | 	}, | ||||||
|  | 	{ | ||||||
|  | 		.name = "nmode", | ||||||
|  | 		.param = INT, | ||||||
|  | 		.handler = wlc_iovar, | ||||||
|  | 		.data.str = "nmode", | ||||||
|  | 		.desc = "N Mode" | ||||||
|  | 	}, | ||||||
|  | 	{ | ||||||
|  | 		.name = "nreqd", | ||||||
|  | 		.param = INT, | ||||||
|  | 		.handler = wlc_iovar, | ||||||
|  | 		.data.str = "nreqd", | ||||||
|  | 		.desc = "N Mode required" | ||||||
|  | 	}, | ||||||
|  | 	{ | ||||||
|  | 		.name = "chanspec", | ||||||
|  | 		.param = INT, | ||||||
|  | 		.handler = wlc_iovar, | ||||||
|  | 		.data.str = "chanspec", | ||||||
|  | 		.desc = "Channel Spec (See bcmwifi.h)" | ||||||
|  | 	}, | ||||||
|  | 	{ | ||||||
|  | 		.name = "band", | ||||||
|  | 		.param = INT, | ||||||
|  | 		.data.num = ((WLC_GET_BAND << 16) | WLC_SET_BAND), | ||||||
|  | 		.handler = wlc_ioctl, | ||||||
|  | 		.desc = "Band" | ||||||
|  | 	}, | ||||||
| }; | }; | ||||||
| #define wlc_calls_size (sizeof(wlc_calls) / sizeof(struct wlc_call)) | #define wlc_calls_size (sizeof(wlc_calls) / sizeof(struct wlc_call)) | ||||||
|  |  | ||||||
| @@ -971,7 +1006,7 @@ static int do_command(const struct wlc_call *cmd, char *arg) | |||||||
| 		set = 1; | 		set = 1; | ||||||
| 		switch(cmd->param & PARAM_TYPE) { | 		switch(cmd->param & PARAM_TYPE) { | ||||||
| 			case INT: | 			case INT: | ||||||
| 				intval = strtoul(arg, &end, 10); | 				intval = strtoul(arg, &end, 0); | ||||||
| 				if (end && !(*end)) { | 				if (end && !(*end)) { | ||||||
| 					memcpy(buf, &intval, sizeof(intval)); | 					memcpy(buf, &intval, sizeof(intval)); | ||||||
| 				} else { | 				} else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Hauke Mehrtens
					Hauke Mehrtens