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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,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 7C29EC388F9 for ; Fri, 20 Nov 2020 02:26:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2397F2236F for ; Fri, 20 Nov 2020 02:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726824AbgKTCZp (ORCPT ); Thu, 19 Nov 2020 21:25:45 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:40352 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726172AbgKTCZo (ORCPT ); Thu, 19 Nov 2020 21:25:44 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kfw7I-008333-JR; Fri, 20 Nov 2020 03:25:40 +0100 Date: Fri, 20 Nov 2020 03:25:40 +0100 From: Andrew Lunn To: DENG Qingfang Cc: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Sean Wang , Landen Chao , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , Matthias Brugger , Russell King , =?iso-8859-1?Q?Ren=E9?= van Dorst , Frank Wunderlich , Greg Ungerer , Alex Dewar , Chuanhong Guo Subject: Re: [RFC PATCH net-next] net: dsa: mt7530: support setting ageing time Message-ID: <20201120022540.GD1804098@lunn.ch> References: <20201119064020.19522-1-dqfext@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201119064020.19522-1-dqfext@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Nov 19, 2020 at 02:40:20PM +0800, DENG Qingfang wrote: > MT7530 has a global address age control register, so use it to set > ageing time. > > The applied timer is (AGE_CNT + 1) * (AGE_UNIT + 1) seconds > > Signed-off-by: DENG Qingfang > --- > drivers/net/dsa/mt7530.c | 41 ++++++++++++++++++++++++++++++++++++++++ > drivers/net/dsa/mt7530.h | 13 +++++++++++++ > 2 files changed, 54 insertions(+) > > RFC: > 1. What is the expected behaviour if the timer is too big or too small? > - return -ERANGE or -EINVAL; ERANGE is good. > or > - if it is too big, apply the maximum value; if it is too small, > disable learning; > > 2. Is there a better algorithm to find the closest pair? The bridge code will default to 300 seconds. And after a topology change, it sets it to 2 * the forwarding delay, which defaults to 15 seconds. So maybe you can look for these two values, and use pre-computed values? You still need to handle other values, the user can configure these. Andrew