Netdev List
 help / color / mirror / Atom feed
From: wenxu <wenxu@ucloud.cn>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] route: Add a new fib_multipath_hash_policy base on cpu id for tunnel packet
Date: Fri, 22 Feb 2019 20:50:26 +0800	[thread overview]
Message-ID: <f4edcd7e-339c-4a55-ed85-ca16f4720f13@ucloud.cn> (raw)
In-Reply-To: <fe3c4fd4-1e8a-41a9-aefc-ebf606729524@cumulusnetworks.com>

On 2019/2/22 下午6:26, Nikolay Aleksandrov wrote:
> On 22/02/2019 11:20, wenxu@ucloud.cn wrote:
>> From: wenxu <wenxu@ucloud.cn>
>>
>> Current fib_multipath_hash_policy can make hash based on the L3 or
>> L4. But it only work on the outer IP. So a specific tunnel always
>> has the same hash value. But a specific tunnel may contain so many
>> inner connections. However there is no good way for tunnel packet.
>> A specific tunnel route based on the percpu dst_cache. It will not
>> lookup route table for each packet.
>>
>> This patch provide a based cpu id hash policy. The different
>> connection run on different cpu and there will be different hash
>> value for percpu dst_cache.
>>
>> Signed-off-by: wenxu <wenxu@ucloud.cn>
>> ---
>>  net/ipv4/route.c           | 6 ++++++
>>  net/ipv4/sysctl_net_ipv4.c | 2 +-
>>  2 files changed, 7 insertions(+), 1 deletion(-)
>>
> Hi,
> When we had the same issue in the bonding, we added a new mode which used
> the flow dissector to get the inner headers and hash on them.
> I believe that is even easier nowadays, but I think people wanted to
> use different hash algorithms as well and last we discussed this we
> were talking about yet another bpf use to generate the hash.
> Now we got bpf_set_hash() which can be used to achieve this from various
> places, if you use that with hash_policy=1 (L4) then skb->hash will
> be used and you can achieve any hashing that you desire.
>
> Cheers,
>  Nik
>
>
Yes, we can set the skb->hash. But ip tunnel lookup the route table without skb.

The most important for performance issue most tunnel send work with dst_cache.

The dst_cache is percpu cache. So the number of dst_entry of a specific tunnel is the cpu cores .

So It's more better hash based on outer and cpu id.



  reply	other threads:[~2019-02-22 12:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  9:20 [PATCH net-next v2] route: Add a new fib_multipath_hash_policy base on cpu id for tunnel packet wenxu
2019-02-22 10:26 ` Nikolay Aleksandrov
2019-02-22 12:50   ` wenxu [this message]
2019-02-22 16:08     ` Nikolay Aleksandrov
2019-02-23  0:45       ` wenxu

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=f4edcd7e-339c-4a55-ed85-ca16f4720f13@ucloud.cn \
    --to=wenxu@ucloud.cn \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    /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