Eric Dumazet <edumazet@xxxxxxxxxx> writes: > On Wed, May 29, 2024 at 1:21 PM Petr Machata <petrm@xxxxxxxxxx> wrote: >> >> When calculating hashes for the purpose of multipath forwarding, both IPv4 >> and IPv6 code currently fall back on flow_hash_from_keys(). That uses a >> randomly-generated seed. That's a fine choice by default, but unfortunately >> some deployments may need a tighter control over the seed used. >> >> In this patch, make the seed configurable by adding a new sysctl key, >> net.ipv4.fib_multipath_hash_seed to control the seed. This seed is used >> specifically for multipath forwarding and not for the other concerns that >> flow_hash_from_keys() is used for, such as queue selection. Expose the knob >> as sysctl because other such settings, such as headers to hash, are also >> handled that way. Like those, the multipath hash seed is a per-netns >> variable. >> >> Despite being placed in the net.ipv4 namespace, the multipath seed sysctl >> is used for both IPv4 and IPv6, similarly to e.g. a number of TCP >> variables. >> > ... > >> + rtnl_lock(); >> + old = rcu_replace_pointer_rtnl(net->ipv4.sysctl_fib_multipath_hash_seed, >> + mphs); >> + rtnl_unlock(); >> + > > In case you keep RCU for the next version, please do not use rtnl_lock() here. Thanks. It looks like it's going to be inline and key constructed at the point of use, so no RCU.