diff mbox series

[v2,1/2] mac80211: add 802.11ad-support

Message ID 20210104172750.31325-1-fercerpav@gmail.com
State Accepted
Delegated to: Daniel Golle
Headers show
Series [v2,1/2] mac80211: add 802.11ad-support | expand

Commit Message

Paul Fertser Jan. 4, 2021, 5:27 p.m. UTC
From: Gary Cooper <gaco@bitmessage.de>

This adds some logic to properly populate defaults in /etc/config/wireless
and support for WPA*-GCMP. TP-Link AD7200, Mikrotik WAP60g, LHGG-60ad, etc

Signed-off-by: Gary Cooper <gaco@bitmessage.de>
---
 package/base-files/files/sbin/wifi                 | 1 +
 package/kernel/mac80211/files/lib/wifi/mac80211.sh | 6 ++++++
 package/network/services/hostapd/files/hostapd.sh  | 8 ++++++++
 3 files changed, 15 insertions(+)

Comments

Daniel Golle Jan. 4, 2021, 7:18 p.m. UTC | #1
Hi Paul,
Hi Gary,

On Mon, Jan 04, 2021 at 08:27:49PM +0300, Paul Fertser wrote:
> From: Gary Cooper <gaco@bitmessage.de>
> 
> This adds some logic to properly populate defaults in /etc/config/wireless
> and support for WPA*-GCMP. TP-Link AD7200, Mikrotik WAP60g, LHGG-60ad, etc

I've split this thing up a bit more and merged it with what lynxis
already had in his staging tree.
Plus missing PKG_RELEASE bumps added where needed.

Please review and test the 80211ad branch of my staging tree:
https://git.openwrt.org/?p=openwrt/staging/dangole.git;a=shortlog;h=refs/heads/80211ad


Cheers


Daniel


> 
> Signed-off-by: Gary Cooper <gaco@bitmessage.de>
> ---
>  package/base-files/files/sbin/wifi                 | 1 +
>  package/kernel/mac80211/files/lib/wifi/mac80211.sh | 6 ++++++
>  package/network/services/hostapd/files/hostapd.sh  | 8 ++++++++
>  3 files changed, 15 insertions(+)
> 
> diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi
> index a8b4451c60..75759b94f3 100755
> --- a/package/base-files/files/sbin/wifi
> +++ b/package/base-files/files/sbin/wifi
> @@ -79,6 +79,7 @@ wifi_fixup_hwmode() {
>  	case "$hwmode" in
>  		11bg) hwmode=bg;;
>  		11a) hwmode=a;;
> +		11ad) hwmode=ad;;
>  		11b) hwmode=b;;
>  		11g) hwmode=g;;
>  		11n*)
> diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> index c0fbfbe5a8..3e99f06693 100644
> --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> @@ -88,6 +88,12 @@ detect_mac80211() {
>  			iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80"
>  		}
>  
> +		iw phy "$dev" info | grep -q '\* 5.... MHz \[' && {
> +			mode_band="ad"
> +			channel=$(iw phy "$dev" info | grep '\* 5.... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\|\].*//g')
> +			iw phy "$dev" info | grep -q 'Capabilities:' && htmode="HT20"
> +		}
> +
>  		[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
>  
>  		path="$(mac80211_phy_to_path "$dev")"
> diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
> index 80e1f7cedf..883b7e0e05 100644
> --- a/package/network/services/hostapd/files/hostapd.sh
> +++ b/package/network/services/hostapd/files/hostapd.sh
> @@ -1312,6 +1312,14 @@ wpa_supplicant_add_network() {
>  		;;
>  	esac
>  
> +	case "$wpa_cipher" in
> +		GCMP)
> +			append network_data "pairwise=GCMP" "$N$T"
> +			append network_data "group=GCMP" "$N$T"
> +		;;
> +		*) ;;
> +	esac
> +
>  	[ "$mode" = mesh ] || {
>  		case "$wpa" in
>  			1)
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Adrian Schmutzler Jan. 4, 2021, 9:31 p.m. UTC | #2
Hi Daniel,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Daniel Golle
> Sent: Montag, 4. Januar 2021 20:19
> To: Paul Fertser <fercerpav@gmail.com>
> Cc: Gary Cooper <gaco@bitmessage.de>; openwrt-devel@lists.openwrt.org
> Subject: Re: [PATCH v2 1/2] mac80211: add 802.11ad-support
> 
> Hi Paul,
> Hi Gary,
> 
> On Mon, Jan 04, 2021 at 08:27:49PM +0300, Paul Fertser wrote:
> > From: Gary Cooper <gaco@bitmessage.de>
> >
> > This adds some logic to properly populate defaults in
> > /etc/config/wireless and support for WPA*-GCMP. TP-Link AD7200,
> > Mikrotik WAP60g, LHGG-60ad, etc
> 
> I've split this thing up a bit more and merged it with what lynxis already had in
> his staging tree.
> Plus missing PKG_RELEASE bumps added where needed.
> 
> Please review and test the 80211ad branch of my staging tree:
> https://git.openwrt.org/?p=openwrt/staging/dangole.git;a=shortlog;h=refs/
> heads/80211ad

A few remarks on the device-support part:

> +tplink,ad7200)
> +	ucidef_set_led_usbport "usb1" "USB 1" "blue:usb_1" "usb1-port1" "usb2-port1"
> +	ucidef_set_led_usbport "usb2" "USB 2" "blue:usb_3" "usb3-port1" "usb4-port1"
> +	ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x02"
> +	ucidef_set_led_switch "lan" "lan" "blue:lan" "switch0" "0x3c"
> +	ucidef_set_led_wlan "wlan2g" "wlan2g" "blue:wlan2g" "phy2tpt"
> +	ucidef_set_led_wlan "wlan5g" "wlan5g" "blue:wlan5g" "phy1tpt"
> +	ucidef_set_led_netdev "wlan60g" "wlan60g" "blue:wlan60g" "wlan0"
> +	;;

I'm not sure what's the state with ipq806x, but probably one can move the USB and/or Wifi triggers to DTS.
If possible, the wlan60g trigger should be converted to phy0something, as that will make it independent of the interface name.

Apart from that, I only found caldata extraction for two of three radios. Is that correct or a mistake?

> +	model = "TP-Link Talon AD7200";
> +	compatible = "tplink,ad7200", "qcom,ipq8064";

I'd decide for one name (either with or without "Talon"), but not mix them. If "Talon" is an alternate name ("nickname"), it should be put behind the proper name in brackets ("TP-Link AD7200 (Talon)").

> +	keys {
[...]
> +		ledgeneral {
> +			label = "ledswitch";

One should decide for one name in both label and node name. I'd recommend "led-enable", as "ledswitch" had me think of a networking switch LED until I read the linux,code property.

> +			gpios = <&qcom_pinmux 53 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_LIGHTS_TOGGLE>;
> +		};
> +	};

> +	leds {
[...]
> +		usb1 {
> +			label = "blue:usb_1";

I'd remove the underscore here, same for usb_3 directly following here.

Apart from that, one could sort all those LEDs by $something

[...]
> +		m25p80@0 {

flash@0

[...]
> +			SBL1@0 {

This should be partition@0 and so on for the following partitions.

> +define Device/tplink_ad7200
> +	$(call Device/TpSafeImage)
> +	DEVICE_VENDOR := TP-Link
> +	DEVICE_MODEL := Talon AD7200

With or without Talon, see above.

> +	DEVICE_VARIANT := v1

Either we only have v1 and can drop this line, or the device should be named tplink,ad7200-v1.

> +	SOC := qcom-ipq8064
> +	BLOCKSIZE := 128k
> +	PAGESIZE := 2048
> +	BOARD_NAME := ad7200

This can be dropped.

> +	SUPPORTED_DEVICES += ad7200

This can be dropped.

Thanks for finally taking care of the 11ad support.

Best

Adrian
Adrian Schmutzler Jan. 5, 2021, 12:26 p.m. UTC | #3
> -----Original Message-----
> From: Adrian Schmutzler [mailto:mail@adrianschmutzler.de]
> Sent: Montag, 4. Januar 2021 22:31
> To: 'Daniel Golle' <daniel@makrotopia.org>; 'Paul Fertser'
> <fercerpav@gmail.com>
> Cc: 'Gary Cooper' <gaco@bitmessage.de>; 'openwrt-
> devel@lists.openwrt.org' <openwrt-devel@lists.openwrt.org>
> Subject: RE: [PATCH v2 1/2] mac80211: add 802.11ad-support
> 
> Hi Daniel,
> 
> > -----Original Message-----
> > From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> > On Behalf Of Daniel Golle
> > Sent: Montag, 4. Januar 2021 20:19
> > To: Paul Fertser <fercerpav@gmail.com>
> > Cc: Gary Cooper <gaco@bitmessage.de>; openwrt-
> devel@lists.openwrt.org
> > Subject: Re: [PATCH v2 1/2] mac80211: add 802.11ad-support
> >
> > Hi Paul,
> > Hi Gary,
> >
> > On Mon, Jan 04, 2021 at 08:27:49PM +0300, Paul Fertser wrote:
> > > From: Gary Cooper <gaco@bitmessage.de>
> > >
> > > This adds some logic to properly populate defaults in
> > > /etc/config/wireless and support for WPA*-GCMP. TP-Link AD7200,
> > > Mikrotik WAP60g, LHGG-60ad, etc
> >
> > I've split this thing up a bit more and merged it with what lynxis
> > already had in his staging tree.
> > Plus missing PKG_RELEASE bumps added where needed.
> >
> > Please review and test the 80211ad branch of my staging tree:
> > https://git.openwrt.org/?p=openwrt/staging/dangole.git;a=shortlog;h=re
> > fs/
> > heads/80211ad
> 
> A few remarks on the device-support part:

Or lets just merge the current crappy state ...
Daniel Golle Jan. 5, 2021, 1:01 p.m. UTC | #4
Hi Adrian,

On Tue, Jan 05, 2021 at 01:26:34PM +0100, Adrian Schmutzler wrote:
> > A few remarks on the device-support part:
> 
> Or lets just merge the current crappy state ...

Whooops, sorry for that. I didn't notice your reply in my inbox while
working on the 11ad stuff with lynxis.
I've addressed most of your comments in a follow-up commit.


Cheers


Daniel
diff mbox series

Patch

diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi
index a8b4451c60..75759b94f3 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -79,6 +79,7 @@  wifi_fixup_hwmode() {
 	case "$hwmode" in
 		11bg) hwmode=bg;;
 		11a) hwmode=a;;
+		11ad) hwmode=ad;;
 		11b) hwmode=b;;
 		11g) hwmode=g;;
 		11n*)
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
index c0fbfbe5a8..3e99f06693 100644
--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
@@ -88,6 +88,12 @@  detect_mac80211() {
 			iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80"
 		}
 
+		iw phy "$dev" info | grep -q '\* 5.... MHz \[' && {
+			mode_band="ad"
+			channel=$(iw phy "$dev" info | grep '\* 5.... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\|\].*//g')
+			iw phy "$dev" info | grep -q 'Capabilities:' && htmode="HT20"
+		}
+
 		[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
 
 		path="$(mac80211_phy_to_path "$dev")"
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 80e1f7cedf..883b7e0e05 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -1312,6 +1312,14 @@  wpa_supplicant_add_network() {
 		;;
 	esac
 
+	case "$wpa_cipher" in
+		GCMP)
+			append network_data "pairwise=GCMP" "$N$T"
+			append network_data "group=GCMP" "$N$T"
+		;;
+		*) ;;
+	esac
+
 	[ "$mode" = mesh ] || {
 		case "$wpa" in
 			1)