devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kurt Kanzenbach <kurt@linutronix.de>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Richard Cochran <richardcochran@gmail.com>,
	Kamil Alkhouri <kamil.alkhouri@hs-offenburg.de>,
	ilias.apalodimas@linaro.org
Subject: Re: [PATCH v5 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Date: Mon, 07 Sep 2020 08:05:25 +0200	[thread overview]
Message-ID: <875z8qazq2.fsf@kurt> (raw)
In-Reply-To: <20200905204235.f6b5til4sc3hoglr@skbuf>

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

On Sat Sep 05 2020, Vladimir Oltean wrote:
> On Fri, Sep 04, 2020 at 08:27:34AM +0200, Kurt Kanzenbach wrote:
>> Add a basic DSA driver for Hirschmann Hellcreek switches. Those switches are
>> implementing features needed for Time Sensitive Networking (TSN) such as support
>> for the Time Precision Protocol and various shapers like the Time Aware Shaper.
>> 
>> This driver includes basic support for networking:
>> 
>>  * VLAN handling
>>  * FDB handling
>>  * Port statistics
>>  * STP
>>  * Phylink
>> 
>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> ---
>> +
>> +/* Default setup for DSA:
>> + *  VLAN 2: CPU and Port 1 egress untagged.
>> + *  VLAN 3: CPU and Port 2 egress untagged.
>> + */
>> +static int hellcreek_setup_vlan_membership(struct dsa_switch *ds, int port,
>> +					   bool enabled)
>
> If you use VLAN 2 and 3 for port separation, then how does the driver
> deal with the following:
>
> ip link add link swp1 name swp1.100 type vlan id 100
> ip link add link swp2 name swp2.100 type vlan id 100
>
> In this case, frames with VLAN 100 shouldn't leak from one port to the
> other, will they?

Well, that depends on whether hellcreek_vlan_add() is called for
creating that vlan interfaces. In general: As soon as both ports are
members of the same vlan that traffic is switched.

>
>> +{
>> +	int upstream = dsa_upstream_port(ds, port);
>> +	struct switchdev_obj_port_vlan vlan = {
>> +		.vid_begin = port,
>> +		.vid_end = port,
>> +	};
>> +	int err = 0;
>> +
>> +	/* The CPU port is implicitly configured by
>> +	 * configuring the front-panel ports
>> +	 */
>> +	if (!dsa_is_user_port(ds, port))
>> +		return 0;
>> +
>> +	/* Apply vid to port as egress untagged and port vlan id */
>> +	vlan.flags = BRIDGE_VLAN_INFO_UNTAGGED | BRIDGE_VLAN_INFO_PVID;
>> +	if (enabled)
>> +		hellcreek_vlan_add(ds, port, &vlan);
>> +	else
>> +		err = hellcreek_vlan_del(ds, port, &vlan);
>> +	if (err) {
>> +		dev_err(ds->dev, "Failed to apply VID %d to port %d: %d\n",
>> +			port, port, err);
>> +		return err;
>> +	}
>> +
>> +	/* Apply vid to cpu port as well */
>> +	vlan.flags = BRIDGE_VLAN_INFO_UNTAGGED;
>> +	if (enabled)
>> +		hellcreek_vlan_add(ds, upstream, &vlan);
>> +	else
>> +		err = hellcreek_vlan_del(ds, upstream, &vlan);
>> +	if (err) {
>> +		dev_err(ds->dev, "Failed to apply VID %d to port %d: %d\n",
>> +			port, port, err);
>> +		return err;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static void hellcreek_setup_ingressflt(struct hellcreek *hellcreek, int port,
>> +				       bool enable)
>> +{
>> +	struct hellcreek_port *hellcreek_port = &hellcreek->ports[port];
>> +	u16 ptcfg;
>> +
>> +	mutex_lock(&hellcreek->reg_lock);
>> +
>> +	ptcfg = hellcreek_port->ptcfg;
>> +
>> +	if (enable)
>> +		ptcfg |= HR_PTCFG_INGRESSFLT;
>> +	else
>> +		ptcfg &= ~HR_PTCFG_INGRESSFLT;
>> +
>> +	hellcreek_select_port(hellcreek, port);
>> +	hellcreek_write(hellcreek, ptcfg, HR_PTCFG);
>> +	hellcreek_port->ptcfg = ptcfg;
>> +
>> +	mutex_unlock(&hellcreek->reg_lock);
>> +}
>> +
>> +static int hellcreek_vlan_filtering(struct dsa_switch *ds, int port,
>> +				    bool vlan_filtering)
>
> I remember asking in Message-ID: <20200716082935.snokd33kn52ixk5h@skbuf>
> whether it would be possible for you to set
> ds->configure_vlan_while_not_filtering = true during hellcreek_setup.
> Did anything unexpected happen while trying that?

No, that comment got lost.

So looking at the flag: Does it mean the driver can receive vlan
configurations when a bridge without vlan filtering is used? That might
be problematic as this driver uses vlans for the port separation by
default. This is undone when vlan filtering is set to 1 meaning vlan
configurations can be received without any problems.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2020-09-07  6:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  6:27 [PATCH v5 0/7] Hirschmann Hellcreek DSA driver Kurt Kanzenbach
2020-09-04  6:27 ` [PATCH v5 1/7] net: dsa: Add tag handling for Hirschmann Hellcreek switches Kurt Kanzenbach
2020-09-04  6:27 ` [PATCH v5 2/7] net: dsa: Add DSA driver " Kurt Kanzenbach
2020-09-05 20:42   ` Vladimir Oltean
2020-09-07  6:05     ` Kurt Kanzenbach [this message]
2020-09-07 10:48       ` Vladimir Oltean
2020-09-07 12:49         ` Kurt Kanzenbach
2020-09-07 13:21           ` Vladimir Oltean
2020-09-07 14:01             ` Kurt Kanzenbach
2020-09-07 15:17         ` Richard Cochran
2020-09-04  6:27 ` [PATCH v5 3/7] net: dsa: hellcreek: Add PTP clock support Kurt Kanzenbach
2020-09-04  6:27 ` [PATCH v5 4/7] net: dsa: hellcreek: Add support for hardware timestamping Kurt Kanzenbach
2020-09-04  6:27 ` [PATCH v5 5/7] net: dsa: hellcreek: Add PTP status LEDs Kurt Kanzenbach
2020-09-04  6:27 ` [PATCH v5 6/7] dt-bindings: Add vendor prefix for Hirschmann Kurt Kanzenbach
2020-09-04  6:27 ` [PATCH v5 7/7] dt-bindings: net: dsa: Add documentation for Hellcreek switches Kurt Kanzenbach

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=875z8qazq2.fsf@kurt \
    --to=kurt@linutronix.de \
    --cc=andrew@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kamil.alkhouri@hs-offenburg.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=richardcochran@gmail.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).