Re: [RESEND PATCH v1] net: dsa: motorcomm: add yt92xx dsa driver
From: Andrew Lunn
Date: Thu Jun 18 2026 - 07:15:49 EST
> >>>> #define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> #define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> -#define ETH_P_YT921X 0x9988 /* Motorcomm YT921x DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> +#define ETH_P_YT92XX 0x9988 /* Motorcomm YT92xx DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> #define ETH_P_DSA_8021Q 0xDADB /* Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>> #define ETH_P_DSA_A5PSW 0xE001 /* A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */
> >>>
> >>> UAPI stands for User-space API. Do not change it unless there is a
> >>> very very good reason.
> >>>
> >>
> >> Ans: The default tpid both yt921x and yt922x is 0x9988. I have modified this to
> >> allow for simultaneous use in both yt922x and yt921x scenarios.
> >
> > As pointed out, this is UAPI. Any changes to this file need a good
> > explanation how it does not change the user API. Do this break
> > backwards compatibility with user space applications? Maybe tcpdump or
> > wireshark has a dissector which expects ETH_P_YT921X and you have just
> > broken it?
> >
>
> Ans:Now I have a better understanding of the role of the UAPI representative.
> If a new dsa driver is added in the subsequent patch, consider adding one instead of modifying the original content.
Or just use ETH_P_YT921X.
> yt921x_vlan_add(struct yt921x_priv *priv, int port, u16 vid, bool untagged)
> {
> u64 mask64;
> u64 ctrl64;
>
> mask64 = YT921X_VLAN_CTRL_PORTn(port) |
> YT921X_VLAN_CTRL_PORTS(priv->cpu_ports_mask);
> ctrl64 = mask64;
>
> mask64 |= YT921X_VLAN_CTRL_UNTAG_PORTn(port);
> if (untagged)
> ctrl64 |= YT921X_VLAN_CTRL_UNTAG_PORTn(port);
>
> return yt921x_reg64_update_bits(priv, YT921X_VLANn_CTRL(vid),
> mask64, ctrl64);
> }
>
> after patch:
>
> yt921x_vlan_add(struct yt921x_priv *priv, int port, u16 vid, bool untagged)
> {
> struct yt_port_mask member;
> struct yt_port_mask untag;
>
> member.portsbits[0] = BIT(port) | priv->cpu_ports_mask;
> if (untagged)
> untag.portbits[0] = BIT(port);
>
> return yt_vlan_port_set(priv->unit, vid, member, untag); // Here we use encapsulated interfaces to complete the hardware configuration.
> // We can ignore the differences between different motorcomm series, which will be reflected in driver/net/dsa/motorocmm/switch/yt_vlan. c
> }
Look at other DSA drivers, e.g. mv88e6xxx, ocelot. They have
structures like ocelot_ops and mv88e6xxx_ops which abstract the
differences between different families.
Andrew