From: Yuho Choi <oss.patchbox@gmail.com>
To: Sunil Goutham <sgoutham@marvell.com>,
Geetha sowjanya <gakula@marvell.com>,
Ratheesh Kannoth <rkannoth@marvell.com>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Bharat Bhushan <bbhushan2@marvell.com>,
Hariprasad Kelam <hkelam@marvell.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Jacob Keller <jacob.e.keller@intel.com>,
netdev@vger.kernel.org, Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH net] octeontx2-pf: QOS: Don't free SQ memory if disabling the SQ fails
Date: Tue, 24 Nov 2026 19:00:24 +0000 [thread overview]
Message-ID: <20261124190046.415260-2-oss.patchbox@gmail.com> (raw)
otx2_qos_disable_sq() asks the AF to disable the QoS send queue, its
aura and its pool, but ignores the result of otx2_qos_ctx_disable().
If the mailbox request fails, for example on a timeout or an AQ error,
the driver cannot confirm that all three contexts have been disabled.
It frees the SQBs, the pool stack, and the aura flow-control buffer
anyway, which the hardware may continue to reference.
If the disable fails, log an error and keep the memory: leaking it is
safer than freeing memory the hardware may still access. If the queue
is not set up again, otx2_free_hw_resources() frees it later with the
other queues when the interface goes down, after the SQ and NPA
contexts of the whole LF have been disabled.
Fixes: ab6dddd2a669 ("octeontx2-pf: qos send queues management")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Compile-tested only (x86_64 with COMPILE_TEST, OCTEONTX2_PF=m, W=1). I
don't have OcteonTX2/CN10K hardware, and the disable only fails when
the mailbox request to the AF fails, so I could not trigger this path.
drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
index 683efce519af..e9ca884cfb4d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
@@ -283,7 +283,7 @@ void otx2_qos_disable_sq(struct otx2_nic *pfvf, int qidx)
struct otx2_hw *hw = &pfvf->hw;
struct otx2_snd_queue *sq;
struct otx2_cq_queue *cq;
- int pool_id, sq_idx;
+ int pool_id, sq_idx, err;
sq_idx = hw->non_qos_queues + qidx;
@@ -311,8 +311,16 @@ void otx2_qos_disable_sq(struct otx2_nic *pfvf, int qidx)
otx2_cleanup_tx_cqes(pfvf, cq);
mutex_lock(&pfvf->mbox.lock);
- otx2_qos_ctx_disable(pfvf, sq_idx, pool_id);
+ err = otx2_qos_ctx_disable(pfvf, sq_idx, pool_id);
mutex_unlock(&pfvf->mbox.lock);
+ if (err) {
+ /* The SQ, aura and pool may still be enabled, so don't free
+ * the memory they point to.
+ */
+ netdev_err(pfvf->netdev,
+ "Failed to disable QoS SQ %d (%d)\n", sq_idx, err);
+ return;
+ }
otx2_qos_sq_free_sqbs(pfvf, sq_idx);
otx2_qos_aura_pool_free(pfvf, pool_id);
base-commit: 37fa509e43ba59d7c329025436e8ea64bdf089d7
--
2.56.1
next reply other threads:[~2026-11-24 19:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 19:00 Yuho Choi [this message]
2026-11-24 19:02 ` [PATCH net] octeontx2-pf: QOS: Don't free SQ memory if disabling the SQ fails netdev-bot+sinfo
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=20261124190046.415260-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=bbhushan2@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=sbhatta@marvell.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