From: Eric Dumazet <eric.dumazet@gmail.com>
To: Su Xuemin <suxm@chinanetcenter.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH v3] udp reuseport: fix packet of same flow hashed to different socket
Date: Sun, 12 Jun 2016 08:32:51 -0700 [thread overview]
Message-ID: <1465745571.7945.76.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1465735407-8345-1-git-send-email-suxm@chinanetcenter.com>
On Sun, 2016-06-12 at 20:43 +0800, Su Xuemin wrote:
> From: "Su, Xuemin" <suxm@chinanetcenter.com>
...
> Signed-off-by: Su, Xuemin <suxm@chinanetcenter.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
First, I want to thank you for this very high quality submission,
especially if this is your first linux kernel patch.
I have one additional comment to make :
> if (score > badness) {
> reuseport = sk->sk_reuseport;
> @@ -556,14 +510,20 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
> daddr, hnum, dif,
> hslot2, slot2, skb);
> if (!result) {
> + unsigned int old = hash2;
> hash2 = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum);
> +
> + /* avoid search the same slot again. */
> + if (unlikely(old == hash2))
> + return result;
> +
Technically speaking, what matters is the slot, not the hash value
(32bit)
So I would save in old, slot2
> slot2 = hash2 & udptable->mask;
And here perform the check
if (unlikely(slot2 != old_slot))
return result;
> hslot2 = &udptable->hash2[slot2];
> if (hslot->count < hslot2->count)
> goto begin;
(Same remark applies in IPv6)
Thanks !
prev parent reply other threads:[~2016-06-12 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-12 12:43 [PATCH v3] udp reuseport: fix packet of same flow hashed to different socket Su Xuemin
2016-06-12 15:32 ` Eric Dumazet [this message]
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=1465745571.7945.76.camel@edumazet-glaptop3.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=suxm@chinanetcenter.com \
--cc=yoshfuji@linux-ipv6.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).