Re: [PATCH net-next] pppoe: optimize hash with word access

From: Eric Dumazet

Date: Mon Apr 13 2026 - 04:45:04 EST


On Sun, Apr 12, 2026 at 8:52 PM Qingfang Deng <qingfang.deng@xxxxxxxxx> wrote:
>
> Currently, hash_item() processes the 6-byte Ethernet address and the
> 2-byte session ID byte-wise to compute a hash.
>
> Optimize this by using 16-bit word operations: XOR three 16-bit words
> from the Ethernet address and the 16-bit session ID, then fold the
> result. This reduces the total number of loads and XORs. The Ethernet
> addresses in a skb and struct pppoe_addr are both 2-byte aligned, so the
> u16 pointer cast is safe.
>
> Signed-off-by: Qingfang Deng <qingfang.deng@xxxxxxxxx>

net-next is closed.

https://lore.kernel.org/netdev/20260412142250.131bf997@xxxxxxxxxx/

Also I would suggest using hash32(hash, PPPOE_HASH_BITS)