Re: [PATCH wireless-next v3 3/6] wifi: brcmfmac: create and remove the AWDL interface
From: Arend van Spriel
Date: Sun Nov 29 2026 - 10:38:34 EST
On Fri, 27 Nov 2026 13:41:01 +0100, Andre Eikmeyer <dev@deq.rocks> wrote:
> Firmware with AWDL support creates an interface of type AWDL with
> interface_create. The host gives the MAC address, the firmware
> interface index 2 and the AWDL BSSID 00:25:00:ff:94:73.
[...]
> 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/Makefile | 3 +-
> .../broadcom/brcm80211/brcmfmac/awdl.c | 292 ++++++++++++++++++
> .../broadcom/brcm80211/brcmfmac/awdl.h | 53 ++++
> .../broadcom/brcm80211/brcmfmac/cfg80211.c | 6 +
> .../broadcom/brcm80211/brcmfmac/core.c | 65 +++-
> .../broadcom/brcm80211/brcmfmac/core.h | 7 +
> .../broadcom/brcm80211/brcmfmac/fweh.c | 17 +
> 7 files changed, 434 insertions(+), 9 deletions(-)
> create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.c
> create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.h
[...]
> + spin_lock(&awdl->lock);
> + own = awdl->adding && ifp->ndev &&
> + ether_addr_equal(ifp->mac_addr, awdl->mac);
> + late = !own && awdl->abandoned && ifp->ndev &&
> + ether_addr_equal(ifp->mac_addr, awdl->abandoned_mac);
> + if (own) {
> + ifp->awdl = true;
> + strscpy(ifp->ndev->name, "awdl%d", IFNAMSIZ);
> + /* Keeps udev from giving it a name from the bus path */
> + ifp->ndev->name_assign_type = NET_NAME_PREDICTABLE;
> + awdl->ifp = ifp;
> + awdl->adding = false;
> + complete(&awdl->if_event);
> + } else if (late) {
> + awdl->abandoned = false;
> + }
> + spin_unlock(&awdl->lock);
[...]
> + if (awdl->ifp)
> + return -EBUSY;
> + if (brcmf_awdl_ifidx_used(drvr)) {
> + bphy_err(drvr, "interface index %d is in use, no AWDL\n",
> + BRCMF_AWDL_IFIDX);
> + return -EBUSY;
> + }
> +
> + spin_lock(&awdl->lock);
> + ether_addr_copy(awdl->mac, mac);
> + awdl->adding = true;
> + reinit_completion(&awdl->if_event);
> + spin_unlock(&awdl->lock);
A retry is still allowed while an abandoned interface event can arrive.
When the retry uses the same MAC, as it normally will, a late event from
the first create matches "own" before "late" and is accepted as the
retry's event.
If the retrying interface_create returns an error, awdl->ifp is then left
pointing at an unregistered interface. If it succeeds and sends another
event, brcmf_add_if() may replace and free the first ifp while awdl->ifp
still points to it. Please do not issue another create while abandoned is
set, unless the two create generations can be distinguished independently
of the MAC address.
Regards,
Arend