linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Prasanna Vengateshan Varadharajan  <prasanna.vengateshan@microchip.com>
Cc: olteanv@gmail.com, netdev@vger.kernel.org, robh+dt@kernel.org,
	kuba@kernel.org, vivien.didelot@gmail.com, f.fainelli@gmail.com,
	davem@davemloft.net, UNGLinuxDriver@microchip.com,
	Woojung.Huh@microchip.com, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH net-next 3/8] net: dsa: microchip: add DSA support for microchip lan937x
Date: Fri, 5 Feb 2021 14:27:09 +0100	[thread overview]
Message-ID: <YB1HrTfUvgXbcsTr@lunn.ch> (raw)
In-Reply-To: <b565944e72a0af12dec0430bd819eb6b755d84b4.camel@microchip.com>

> > > +bool lan937x_is_internal_tx_phy_port(struct ksz_device *dev, int
> > > port)
> > > +{
> > > +     /* Check if the port is internal tx phy port */
> > 
> > What is an internal TX phy port? Is it actually a conventional t2
> > Fast
> > Ethernet port, as opposed to a t1 port?
> This is 100 Base-Tx phy which is compliant with
> 802.3/802.3u standards. Two of the SKUs have both T1 and TX integrated
> Phys as mentioned in the patch intro mail.

I don't think we have a good name for a conventional fast Ethernet.
But since we call the other T1, since it has a single pair, maybe use
T2, since Fast Ethernet uses 2 pair. I would also suggest a comment
near this code explaining what T1 and T2 mean.

> > What PHY driver is actually used? The "Microchip LAN87xx T1" driver?

> Phy is basically a LAN87xx PHY. But the driver is customized for
> LAN937x.

Does it have its own ID in registers 2 and 3? Can you tell this
customised version from the regular?

> > > +static void tx_phy_port_init(struct ksz_device *dev, int port)
> > > +{
> > > +     u32 data;
> > > +
> > > +     /* Software reset. */
> > > +     lan937x_t1_tx_phy_mod_bits(dev, port, MII_BMCR, BMCR_RESET,
> > > true);
> > > +
> > > +     /* tx phy setup */
> > > +     tx_phy_setup(dev, port);
> > 
> > And which PHY driver is used here? "Microchip LAN88xx"? All this code
> > should be in the PHY driver.
> As of now, no driver is available in the kernel since its part of
> LAN937x.

Right, so you need to write such a driver, and put it into
drivers/net/phy.

> > > +             member = dev->host_mask | p->vid_member;
> > > +             mutex_lock(&dev->dev_mutex);
> > > +
> > > +             /* Port is a member of a bridge. */
> > > +             if (dev->br_member & (1 << port)) {
> > > +                     dev->member |= (1 << port);
> > > +                     member = dev->member;
> > > +             }
> > > +             mutex_unlock(&dev->dev_mutex);
> > > +             break;
> > > +     case BR_STATE_BLOCKING:
> > > +             data |= PORT_LEARN_DISABLE;
> > > +             if (port != dev->cpu_port &&
> > > +                 p->stp_state == BR_STATE_DISABLED)
> > > +                     member = dev->host_mask | p->vid_member;
> > > +             break;
> > > +     default:
> > > +             dev_err(ds->dev, "invalid STP state: %d\n", state);
> > > +             return;
> > > +     }
> > > +
> > > +     lan937x_pwrite8(dev, port, P_STP_CTRL, data);
> > > +
> > > +     p->stp_state = state;
> > > +     mutex_lock(&dev->dev_mutex);
> > > +
> > > +     /* Port membership may share register with STP state. */
> > > +     if (member >= 0 && member != p->member)
> > > +             lan937x_cfg_port_member(dev, port, (u8)member);
> > > +
> > > +     /* Check if forwarding needs to be updated. */
> > > +     if (state != BR_STATE_FORWARDING) {
> > > +             if (dev->br_member & (1 << port))
> > > +                     dev->member &= ~(1 << port);
> > > +     }
> > > +
> > > +     /* When topology has changed the function
> > > ksz_update_port_member
> > > +      * should be called to modify port forwarding behavior.
> > > +      */
> > > +     if (forward != dev->member)
> > > +             ksz_update_port_member(dev, port);
> > 
> > Please could you explain more what is going on with membership?
> > Generally, STP state is specific to the port, and nothing else
> > changes. So it is not clear what this membership is all about.
> It updates the membership for the forwarding behavior based on
> forwarding state of the port.

So membership is about forwarding packets between ports. Most other
chips handles this itself. But for this device, you need to handle
this in software. O.K.

You only want to forward when in STP state BR_STATE_FORWARDING. But
the code seems more complex than this.

    Andrew

  reply	other threads:[~2021-02-05 13:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  6:41 [PATCH net-next 0/8] net: dsa: microchip: DSA driver support for LAN937x switch Prasanna Vengateshan
2021-01-28  6:41 ` [PATCH net-next 1/8] dt-bindings: net: dsa: dt bindings for microchip lan937x Prasanna Vengateshan
2021-01-30  2:02   ` Vladimir Oltean
2021-02-10 11:46     ` Prasanna Vengateshan Varadharajan
2021-02-10 18:57       ` Andrew Lunn
2021-02-09 19:35   ` Rob Herring
2021-01-28  6:41 ` [PATCH net-next 2/8] net: dsa: tag_ksz: add tag handling for Microchip LAN937x Prasanna Vengateshan
2021-01-28 18:03   ` Andrew Lunn
2021-01-30  2:27   ` Vladimir Oltean
2021-02-10 11:55     ` Prasanna Vengateshan Varadharajan
2021-01-28  6:41 ` [PATCH net-next 3/8] net: dsa: microchip: add DSA support for microchip lan937x Prasanna Vengateshan
2021-01-29  1:07   ` Andrew Lunn
2021-02-05 12:48     ` Prasanna Vengateshan Varadharajan
2021-02-05 13:27       ` Andrew Lunn [this message]
2021-03-15  6:25         ` Prasanna Vengateshan Varadharajan
2021-01-28  6:41 ` [PATCH net-next 4/8] net: dsa: microchip: add support for phylink management Prasanna Vengateshan
2021-01-29  1:12   ` Andrew Lunn
2021-01-28  6:41 ` [PATCH net-next 5/8] net: dsa: microchip: add support for ethtool port counters Prasanna Vengateshan
2021-01-28  6:41 ` [PATCH net-next 6/8] net: dsa: microchip: add support for port mirror operations Prasanna Vengateshan
2021-01-28  6:41 ` [PATCH net-next 7/8] net: dsa: microchip: add support for fdb and mdb management Prasanna Vengateshan
2021-01-28  6:41 ` [PATCH net-next 8/8] net: dsa: microchip: add support for vlan operations Prasanna Vengateshan
2021-01-28 17:55 ` [PATCH net-next 0/8] net: dsa: microchip: DSA driver support for LAN937x switch Florian Fainelli
2021-01-30  2:09   ` Vladimir Oltean
2021-02-02  1:25   ` Woojung.Huh

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=YB1HrTfUvgXbcsTr@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=prasanna.vengateshan@microchip.com \
    --cc=robh+dt@kernel.org \
    --cc=vivien.didelot@gmail.com \
    /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).