Re: [PATCH net-next v2 2/2] macvlan: fix RX byte accounting for local broadcast and multicast

From: Arnd Bergmann

Date: Wed Nov 18 2026 - 12:49:05 EST


On Thu, Nov 12, 2026, at 03:56, Xia Yan wrote:
> In bridge mode, broadcast and multicast packets sent by one macvlan
> are delivered to the other bridge ports by macvlan_broadcast(),
> called from macvlan_queue_xmit(). The skb still contains its
> Ethernet header there, so adding ETH_HLEN again in the rx_bytes
> accounting overcounts by 14 bytes per packet on every receiving
> macvlan.
>
> Packets flooded from the receive handler have had the Ethernet
> header pulled by eth_type_trans(), so they still need ETH_HLEN.
>
> Use the existing mode argument to skip the extra ETH_HLEN for the
> local bridge-mode path.
>
> Noticed in macvlan during review of the ipvlan fix, and confirmed
> on a 6.6 distribution kernel: five IPv4 UDP packets with 32-byte
> payloads increased rx_bytes by 440 instead of 370.
>
> Tested before and after the change with custom IPv4 and IPv6 UDP
> tests in UML. The corrected counters match the received Ethernet
> frame lengths. Local unicast and external RX counts are unchanged
> in these tests.
>
> Fixes: 618e1b7482f7 ("macvlan: implement bridge, VEPA and private mode")
> Signed-off-by: Xia Yan <yanxia@xxxxxxxxxxxxxxxxxxxx>

Acked-by: Arnd Bergmann <arnd@xxxxxxxx>