From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: "Rafał Miłecki" <zajec5@gmail.com>,
"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>,
brcm80211-dev-list.pdl@broadcom.com,
brcm80211-dev-list@cypress.com
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: Research + questions on brcmfmac and support for monitor mode
Date: Wed, 16 May 2018 10:37:44 +0200 [thread overview]
Message-ID: <5AFBEDD8.8030801@broadcom.com> (raw)
In-Reply-To: <986bbf4c-8fa1-4367-db9e-76a209594b81@gmail.com>
On 5/15/2018 2:29 PM, Rafał Miłecki wrote:
> I'm interested in adding support for monitor mode to the brcmfmac. I did
> some early research on firmware capabilities & behavior using various
> firmwares I could find for my devices: 43602a1, 4366b1, 4366c0 (BCM4366
> and BCM4366E).
I am interested too and already did some work in this respect.
> I was doing my tests by starting monitor mode with SET_MONITOR ioctl +
> value 3 and dumping msgbuf RX header + skb data.
>
> The good news is that almost every firmware has some minimal support for
> monitor mode. Unfortunately implementing it may be (a big?) problem.
>
> The basic concept is simple. Once we set SET_MONITOR to 3, firmware
> starts passing up monitor mode frames to the driver.
The main issue is that monitor mode was historically made for what we
call NIC drivers, ie. driver running on the host so without an active
cpu on the device. Also monitor functionality is used within the
firmware itself by other features, which is why most firmwares you have
include monitor functionality.
I implemented monitor mode for SDIO devices, but that required firmware
changes so an explicit firmware target. Unfortunately, for PCIe things
are quite different. On SDIO the entire packet is passed to the host,
but for PCIe the 802.11 part is split from the 802.3 payload.
> The first problem I see is identifying monitor mode frames in order to
> make brcmfmac pass them to the monitor interface. Monitor frames have
> msg.ifidx set to 0 which makes them indistinguishable from main
> interface frames by simply looking at that index field. There is nothing
> in the msg.rsvd0, compl_hdr.status, rx_status_0 or rx_status_1 fields.
>
> Now, some new firmwares have flags set to 0x0002 (instead of 0x0001) for
> monitor frames. This is very helpful but it only applies to the really
> recent images.
>
> My first question is: is there any reliable way of filtering monitor
> frames for older firmwares? We could try to reserve ifidx 0 for monitor
> mode purposes, but I'm afraid I'd require hacking quite some code. Is
> there any better & simpler solution?
Depends what you want. I wanted mainly a dedicated sniffer so only
allowing changing the main interface to monitor mode. Not allowing
adding a monitor mode interface.
> The second problem is monitor frame format. Older firmwares were simply
> passing 802.11 frames to the driver. It means passing frame control
> field, duration, AP MAC, src MAC, dst MAC, sequence + data. There was no
> info about signal, noise, etc. passed. New firmwares seem to be
> including radiotap header which makes things much nicer.
For the SDIO implementation mentioned I generated radiotap header in
brcmfmac. I recall that was the intention for the PCIe implementation as
well, but maybe things changed since then as you managed to get radiotap
headers on recent firmwares.
> The second question: is there a reliable way of telling what format uses
> monitor packet passed by a firmware? Is it maybe strictly related to the
> flags set to 0x0002 (instead of 0x0001)?
This is the flags in the msgbuf RXHEADER? That is
> I was hoping that maybe looking at fw-reported capabilities will give me
> any hint regarding that but I'm afraid I'm out of luck. Below is a list
> of firmwares I tested and summary of each of them.
>
> Note: as every firmware reports following capabilities:
> 802.11d 802.11h ampdu ampdu_rx ampdu_tx amsdurx amsdutx anqpo ap bcm_dcs
> bsstrans cac cqa dfrts dwds led mfp p2po probresp_mac_filter pspretend
> psr psta radio_pwrsave rm rxchain_pwrsave sta stbc-rx-1ss stbc-tx
> traffic-mgmt traffic-mgmt-dwm vht-prop-rates wds wet wet_tunnel wme wnm
> I omitted them below.
Actually the capability iovar is tricky/broken. It can potentially
truncate the string so you don't get all the information on the host.
So a question about monitor mode. In hostapd an attempt is made to
create a monitor interface. Is that no longer done because of you recent
patch regarding the wiphy flag HAVE_AP_SME?
Regards,
Arend
next prev parent reply other threads:[~2018-05-16 8:37 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 [this message]
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
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=5AFBEDD8.8030801@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).