From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH net-next 4/4] ipv6: Add support for non-equal-cost multipath Date: Wed, 10 Jan 2018 08:53:14 -0700 Message-ID: <8afde8f1-9bca-0ee9-3ba4-28db3688aa0b@gmail.com> References: <20180109144028.30133-1-idosch@mellanox.com> <20180109144028.30133-5-idosch@mellanox.com> <1dedd203-78ad-5290-fe27-9a8d376a991a@gmail.com> <20180110114738.GA12249@splinter> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Ido Schimmel , netdev@vger.kernel.org, davem@davemloft.net, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, pch@ordbogen.com, jkbs@redhat.com, yoshfuji@linux-ipv6.org, mlxsw@mellanox.com To: Ido Schimmel Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:37518 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965425AbeAJPxQ (ORCPT ); Wed, 10 Jan 2018 10:53:16 -0500 Received: by mail-pl0-f66.google.com with SMTP id s3so7503396plp.4 for ; Wed, 10 Jan 2018 07:53:16 -0800 (PST) In-Reply-To: <20180110114738.GA12249@splinter> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 1/10/18 4:47 AM, Ido Schimmel wrote: > Hi David, > > On Tue, Jan 09, 2018 at 08:48:37PM -0700, David Ahern wrote: >> On 1/9/18 7:40 AM, Ido Schimmel wrote: >>> The use of hash-threshold instead of modulo-N makes it trivial to add >>> support for non-equal-cost multipath. >>> >>> Instead of dividing the multipath hash function's output space equally >>> between the nexthops, each nexthop is assigned a region size which is >>> proportional to its weight. >>> >>> Signed-off-by: Ido Schimmel >>> --- >>> include/net/ip6_fib.h | 1 + >>> net/ipv6/route.c | 11 +++++++---- >>> 2 files changed, 8 insertions(+), 4 deletions(-) >>> >>> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h >>> index 97cd05d87780..34ec321d6a03 100644 >>> --- a/include/net/ip6_fib.h >>> +++ b/include/net/ip6_fib.h >>> @@ -171,6 +171,7 @@ struct rt6_info { >>> u32 rt6i_metric; >>> u32 rt6i_pmtu; >>> /* more non-fragment space at head required */ >>> + int rt6i_nh_weight; >>> unsigned short rt6i_nfheader_len; >>> u8 rt6i_protocol; >>> u8 exception_bucket_flushed:1, >> >> Since dst is cacheline aligned there is a hole after rt6i_nh_flags. In >> patch 1 you put rt6i_nh_upper_bound in that hole. Putting the weight >> there too keeps those variables together as well as using the open space. > > Before patch 1 there's a hole of 4 bytes after rt6i_nh_flags which I use > for rt6i_nh_upper_bound. If I put rt6i_nh_weight there as well, then I > create a 60 bytes hole because the dst needs to be cached aligned. > > Since rt6i_nh_weight isn't used in fast-path, I just put it at the end. > Apparently, I was on a 4.14 branch when I ran pahole to dump the layout of rt6_info. The patch looks good to me. Acked-by: David Ahern