linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: Franky Lin <franky.lin@broadcom.com>,
	Hante Meuleman <hante.meuleman@broadcom.com>,
	Chi-Hsien Lin <chi-hsien.lin@cypress.com>,
	Wright Feng <wright.feng@cypress.com>,
	Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>,
	"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
	<brcm80211-dev-list.pdl@broadcom.com>,
	"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
	<brcm80211-dev-list.pdl@broadcom.com>,
	brcm80211-dev-list@cypress.com,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: Research + questions on brcmfmac and support for monitor mode
Date: Tue, 19 Jun 2018 09:53:51 +0200	[thread overview]
Message-ID: <5B28B68F.8070505@broadcom.com> (raw)
In-Reply-To: <CACna6rxa4+UEOs1FjQUGnHpFJn4n_TO6v=Vx3SqNA32QvzQEGQ@mail.gmail.com>

On 6/19/2018 9:27 AM, Rafał Miłecki wrote:
> On Mon, 11 Jun 2018 at 12:48, Arend van Spriel
> <arend.vanspriel@broadcom.com> wrote:
>> On 5/30/2018 1:52 PM, Rafał Miłecki wrote:
>>> I'm providing extra version info of tested firmware images as requested
>>> by Arend in another e-mail thread.
>>
>> Looking into our firmware repo it there are two flags, ie. WL_MONITOR
>> and WL_RADIOTAP. It seems both are set for firmware containing -stamon-
>> feature. Your list below confirms that. I still plan to add indication
>> for WL_RADIOTAP in the "cap" iovar, but a stamon feature check could be
>> used for older firmwares.
>
> I just checked wl.mk (it's an open source file) and found following line:
> WLFILES_SRC_HI += src/wl/sys/wlc_stamon.c
> not guarded by any ifeq.

wl.mk is used for NIC driver (softmac) so it is not used for fullmac 
firmware.

> It appears wlc_stamon.c is always being compiled in. Are you 100% sure
> that wlc_stamon.c depends & uses radiotap? Are you sure it's
> impossible to include stamon support without radiotap support?
>
> I'm asking because we're going to check "sta_monitor" iovar to find
> out if radiotap support is included. I'd like to be sure it's 100%
> reliable.

I have already created a patch for this (see below). I will submit it 
this week.

Regards,
Arend

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
index f70fec6..67d7fc7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
@@ -207,6 +207,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
  	struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  	struct brcmf_pno_macaddr_le pfn_mac;
  	struct brcmf_gscan_config gscan_cfg;
+	struct brcmf_stamon_sta_config stamon_cfg;
  	u32 wowl_cap;
  	s32 err;

@@ -217,6 +218,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
  		brcmf_feat_iovar_data_set(ifp, BRCMF_FEAT_GSCAN,
  					  "pfn_gscan_cfg",
  					  &gscan_cfg, sizeof(gscan_cfg));
+
+	if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR) ||
+	    !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RADIOTAP)) {
+		ifp->fwil_fwerr = true;
+		memset(&stamon_cfg, 0, sizeof(stamon_cfg));
+		/* iovar requires IOVF_SET_UP so this fails either way */
+		err = brcmf_fil_iovar_data_set(ifp, "sta_monitor", &stamon_cfg,
+					       sizeof(stamon_cfg));
+		if (err != BRCMF_FW_UNSUPPORTED) {
+			ifp->drvr->feat_flags |= BRCMF_FEAT_MONITOR;
+			ifp->drvr->feat_flags |= BRCMF_FEAT_RADIOTAP;
+		}
+		ifp->fwil_fwerr = false;
+	}
  	brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  	if (drvr->bus_if->wowl_supported)
  		brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
diff --git 
a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
index 4b29070..e42d296 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
@@ -963,4 +963,36 @@ struct brcmf_gscan_config {
  	struct brcmf_gscan_bucket_config bucket[1];
  };

+enum brcmf_stamon_cfg_cmd {
+        STAMON_CFG_CMD_DEL = 0,
+        STAMON_CFG_CMD_ADD = 1,
+        STAMON_CFG_CMD_ENB = 2,
+        STAMON_CFG_CMD_DSB = 3,
+        STAMON_CFG_CMD_CNT = 4,
+        STAMON_CFG_CMD_RSTCNT = 5,
+        STAMON_CFG_CMD_GET_STATS = 6,
+        STAMON_CFG_CMD_SET_MONTIME = 7
+};
+
+/**
+ * struct brcmf_stamon_sta_config - configuration data for sta monitor.
+ *
+ * @cmd: subcommand for this configuration (see @enum 
brcmf_stamon_cfg_cmd).
+ * @mac: mac address of sta for which @cmd is intended.
+ * @version: version of this configuration structure.
+ * @length: number of bytes following this field.
+ * @chanspec: not used ?
+ * @mon_time: time for which STA's are monitored (ms).
+ * @offchan_time: timer for which off-channel STA's are monitored.
+ */
+struct brcmf_stamon_sta_config {
+        __le32 cmd;
+        u8 mac[ETH_ALEN];
+        __le16 version;
+        __le16 length;
+        __le16 chanspec;
+        __le32 monitor_time;
+        __le32 offchan_time;
+};
+
  #endif /* FWIL_TYPES_H_ */

  reply	other threads:[~2018-06-19  7:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 12:29 Research + questions on brcmfmac and support for monitor mode Rafał Miłecki
2018-05-16  8:37 ` Arend van Spriel
2018-05-16 10:42   ` Rafał Miłecki
2018-05-30 11:52 ` Rafał Miłecki
2018-06-11 10:48   ` Arend van Spriel
2018-06-18 11:54     ` Rafał Miłecki
2018-06-18 19:36       ` Arend van Spriel
2018-06-18 21:46         ` Rafał Miłecki
2018-06-19  5:36           ` Rafał Miłecki
2018-06-19  6:58             ` Rafał Miłecki
2018-06-19  7:27     ` Rafał Miłecki
2018-06-19  7:53       ` Arend van Spriel [this message]
2018-06-19  8:32         ` Rafał Miłecki
2018-06-19 10:49           ` Arend van Spriel
2018-06-25  8:39 ` Rafał Miłecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B28B68F.8070505@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211-dev-list@cypress.com \
    --cc=chi-hsien.lin@cypress.com \
    --cc=franky.lin@broadcom.com \
    --cc=hante.meuleman@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pieter-paul.giesberts@broadcom.com \
    --cc=wright.feng@cypress.com \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).