mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Andre Eikmeyer <dev@deq.rocks>
Cc: arend.vanspriel@broadcom.com, linux-wireless@vger.kernel.org,
	brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com,
	linux-kernel@vger.kernel.org,
	Yossef Osman <Yossef.Osman@proton.me>,
	Aditya Garg <aditya.garg@linux.dev>
Subject: Re: [PATCH 7/7] wifi: brcmfmac: pass AWDL frames and role changes to user space
Date: Sun, 22 Nov 2026 21:09:31 +0100	[thread overview]
Message-ID: <20261122200931.2090372-6-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <20261104151547.70333-8-dev@deq.rocks>

On Wed, 4 Nov 2026 16:15:47 +0100, Andre Eikmeyer <dev@deq.rocks> wrote:
> User space runs the AWDL election and peer discovery from the AWDL
> action frames other devices send. The firmware reports them with two
> events on the AWDL interface, ACTION_FRAME_RX and AWDL_EVENT (98). A
> header is in front of the frame. Its first 16 bits, high byte first,
> are its version: 1 is struct brcmf_rx_mgmt_data with 16 bytes, 2 has 24
> bytes. Both events come with either version. AWDL_EVENT carries a frame
> only with some of its status values. AWDL_ROLE (97) reports the AWDL
> role of the firmware in its status, 0 slave, 1 master not taking part
> in the election and 2 master.
>
> Register the two AWDL events when the firmware supports AWDL, so the
> event mask includes them. Pass every AWDL action frame (vendor specific
> category, OUI 00:17:f2, type 8) of the two events and the role changes
> to user space as the vendor events AWDL_FRAME and AWDL_ROLE. Other
> events of the AWDL interface are dropped as before.
>
> Tested-by: Yossef Osman <Yossef.Osman@proton.me>
> Tested-by: Aditya Garg <aditya.garg@linux.dev>
> Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
> ---
>  .../broadcom/brcm80211/brcmfmac/awdl.c        | 122 +++++++++++++++++-
>  .../broadcom/brcm80211/brcmfmac/awdl.h        |   4 +
>  .../broadcom/brcm80211/brcmfmac/cfg80211.c    |   1 +
>  .../broadcom/brcm80211/brcmfmac/fweh.c        |   8 +-
>  .../broadcom/brcm80211/brcmfmac/fweh.h        |   5 +
>  .../broadcom/brcm80211/brcmfmac/vendor.c      |   8 ++
>  .../broadcom/brcm80211/brcmfmac/vendor.h      |  12 ++
>  7 files changed, 151 insertions(+), 9 deletions(-)

[...]

> @@ -324,11 +324,13 @@ static void brcmf_fweh_event_worker(struct work_struct *work)
>  			ifp = drvr->iflist[0];
>  		else
>  			ifp = drvr->iflist[emsg.bsscfgidx];
> -		/* The AWDL interface has no vif, its events are not for
> -		 * the cfg80211 handlers
> +		/* The AWDL interface has no vif, its events go to user
> +		 * space and not to the cfg80211 handlers
>  		 */
> -		if (ifp && ifp->awdl)
> +		if (ifp && ifp->awdl) {
> +			brcmf_awdl_fweh_event(ifp, &emsg, event->data);
>  			goto event_free;
> +		}
>
>  		err = brcmf_fweh_call_event_handler(drvr, ifp, event->code,
>  						    &emsg, event->data);

The return value of brcmf_awdl_fweh_event() is not used, and a
failure to allocate or fill the vendor event drops the frame without a
trace. A bphy_err() on those paths would show why frames are missing.

[...]

> @@ -94,7 +94,12 @@ struct brcmf_cfg80211_info;
>  	BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
>  	BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
>  	BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
> +	BRCMF_ENUM_DEF(AWDL_AW, 96) \
> +	BRCMF_ENUM_DEF(AWDL_ROLE, 97) \
> +	BRCMF_ENUM_DEF(AWDL_EVENT, 98) \
>  	BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
> +	BRCMF_ENUM_DEF(AWDL_STATS, 150) \
> +	BRCMF_ENUM_DEF(SDB_STATE, 152) \
>  	BRCMF_ABSTRACT_ENUM_DEF(EXT_AUTH_REQ, 0) \
>  	BRCMF_ABSTRACT_ENUM_DEF(EXT_AUTH_FRAME_RX, 1) \
>  	BRCMF_ABSTRACT_ENUM_DEF(MGMT_FRAME_TXSTATUS, 2) \

These event codes are specific to the firmware used for the Apple
chips, but BRCMF_ENUM_DEF puts them in the common list where the same
numbers may mean something else on other firmware families. Use
abstract codes for them and translate them in the WCC vendor module,
like cyw/core.c does for EXT_AUTH_REQ:

1. fweh.h: replace the five BRCMF_ENUM_DEF() entries by
   BRCMF_ABSTRACT_ENUM_DEF(AWDL_AW, 4), AWDL_ROLE 5, AWDL_EVENT 6,
   AWDL_STATS 7 and SDB_STATE 8, after the existing abstract entries.
2. wcc/core.c: define BRCMF_WCC_E_AWDL_AW (96), _AWDL_ROLE (97),
   _AWDL_EVENT (98), _AWDL_STATS (150) and _SDB_STATE (152) next to
   BRCMF_WCC_E_LAST, which already covers them, and add a
   struct brcmf_fweh_event_map brcmf_wcc_event_map with these five items
   and n_items = 5.
3. wcc/core.c: set fweh->event_map = &brcmf_wcc_event_map in
   brcmf_wcc_alloc_fweh_info().
4. Register the events from a new brcmf_wcc_register_event_handlers(),
   set as .register_event_handlers in brcmf_wcc_ops, instead of
   brcmf_awdl_register_events() called from wl_init_priv(). Keep the
   BRCMF_FEAT_AWDL check there, and export brcmf_awdl_fweh_event() for
   it. An abstract code is not range checked by brcmf_fweh_register()
   on a vendor without an event map, so it must not be registered from
   common code.

brcmf_awdl_fweh_event() itself keeps working, the event worker passes
it the abstract code.

Regards,
Arend

  reply	other threads:[~2026-11-22 20:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 15:15 [PATCH 0/7] wifi: brcmfmac: AWDL for AirDrop on Apple T2 Macs Andre Eikmeyer
2026-11-04 15:15 ` [PATCH 1/7] wifi: brcmfmac: match firmware capabilities as whole words Andre Eikmeyer
2026-11-05 17:33   ` Arend van Spriel
2026-11-06  7:07     ` André Eikmeyer
2026-11-04 15:15 ` [PATCH 2/7] wifi: brcmfmac: move the interface_create definitions to fwil_types.h Andre Eikmeyer
2026-11-22 20:09   ` Arend van Spriel
2026-11-04 15:15 ` [PATCH 3/7] wifi: brcmfmac: detect AWDL support of the firmware Andre Eikmeyer
2026-11-22 20:09   ` Arend van Spriel
2026-11-04 15:15 ` [PATCH 4/7] wifi: brcmfmac: create and remove the AWDL interface Andre Eikmeyer
2026-11-22 20:09   ` Arend van Spriel
2026-11-04 15:15 ` [PATCH 5/7] wifi: brcmfmac: add the AWDL data path Andre Eikmeyer
2026-11-22 20:09   ` Arend van Spriel
2026-11-04 15:15 ` [PATCH 6/7] wifi: brcmfmac: add vendor commands for AWDL Andre Eikmeyer
2026-11-22 20:09   ` Arend van Spriel
2026-11-04 15:15 ` [PATCH 7/7] wifi: brcmfmac: pass AWDL frames and role changes to user space Andre Eikmeyer
2026-11-22 20:09   ` Arend van Spriel [this message]
2026-11-08 15:41 ` [PATCH 0/7] wifi: brcmfmac: AWDL for AirDrop on Apple T2 Macs Arend van Spriel
2026-11-08 18:20   ` André Eikmeyer
2026-11-11 14:28   ` Aditya Garg
2026-11-18 10:52     ` Arend van Spriel
2026-11-22 20:08       ` Arend van Spriel

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=20261122200931.2090372-6-arend.vanspriel@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=Yossef.Osman@proton.me \
    --cc=aditya.garg@linux.dev \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211@lists.linux.dev \
    --cc=dev@deq.rocks \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®