From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F6B7C43381 for ; Fri, 22 Feb 2019 12:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A1152070D for ; Fri, 22 Feb 2019 12:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbfBVMub (ORCPT ); Fri, 22 Feb 2019 07:50:31 -0500 Received: from m97179.mail.qiye.163.com ([220.181.97.179]:55996 "EHLO m97179.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726087AbfBVMua (ORCPT ); Fri, 22 Feb 2019 07:50:30 -0500 Received: from [192.168.0.107] (unknown [180.157.111.121]) by m97179.mail.qiye.163.com (Hmail) with ESMTPA id 345AFE0194B; Fri, 22 Feb 2019 20:50:27 +0800 (CST) Subject: Re: [PATCH net-next v2] route: Add a new fib_multipath_hash_policy base on cpu id for tunnel packet To: Nikolay Aleksandrov , davem@davemloft.net Cc: netdev@vger.kernel.org References: <1550827209-23440-1-git-send-email-wenxu@ucloud.cn> From: wenxu Message-ID: Date: Fri, 22 Feb 2019 20:50:26 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-HM-Spam-Status: e1kIGBQJHllBS1VLV1koWUFJQjdXWS1ZQUlXWQkOFx4IWUFZMjUtOjcyP0 FLVUtZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6ODI6MCo4NDlJQg85MiwxOU86 AgMKCRlVSlVKTk5LQ0hCQ0lMSENLVTMWGhIXVQweFQMOOw4YFxQOH1UYFUVZV1kSC1lBWUpDS1VK TkxVSkpKVUpJSllXWQgBWUFISk9LNwY+ X-HM-Tid: 0a691541cb7420bdkuqy345afe0194b Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2019/2/22 下午6:26, Nikolay Aleksandrov wrote: > On 22/02/2019 11:20, wenxu@ucloud.cn wrote: >> From: wenxu >> >> 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 >> --- >> 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.