Netdev List
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <davem@davemloft.net>, <hkelam@marvell.com>,
	<linux-kernel@vger.kernel.org>, <naveenm@marvell.com>,
	<netdev@vger.kernel.org>, <sgoutham@marvell.com>
Cc: <andrew+netdev@lunn.ch>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, Ratheesh Kannoth <rkannoth@marvell.com>
Subject: [PATCH net] octeontx2-pf: reset TL4 topology on HTB offload teardown
Date: Fri, 21 Aug 2026 12:58:12 +0530	[thread overview]
Message-ID: <20260821072812.2890922-1-rkannoth@marvell.com> (raw)

HTB offload programs NIX_AF_TL4X_TOPOLOGY with RR priority and anchor
settings that the AF retains after scheduler nodes are freed. When mqprio
bandwidth offload later parents MDQs under TL4[0], stale HTB topology can
starve transmit queues. Restore the default TL4 topology for every active
TL4 node when TC_HTB_DESTROY tears down the HTB hierarchy.

Fixes: 5e6808b4c68d ("octeontx2-pf: Add support for HTB offload")
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
 .../net/ethernet/marvell/octeontx2/nic/qos.c  | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
index 69c0911e28e9..21943fc059db 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
@@ -235,6 +235,49 @@ static int otx2_qos_txschq_set_parent_topology(struct otx2_nic *pfvf,
 	return rc;
 }
 
+static int otx2_qos_reset_tl4_topology(struct otx2_nic *pfvf)
+{
+	struct mbox *mbox = &pfvf->mbox;
+	struct nix_txschq_config *cfg;
+	int i, err;
+
+	if (!pfvf->hw.txschq_cnt[NIX_TXSCH_LVL_TL4])
+		return 0;
+
+	mutex_lock(&mbox->lock);
+
+	for (i = 0; i < pfvf->hw.txschq_cnt[NIX_TXSCH_LVL_TL4]; ) {
+		cfg = otx2_mbox_alloc_msg_nix_txschq_cfg(mbox);
+		if (!cfg) {
+			mutex_unlock(&mbox->lock);
+			return -ENOMEM;
+		}
+
+		cfg->lvl = NIX_TXSCH_LVL_TL4;
+		cfg->num_regs = 0;
+
+		while (i < pfvf->hw.txschq_cnt[NIX_TXSCH_LVL_TL4] &&
+		       cfg->num_regs < MAX_REGS_PER_MBOX_MSG) {
+			int schq = pfvf->hw.txschq_list[NIX_TXSCH_LVL_TL4][i];
+
+			cfg->reg[cfg->num_regs] = NIX_AF_TL4X_TOPOLOGY(schq);
+			cfg->regval[cfg->num_regs] = 0;
+			cfg->num_regs++;
+			i++;
+		}
+
+		err = otx2_sync_mbox_msg(mbox);
+		if (err) {
+			mutex_unlock(&mbox->lock);
+			return err;
+		}
+	}
+
+	mutex_unlock(&mbox->lock);
+
+	return 0;
+}
+
 static void otx2_qos_free_hw_node_schq(struct otx2_nic *pfvf,
 				       struct otx2_qos_node *parent)
 {
@@ -1098,6 +1141,7 @@ static int otx2_qos_root_add(struct otx2_nic *pfvf, u16 htb_maj_id, u16 htb_defc
 static int otx2_qos_root_destroy(struct otx2_nic *pfvf)
 {
 	struct otx2_qos_node *root;
+	int err;
 
 	netdev_dbg(pfvf->netdev, "TC_HTB_DESTROY\n");
 
@@ -1109,6 +1153,14 @@ static int otx2_qos_root_destroy(struct otx2_nic *pfvf)
 	/* free the hw mappings */
 	otx2_qos_destroy_node(pfvf, root);
 
+	if (netif_running(pfvf->netdev)) {
+		err = otx2_qos_reset_tl4_topology(pfvf);
+		if (err)
+			netdev_warn(pfvf->netdev,
+				    "HTB destroy: failed to reset TL4 topology: %d\n",
+				    err);
+	}
+
 	return 0;
 }
 
-- 
2.43.0


                 reply	other threads:[~2026-08-21  7:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260821072812.2890922-1-rkannoth@marvell.com \
    --to=rkannoth@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkelam@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveenm@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgoutham@marvell.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