From: Paolo Abeni <pabeni@redhat.com>
To: Stanislaw Pal <kuncy7@gmail.com>,
Christian Marangi <ansuelsmth@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Yongzhao Chen <yongzhao.derek@gmail.com>,
Alexey Immoreev <luixo-public@luixo.me>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 0/4] net: dsa: qca8k: fix the MIB autocast and management frame handlers
Date: Wed, 25 Nov 2026 15:55:41 +0100 [thread overview]
Message-ID: <b1320ae3-e2eb-4138-bd1c-cdb9dbc41598@redhat.com> (raw)
In-Reply-To: <20261119134110.15048-1-kuncy7@gmail.com>
On 11/19/26 14:41, Stanislaw Pal wrote:
> The netdev AI review of the MIB statistics series [1] found bugs in
> the qca8k handlers of the Ethernet management and MIB autocast frames,
> and its review of v1 of this series [2] found two more. None of them
> has been seen in production, so as Andrew asked for the related MTU
> series [3], this goes to net-next rather than net. All four keep their
> Fixes tags.
>
> 1. qca8k_bulk_read() falls back to MDIO when the management path is
> not available, but stores register i at val_buf + i with val_buf a
> void pointer, so every multi-register read is garbage: the FDB dump
> and the MDB add/del write the wrong port mask back into the ATU.
>
> 2. An ethtool MIB request over Ethernet (autocast) that times out
> leaves the caller's buffer published; late frames write into it
> after ethtool has freed it, and extra frames underflow the frame
> counter. v2 also handles the frames of an earlier autocast arriving
> during the next request.
>
> 3. The autocast handler reads up to 164 bytes of counters without
> checking the frame length.
>
> 4. The management ack handler trusts the frame for both the length and
> the layout: up to 32 bytes into a 16-byte buffer, read from
> skb->data without checking that the frame has them.
>
> Changes in v4:
> - 4/4: take the Ethernet header again after pskb_may_pull(), which can
> move the head; v3 read ->seq and ->mdio_data through the pointer
> taken before the pull [6]. 3/4 already did this for the MIB frame.
> - Rebase on current net-next; 1/4-3/4 unchanged.
>
> Changes in v3:
> - Rebase on current net-next; the code is unchanged.
> - 1/4: the description said that the last three bytes of a
> three-register read are never written; it is the last six (Alexey
> Immoreev) [5].
>
> Changes in v2:
> - Drop "let regmap serialize register access" (v1 1/3): Yongzhao Chen
> carries it, unchanged, as 1/2 of his net-next v8 "preserve port state
> across MTU changes" [4]; this series does not depend on it.
> - New 1/4: the MDIO fallback of qca8k_bulk_read() (review of v1 1/3).
> - 2/4: poll MIB_BUSY before the next autocast, as qca8k_mib_init()
> does after a flush, and track the ports seen as a bitmap instead of
> a countdown (review of v1 2/3). The description now says that a
> frame of the previous autocast still queued on the host can serve the
> next request, with counters one autocast old, instead of claiming
> that every late frame is dropped.
> - 3/4 unchanged (v1 3/3).
> - New 4/4: bound the data of a management ack frame (review of v1
> 3/3).
> - Target net-next; describe the LLM assistance here and in the commit
> messages instead of an Assisted-by tag.
>
> Testing: the affected objects build with W=1 on arm64 on this base.
> The hardware test is the one of v2, from before the three lines v4
> adds to 4/4, which are only built: on a QCA8337 behind an IPQ5018
> (GL.iNet GL-B3000), kernel 6.18.60 with these four patches, under
> tag_qca with the management conduit on port 0, counted on the conduit:
> one ethtool -S costs 3 management frames up and 10 down (the MIB_BUSY
> poll, the cast, the 7 autocast frames and acks); with the request
> timeout forced to 0 by a test-only module parameter it costs 50 up and
> 57 down, i.e. the register fallback over management frames plus the 7
> late autocast frames, which the handler drops. The counters stayed
> monotonic over 2000 such reads and over 5x200 reads under iperf3 in
> both directions while toggling the timeout, with no memory growth and
> no splat. Under a tagger without management frames (qca-8021q,
> OpenWrt) the MDIO fallback of 1/4 was checked by the FDB dump.
>
> LLM assistance: Claude Code (Claude Opus 5.5 for v1, Claude Fable 5.1
> for v2, Claude Fable 5.2 for the v3 rebase, Claude Opus 5.5 for the v4
> fix) drafted the code and the descriptions from my analysis and the
> review findings, and helped work out the race in 2/4. I reviewed every
> line, built the series and ran the tests above. The review findings
> themselves came from Sashiko, the netdev AI review bot, and for v4
> from the OpenWrt AI review of the same patch in OpenWrt.
>
> [1] https://lore.kernel.org/netdev/20261019191137.307514-1-kuncy7@gmail.com/
> [2] https://lore.kernel.org/netdev/179304303832.3134.328719975361344250@kernel.org/
> [3] https://lore.kernel.org/netdev/47e9713f-815e-4caf-8928-a7ec12d0087b@lunn.ch/
> [4] https://lore.kernel.org/netdev/20261104120130.48455-1-yongzhao.derek@gmail.com/
> [5] https://lore.kernel.org/netdev/20261107031005.2525-1-luixo-public@luixo.me/
> [6] https://lore.kernel.org/netdev/20261119133908.12428-1-kuncy7@gmail.com/
>
> v3: https://lore.kernel.org/netdev/20261118104104.26684-1-kuncy7@gmail.com/
> v2: https://lore.kernel.org/netdev/20261104210757.467964-1-kuncy7@gmail.com/
> v1: https://lore.kernel.org/netdev/20261022192933.384898-1-kuncy7@gmail.com/
Applied, thanks!
Paolo
prev parent reply other threads:[~2026-11-25 14:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 13:41 Stanislaw Pal
2026-11-19 13:41 ` [PATCH net-next v4 1/4] net: dsa: qca8k: read each register into its own word over MDIO Stanislaw Pal
2026-11-19 13:41 ` [PATCH net-next v4 2/4] net: dsa: qca8k: drop MIB autocast frames once the request is over Stanislaw Pal
2026-11-19 13:41 ` [PATCH net-next v4 3/4] net: dsa: qca8k: check the length of MIB autocast frames Stanislaw Pal
2026-11-19 13:41 ` [PATCH net-next v4 4/4] net: dsa: qca8k: bound the data of a management ack frame Stanislaw Pal
2026-11-25 14:55 ` Paolo Abeni [this message]
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=b1320ae3-e2eb-4138-bd1c-cdb9dbc41598@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=kuncy7@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luixo-public@luixo.me \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=yongzhao.derek@gmail.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
all inboxes | Powered by JetHome®