netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Tristram.Ha@microchip.com, Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew@lunn.ch>,
	davem@davemloft.net, Woojung Huh <woojung.huh@microchip.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	UNGLinuxDriver@microchip.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [PATCH v5 net-next 5/5] net: dsa: microchip: Enable HSR offloading for KSZ9477
Date: Fri, 22 Sep 2023 13:29:04 +0200	[thread overview]
Message-ID: <20230922132904.750688b6@wsk> (raw)
In-Reply-To: <20230921193224.l3ojpdcsb4bpfl7d@skbuf>

[-- Attachment #1: Type: text/plain, Size: 3230 bytes --]

Hi Vladimir,

> On Wed, Sep 20, 2023 at 01:43:43PM +0200, Lukasz Majewski wrote:
> > +void ksz9477_hsr_join(struct dsa_switch *ds, int port, struct
> > net_device *hsr) +{
> > +	struct ksz_device *dev = ds->priv;
> > +	struct net_device *slave;
> > +	u8 data;
> > +
> > +	/* Program which port(s) shall support HSR */
> > +	ksz_rmw32(dev, REG_HSR_PORT_MAP__4, BIT(port), BIT(port));
> > +
> > +	/* Forward frames between HSR ports (i.e. bridge together
> > HSR ports) */
> > +	ksz9477_cfg_port_member(dev, port,
> > +				BIT(dsa_upstream_port(ds, port)) |
> > BIT(port));  
> 
> Isn't this supposed to be
> 
> 	ksz9477_cfg_port_member(dev, port,
> 				BIT(dsa_upstream_port(ds, port)) |
> BIT(pair));
> 
> where "pair" is not even passed as an argument to ksz9477_hsr_join(),
> but represents the *other* port in the HSR ring, not this one?

Unfortunately, yes...

The code as it is now -> would set for port lan1 0x21 and lan2 0x22.

However the setup shall be 0x23 for both ports.

More info here:
https://github.com/Microchip-Ethernet/EVB-KSZ9477/issues/98#issuecomment-1701557449

I will setup this register from dev->hsr_ports when both HSR ports are
known.


> 
> > +
> > +	if (!dev->hsr_ports) {
> > +		/* Enable discarding of received HSR frames */
> > +		ksz_read8(dev, REG_HSR_ALU_CTRL_0__1, &data);
> > +		data |= HSR_DUPLICATE_DISCARD;
> > +		data &= ~HSR_NODE_UNICAST;
> > +		ksz_write8(dev, REG_HSR_ALU_CTRL_0__1, data);
> > +	}
> > +
> > +	/* Enable per port self-address filtering.
> > +	 * The global self-address filtering has already been
> > enabled in the
> > +	 * ksz9477_reset_switch() function.
> > +	 */
> > +	ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL,
> > PORT_SRC_ADDR_FILTER, true); +
> > +	/* Setup HW supported features for lan HSR ports */
> > +	slave = dsa_to_port(ds, port)->slave;
> > +	slave->features |= KSZ9477_SUPPORTED_HSR_FEATURES;
> > +}
> > diff --git a/drivers/net/dsa/microchip/ksz_common.h
> > b/drivers/net/dsa/microchip/ksz_common.h index
> > 1f3fb6c23f36..1f447a34f555 100644 ---
> > a/drivers/net/dsa/microchip/ksz_common.h +++
> > b/drivers/net/dsa/microchip/ksz_common.h @@ -101,6 +101,11 @@
> > struct ksz_ptp_irq { int num;
> >  };
> >  
> > +struct ksz_switch_macaddr {
> > +	unsigned char addr[ETH_ALEN];
> > +	refcount_t refcount;
> > +};
> > +
> >  struct ksz_port {
> >  	bool remove_tag;		/* Remove Tag flag set,
> > for ksz8795 only */ bool learning;
> > @@ -169,6 +174,10 @@ struct ksz_device {
> >  	struct mutex lock_irq;		/* IRQ Access */
> >  	struct ksz_irq girq;
> >  	struct ksz_ptp_data ptp_data;
> > +
> > +	struct ksz_switch_macaddr *switch_macaddr;
> > +	struct net_device *hsr_dev;     /* HSR */  
> 
> Please be consistent with the lines above, and use tabs to align the
> "/* HSR */" comment.
> 
> > +	u8 hsr_ports;
> >  };
> >  
> >  /* List of supported models */
> > -- 
> > 2.20.1
> >   
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-09-22 11:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 11:43 [PATCH v5 net-next 0/5] net: dsa: hsr: Enable HSR HW offloading for KSZ9477 Lukasz Majewski
2023-09-20 11:43 ` [PATCH v5 net-next 1/5] net: dsa: propagate extack to ds->ops->port_hsr_join() Lukasz Majewski
2023-09-21 17:47   ` Florian Fainelli
2023-09-20 11:43 ` [PATCH v5 net-next 2/5] net: dsa: notify drivers of MAC address changes on user ports Lukasz Majewski
2023-09-21 17:49   ` Florian Fainelli
2023-09-20 11:43 ` [PATCH v5 net-next 3/5] net: dsa: tag_ksz: Extend ksz9477_xmit() for HSR frame duplication Lukasz Majewski
2023-09-21 17:50   ` Florian Fainelli
2023-09-21 19:12   ` Vladimir Oltean
2023-09-20 11:43 ` [PATCH v5 net-next 4/5] net: dsa: microchip: move REG_SW_MAC_ADDR to dev->info->regs[] Lukasz Majewski
2023-09-21 17:50   ` Florian Fainelli
2023-09-20 11:43 ` [PATCH v5 net-next 5/5] net: dsa: microchip: Enable HSR offloading for KSZ9477 Lukasz Majewski
2023-09-21 17:52   ` Florian Fainelli
2023-09-21 19:32   ` Vladimir Oltean
2023-09-22 11:29     ` Lukasz Majewski [this message]
2023-09-22 11:43       ` Vladimir Oltean
2023-09-21 19:23 ` [PATCH v5 net-next 0/5] net: dsa: hsr: Enable HSR HW " Vladimir Oltean
2023-09-22 11:18   ` Lukasz Majewski
2023-09-22 11:31     ` Vladimir Oltean
2023-09-22 11:47       ` Lukasz Majewski

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=20230922132904.750688b6@wsk \
    --to=lukma@denx.de \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=woojung.huh@microchip.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).