Devicetree
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kyle.switch@motor-comm.com
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	mmyangfl@gmail.com, horms@kernel.org, linux@armlinux.org.uk,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, david.laight.linux@gmail.com,
	ming.xu@motor-comm.com, xiaolin.xu@motor-comm.com,
	jianmin.wang@motor-comm.com, wei.zhang@gl-inet.com,
	sijia.huang@gl-inet.com
Subject: Re: [PATCH net-next v18 5/6] net: dsa: tag_yt922x: add support for Motorcomm YT922x tags
Date: Thu, 03 Dec 2026 08:57:33 +0000	[thread overview]
Message-ID: <179628825391.3146.14161603947402253086@kernel.org> (raw)
In-Reply-To: <20261202084022.3716891-6-kyle.switch@motor-comm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] yt922x_tag_xmit() in net/dsa/tag_yt922x.c line 66 builds the
  TX tag with YT922X_TAG_PRIO(skb->priority).
- [Low] The layout documentation in the header of net/dsa/tag_yt922x.c is
  mislabelled, and the commit message describes the MAINTAINERS change…

--

net: dsa: tag_yt922x: add support for Motorcomm YT922x tags

This adds a new DSA tag driver for Motorcomm YT922x switches. They use the
same ETH_P_YT921X EtherType and 8-byte tag length as YT921x, but the tag
layout is different. The patch also adds a DSA_TAG_PROTO_YT922X protocol
value and a new maintainer to the Motorcomm YT921X MAINTAINERS entry.

> diff --git a/net/dsa/tag_yt922x.c b/net/dsa/tag_yt922x.c
> new file mode 100644
> index 0000000000000..ee5d44df0dc79
> --- /dev/null
> +++ b/net/dsa/tag_yt922x.c
> @@ -0,0 +1,133 @@

[ ... ]

> +/*
> + * To define the from cpu tag format 8 bytes.
> + *
> + * +----+----+-------+-----+----+---------
> + * | DA | SA | TagET | Tag | ET | Payload ...
> + * +----+----+-------+-----+----+---------
> + *   6    6      2      6    2       N
> + *
> + * To-CPU (RX) tag format, 8 bytes:

[Severity: Low]
This isn't a bug, but is "from cpu tag format" the right label for this
diagram? The DA | SA | TagET | Tag | ET layout covers both directions. The
comment then describes the To-CPU (RX) and From-CPU (TX) layouts
separately.

Also, the commit message says:

    Update the co-maintainer for the Motorcomm DSA driver.

The MAINTAINERS hunk doesn't update an existing entry. It adds a new
"M: Kyle Switch" line to the MOTORCOMM YT921X ETHERNET SWITCH DRIVER
section, and that line isn't related to the new tag driver.

Could the commit message say that a maintainer is being added?

[ ... ]

> +#define YT922X_TAG_PRIO_M	GENMASK(12, 10)
> +#define YT922X_TAG_PRIO_EN	BIT(13)
> +#define  YT922X_TAG_PRIO(x)	(FIELD_PREP(YT922X_TAG_PRIO_M, (x)) | YT922X_TAG_PRIO_EN)

[ ... ]

> +	tag[0] = htons(ETH_P_YT921X);
> +	ports = dsa_xmit_port_mask(skb, netdev);
> +	/*To fill in the case where the port index is not 0 */
> +	ctrl = YT922X_TAG_PRIO(skb->priority) | YT922X_TAG_FORCE_DST |
> +	       YT922X_TAG_PORTS(ports >> 1);

[Severity: Medium]
In yt922x_tag_xmit(), what happens when skb->priority is larger than 7?

skb->priority is a runtime u32, so FIELD_PREP() does no range check here.
It only shifts the value and masks it into GENMASK(12, 10), which wraps it
modulo 8. For example, 8 becomes 0, 9 becomes 1, and a classid such as
0x10001 becomes 1.

YT922X_TAG_PRIO() always sets YT922X_TAG_PRIO_EN, so the switch applies the
wrapped value as the frame's internal priority. A frame given a high
priority via SO_PRIORITY, tc skbedit or a VLAN egress QoS map could then
be sent at the lowest hardware priority.

This path is used once yt922x_dsa_get_tag_protocol() returns
DSA_TAG_PROTO_YT922X in the follow-up patch "net: dsa: motorcomm: Add
support for Motorcomm YT922x".

Other taggers map the value and/or clamp it first. tag_lan9645x.c does:

	qos_class = netdev_get_num_tc(ndev) ?
		    netdev_get_prio_tc_map(ndev, skb->priority) :
		    skb->priority;
	qos_class = min_t(u32, qos_class, GENMASK(IFH_QOS_CLASS_SZ - 1, 0));

tag_ocelot.c also uses netdev_get_prio_tc_map().

Should yt922x_tag_xmit() map and clamp skb->priority in a similar way
before building the tag?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202084022.3716891-1-kyle.switch%40motor-comm.com

  reply	other threads:[~2026-12-03  8:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  8:40 [PATCH net-next v18 0/6] net: dsa: motorcomm: add support yt922x driver Kyle Switch
2026-12-02  8:40 ` [PATCH net-next v18 1/6] net: dsa: motorcomm: initialize dsa_switch based on chipid Kyle Switch
2026-12-03  8:40   ` sashiko-bot
2026-12-03  8:57   ` netdev-bot+sashiko
2026-12-02  8:40 ` [PATCH net-next v18 2/6] net: dsa: motorcomm: use max_ports in series for port bounds checking Kyle Switch
2026-12-03  8:40   ` sashiko-bot
2026-12-03  8:57   ` netdev-bot+sashiko
2026-12-02  8:40 ` [PATCH net-next v18 3/6] net: dsa: motorcomm: use GENMASK_U32() for mbus phy_mask Kyle Switch
2026-12-03  8:57   ` netdev-bot+sashiko
2026-12-02  8:40 ` [PATCH net-next v18 4/6] dt-bindings: net: dsa: add Motorcomm YT9224 Kyle Switch
2026-12-02 22:58   ` Rob Herring (Arm)
2026-12-03  8:40   ` sashiko-bot
2026-12-03  8:57   ` netdev-bot+sashiko
2026-12-02  8:40 ` [PATCH net-next v18 5/6] net: dsa: tag_yt922x: add support for Motorcomm YT922x tags Kyle Switch
2026-12-03  8:57   ` netdev-bot+sashiko [this message]
2026-12-02  8:40 ` [PATCH net-next v18 6/6] net: dsa: motorcomm: Add support for Motorcomm YT922x Kyle Switch
2026-12-03  8:40   ` sashiko-bot
2026-12-03  8:57   ` netdev-bot+sashiko

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=179628825391.3146.14161603947402253086@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david.laight.linux@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jianmin.wang@motor-comm.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kyle.switch@motor-comm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ming.xu@motor-comm.com \
    --cc=mmyangfl@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sijia.huang@gl-inet.com \
    --cc=wei.zhang@gl-inet.com \
    --cc=xiaolin.xu@motor-comm.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