[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35a99c33-7a22-4a49-84ef-6e73b9e6cabd@lunn.ch>
Date: Sun, 3 Sep 2023 19:17:17 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Lukasz Majewski <lukma@...x.de>
Cc: Eric Dumazet <edumazet@...gle.com>, davem@...emloft.net,
Paolo Abeni <pabeni@...hat.com>,
Woojung Huh <woojung.huh@...rochip.com>,
Vladimir Oltean <olteanv@...il.com>, Tristram.Ha@...rochip.com,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <kuba@...nel.org>, UNGLinuxDriver@...rochip.com,
George McCollister <george.mccollister@...il.com>,
Oleksij Rempel <o.rempel@...gutronix.de>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] net: dsa: hsr: Enable in KSZ9477 switch HW HSR
offloading
> +int ksz9477_hsr_join(struct dsa_switch *ds, int port, struct net_device *hsr,
> + struct dsa_port *partner)
> +{
> + struct ksz_device *dev = ds->priv;
> + struct net_device *slave;
> + u8 i, data;
> + int ret;
> +
> + /* Program which ports shall support HSR */
> + dev->hsr_ports = BIT(port) | BIT(partner->index);
> + ksz_write32(dev, REG_HSR_PORT_MAP__4, 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);
> +
> + /* Self MAC address filtering for HSR frames to avoid
> + * traverse of the HSR ring more than once.
> + *
> + * The HSR port (i.e. hsr0) MAC address is used.
> + */
> + if (!is_valid_ether_addr(hsr->dev_addr)) {
> + dev_err(dev->dev,
> + "Set valid MAC address to %s for HSR operation!",
> + hsr->name);
> + return -EINVAL;
> + }
This seems like something which should be done at a higher level, not
per driver. Please check if there is an existing test, and if not, add
one in the HSR core.
Andrew
Powered by blists - more mailing lists