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 5/7] wifi: brcmfmac: add the AWDL data path
Date: Sun, 22 Nov 2026 21:09:28 +0100	[thread overview]
Message-ID: <20261122200931.2090372-3-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <20261104151547.70333-6-dev@deq.rocks>

On Wed, 4 Nov 2026 16:15:45 +0100, Andre Eikmeyer <dev@deq.rocks> wrote:
> The firmware passes AWDL data frames as 802.3 frames. An LLC/SNAP
> header with the Apple OUI (aa aa 03 00 17 f2 08 00) is followed by the
> AWDL data header 03 04, a 16 bit sequence number, two reserved bytes
> and the ethertype.
>
> Let the AWDL network device send and receive plain Ethernet frames. Its
> transmit function adds the 16 bytes of headers and counts the sequence
> number, brcmf_netif_rx() removes them from received frames. The headroom
> of the network device covers the added header. The addresses of
> received frames are moved so that they form an Ethernet header with the
> ethertype again, which keeps packet taps consistent. Other frames on
> the AWDL interface are dropped.
>
> 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        | 83 +++++++++++++++++++
>  .../broadcom/brcm80211/brcmfmac/awdl.h        |  9 ++
>  .../broadcom/brcm80211/brcmfmac/core.c        | 23 ++++-
>  3 files changed, 114 insertions(+), 1 deletion(-)

[...]

> @@ -252,6 +274,67 @@ int brcmf_awdl_del(struct brcmf_pub *drvr)
> +/**
> + * brcmf_awdl_encap() - add the AWDL data header to a frame to be sent.
> + *
> + * @ifp: the AWDL interface.
> + * @skb: Ethernet frame, an 802.3 frame on return.
> + *
> + * Called in the transmit path of the AWDL network device, which serializes
> + * it. Return: 0 or a negative error code, the caller frees @skb on error.
> + */
> +int brcmf_awdl_encap(struct brcmf_if *ifp, struct sk_buff *skb)
> +{

Same as in patch 4, Return: has to start its own line. The kdoc
check reports no return value description for brcmf_awdl_encap() and
brcmf_awdl_decap().

[...]

> @@ -653,6 +659,19 @@ static int brcmf_awdl_netdev_open(struct net_device *ndev)
>  	return 0;
>  }
>
> +static netdev_tx_t brcmf_awdl_netdev_start_xmit(struct sk_buff *skb,
> +						struct net_device *ndev)
> +{
> +	struct brcmf_if *ifp = netdev_priv(ndev);
> +
> +	if (brcmf_awdl_encap(ifp, skb)) {
> +		dev_kfree_skb_any(skb);
> +		ndev->stats.tx_dropped++;
> +		return NETDEV_TX_OK;
> +	}
> +	return brcmf_netdev_start_xmit(skb, ndev);
> +}
> +
>  static int brcmf_awdl_netdev_stop(struct net_device *ndev)
>  {
>  	netif_stop_queue(ndev);

In brcmf_netdev_start_xmit() tx_bytes is taken from skb->len on entry,
which is after brcmf_awdl_encap() here, so tx_bytes counts the 16 added
bytes of every frame while rx_bytes in brcmf_netif_rx() is counted
after brcmf_awdl_decap() and leaves them out. Count the length of the
Ethernet frame on both sides.

[...]

> @@ -693,6 +712,8 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool locked)
>  		ndev->netdev_ops = &brcmf_netdev_ops_pri;
>
>  	ndev->needed_headroom += drvr->hdrlen;
> +	if (ifp->awdl)
> +		ndev->needed_headroom += BRCMF_AWDL_HDR_LEN;
>  	ndev->ethtool_ops = &brcmf_ethtool_ops;
>
>  	/* set the mac address & netns */
>

The MTU stays at the ether_setup() default of 1500, so a full size
frame reaches the firmware as 14 + 16 + 1500 bytes. If the firmware
takes less than that, set mtu and max_mtu of the AWDL interface to the
largest payload it accepts with the added header.

You can add my acknowledgement for this patch in v2 series:

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

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 [this message]
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
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-3-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®