netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Tristram.Ha@microchip.com>
To: <andrew@lunn.ch>, <m.grzeschik@pengutronix.de>
Cc: <netdev@vger.kernel.org>, <f.fainelli@gmail.com>,
	<davem@davemloft.net>, <kernel@pengutronix.de>,
	<matthias.schiffer@ew.tq-group.com>, <Woojung.Huh@microchip.com>,
	<UNGLinuxDriver@microchip.com>
Subject: RE: [PATCH 08/11] net: dsa: microchip: ksz8795: align port_cnt usage with other microchip drivers
Date: Thu, 19 Nov 2020 18:06:03 +0000	[thread overview]
Message-ID: <BYAPR11MB35589C5922F285095F7768B4ECE00@BYAPR11MB3558.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201119003556.GL1804098@lunn.ch>

> On Wed, Nov 18, 2020 at 11:03:54PM +0100, Michael Grzeschik wrote:
> > The ksz8795 driver is using port_cnt differently to the other microchip
> > DSA drivers. It sets it to the external physical port count, than the
> > whole port count (including the cpu port). This patch is aligning the
> > variables purpose with the other microchip drivers.
> >
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> >  drivers/net/dsa/microchip/ksz8795.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/dsa/microchip/ksz8795.c
> b/drivers/net/dsa/microchip/ksz8795.c
> > index 17dc720df2340b0..10c9b301833dd59 100644
> > --- a/drivers/net/dsa/microchip/ksz8795.c
> > +++ b/drivers/net/dsa/microchip/ksz8795.c
> > @@ -1183,7 +1183,7 @@ static const struct ksz_chip_data
> ksz8795_switch_chips[] = {
> >               .num_alus = 0,
> >               .num_statics = 8,
> >               .cpu_ports = 0x10,      /* can be configured as cpu port */
> > -             .port_cnt = 4,          /* total physical port count */
> > +             .port_cnt = 5,
> 
> Rather than remove the comment, please could you update the
> comment. port_cnt is too generic to know its exact meaning without a
> helpful comment. And this might be why this driver is different...

At one time there are 3 distinctions of the ports used in the drivers for KSZ switches.
Physical ports require valid link to operate.  They are the usual ports users interact with.
The total port count is usually physical port count + 1.  The last port is the host port.
They all have the usual port controls like receive, transmit, QoS, and other functions.
That last port may not have MIB counters.  That is why another variable is used to
manage handling of MIB counters in a loop.

The KSZ9477/KSZ9897 family of switches is a new design where any port can be a host port.
It also has extra RGMII/SGMII port that makes the term "physical port" ambiguous.

KSZ8795 has 5 ports.  The last is always the host port.
KSZ8794 has 3 physical ports, but the last port is still 5.  Port 4 is disabled.

There is another KSZ8895 switch which also has 5 ports.  It has a variation KSZ8864 which
disables the first port.

Now the DSA layer treats each port individually and there is less use of a loop of ports
Inside the switch driver it is good to consolidate those port variables.


  reply	other threads:[~2020-11-19 18:06 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 22:03 [PATCH 00/11] net: dsa: microchip: make ksz8795 driver more dynamic Michael Grzeschik
2020-11-18 22:03 ` [PATCH 01/11] net: dsa: microchip: ksz8795: remove unused last_port variable Michael Grzeschik
2020-11-19  0:05   ` Andrew Lunn
2020-11-19  3:06   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 02/11] net: dsa: microchip: ksz8795: remove superfluous port_cnt assignment Michael Grzeschik
2020-11-19  0:10   ` Andrew Lunn
2020-11-19  3:07   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 03/11] net: dsa: microchip: ksz8795: move variable assignments from detect to init Michael Grzeschik
2020-11-19  0:14   ` Andrew Lunn
2020-11-19  3:07   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 04/11] net: dsa: microchip: ksz8795: use reg_mib_cnt where possible Michael Grzeschik
2020-11-19  0:16   ` Andrew Lunn
2020-11-19  3:08   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 05/11] net: dsa: microchip: ksz8795: use mib_cnt " Michael Grzeschik
2020-11-19  0:20   ` Andrew Lunn
2020-11-19  7:36     ` Michael Grzeschik
2020-11-19  3:09   ` Florian Fainelli
2020-11-19  7:01   ` kernel test robot
2020-11-18 22:03 ` [PATCH 06/11] net: dsa: microchip: ksz8795: use phy_port_cnt " Michael Grzeschik
2020-11-19  0:29   ` Andrew Lunn
2020-11-19  8:40     ` Michael Grzeschik
2020-11-19 13:59       ` Andrew Lunn
2020-11-19  3:13   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 07/11] net: dsa: microchip: remove superfluous num_ports asignment Michael Grzeschik
2020-11-19  0:32   ` Andrew Lunn
2020-11-19  3:10   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 08/11] net: dsa: microchip: ksz8795: align port_cnt usage with other microchip drivers Michael Grzeschik
2020-11-19  0:35   ` Andrew Lunn
2020-11-19 18:06     ` Tristram.Ha [this message]
2020-11-19  3:13   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 09/11] net: dsa: microchip: remove usage of mib_port_count Michael Grzeschik
2020-11-19  1:13   ` Andrew Lunn
2020-11-19  3:12   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 10/11] net: dsa: microchip: ksz8795: dynamic allocate memory for flush_dyn_mac_table Michael Grzeschik
2020-11-19  1:21   ` Andrew Lunn
2020-11-19  3:12   ` Florian Fainelli
2020-11-18 22:03 ` [PATCH 11/11] net: dsa: microchip: ksz8795: use num_vlans where possible Michael Grzeschik
2020-11-19  1:22   ` Andrew Lunn
2020-11-19  3:11   ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR11MB35589C5922F285095F7768B4ECE00@BYAPR11MB3558.namprd11.prod.outlook.com \
    --to=tristram.ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=m.grzeschik@pengutronix.de \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).