From: Vincent Bernat <vincent@bernat.im>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Wensong Zhang <wensong@linux-vs.org>,
Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, lvs-devel@vger.kernel.org
Subject: Re: [PATCH net-next v1] ipvs: add consistent source hashing scheduling
Date: Mon, 02 Apr 2018 19:57:12 +0200 [thread overview]
Message-ID: <m3zi2lcwzr.fsf@luffy.cx> (raw)
In-Reply-To: <63c63fab-12ed-8b15-e00e-dc54e5c144eb@gmail.com> (Eric Dumazet's message of "Mon, 2 Apr 2018 10:33:27 -0700")
❦ 2 avril 2018 10:33 -0700, Eric Dumazet <eric.dumazet@gmail.com> :
>> +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)
next prev parent reply other threads:[~2018-04-02 17:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 17:20 [PATCH net-next v1] ipvs: add consistent source hashing scheduling Vincent Bernat
2018-04-02 17:33 ` Eric Dumazet
2018-04-02 17:57 ` Vincent Bernat [this message]
2018-04-02 19:05 ` Julian Anastasov
2018-04-02 19:12 ` Vincent Bernat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3zi2lcwzr.fsf@luffy.cx \
--to=vincent@bernat.im \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=wensong@linux-vs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).