From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:35361 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935382AbeB1WZF (ORCPT ); Wed, 28 Feb 2018 17:25:05 -0500 Received: by mail-pl0-f67.google.com with SMTP id bb3-v6so2400976plb.2 for ; Wed, 28 Feb 2018 14:25:05 -0800 (PST) Subject: Re: [PATCH RFC net-next 10/20] net/ipv6: move expires into rt6_info To: Martin KaFai Lau Cc: Wei Wang , Linux Kernel Network Developers , "David S . Miller" , Ido Schimmel , roopa@cumulusnetworks.com, Eric Dumazet , Hideaki YOSHIFUJI References: <20180225194730.30063-1-dsahern@gmail.com> <20180225194730.30063-11-dsahern@gmail.com> <754ecc89-3e65-c37f-b5e0-4226eda47a83@gmail.com> <20180228192122.liokziwr7xqwddkh@kafai-mbp.dhcp.thefacebook.com> From: David Ahern Message-ID: Date: Wed, 28 Feb 2018 15:25:02 -0700 MIME-Version: 1.0 In-Reply-To: <20180228192122.liokziwr7xqwddkh@kafai-mbp.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 2/28/18 12:21 PM, Martin KaFai Lau wrote: > On Mon, Feb 26, 2018 at 03:55:14PM -0700, David Ahern wrote: >> On 2/26/18 3:28 PM, Wei Wang wrote: >>>> @@ -213,11 +234,6 @@ static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) >>>> >>>> static inline void rt6_update_expires(struct rt6_info *rt0, int timeout) >>>> { >>>> - struct rt6_info *rt; >>>> - >>>> - for (rt = rt0; rt && !(rt->rt6i_flags & RTF_EXPIRES); rt = rt->from); >>>> - if (rt && rt != rt0) >>>> - rt0->dst.expires = rt->dst.expires; >>> >>> I was wondering if we need to retain the above logic. It makes sure >>> dst.expires gets synced to its "parent" route. But it might be hard >>> because after your change, we can no longer use rt->from to refer to >>> the "parent". >> >> As I understand it, the FIB entries are cloned into pcpu, uncached and >> exception routes. We should never have an rt6_info that ever points back >> more than 1 level -- ie., the dst rt6_info points to a from representing >> the original FIB entry. > Agree on at most 1 level. > >> >> After my change 'from' will still point to the FIB entry as a fib6_info >> which has its own expires. >> >> When I looked this code I was really confused. At best, the for loop >> above sets rt0->dst.expires to some value based on the 'from' but then >> the very next line calls dst_set_expires with the passed in timeout value. > My understanding is, the rt0 first inherits the expires from its rt0->from. > > The following dst_set_expires() set a new timeout if the new timeout > is earlier than the existing expires. I think it is essentially > taking a min. > > One question, would avoid taking the min cause the rt0 somehow > have a longer expires than its parent (or f6i after this series)? I believe the current logic expands to: static inline void rt6_update_expires(struct rt6_info *rt0, int timeout) { if (!(rt0->rt6i_flags & RTF_EXPIRES) && rt0->from) rt0->dst.expires = rt0->from->dst.expires; dst_set_expires(&rt0->dst, timeout); rt0->rt6i_flags |= RTF_EXPIRES; } With the fib6_info I can keep that logic with: static inline void rt6_update_expires(struct rt6_info *rt0, int timeout) { if (!(rt0->rt6i_flags & RTF_EXPIRES) && rt0->from) rt0->dst.expires = rt0->from->expires; dst_set_expires(&rt0->dst, timeout); rt0->rt6i_flags |= RTF_EXPIRES; }