Re: [PATCH wireless-next v3 5/6] wifi: brcmfmac: add vendor commands for AWDL
From: Arend van Spriel
Date: Sun Nov 29 2026 - 10:38:39 EST
On Fri, 27 Nov 2026 13:41:03 +0100, Andre Eikmeyer <dev@deq.rocks> wrote:
> AWDL election, peer discovery and services run in user space, the
> firmware carries the AWDL frames and data. Add vendor commands of the
> Broadcom OUI on the primary interface, described in vendor.h:
[...]
> Tested-by: Yossef Osman <Yossef.Osman@xxxxxxxxx>
> Tested-by: Aditya Garg <aditya.garg@xxxxxxxxx>
> Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
> ---
> .../broadcom/brcm80211/brcmfmac/awdl.c | 726 +++++++++++++++++-
> .../broadcom/brcm80211/brcmfmac/awdl.h | 64 +-
> .../broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +-
> .../broadcom/brcm80211/brcmfmac/feature.c | 6 +
> .../broadcom/brcm80211/brcmfmac/feature.h | 5 +-
> .../broadcom/brcm80211/brcmfmac/vendor.c | 82 ++
> .../broadcom/brcm80211/brcmfmac/vendor.h | 97 +++
> 7 files changed, 959 insertions(+), 26 deletions(-)
[...]
> +static void brcmf_awdl_remove_work(struct work_struct *work)
> +{
> + struct brcmf_awdl *awdl = container_of(work, struct brcmf_awdl,
> + remove_work);
> + struct brcmf_pub *drvr = container_of(awdl, struct brcmf_pub, awdl);
> + bool gone;
> +
> + rtnl_lock();
> + wiphy_lock(drvr->wiphy);
> + /* After a STOP, a suspend or the detach there is nothing left */
> + spin_lock(&awdl->lock);
> + gone = awdl->ifp && awdl->fw_removed;
> + spin_unlock(&awdl->lock);
> + if (gone && !brcmf_awdl_del(drvr))
> + brcmf_awdl_send_result(drvr, BRCMF_VNDR_EVTS_AWDL_STOPPED,
> + -ENOLINK, NULL);
> + wiphy_unlock(drvr->wiphy);
> + rtnl_unlock();
> +}
[...]
> + if (awdl->op != BRCMF_AWDL_OP_NONE)
> + return -EBUSY;
> + if (!awdl->ifp)
> + return -ENOENT;
> +
> + spin_lock(&awdl->lock);
> + awdl->op = BRCMF_AWDL_OP_STOP;
> + spin_unlock(&awdl->lock);
> + schedule_work(&awdl->ctrl_work);
> + return 0;
> +}
After an unsolicited removal sets fw_removed and queues remove_work,
AWDL_STOP can still see ifp and queue ctrl_work. If remove_work gets the
locks first, it sends AWDL_STOPPED(-ENOLINK), then ctrl_work consumes the
accepted STOP and sends a second AWDL_STOPPED(-ENOENT).
The driver state remains safe here, and the two events can be viewed as the
unsolicited removal followed by the result of the accepted STOP. I leave it
to you as I do not know whether user space can handle duplicate STOPPED
events, or whether the pending STOP should be coalesced with the
unsolicited-removal work (have remove_work consume pending STOP).
You may add my acknowledgement in v4.
Acked-by: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
Regards,
Arend