Re: [PATCH net-next] etherdevice: Optimize is_broadcast_ether_addr

From: Qingfang Deng
Date: Tue Jun 18 2024 - 02:48:02 EST


Hi Jakub,

On Fri, Jun 14, 2024 at 8:05 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> Can you provide more context on why it's beneficial. I mean, there's a
> lot of code in the kernel one could micro-optimize...
>
> Show us the assembly, cycle counts, where it's used on fast paths...

is_broadcast_ether_addr is used in bridge forwarding fast paths
(br_dev_xmit, br_multicast_flood, br_handle_frame_finish), and often
in combination with is_multicast_ether_addr.
Since commit d54385ce68cd ("etherdev: Process is_multicast_ether_addr
at same size as other operations"), is_multicast_ether_addr already
does a 32-bit load. We can avoid duplicate loads by applying the same
approach to is_broadcast_ether_addr and save a few instructions.
Tested with x86_64, aarch64 and RISC-V compilers.

> --
> pw-bot: cr