From: Vladimir Oltean <olteanv@gmail.com>
To: Yangfl <mmyangfl@gmail.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>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Simon Horman <horms@kernel.org>,
Russell King <linux@armlinux.org.uk>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v6 2/3] net: dsa: tag_yt921x: add support for Motorcomm YT921x tags
Date: Tue, 26 Aug 2025 17:38:47 +0300 [thread overview]
Message-ID: <20250826143847.wwczaqgafl6y7ped@skbuf> (raw)
In-Reply-To: <CAAXyoMNh-6_NtYGBYYBhbiH0UPWCOoiZNhMkgeGqPzKP3HA-_g@mail.gmail.com>
On Tue, Aug 26, 2025 at 09:47:34AM +0800, Yangfl wrote:
> > The tag format sort of becomes fixed ABI as soon as user space is able
> > to run "cat /sys/class/net/eth0/dsa/tagging", see "yt921x", and record
> > it to a pcap file. Unless the EtherType bears some other meaning rather
> > than being a fixed value, then if you change it later to some other
> > value than 0x9988, you'd better also change the protocol name to
> > distinguish it from "yt921x".
>
> "EtherType" here does not necessarily become EtherType; better to
> think it is a key to enable port control over the switch. It could be
> a dynamic random value as long as everyone gets the same value all
> over the kernel, see the setup process of the switch driver. Ideally
> only the remaining content of the tag should become the ABI (and is
> actually enforced by the switch), but making a dynamic "EtherType" is
> clearly a worse idea so I don't know how to clarify the fact...
>
> > Also, you can _not_ use yt921x_priv :: tag_eth_p, because doing so would
> > assume that typeof(ds->priv) == struct yt921x_priv. In principle we
> > would like to be able to run the tagging protocols on the dsa_loop
> > driver as well, which can be attached to any network interface. Very
> > few, if any, tagging protocol drivers don't work on dsa_loop.
> > > +
> > > +static struct sk_buff *
> > > +yt921x_tag_rcv(struct sk_buff *skb, struct net_device *netdev)
> > > +{
> > > + unsigned int port;
> > > + __be16 *tag;
> > > + u16 rx;
> > > +
> > > + if (unlikely(!pskb_may_pull(skb, YT921X_TAG_LEN)))
> > > + return NULL;
> > > +
> > > + tag = (__be16 *)skb->data;
> >
> > Use dsa_etype_header_pos_rx() and validate the CPU_TAG_TPID_TPID as well.
>
> See the above explanation why rx "EtherType" is not considered part of ABI.
So what I don't understand is: it's impossible to separate RX from TX in
current DSA taggers. If TX hardcodes the assumption that the switch was
configured to use EtherType 0x9988, why would we expect RX to use anything else?
What valid configuration would we prevent, if we ensured that RX packets
have the same EtherType?
It should be ok if you documented that the EtherType is self-assigned
and must be hardcoded to 0x9988 by local convention for the moment, but
is otherwise configurable, and the meaning of a different value is
undefined. Even if self-assigned, I suppose you could still add the
value to include/uapi/linux/if_ether.h to avoid conflicts with other
uses.
Even better if you clarify the expectations by writing a libpcap
dissector for the new tagging protocol, which you need to do anyway for
recent tcpdump versions to work on the conduit interface (otherwise it
fails with "unsupported protocol"). See
https://github.com/the-tcpdump-group/libpcap/pull/1463
The libpcap dissector uses the /sys/class/net/eth0/dsa/tagging text to
identify the protocol in use, not the EtherType.
next prev parent reply other threads:[~2025-08-26 14:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-24 0:51 [PATCH net-next v6 0/3] net: dsa: yt921x: Add support for Motorcomm YT921x David Yang
2025-08-24 0:51 ` [PATCH net-next v6 1/3] dt-bindings: net: dsa: yt921x: Add Motorcomm YT921x switch support David Yang
2025-08-24 9:20 ` Krzysztof Kozlowski
2025-08-24 9:25 ` Yangfl
2025-08-24 17:16 ` Krzysztof Kozlowski
2025-08-25 2:39 ` Yangfl
2025-08-25 7:37 ` Krzysztof Kozlowski
2025-08-24 0:51 ` [PATCH net-next v6 2/3] net: dsa: tag_yt921x: add support for Motorcomm YT921x tags David Yang
2025-08-25 22:15 ` Vladimir Oltean
2025-08-26 1:47 ` Yangfl
2025-08-26 2:18 ` Andrew Lunn
2025-08-26 2:44 ` Yangfl
2025-08-26 14:38 ` Vladimir Oltean [this message]
2025-08-24 0:51 ` [PATCH net-next v6 3/3] net: dsa: yt921x: Add support for Motorcomm YT921x David Yang
2025-08-24 8:42 ` Russell King (Oracle)
2025-08-24 9:31 ` Yangfl
2025-08-24 15:22 ` Andrew Lunn
2025-08-24 15:26 ` Andrew Lunn
2025-08-24 15:34 ` Andrew Lunn
2025-08-24 15:51 ` Andrew Lunn
2025-08-24 16:38 ` Yangfl
2025-08-24 18:14 ` Russell King (Oracle)
2025-08-24 19:16 ` Andrew Lunn
2025-08-25 14:14 ` Yangfl
2025-08-26 19:07 ` Vladimir Oltean
2025-08-24 19:14 ` Andrew Lunn
2025-08-24 16:40 ` kernel test robot
2025-08-25 21:23 ` Vladimir Oltean
2025-08-26 5:19 ` Yangfl
2025-08-26 12:15 ` Andrew Lunn
2025-08-26 13:51 ` 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=20250826143847.wwczaqgafl6y7ped@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/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