Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599906

Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time
Date 2017-03-14 00:00 +0100
Message-ID <tkH6y-7El-5@gated-at.bofh.it> (permalink)
References <tkDPk-58M-15@gated-at.bofh.it> <tkGNc-7uk-17@gated-at.bofh.it> <tkGWR-7zv-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Mar 13, 2017 at 03:42:36PM -0700, Florian Fainelli wrote:
> On 03/13/2017 03:39 PM, Andrew Lunn wrote:
> > On Mon, Mar 13, 2017 at 03:20:43PM -0400, Vivien Didelot wrote:
> >> The ATU ageing time value programmed in the switch is rounded up to the
> >> nearest multiple of its coefficient (variable depending on the model.)
> >>
> >> Add a debug message to inform the user about the exact programmed value.
> >>
> >> On 6352, "brctl setageing br0 18" gives "AgeTime set to 0x01 (15000 ms)"
> >> while on 6390 we get "AgeTime set to 0x05 (18750 ms)".
> >>
> >> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> >> ---
> >>  drivers/net/dsa/mv88e6xxx/global1_atu.c | 9 ++++++++-
> >>  1 file changed, 8 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c
> >> index f6cd3c939da4..bac34737b096 100644
> >> --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c
> >> +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c
> >> @@ -65,7 +65,14 @@ int mv88e6xxx_g1_atu_set_age_time(struct mv88e6xxx_chip *chip,
> >>  	val &= ~0xff0;
> >>  	val |= age_time << 4;
> >>  
> >> -	return mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val);
> >> +	err = mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val);
> >> +	if (err)
> >> +		return err;
> >> +
> >> +	dev_dbg(chip->dev, "AgeTime set to 0x%02x (%d ms)\n", age_time,
> >> +		age_time * coeff);
> >> +
> > 
> > Hi Vivien
> > 
> > You could put the dev_dbg before the mv88e6xxx_g1_write(), to keep the
> > code simpler. If this write fails, we expect a lot of other things to
> > go horribly wrong, so having one debug message being not quite accurate
> > is not important.
> 
> The debug message would not be printed in case mv88e6xxx_g1_write()
> fails, also, having the message printed after the write occurred is a
> good way to make sure the write did make it through. Did I miss
> something in what you are suggesting here?

We never, ever see a read or a write failure on the MDIO bus. If it
ever does, i expect the switch is dead, gone, never to be heard from
again until the power is reset. We are going to have lots of
failures. So it seems simpler to have:

	dev_dbg(chip->dev, "Setting AgeTime to 0x%02x (%d ms)\n", age_time,
		age_time * coeff);

	return mv88e6xxx_g1_write(chip, GLOBAL_ATU_CONTROL, val);

and accept that if for some unlikely reason the write does fail, the
debug message is probably not accurate.

      Andrew

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-13 20:30 +0100
  Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Andrew Lunn <andrew@lunn.ch> - 2017-03-13 23:40 +0100
    Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Florian Fainelli <f.fainelli@gmail.com> - 2017-03-13 23:50 +0100
      Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Andrew Lunn <andrew@lunn.ch> - 2017-03-14 00:00 +0100
        Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Matthias May <matthias.may@neratec.com> - 2017-03-14 12:20 +0100
          Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Andrew Lunn <andrew@lunn.ch> - 2017-03-14 13:10 +0100
            Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-14 15:10 +0100
              Re: [PATCH net-next] net: dsa: mv88e6xxx: debug ATU Age Time Andrew Lunn <andrew@lunn.ch> - 2017-03-14 15:20 +0100

csiph-web