public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Joris Vaisvila <joey@tinyisr.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>
Subject: Re: [RFC PATCH 1/2 net-next] net: dsa: initial MT7628 special tag driver
Date: Thu, 5 Mar 2026 00:16:47 +0200	[thread overview]
Message-ID: <20260304221647.ed6tfossgptpjqm2@skbuf> (raw)
In-Reply-To: <20260228185242.800836-3-joey@tinyisr.com>

On Sat, Feb 28, 2026 at 08:52:42PM +0200, Joris Vaisvila wrote:
> +#include <linux/etherdevice.h>
> +#include <linux/dsa/8021q.h>
> +#include <net/dsa.h>
> +
> +#include "tag.h"
> +
> +/* 

You have a trailing whitespace here.

> + * MT7628 uses the ralink special tag. It merges the VLAN TPID with source
> + * port ID on RX and target port bitmap on TX.
> + *
> + * The switch forwarding is controlled with VLANs, so each port is put in a
> + * standalone VLAN using tag_8021q. Double tag is enabled to simulate VLAN
> + * unaware ports.
> + *
> + * A VLAN tag is constructed on egress to target the standalone VLAN and port.
> + * The outer VLAN tag is parsed and removed on ingress.
> + */
> +
> +#define MT7628_TAG_NAME "tag_mt7628"

No other protocol name starts with "tag_". This is exported to user
space (cat /sys/class/net/<conduit>/dsa/tagging), it's good to have some
uniformity.

> +
> +#define SPECIAL_HEADER_RECV_SOURCE_PORT_MASK GENMASK(2, 0)
> +#define SPECIAL_TAG_LEN 4
> +
> +static struct sk_buff *dsa_user_special_xmit(struct sk_buff *skb,
> +					     struct net_device *dev)
> +{
> +	struct dsa_port *dp = dsa_user_to_port(dev);
> +	u16 xmit_vlan = dsa_tag_8021q_standalone_vid(dp);
> +	u8 *special_tag;
> +
> +	skb_push(skb, SPECIAL_TAG_LEN);
> +	dsa_alloc_etype_header(skb, SPECIAL_TAG_LEN);
> +
> +	special_tag = dsa_etype_header_pos_tx(skb);
> +
> +	special_tag[0] = ETH_P_8021Q >> 8;
> +	special_tag[1] = BIT(dp->index);

We don't do BIT(dp->index) anymore. It's wrapped around a
dsa_xmit_port_mask() helper, which also gives you some HSR TX offloading
if you set the offload pointers to dsa_port_simple_hsr_join() and
dsa_port_simple_hsr_leave().

> +
> +	special_tag[2] = xmit_vlan >> 8;
> +	special_tag[3] = xmit_vlan & 0xff;
> +	return skb;
> +}

  parent reply	other threads:[~2026-03-04 22:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28 18:52 [RFC 0/2 net-next] net: dsa: MT7628 embedded switch initial support Joris Vaisvila
2026-02-28 18:52 ` [RFC PATCH 1/2 net-next] net: dsa: initial MT7628 special tag driver Joris Vaisvila
2026-02-28 20:12   ` Andrew Lunn
2026-03-04 22:16   ` Vladimir Oltean [this message]
2026-02-28 18:52 ` [RFC PATCH 2/2 net-next] net: dsa: initial support for MT7628 embedded switch Joris Vaisvila
2026-02-28 20:16   ` Andrew Lunn
2026-02-28 20:31   ` Andrew Lunn
2026-03-01 17:23     ` Joris Vaišvila
2026-02-28 23:40 ` [RFC 0/2 net-next] net: dsa: MT7628 embedded switch initial support Vladimir Oltean
2026-03-01 12:00   ` Daniel Golle
2026-03-01 12:36     ` Vladimir Oltean
2026-03-01 13:13       ` Joris Vaišvila

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=20260304221647.ed6tfossgptpjqm2@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=joey@tinyisr.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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