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,
	Sasha Finkelstein <k@chaosmail.tech>,
	Sven Peter <sven@kernel.org>, Janne Grunau <j@jannau.net>,
	Aditya Garg <aditya.garg@linux.dev>,
	Yossef Osman <Yossef.Osman@proton.me>
Subject: Re: [PATCH wireless-next v2 3/6] wifi: brcmfmac: create and remove the AWDL interface
Date: Thu, 26 Nov 2026 17:14:40 +0100	[thread overview]
Message-ID: <20261126161444.2484980-2-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <20261125190254.176055-4-dev@deq.rocks>

On Wed, 25 Nov 2026 20:02:51 +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.

[...]

> Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
> ---
>  .../broadcom/brcm80211/brcmfmac/Makefile      |   3 +-
>  .../broadcom/brcm80211/brcmfmac/awdl.c        | 288 ++++++++++++++++++
>  .../broadcom/brcm80211/brcmfmac/awdl.h        |  51 ++++
>  .../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, 428 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

[...]

> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.c
> new file mode 100644
> index 000000000000..1ef6dd50958f
> --- /dev/null
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/awdl.c
> @@ -0,0 +1,288 @@
> +// SPDX-License-Identifier: GPL-2.0

Missed this in the earlier review round, but all other brcmfmac files are ISC.
I always struggle with the per-file identifiers. If ISC is acceptable for you
please consider changing this here and in awdl.h.

[...]

> +	spin_lock(&awdl->lock);
> +	ether_addr_copy(awdl->mac, mac);
> +	awdl->adding = true;
> +	awdl->abandoned = false;
> +	reinit_completion(&awdl->if_event);
> +	spin_unlock(&awdl->lock);

awdl->abandoned is cleared here. After an add that timed out, the
firmware interface event may still be on its way. If the next add fails
in interface_create (the interface exists) the late event is claimed by
nobody, brcmf_add_if() keeps the ifp with ifidx 2 in iflist and
brcmf_awdl_ifidx_used() blocks every later add, as in v1. Keep
abandoned set here and clear it when brcmf_awdl_if_added() has claimed
an event instead.

[...]

> +	spin_lock(&awdl->lock);
> +	awdl->adding = false;
> +	ifp = awdl->ifp;
> +	/* The firmware created the interface, its event may still come */
> +	if (!err && !ifp)
> +		awdl->abandoned = true;
> +	spin_unlock(&awdl->lock);
> +
> +	if (err) {
> +		bphy_err(drvr, "AWDL interface_create failed: %d\n", err);
> +		return err;
> +	}
> +	if (!left || !ifp) {
> +		bphy_err(drvr, "no interface event for the AWDL interface\n");
> +		return -ETIMEDOUT;
> +	}

If the event is handled after wait_for_completion_timeout() expired but
before the spin_lock() above, ifp is set and adding is already cleared.
Then !left makes this return -ETIMEDOUT with awdl->ifp set and no
network device registered, so AWDL_START reports a failure while the
interface is kept. Test !ifp only.

[...]

Regards,
Arend

  reply	other threads:[~2026-11-26 16:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 19:02 [PATCH wireless-next v2 0/6] wifi: brcmfmac: AWDL for AirDrop on Apple T2 Macs Andre Eikmeyer
2026-11-25 19:02 ` [PATCH wireless-next v2 1/6] wifi: brcmfmac: move the interface_create definitions to fwil_types.h Andre Eikmeyer
2026-11-26 16:14   ` Arend van Spriel
2026-11-25 19:02 ` [PATCH wireless-next v2 2/6] wifi: brcmfmac: detect AWDL support of the firmware Andre Eikmeyer
2026-11-26 16:14   ` Arend van Spriel
2026-11-25 19:02 ` [PATCH wireless-next v2 3/6] wifi: brcmfmac: create and remove the AWDL interface Andre Eikmeyer
2026-11-26 16:14   ` Arend van Spriel [this message]
2026-11-25 19:02 ` [PATCH wireless-next v2 4/6] wifi: brcmfmac: add the AWDL data path Andre Eikmeyer
2026-11-26 16:14   ` Arend van Spriel
2026-11-25 19:02 ` [PATCH wireless-next v2 5/6] wifi: brcmfmac: add vendor commands for AWDL Andre Eikmeyer
2026-11-26 16:14   ` Arend van Spriel
2026-11-25 19:02 ` [PATCH wireless-next v2 6/6] wifi: brcmfmac: pass AWDL frames and role changes to user space Andre Eikmeyer
2026-11-26 16:14   ` 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=20261126161444.2484980-2-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=j@jannau.net \
    --cc=k@chaosmail.tech \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sven@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®