From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131581; b=MNx3LAGwtQTfAbVQvApNa+v5tHlPayIn0dC9ZjyaMRtXVEntkPrjbTt0J60Pgav4Snpd dk8De5MPquJBHtLdHJTIgg9g1VWfBEdotDEhSkQRepR1DnphX/Guv2Gw0uTDYfFu22zUv 8O7X2ZGHzFChxMVxYOCl+u207TxspKDb5zTtoqiHNvZjhT4NFoSMv7hGfua/CxIpf+ZrR KUYw1kGvqcOh1kbytk+GvTR/z9x1ObDIat4wpAu+edQmoqklso7n3yD87RbwY68hHmxbP pOMQsQ79QV1FwA6Kq+/VqSOttcS1ElGyDaoWfnwpxRCQ8RkHeygR0shPFB/5yGTDhNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131581; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=KS96HcN0cp6Ak3rpHZGQ2zHtHCULt+6KccFteCRwYAs=; b=OrRrUT2X7pFOBouO4ncVpV22k7tbntnXnEAwRWoO8C+byVNf9nVEPFZCK/UYV5Bd7kHJ EztdgsrldM/PIAUF2uzMok1aPezLe8zdJnaQJtTyCzeWgIBUm6vCKqh9gNGxnZP7u+L1F CjEFDqTU+RdtmBVD3OS/tnOEZ5RU+kRatzfzEG9Ay9VbMYWj1/osteCLuY43W4fROo0+K 0RycQACjzdjnWkDjVGBg4IHtxsbAOfhV2zKXRMvCybrUJkFdUDCBu0+ru6Thd/L6IW1d8 vA4KJm/Ew4GyYXxuYLzR2u0fMcquGDsD0ZS1Tke38pCWsZrQ6K9w7YC/JsIhY3i3I5g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NYzCQwN7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71DD5606A31A; Tue, 1 Dec 2026 13:26:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NYzCQwN7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4F771F0089A; Tue, 1 Dec 2026 13:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796131580; bh=KS96HcN0cp6Ak3rpHZGQ2zHtHCULt+6KccFteCRwYAs=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NYzCQwN7HDhqg22CyfogoQgtpvFi4djiiBy4ApdxD+tZNTklzveMVwnecpoiKbFU4 3SnSUvrFHon/Jevo2gtKMACrstd6QicK//v9XQPxAHeO2g5bDcuN+AAVhviuQUEPgJ ujybgYSi/JcvHrrGMDWBgUvF4YMbi+CW4hYDxu/Jz03kWBRLIeh852jAPkY0X4WQIS dGHKiPo17lZ1/Z8l5ZQeAG9jjzWezV7BOFqahS9aGDKkqbIirUZulIIMa0S/kgjAB7 WDhTawCSafd7TBinrIGl6RlU8Q45dpl/q8wpi3+jCeSZarsT8W4mLIARn6vMLpADUF +mCNQv0MsAKOQ== Subject: Re: [PATCH net-next v2 2/2] net: dsa: realtek: rtl8365mb: offload ETS strict priority scheduling From: netdev-bot+sashiko@kernel.org To: o.rempel@pengutronix.de Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linusw@kernel.org, luizluca@gmail.com, andrew@lunn.ch, olteanv@gmail.com, alvin.sipraga@analog.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Tue, 01 Dec 2026 13:26:19 +0000 Message-ID: <179613157942.3146.15452909686182465491@kernel.org> In-Reply-To: <20261130-rtl8365mb-ets-strict-v2-2-9639f6f40499@pengutronix.de> References: <20261130-rtl8365mb-ets-strict-v2-2-9639f6f40499@pengutronix.de> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 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] In drivers/net/dsa/realtek/rtl83xx-qos.c, rtl83xx_port_setup_tc() keeps only one ETS handle per port… - [Low] rtl83xx_setup_tc_ets_replace() in drivers/net/dsa/realtek/rtl83xx-qos.c accepts TC_ETS_REPLACE and… - [Low] The commit body, which is the part that stays in git history (everything after the first '---' is dropped by git am), describes the… -- net: dsa: realtek: rtl8365mb: offload ETS strict priority scheduling This commit adds ETS qdisc offload for rtl8365mb user ports. Installing a root ETS qdisc with one strict band per queue switches the port from the default equal-weight WFQ scheduler to strict priority. Deleting the qdisc, or a refused offload, puts the port back on WFQ, and the priomap is not offloaded. > Offload the ETS qdisc so a user port can be switched from the WFQ > default to strict priority. With WFQ (weighted fair queuing) the > switch serves all queues of a port in turn, by their weights. By > default the driver sets equal weights, so no queue is served before > another. With strict priority a higher queue is always sent first. > Deleting the qdisc puts the port back on WFQ. [Severity: Low] Is the last sentence accurate in all cases? With hw-tc-offload off, ets_offload_destroy() returns early on !tc_can_offload(dev), so deleting the qdisc leaves the port strict. The comment in the TC_ETS_DESTROY case says so, but the commit body does not. A few other user-visible details appear only in the Q&A below the --- line, which git am drops: rtl83xx_port_setup_tc() returns -EOPNOTSUPP for TC_ETS_STATS on purpose. So qdisc_offload_dump_helper() never sets TCQ_F_OFFLOADED, even while the QTYPE register is set to strict. Nothing reports whether the port runs strict or WFQ. If a replacement root qdisc fails after its REPLACE was accepted, the port goes back to WFQ while the old strict qdisc stays root. Could these details go into the commit message itself? > diff --git a/drivers/net/dsa/realtek/rtl83xx-qos.c b/drivers/net/dsa/realtek/rtl83xx-qos.c > index f294222987eff..d2b21521b6de4 100644 > --- a/drivers/net/dsa/realtek/rtl83xx-qos.c > +++ b/drivers/net/dsa/realtek/rtl83xx-qos.c [ ... ] > @@ -208,3 +209,110 @@ int rtl83xx_port_set_apptrust(struct dsa_switch *ds, int port, const u8 *sel, > ARRAY_SIZE(trust)); > } > EXPORT_SYMBOL_NS_GPL(rtl83xx_port_set_apptrust, "REALTEK_DSA"); > + > +static int > +rtl83xx_setup_tc_ets_replace(struct dsa_switch *ds, int port, > + struct tc_ets_qopt_offload_replace_params *p) > +{ > + struct realtek_priv *priv = ds->priv; > + unsigned int nq = ds->num_tx_queues; > + int i; > + > + /* The qdisc must have one band per queue. */ > + if (p->bands != nq) { [ ... ] > + /* The switch does not use the priomap. */ > + return priv->ops->qos_set_port_sched(priv, port, nq, true); > +} [Severity: Low] Should a non-default priomap be refused here, or programmed into the switch? rtl83xx_setup_tc_ets_replace() checks only p->bands and p->quanta[]. A priomap that sends every skb->priority to a single band is accepted, and the port still switches to strict priority based on the switch's own traffic-type-to-queue map. ksz_tc_ets_add() in drivers/net/dsa/microchip/ksz_common.c programs the priomap into the switch's priority-to-queue map (KSZ9477_PORT_MRI_TC_MAP__4). This chip has a per-port qmap (rtl8365mb_qos_set_qmap_qid() and rtl8365mb_qos_set_port_qmap()) that might do the same job. The commit message documents this limitation, and the qdisc is never reported as offloaded. The hardware scheduler still changes, though. > + > +/* Forget the offloaded ETS qdisc of @port and put the port back on WFQ */ > +static int rtl83xx_setup_tc_ets_restore_wfq(struct dsa_switch *ds, int port) > +{ > + struct realtek_priv *priv = ds->priv; > + int ret; > + > + priv->ets_handle[port] = 0; [ ... ] > + switch (ets->command) { > + case TC_ETS_REPLACE: > + /* sch_ets keeps the qdisc when the offload fails. Put the > + * port back on WFQ so an earlier strict setup does not stay > + * active. > + */ > + ret = rtl83xx_setup_tc_ets_replace(ds, port, > + &ets->replace_params); > + if (ret) { > + rtl83xx_setup_tc_ets_restore_wfq(ds, port); > + return ret; > + } > + > + priv->ets_handle[port] = ets->handle; > + > + return 0; > + > + case TC_ETS_DESTROY: > + /* sch_ets offloads a new root qdisc before it destroys the > + * old one. Put the port back on WFQ only when DESTROY carries > + * the handle that was offloaded last. The new qdisc can fail > + * after the driver has offloaded it, for example in its rate > + * estimator. In that case qdisc_create() destroys the new > + * qdisc. Its DESTROY carries the handle offloaded last, so the > + * port goes back to WFQ. The old qdisc keeps running in > + * software. > + * > + * With hw-tc-offload off, sch_ets sends no DESTROY, so the > + * port stays strict. > + */ > + if (ets->handle != priv->ets_handle[port]) > + return 0; > + > + return rtl83xx_setup_tc_ets_restore_wfq(ds, port); [Severity: Medium] Can this leave the port on WFQ while an accepted all-strict root qdisc is still installed? Only one handle is tracked per port. So a DESTROY for a new qdisc that failed after its REPLACE looks the same as a delete of the active qdisc. Consider this sequence: 1. Root ETS qdisc 1: with nq strict bands is offloaded. The port is strict and ets_handle[port] = 1:. 2. tc qdisc replace dev lanX root handle 2: ets bands N strict N ... 3. qdisc_create()->ets_qdisc_init()->ets_qdisc_change()-> ets_offload_change() sends TC_ETS_REPLACE for 2:, which is accepted, and ets_handle[port] = 2:. 4. qdisc_create() then fails in gen_new_estimator() for TCA_RATE, or qdisc_graft() fails in tc_modify_qdisc() and calls qdisc_put(q). 5. ets_qdisc_destroy()->ets_offload_destroy() sends TC_ETS_DESTROY for 2:. That matches ets_handle[port], so rtl83xx_setup_tc_ets_restore_wfq() clears the handle and writes WFQ. The tc command fails and qdisc 1: stays root, but the port now runs WFQ. Nothing sends the REPLACE for 1: again. A later DESTROY for 1: no longer matches the cleared handle, so it is ignored. The comment above describes this outcome. Could the driver remember the previously offloaded handle and put the port back to strict here? The two cases look different from the driver's side. On a successful replace, the old qdisc's DESTROY arrives after the new REPLACE. On a failed replace, the new qdisc's DESTROY arrives and the old qdisc is never destroyed. [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-rtl8365mb-ets-strict-v2-0-9639f6f40499%40pengutronix.de