[RFC PATCHv2 net-next 1/3] net/udp: Add a new struct for hash2 slot
From: Gur Stavi
Date: Tue Sep 24 2024 - 08:52:36 EST
> @@ -224,13 +224,12 @@ struct sock *__udp6_lib_lookup(const struct net *net,
> struct sk_buff *skb)
> {
> unsigned short hnum = ntohs(dport);
> - unsigned int hash2, slot2;
> struct udp_hslot *hslot2;
> struct sock *result, *sk;
> + unsigned int hash2;
>
> hash2 = ipv6_portaddr_hash(net, daddr, hnum);
> - slot2 = hash2 & udptable->mask;
> - hslot2 = &udptable->hash2[slot2];
> + hslot2 = udp_hashslot2(udptable, hash2);
>
Why not minimize the code change by using udptable->hash2[slot2].hslot?
Especially since later you do it in __udp6_lib_mcast_deliver.
I think that many developers would find usage of C primitives more
readable.