Re: [PATCH v3 net-next 2/3] net/udp: Add 4-tuple hash list basis

From: Philo Lu
Date: Thu Oct 10 2024 - 21:23:30 EST




On 2024/10/10 21:48, Willem de Bruijn wrote:
Philo Lu wrote:
Add a new hash list, hash4, in udp table. It will be used to implement
4-tuple hash for connected udp sockets. This patch adds the hlist to
table, and implements helpers and the initialization. 4-tuple hash is
implemented in the following patch.

Signed-off-by: Philo Lu <lulie@xxxxxxxxxxxxxxxxx>
Signed-off-by: Cambda Zhu <cambda@xxxxxxxxxxxxxxxxx>
Signed-off-by: Fred Chen <fred.cc@xxxxxxxxxxxxxxx>
Signed-off-by: Yubing Qiu <yubing.qiuyubing@xxxxxxxxxxxxxxx>

@@ -3480,16 +3486,15 @@ static struct udp_table __net_init *udp_pernet_table_alloc(unsigned int hash_ent
if (!udptable)
goto out;
- slot_size = sizeof(struct udp_hslot) + sizeof(struct udp_hslot_main);
+ slot_size = 2 * sizeof(struct udp_hslot) + sizeof(struct udp_hslot_main);
udptable->hash = vmalloc_huge(hash_entries * slot_size,
GFP_KERNEL_ACCOUNT);
if (!udptable->hash)
goto free_table;
udptable->hash2 = UDP_HSLOT_MAIN(udptable->hash + hash_entries);
- udptable->mask = hash_entries - 1;
+ udptable->hash4 = (struct udp_hslot *)(udptable->hash2 + hash_entries);

Unintentional removal of the mask assignment?


Will fix. Sorry for the mistake.

udptable->log = ilog2(hash_entries);
-

Unnecessary whitespace line removal


Ditto.

Thank you for review, Willem.
--
Philo