Re: [PATCH RFC 3/5] Add KSZ8795 switch driver
From: Andrew Lunn
Date: Thu Sep 28 2017 - 15:34:27 EST
On Mon, Sep 18, 2017 at 08:27:13PM +0000, Tristram.Ha@xxxxxxxxxxxxx wrote:
> > > +/**
> > > + * Some counters do not need to be read too often because they are less
> > likely
> > > + * to increase much.
> > > + */
> >
> > What does comment mean? Are you caching statistics, and updating
> > different values at different rates?
> >
>
> There are 34 counters. In normal case using generic bus I/O or PCI to read them
> is very quick, but the switch is mostly accessed using SPI, or even I2C. As the SPI
> access is very slow.
How slow is it? The Marvell switches all use MDIO. It is probably a
bit faster than I2C, but it is a lot slower than MMIO or PCI.
ethtool -S lan0 takes about 25ms.
No other driver does caching. So i'm hesitant to add one which does.
> These accesses can be getting 1588 PTP timestamps and opening/closing ports.
You could drop the mutex between each statistic read, so allowing
something else access to the switch. That should reduce the jitter PTP
experiences.
Andrew