mac80211: brcmfmac: backport important changes from the 4.19
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
		| @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk | |||||||
| PKG_NAME:=mac80211 | PKG_NAME:=mac80211 | ||||||
|  |  | ||||||
| PKG_VERSION:=2017-01-31 | PKG_VERSION:=2017-01-31 | ||||||
| PKG_RELEASE:=12 | PKG_RELEASE:=13 | ||||||
| PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources | PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources | ||||||
| PKG_BACKPORT_VERSION:= | PKG_BACKPORT_VERSION:= | ||||||
| PKG_HASH:=75e6d39e34cf156212a2509172a4a62b673b69eb4a1d9aaa565f7fa719fa2317 | PKG_HASH:=75e6d39e34cf156212a2509172a4a62b673b69eb4a1d9aaa565f7fa719fa2317 | ||||||
|   | |||||||
| @@ -0,0 +1,59 @@ | |||||||
|  | From 01f69dfafdbe7deff58b58053bc3a4a75c6a570c Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> | ||||||
|  | Date: Sun, 24 Jun 2018 21:44:35 +0200 | ||||||
|  | Subject: [PATCH] brcmfmac: detect firmware support for monitor interface | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  |  | ||||||
|  | Many/most of firmwares support creating monitor interface but only the | ||||||
|  | most recent ones explicitly /announce/ it using a "monitor" entry in the | ||||||
|  | list of capabilities. | ||||||
|  |  | ||||||
|  | Check for that entry and store internally info about monitor mode | ||||||
|  | support using a new feature flag. Once we sort out all details of | ||||||
|  | handling monitor interface it will be used when reporting available | ||||||
|  | interfaces to the cfg80211. | ||||||
|  |  | ||||||
|  | Later some fallback detecion method may be added for older firmwares. | ||||||
|  | For now just stick to the "monitor" capability which should be 100% | ||||||
|  | reliable. | ||||||
|  |  | ||||||
|  | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> | ||||||
|  | Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> | ||||||
|  | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 1 + | ||||||
|  |  drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- | ||||||
|  |  2 files changed, 4 insertions(+), 1 deletion(-) | ||||||
|  |  | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | ||||||
|  | @@ -47,6 +47,7 @@ static const struct brcmf_feat_fwcap brc | ||||||
|  |  	{ BRCMF_FEAT_MBSS, "mbss" }, | ||||||
|  |  	{ BRCMF_FEAT_MCHAN, "mchan" }, | ||||||
|  |  	{ BRCMF_FEAT_P2P, "p2p" }, | ||||||
|  | +	{ BRCMF_FEAT_MONITOR, "monitor" }, | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  #ifdef DEBUG | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | ||||||
|  | @@ -31,6 +31,7 @@ | ||||||
|  |   * WOWL_GTK: (WOWL) GTK rekeying offload | ||||||
|  |   * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL. | ||||||
|  |   * MFP: 802.11w Management Frame Protection. | ||||||
|  | + * MONITOR: firmware can pass monitor packets to host. | ||||||
|  |   */ | ||||||
|  |  #define BRCMF_FEAT_LIST \ | ||||||
|  |  	BRCMF_FEAT_DEF(MBSS) \ | ||||||
|  | @@ -44,7 +45,8 @@ | ||||||
|  |  	BRCMF_FEAT_DEF(WOWL_ND) \ | ||||||
|  |  	BRCMF_FEAT_DEF(WOWL_GTK) \ | ||||||
|  |  	BRCMF_FEAT_DEF(WOWL_ARP_ND) \ | ||||||
|  | -	BRCMF_FEAT_DEF(MFP) | ||||||
|  | +	BRCMF_FEAT_DEF(MFP) \ | ||||||
|  | +	BRCMF_FEAT_DEF(MONITOR) | ||||||
|  |   | ||||||
|  |  /* | ||||||
|  |   * Quirks: | ||||||
| @@ -0,0 +1,51 @@ | |||||||
|  | From e63410ac65e0ead2040bbd3927c116889edf87e4 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> | ||||||
|  | Date: Sun, 24 Jun 2018 21:44:36 +0200 | ||||||
|  | Subject: [PATCH] brcmfmac: detect firmware support for radiotap monitor frames | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  |  | ||||||
|  | Depending on used build-time options some firmwares may already include | ||||||
|  | radiotap header in passed monitor frames. Add a new feature flag to | ||||||
|  | store info about it. It's needed for proper handling of received frames | ||||||
|  | before passing them up. | ||||||
|  |  | ||||||
|  | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> | ||||||
|  | Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> | ||||||
|  | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 1 + | ||||||
|  |  drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- | ||||||
|  |  2 files changed, 4 insertions(+), 1 deletion(-) | ||||||
|  |  | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | ||||||
|  | @@ -48,6 +48,7 @@ static const struct brcmf_feat_fwcap brc | ||||||
|  |  	{ BRCMF_FEAT_MCHAN, "mchan" }, | ||||||
|  |  	{ BRCMF_FEAT_P2P, "p2p" }, | ||||||
|  |  	{ BRCMF_FEAT_MONITOR, "monitor" }, | ||||||
|  | +	{ BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  #ifdef DEBUG | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | ||||||
|  | @@ -32,6 +32,7 @@ | ||||||
|  |   * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL. | ||||||
|  |   * MFP: 802.11w Management Frame Protection. | ||||||
|  |   * MONITOR: firmware can pass monitor packets to host. | ||||||
|  | + * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header | ||||||
|  |   */ | ||||||
|  |  #define BRCMF_FEAT_LIST \ | ||||||
|  |  	BRCMF_FEAT_DEF(MBSS) \ | ||||||
|  | @@ -46,7 +47,8 @@ | ||||||
|  |  	BRCMF_FEAT_DEF(WOWL_GTK) \ | ||||||
|  |  	BRCMF_FEAT_DEF(WOWL_ARP_ND) \ | ||||||
|  |  	BRCMF_FEAT_DEF(MFP) \ | ||||||
|  | -	BRCMF_FEAT_DEF(MONITOR) | ||||||
|  | +	BRCMF_FEAT_DEF(MONITOR) \ | ||||||
|  | +	BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) | ||||||
|  |   | ||||||
|  |  /* | ||||||
|  |   * Quirks: | ||||||
| @@ -0,0 +1,141 @@ | |||||||
|  | From a8d7631858aff156b72f807ee7cc062048e63836 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> | ||||||
|  | Date: Sun, 24 Jun 2018 21:44:37 +0200 | ||||||
|  | Subject: [PATCH] brcmfmac: handle msgbuf packets marked with monitor mode flag | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  |  | ||||||
|  | New Broadcom firmwares mark monitor mode packets using a newly defined | ||||||
|  | bit in the flags field. Use it to filter them out and pass to the | ||||||
|  | monitor interface. These defines were found in bcmmsgbuf.h from SDK. | ||||||
|  |  | ||||||
|  | As not every firmware generates radiotap header this commit introduces | ||||||
|  | BRCMF_FEAT_MONITOR_FMT_RADIOTAP flag. It has to be has based on firmware | ||||||
|  | capabilities. If not present brcmf_netif_mon_rx() will assume packet is | ||||||
|  | a raw 802.11 frame and will prepend it with an empty radiotap header. | ||||||
|  |  | ||||||
|  | This new code is limited to the msgbuf protocol at this point. Adding | ||||||
|  | support for SDIO/USB devices will require some extra work (possibly a | ||||||
|  | new firmware release). | ||||||
|  |  | ||||||
|  | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> | ||||||
|  | Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> | ||||||
|  | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 25 ++++++++++++++++++++++ | ||||||
|  |  .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 ++ | ||||||
|  |  .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c  | 18 ++++++++++++++++ | ||||||
|  |  3 files changed, 45 insertions(+) | ||||||
|  |  | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | ||||||
|  | @@ -21,6 +21,7 @@ | ||||||
|  |  #include <net/cfg80211.h> | ||||||
|  |  #include <net/rtnetlink.h> | ||||||
|  |  #include <net/addrconf.h> | ||||||
|  | +#include <net/ieee80211_radiotap.h> | ||||||
|  |  #include <net/ipv6.h> | ||||||
|  |  #include <brcmu_utils.h> | ||||||
|  |  #include <brcmu_wifi.h> | ||||||
|  | @@ -367,6 +368,34 @@ void brcmf_netif_rx(struct brcmf_if *ifp | ||||||
|  |  		netif_rx_ni(skb); | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb) | ||||||
|  | +{ | ||||||
|  | +	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) { | ||||||
|  | +		/* Do nothing */ | ||||||
|  | +	} else { | ||||||
|  | +		struct ieee80211_radiotap_header *radiotap; | ||||||
|  | + | ||||||
|  | +		/* TODO: use RX status to fill some radiotap data */ | ||||||
|  | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) | ||||||
|  | +		radiotap = skb_push(skb, sizeof(*radiotap)); | ||||||
|  | +#else | ||||||
|  | +		radiotap = (struct ieee80211_radiotap_header *)skb_push(skb, sizeof(*radiotap)); | ||||||
|  | +#endif | ||||||
|  | +		memset(radiotap, 0, sizeof(*radiotap)); | ||||||
|  | +		radiotap->it_len = cpu_to_le16(sizeof(*radiotap)); | ||||||
|  | + | ||||||
|  | +		/* TODO: 4 bytes with receive status? */ | ||||||
|  | +		skb->len -= 4; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	skb->dev = ifp->ndev; | ||||||
|  | +	skb_reset_mac_header(skb); | ||||||
|  | +	skb->pkt_type = PACKET_OTHERHOST; | ||||||
|  | +	skb->protocol = htons(ETH_P_802_2); | ||||||
|  | + | ||||||
|  | +	brcmf_netif_rx(ifp, skb); | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb, | ||||||
|  |  			    struct brcmf_if **ifp) | ||||||
|  |  { | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | ||||||
|  | @@ -121,6 +121,7 @@ struct brcmf_pub { | ||||||
|  |   | ||||||
|  |  	struct brcmf_if *iflist[BRCMF_MAX_IFS]; | ||||||
|  |  	s32 if2bss[BRCMF_MAX_IFS]; | ||||||
|  | +	struct brcmf_if *mon_if; | ||||||
|  |   | ||||||
|  |  	struct mutex proto_block; | ||||||
|  |  	unsigned char proto_buf[BRCMF_DCMD_MAXLEN]; | ||||||
|  | @@ -215,6 +216,7 @@ void brcmf_txflowblock_if(struct brcmf_i | ||||||
|  |  			  enum brcmf_netif_stop_reason reason, bool state); | ||||||
|  |  void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success); | ||||||
|  |  void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb); | ||||||
|  | +void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb); | ||||||
|  |  void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on); | ||||||
|  |  int __init brcmf_core_init(void); | ||||||
|  |  void __exit brcmf_core_exit(void); | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | ||||||
|  | @@ -69,6 +69,8 @@ | ||||||
|  |  #define BRCMF_MSGBUF_MAX_EVENTBUF_POST		8 | ||||||
|  |   | ||||||
|  |  #define BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_3	0x01 | ||||||
|  | +#define BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_11	0x02 | ||||||
|  | +#define BRCMF_MSGBUF_PKT_FLAGS_FRAME_MASK	0x07 | ||||||
|  |  #define BRCMF_MSGBUF_PKT_FLAGS_PRIO_SHIFT	5 | ||||||
|  |   | ||||||
|  |  #define BRCMF_MSGBUF_TX_FLUSH_CNT1		32 | ||||||
|  | @@ -1126,6 +1128,7 @@ brcmf_msgbuf_process_rx_complete(struct | ||||||
|  |  	struct sk_buff *skb; | ||||||
|  |  	u16 data_offset; | ||||||
|  |  	u16 buflen; | ||||||
|  | +	u16 flags; | ||||||
|  |  	u32 idx; | ||||||
|  |  	struct brcmf_if *ifp; | ||||||
|  |   | ||||||
|  | @@ -1135,6 +1138,7 @@ brcmf_msgbuf_process_rx_complete(struct | ||||||
|  |  	data_offset = le16_to_cpu(rx_complete->data_offset); | ||||||
|  |  	buflen = le16_to_cpu(rx_complete->data_len); | ||||||
|  |  	idx = le32_to_cpu(rx_complete->msg.request_id); | ||||||
|  | +	flags = le16_to_cpu(rx_complete->flags); | ||||||
|  |   | ||||||
|  |  	skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, | ||||||
|  |  				     msgbuf->rx_pktids, idx); | ||||||
|  | @@ -1148,6 +1152,20 @@ brcmf_msgbuf_process_rx_complete(struct | ||||||
|  |   | ||||||
|  |  	skb_trim(skb, buflen); | ||||||
|  |   | ||||||
|  | +	if ((flags & BRCMF_MSGBUF_PKT_FLAGS_FRAME_MASK) == | ||||||
|  | +	    BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_11) { | ||||||
|  | +		ifp = msgbuf->drvr->mon_if; | ||||||
|  | + | ||||||
|  | +		if (!ifp) { | ||||||
|  | +			brcmf_err("Received unexpected monitor pkt\n"); | ||||||
|  | +			brcmu_pkt_buf_free_skb(skb); | ||||||
|  | +			return; | ||||||
|  | +		} | ||||||
|  | + | ||||||
|  | +		brcmf_netif_mon_rx(ifp, skb); | ||||||
|  | +		return; | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  |  	ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx); | ||||||
|  |  	if (!ifp || !ifp->ndev) { | ||||||
|  |  		brcmf_err("Received pkt for invalid ifidx %d\n", | ||||||
| @@ -0,0 +1,60 @@ | |||||||
|  | From 4b4a8d808c58fc0defc32a26b2fea35d66692c45 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> | ||||||
|  | Date: Thu, 28 Jun 2018 08:16:13 +0200 | ||||||
|  | Subject: [PATCH] brcmfmac: define more bits for the flags of struct | ||||||
|  |  brcmf_sta_info_le | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  |  | ||||||
|  | That struct is passed by a firmware when querying for STA info. Flags | ||||||
|  | are used to indicate what info could be obtained. | ||||||
|  |  | ||||||
|  | These new defines may allow passing more info to the cfg80211 in the | ||||||
|  | future. They had been obtained from Broadcom's SDK file wlioctl_defs.h | ||||||
|  | used by DD-WRT. | ||||||
|  |  | ||||||
|  | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> | ||||||
|  | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  .../broadcom/brcm80211/brcmfmac/fwil_types.h       | 29 ++++++++++++++++++---- | ||||||
|  |  1 file changed, 24 insertions(+), 5 deletions(-) | ||||||
|  |  | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | ||||||
|  | @@ -32,11 +32,30 @@ | ||||||
|  |  #define	BRCMF_BSS_INFO_VERSION	109 /* curr ver of brcmf_bss_info_le struct */ | ||||||
|  |  #define BRCMF_BSS_RSSI_ON_CHANNEL	0x0002 | ||||||
|  |   | ||||||
|  | -#define BRCMF_STA_WME              0x00000002      /* WMM association */ | ||||||
|  | -#define BRCMF_STA_AUTHE            0x00000008      /* Authenticated */ | ||||||
|  | -#define BRCMF_STA_ASSOC            0x00000010      /* Associated */ | ||||||
|  | -#define BRCMF_STA_AUTHO            0x00000020      /* Authorized */ | ||||||
|  | -#define BRCMF_STA_SCBSTATS         0x00004000      /* Per STA debug stats */ | ||||||
|  | +#define BRCMF_STA_BRCM			0x00000001	/* Running a Broadcom driver */ | ||||||
|  | +#define BRCMF_STA_WME			0x00000002	/* WMM association */ | ||||||
|  | +#define BRCMF_STA_NONERP		0x00000004	/* No ERP */ | ||||||
|  | +#define BRCMF_STA_AUTHE			0x00000008	/* Authenticated */ | ||||||
|  | +#define BRCMF_STA_ASSOC			0x00000010	/* Associated */ | ||||||
|  | +#define BRCMF_STA_AUTHO			0x00000020	/* Authorized */ | ||||||
|  | +#define BRCMF_STA_WDS			0x00000040	/* Wireless Distribution System */ | ||||||
|  | +#define BRCMF_STA_WDS_LINKUP		0x00000080	/* WDS traffic/probes flowing properly */ | ||||||
|  | +#define BRCMF_STA_PS			0x00000100	/* STA is in power save mode from AP's viewpoint */ | ||||||
|  | +#define BRCMF_STA_APSD_BE		0x00000200	/* APSD delv/trigger for AC_BE is default enabled */ | ||||||
|  | +#define BRCMF_STA_APSD_BK		0x00000400	/* APSD delv/trigger for AC_BK is default enabled */ | ||||||
|  | +#define BRCMF_STA_APSD_VI		0x00000800	/* APSD delv/trigger for AC_VI is default enabled */ | ||||||
|  | +#define BRCMF_STA_APSD_VO		0x00001000	/* APSD delv/trigger for AC_VO is default enabled */ | ||||||
|  | +#define BRCMF_STA_N_CAP			0x00002000	/* STA 802.11n capable */ | ||||||
|  | +#define BRCMF_STA_SCBSTATS		0x00004000	/* Per STA debug stats */ | ||||||
|  | +#define BRCMF_STA_AMPDU_CAP		0x00008000	/* STA AMPDU capable */ | ||||||
|  | +#define BRCMF_STA_AMSDU_CAP		0x00010000	/* STA AMSDU capable */ | ||||||
|  | +#define BRCMF_STA_MIMO_PS		0x00020000	/* mimo ps mode is enabled */ | ||||||
|  | +#define BRCMF_STA_MIMO_RTS		0x00040000	/* send rts in mimo ps mode */ | ||||||
|  | +#define BRCMF_STA_RIFS_CAP		0x00080000	/* rifs enabled */ | ||||||
|  | +#define BRCMF_STA_VHT_CAP		0x00100000	/* STA VHT(11ac) capable */ | ||||||
|  | +#define BRCMF_STA_WPS			0x00200000	/* WPS state */ | ||||||
|  | +#define BRCMF_STA_DWDS_CAP		0x01000000	/* DWDS CAP */ | ||||||
|  | +#define BRCMF_STA_DWDS			0x02000000	/* DWDS active */ | ||||||
|  |   | ||||||
|  |  /* size of brcmf_scan_params not including variable length array */ | ||||||
|  |  #define BRCMF_SCAN_PARAMS_FIXED_SIZE	64 | ||||||
| @@ -0,0 +1,75 @@ | |||||||
|  | From 07b1ae46874949252625c96f309f96ca0f337020 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> | ||||||
|  | Date: Thu, 28 Jun 2018 12:36:23 +0200 | ||||||
|  | Subject: [PATCH] brcmfmac: update STA info struct to the v5 | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  |  | ||||||
|  | That struct is used when querying firmware for the STA. It seem is has | ||||||
|  | been changing during the time. Luckily its format seems to be backward | ||||||
|  | compatible starting with v2 (the only breakage was v1 -> v2). | ||||||
|  |  | ||||||
|  | The version that was supported by brcmfmac so far was v4. It was what | ||||||
|  | 43602a1 and 4366b1 firmwares (7.35.177.56 and 10.10.69.3309 accordingly) | ||||||
|  | were using. It also seems to be used by early 4366c0 firmwares | ||||||
|  | (10.10.69.6908 and 10.10.69.69017). | ||||||
|  |  | ||||||
|  | The problem appears when switching to the 10.10.122.20 firmware. It uses | ||||||
|  | v5 and instead of falling back to v4 when submitted buffer isn't big | ||||||
|  | enough it fallbacks to the v3. | ||||||
|  |  | ||||||
|  | To receive all v4 specific info with the newest firmware we have to | ||||||
|  | submit a struct (buffer) that matches v5. | ||||||
|  |  | ||||||
|  | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> | ||||||
|  | Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> | ||||||
|  | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  .../net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h  | 14 ++++++++++++++ | ||||||
|  |  1 file changed, 14 insertions(+) | ||||||
|  |  | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h | ||||||
|  | @@ -165,6 +165,8 @@ | ||||||
|  |  #define BRCMF_MFP_NONE			0 | ||||||
|  |  #define BRCMF_MFP_CAPABLE		1 | ||||||
|  |  #define BRCMF_MFP_REQUIRED		2 | ||||||
|  | +  | ||||||
|  | +#define BRCMF_VHT_CAP_MCS_MAP_NSS_MAX	8 | ||||||
|  |   | ||||||
|  |  /* join preference types for join_pref iovar */ | ||||||
|  |  enum brcmf_join_pref_types { | ||||||
|  | @@ -514,6 +516,8 @@ struct brcmf_sta_info_le { | ||||||
|  |  						/* w/hi bit set if basic */ | ||||||
|  |  	__le32 in;		/* seconds elapsed since associated */ | ||||||
|  |  	__le32 listen_interval_inms; /* Min Listen interval in ms for STA */ | ||||||
|  | + | ||||||
|  | +	/* Fields valid for ver >= 3 */ | ||||||
|  |  	__le32 tx_pkts;	/* # of packets transmitted */ | ||||||
|  |  	__le32 tx_failures;	/* # of packets failed */ | ||||||
|  |  	__le32 rx_ucast_pkts;	/* # of unicast packets received */ | ||||||
|  | @@ -522,6 +526,8 @@ struct brcmf_sta_info_le { | ||||||
|  |  	__le32 rx_rate;	/* Rate of last successful rx frame */ | ||||||
|  |  	__le32 rx_decrypt_succeeds;	/* # of packet decrypted successfully */ | ||||||
|  |  	__le32 rx_decrypt_failures;	/* # of packet decrypted failed */ | ||||||
|  | + | ||||||
|  | +	/* Fields valid for ver >= 4 */ | ||||||
|  |  	__le32 tx_tot_pkts;    /* # of tx pkts (ucast + mcast) */ | ||||||
|  |  	__le32 rx_tot_pkts;    /* # of data packets recvd (uni + mcast) */ | ||||||
|  |  	__le32 tx_mcast_pkts;  /* # of mcast pkts txed */ | ||||||
|  | @@ -558,6 +564,14 @@ struct brcmf_sta_info_le { | ||||||
|  |  						*/ | ||||||
|  |  	__le32 rx_pkts_retried;        /* # rx with retry bit set */ | ||||||
|  |  	__le32 tx_rate_fallback;       /* lowest fallback TX rate */ | ||||||
|  | + | ||||||
|  | +	/* Fields valid for ver >= 5 */ | ||||||
|  | +	struct { | ||||||
|  | +		__le32 count;					/* # rates in this set */ | ||||||
|  | +		u8 rates[BRCMF_MAXRATES_IN_SET];		/* rates in 500kbps units w/hi bit set if basic */ | ||||||
|  | +		u8 mcs[BRCMF_MCSSET_LEN];			/* supported mcs index bit map */ | ||||||
|  | +		__le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX];	/* supported mcs index bit map per nss */ | ||||||
|  | +	} rateset_adv; | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  struct brcmf_chanspec_list { | ||||||
| @@ -0,0 +1,84 @@ | |||||||
|  | From 1e591c56a65fbbcd5754a4210a0ef0402d5e5f33 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> | ||||||
|  | Date: Mon, 9 Jul 2018 06:55:43 +0200 | ||||||
|  | Subject: [PATCH] brcmfmac: specify some features per firmware version | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  |  | ||||||
|  | Some features supported by firmware aren't advertised and there is no | ||||||
|  | way for a driver to query them. This includes e.g. monitor mode details. | ||||||
|  |  | ||||||
|  | Most firmwares support monitor interface but only the latest ones | ||||||
|  | /announce/ it with a "monitor" flag in the "cap" iovar. There isn't any | ||||||
|  | reliable detection method for older firmwares (BRCMF_C_MONITOR was tried | ||||||
|  | but "it only indicates the core part of the stack supports"). | ||||||
|  |  | ||||||
|  | Similarly support for tagging monitor frames and building radiotap | ||||||
|  | headers can't be reliably detected for all firmwares. | ||||||
|  |  | ||||||
|  | This commit adds table that allows mapping features to firmware version. | ||||||
|  | It adds mappings for 43602a1 and 4366b1 firmwares from | ||||||
|  | linux-firmware.git. Both were confirmed to be passing monitor frames. | ||||||
|  |  | ||||||
|  | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> | ||||||
|  | Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> | ||||||
|  | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||||
|  | --- | ||||||
|  |  .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 38 ++++++++++++++++++++++ | ||||||
|  |  1 file changed, 38 insertions(+) | ||||||
|  |  | ||||||
|  | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | ||||||
|  | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | ||||||
|  | @@ -92,6 +92,42 @@ static int brcmf_feat_debugfs_read(struc | ||||||
|  |  } | ||||||
|  |  #endif /* DEBUG */ | ||||||
|  |   | ||||||
|  | +struct brcmf_feat_fwfeat { | ||||||
|  | +	const char * const fwid; | ||||||
|  | +	u32 feat_flags; | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static const struct brcmf_feat_fwfeat brcmf_feat_fwfeat_map[] = { | ||||||
|  | +	/* brcmfmac43602-pcie.ap.bin from linux-firmware.git commit ea1178515b88 */ | ||||||
|  | +	{ "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, | ||||||
|  | +	/* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */ | ||||||
|  | +	{ "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) }, | ||||||
|  | +}; | ||||||
|  | + | ||||||
|  | +static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) | ||||||
|  | +{ | ||||||
|  | +	const struct brcmf_feat_fwfeat *e; | ||||||
|  | +	u32 feat_flags = 0; | ||||||
|  | +	int i; | ||||||
|  | + | ||||||
|  | +	for (i = 0; i < ARRAY_SIZE(brcmf_feat_fwfeat_map); i++) { | ||||||
|  | +		e = &brcmf_feat_fwfeat_map[i]; | ||||||
|  | +		if (!strcmp(e->fwid, drv->fwver)) { | ||||||
|  | +			feat_flags = e->feat_flags; | ||||||
|  | +			break; | ||||||
|  | +		} | ||||||
|  | +	} | ||||||
|  | + | ||||||
|  | +	if (!feat_flags) | ||||||
|  | +		return; | ||||||
|  | + | ||||||
|  | +	for (i = 0; i < BRCMF_FEAT_LAST; i++) | ||||||
|  | +		if (feat_flags & BIT(i)) | ||||||
|  | +			brcmf_dbg(INFO, "enabling firmware feature: %s\n", | ||||||
|  | +				  brcmf_feat_names[i]); | ||||||
|  | +	drv->feat_flags |= feat_flags; | ||||||
|  | +} | ||||||
|  | + | ||||||
|  |  /** | ||||||
|  |   * brcmf_feat_iovar_int_get() - determine feature through iovar query. | ||||||
|  |   * | ||||||
|  | @@ -219,6 +255,8 @@ void brcmf_feat_attach(struct brcmf_pub | ||||||
|  |  		ifp->drvr->feat_flags &= ~drvr->settings->feature_disable; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | +	brcmf_feat_firmware_overrides(drvr); | ||||||
|  | + | ||||||
|  |  	/* set chip related quirks */ | ||||||
|  |  	switch (drvr->bus_if->chip) { | ||||||
|  |  	case BRCM_CC_43236_CHIP_ID: | ||||||
| @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com> | |||||||
|  |  | ||||||
| --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | ||||||
| +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | ||||||
| @@ -1276,6 +1276,7 @@ int __init brcmf_core_init(void) | @@ -1301,6 +1301,7 @@ int __init brcmf_core_init(void) | ||||||
|  { |  { | ||||||
|  	if (!schedule_work(&brcmf_driver_work)) |  	if (!schedule_work(&brcmf_driver_work)) | ||||||
|  		return -EBUSY; |  		return -EBUSY; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Rafał Miłecki
					Rafał Miłecki