Re: [PATCH 5/7] wifi: brcmfmac: add the AWDL data path

From: Arend van Spriel

Date: Sun Nov 22 2026 - 15:09:56 EST


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@xxxxxxxxx>
> Tested-by: Aditya Garg <aditya.garg@xxxxxxxxx>
> 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@xxxxxxxxxxxx>

Regards,
Arend