LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH net-next v1] ipvs: add consistent source hashing scheduling

To: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Subject: Re: [PATCH net-next v1] ipvs: add consistent source hashing scheduling
Cc: Wensong Zhang <wensong@xxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx
From: Vincent Bernat <vincent@xxxxxxxxx>
Date: Mon, 02 Apr 2018 19:57:12 +0200
 ❦  2 avril 2018 10:33 -0700, Eric Dumazet <eric.dumazet@xxxxxxxxx> :

>> +static inline u32
>> +ip_vs_csh_permutation(struct ip_vs_dest *d, int j)
>> +{
>> +    u32 offset, skip;
>> +    __be32 addr_fold = d->addr.ip;
>> +
>> +#ifdef CONFIG_IP_VS_IPV6
>> +    if (d->af == AF_INET6)
>> +            addr_fold = d->addr.ip6[0]^d->addr.ip6[1]^
>> +                    d->addr.ip6[2]^d->addr.ip6[3];
>> +#endif
>> +    addr_fold = ntohl(addr_fold) + ntohs(d->port);
>> +    offset = hash_32(addr_fold, 32) % IP_VS_CSH_TAB_SIZE;
>> +    skip = (hash_32(addr_fold + 1, 32) % (IP_VS_CSH_TAB_SIZE - 1)) + 1;
>> +    return (offset + j * skip) % IP_VS_CSH_TAB_SIZE;
>> +}
>> +
>
> This does not look very strong to me, particularly the IPv6 folding
>
> I would rather use __ipv6_addr_jhash() instead of ipv6_addr_hash(),
> even if it is hard coded ;)

I can switch to ipv6_addr_hash(). However, switching to
__ipv6_addr_jhash seems useless as I would need to hardcode the initial
value: people use source hashing to get the same result from one host to
another. Am I missing something?
-- 
Each module should do one thing well.
            - The Elements of Programming Style (Kernighan & Plauger)
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>