[RFC PATCH net-next] net: dsa: mt7530: support setting ageing time

Andrew Lunn andrew at lunn.ch
Thu Nov 19 21:25:40 EST 2020


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 <dqfext at gmail.com>
> ---
>  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



More information about the Linux-mediatek mailing list