public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Joris Vaišvila" <joey@tinyisr.com>
To: Daniel Golle <daniel@makrotopia.org>
Cc: netdev@vger.kernel.org, horms@kernel.org, pabeni@redhat.com,
	 kuba@kernel.org, edumazet@google.com, davem@davemloft.net,
	olteanv@gmail.com,  Andrew Lunn <andrew@lunn.ch>
Subject: Re: [RFC v2 2/3] net: dsa: initial MT7628 tagging driver
Date: Sat, 14 Mar 2026 22:46:17 +0200	[thread overview]
Message-ID: <abW8H_2Msj8-qrA6@archlinux> (raw)
In-Reply-To: <abWh_zVCnRiVLuM0@makrotopia.org>

Hi Daniel, thanks for the feedback. 

On Sat, Mar 14, 2026 at 05:59:27PM +0000, Daniel Golle wrote:
> On Sat, Mar 14, 2026 at 05:08:44PM +0200, Joris Vaisvila wrote:
> > +	tag[0] = ETH_P_8021Q >> 8;
> > +	tag[1] = FIELD_PREP(MT7628_TAG_TX_PORT_BIT_MASK,
> > +			    dsa_xmit_port_mask(skb, dev));
> > +
> > +	tag[2] = xmit_vlan >> 8;
> > +	tag[3] = xmit_vlan & 0xff;
> 
> So there are basically two 16-bit fields which need endian swapping
> from host-byte order (little endian on MT7628) to network byte-order.
> Imho it would be better expressed by using something along the lines
> of
> 
> 	__be16 *tag;
> ...
> 	tag = dsa_etype_header_pos_tx(skb);
> 	tag[0] = htons(ETH_P_8021Q |
> 		       FIELD_PREP(MT7628_TAG_TX_PORT_BIT_MASK,
> 				  dsa_xmit_port_mask(skb, dev)));
> 	tag[1] = htons(xmit_vlan);

Will use this in later revisions, thanks for the suggestion.

> > +static struct sk_buff *mt7628_tag_rcv(struct sk_buff *skb,
> > +				      struct net_device *dev)
> > +{
> > +	int src_port;
> > +	__be16 *phdr;
> > +	u16 tpid;
> > +
> > +	if (unlikely(!pskb_may_pull(skb, MT7628_TAG_LEN)))
> > +		return NULL;
> > +
> > +	phdr = dsa_etype_header_pos_rx(skb);
> > +	tpid = ntohs(*phdr);
> > +	skb_pull_rcsum(skb, MT7628_TAG_LEN);
> > +	dsa_strip_etype_header(skb, MT7628_TAG_LEN);
> > +
> > +	src_port = tpid & MT7628_TAG_RX_PORT_MASK;
> > +
> > +	skb->dev = dsa_conduit_find_user(dev, 0, src_port);
> > +	if (!skb->dev)
> > +		return NULL;
> > +	dsa_default_offload_fwd_mark(skb);
> > +	return skb;
> 
> This looks like it is semantically identical to the RX path in tag_mtk.c.
> 
> Maybe the TX-side can be added to the existing mtk_tag.c driver, so the
> RX-side can be shared? tag_brcm.c also defines multiple similar protocols
> in the same C source file.

While the core structure is really similar, there are subtle hardware
differences in the MT7628 switch that will make the RX code diverge
from the MTK tag when VLAN offloading is implemented. To account for
that, I'd prefer to keep these drivers separate.

I plan to implement bridge and VLAN offloading after the initial switch
support lands, to keep the initial series smaller and simplify review.

  reply	other threads:[~2026-03-14 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14 15:08 [RFC v2 0/3] net: dsa: MT7628 embedded switch initial support Joris Vaisvila
2026-03-14 15:08 ` [RFC v2 1/3] net: phy: mediatek: add phy driver for MT7628 built-in Fast Ethernet PHYs Joris Vaisvila
2026-03-17 18:03   ` Andrew Lunn
2026-03-21 11:35     ` Joris Vaisvila
2026-03-14 15:08 ` [RFC v2 2/3] net: dsa: initial MT7628 tagging driver Joris Vaisvila
2026-03-14 17:59   ` Daniel Golle
2026-03-14 20:46     ` Joris Vaišvila [this message]
2026-03-14 15:08 ` [RFC v2 3/3] net: dsa: initial support for MT7628 embedded switch Joris Vaisvila
2026-03-14 23:41   ` Daniel Golle
2026-03-15  7:02     ` 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=abW8H_2Msj8-qrA6@archlinux \
    --to=joey@tinyisr.com \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --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