public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: George McCollister <george.mccollister@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 4/4] net: dsa: xrs700x: add HSR offloading support
Date: Sun, 7 Feb 2021 01:53:49 +0200	[thread overview]
Message-ID: <20210206235349.7ypxtmjvnpxnn5cr@skbuf> (raw)
In-Reply-To: <20210204215926.64377-5-george.mccollister@gmail.com>

On Thu, Feb 04, 2021 at 03:59:26PM -0600, George McCollister wrote:
> +static int xrs700x_hsr_join(struct dsa_switch *ds, int port,
> +			    struct net_device *hsr)
> +{
> +	unsigned int val = XRS_HSR_CFG_HSR_PRP;
> +	struct dsa_port *partner = NULL, *dp;
> +	struct xrs700x *priv = ds->priv;
> +	struct net_device *slave;
> +	enum hsr_version ver;
> +	int ret;
> +
> +	ret = hsr_get_version(hsr, &ver);
> +	if (ret)
> +		return ret;
> +
> +	if (ver == HSR_V1)
> +		val |= XRS_HSR_CFG_HSR;
> +	else if (ver == PRP_V1)
> +		val |= XRS_HSR_CFG_PRP;
> +	else
> +		return -EOPNOTSUPP;
> +
> +	dsa_hsr_foreach_port(dp, ds, hsr) {
> +		partner = dp;
> +	}
> +
> +	/* We can't enable redundancy on the switch until both
> +	 * redundant ports have signed up.
> +	 */
> +	if (!partner)
> +		return 0;
> +
> +	regmap_fields_write(priv->ps_forward, partner->index,
> +			    XRS_PORT_DISABLED);
> +	regmap_fields_write(priv->ps_forward, port, XRS_PORT_DISABLED);
> +
> +	regmap_write(priv->regmap, XRS_HSR_CFG(partner->index),
> +		     val | XRS_HSR_CFG_LANID_A);
> +	regmap_write(priv->regmap, XRS_HSR_CFG(port),
> +		     val | XRS_HSR_CFG_LANID_B);
> +
> +	/* Clear bits for both redundant ports (HSR only) and the CPU port to
> +	 * enable forwarding.
> +	 */
> +	val = GENMASK(ds->num_ports - 1, 0);
> +	if (ver == HSR_V1) {
> +		val &= ~BIT(partner->index);
> +		val &= ~BIT(port);
> +	}
> +	val &= ~BIT(dsa_upstream_port(ds, port));
> +	regmap_write(priv->regmap, XRS_PORT_FWD_MASK(partner->index), val);
> +	regmap_write(priv->regmap, XRS_PORT_FWD_MASK(port), val);
> +
> +	regmap_fields_write(priv->ps_forward, partner->index,
> +			    XRS_PORT_FORWARDING);
> +	regmap_fields_write(priv->ps_forward, port, XRS_PORT_FORWARDING);
> +
> +	slave = dsa_to_port(ds, port)->slave;
> +
> +	slave->features |= NETIF_F_HW_HSR_TAG_INS | NETIF_F_HW_HSR_TAG_RM |
> +			   NETIF_F_HW_HSR_FWD | NETIF_F_HW_HSR_DUP;
> +
> +	return 0;
> +}

Is it deliberate that only one slave HSR/PRP port will have the offload
ethtool features set? If yes, then I find that a bit odd from a user
point of view.

  reply	other threads:[~2021-02-06 23:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 21:59 [PATCH net-next v2 0/4] add HSR offloading support for DSA switches George McCollister
2021-02-04 21:59 ` [PATCH net-next v2 1/4] net: hsr: generate supervision frame without HSR/PRP tag George McCollister
2021-02-07  1:26   ` Vladimir Oltean
2021-02-08 17:31     ` George McCollister
2021-02-04 21:59 ` [PATCH net-next v2 2/4] net: hsr: add offloading support George McCollister
2021-02-04 21:59 ` [PATCH net-next v2 3/4] net: dsa: add support for offloading HSR George McCollister
2021-02-06 23:29   ` Vladimir Oltean
2021-02-08 17:21     ` George McCollister
2021-02-09 17:20       ` Vladimir Oltean
2021-02-09 18:37         ` George McCollister
2021-02-09 18:51           ` Vladimir Oltean
2021-02-09 19:09             ` George McCollister
2021-02-04 21:59 ` [PATCH net-next v2 4/4] net: dsa: xrs700x: add HSR offloading support George McCollister
2021-02-06 23:53   ` Vladimir Oltean [this message]
2021-02-08 14:46     ` George McCollister
2021-02-08 20:16 ` [PATCH net-next v2 0/4] add HSR offloading support for DSA switches Tobias Waldekranz
2021-02-08 21:09   ` George McCollister
2021-02-09 14:38     ` Tobias Waldekranz
2021-02-09 17:04       ` George McCollister
2021-02-09 17:14         ` Vladimir Oltean
2021-02-10 21:10         ` Tobias Waldekranz
2021-02-10 21:55           ` Vladimir Oltean
2021-02-12 23:52             ` Tobias Waldekranz
2021-02-13  0:43               ` Vladimir Oltean

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=20210206235349.7ypxtmjvnpxnn5cr@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=f.fainelli@gmail.com \
    --cc=george.mccollister@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.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