octeontx2-pf: add mqprio bandwidth offload for NIX TX schedulers
Subsystems (5)
Ratheesh Kannoth
maintainerPATCH v9 1/1 octeontx2-pf: add mqprio bandwidth offload for NIX TX schedulers
Add TC_SETUP_QDISC_MQPRIO handling for channel-mode mqprio with TC_MQPRIO_SHAPER_BW_RATE. Offload programs per-transmit-queue MDQ CIR/PIR shapers on non-QoS queues (hw.non_qos_queues). When enabled, allocate one SMQ per such queue, parent every MDQ under TL4[0], and apply each traffic class min/max rate to the queue(s) in that class.
Rates are only supported when a traffic class maps to a single queue; multi-queue classes with min or max rates are rejected because the driver shapes at MDQ granularity and cannot enforce a shared TC cap without per-TC TL4 shapers. TC-to-queue mapping without rates is still allowed for multi-queue classes. Advertise TC_QUERY_CAPS.validate_queue_counts so the core mqprio code validates queue layout before offload.
Setup and teardown that change the scheduler hierarchy restart the netdev via ndo_stop()/ndo_open(). That drops carrier, tears down IRQ/NAPI, and discards in-flight traffic. Offload setup requires the interface to already be running. If ndo_open() fails after restart, the interface is left administratively down.
Reject incompatible configurations: HTB, PFC, XDP, SDP representors, and hardware without CIR+PIR support (QOS_CIR_PIR_SUPPORT). Reject rates outside the NIX TLX encoder range (~2 Mbps to ~130 Gbps). Block ethtool channel changes while offload is active.
Track offload state in pfvf->mqprio.rate_limit instead of pfvf->flags to avoid races with the mbox up-handler. Handle tc qdisc replace viaTC_ROOT_GRAFT: skip teardown of the replaced qdisc after the new configuration is programmed. Clear all MDQ shapers before applying a new mapping so queues removed from the TC layout do not keep stale limits. Cache per-queue rates and restore them across routine netdev stop/open in otx2_mqprio_up().
---
v8 -> v9: Addressed Sashiko comments
https://lore.kernel.org/netdev/aoJ6FhtWue0FHDQV@rkannoth-OptiPlex-7090/
v7 -> v8: Addressed Sashiko comments
https://sashiko.dev/#/patchset/20260811085050.3212280-1-rkannoth%40marvell.com v6 -> v7: Addressed Sashiko comments https://sashiko.dev/#/message/20260810034738.1786029-1-rkannoth%40marvell.com v5 -> v6: Addressed Sashiko comments https://lore.kernel.org/netdev/[email protected]/ v4 -> v5: Addressed sashiko comments https://sashiko.dev/#/patchset/20260803042724.3380209-1-rkannoth%40marvell.com v3 -> v4: Addressed sashiko comments https://lore.kernel.org/netdev/[email protected]/ v2 -> v3: Addressed sashiko comments https://lore.kernel.org/netdev/amnYX866mYx02cBe@rkannoth-OptiPlex-7090/T/#m67310cbec48b21c7720858ab3a1ea083a0f8dc10 v1 -> v2: Addressed sashiko comments https://lore.kernel.org/netdev/[email protected]/ --- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 6 +- .../marvell/octeontx2/nic/otx2_common.c | 154 ++++- .../marvell/octeontx2/nic/otx2_common.h | 16 + .../marvell/octeontx2/nic/otx2_dcbnl.c | 6 + .../marvell/octeontx2/nic/otx2_ethtool.c | 8 + .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 17 + .../ethernet/marvell/octeontx2/nic/otx2_tc.c | 604 ++++++++++++++++++ .../net/ethernet/marvell/octeontx2/nic/qos.c | 15 + .../net/ethernet/marvell/octeontx2/nic/qos.h | 1 + 9 files changed, 825 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +5 -1
@@ -331,8 +331,12 @@ static bool is_valid_txschq(struct rvu *rvu, int blkaddr,return true; } -if (map_func != pcifunc) +if (map_func != pcifunc) { +dev_err_ratelimited (rvu->dev, +"pcifunc %x map pcifunc %x not equal, lvl=%u schq=%u\n" , + pcifunc, map_func, lvl, schq);return false; + }return true; }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +153 -1
172 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +16 -0
@@ -483,6 +483,13 @@ struct pf_irq_data {int mdevs; }; +struct otx2_mqprio { +u32 flags; +u64 *min_rate; +u64 *max_rate; +bool rate_limit; +}; +struct otx2_nic {void __iomem *reg_base;struct net_device *netdev;
@@ -515,6 +522,10 @@ struct otx2_nic {u64 flags;u64 *cq_op_addr; +struct otx2_mqprio mqprio; +bool mqprio_replace_pending; +bool mqprio_skip_teardown; +struct bpf_prog *xdp_prog;struct otx2_qset qset;struct otx2_hw hw;
@@ -1246,6 +1257,11 @@ dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf, struct sk_buff *skb, int seg, int *len);void otx2_dma_unmap_skb_frags (struct otx2_nic *pfvf,struct sg_list *sg);int otx2_read_free_sqe (struct otx2_nic *pfvf,u16 qidx); +int otx2_nix_tm_set_queue_shaper (struct otx2_nic *pfvf,int txq, +u64 minrate,u64 maxrate); +int otx2_nix_tm_clear_queue_shaper (struct otx2_nic *pfvf); +int otx2_mqprio_down (struct otx2_nic *pfvf); +int otx2_mqprio_up (struct otx2_nic *pfvf);void otx2_queue_vf_work (struct mbox *mw,struct workqueue_struct *mbox_wq,int first,int mdevs,u64 intr); int otx2_del_mcam_flow_entry(struct otx2_nic *nic, u16 entry,
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c +6 -0
@@ -413,6 +413,12 @@ static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc)u8 old_pfc_en;int err; +if (pfvf->mqprio.rate_limit && pfc->pfc_en) { +netdev_err (dev, +"PFC: cannot enable while mqprio bandwidth offload is active\n" ); +return -EOPNOTSUPP ; + } + old_pfc_en = pfvf->pfc_en; pfvf->pfc_en = pfc->pfc_en;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +8 -0
@@ -287,6 +287,14 @@ static int otx2_set_channels(struct net_device *dev,return -EINVAL ; } +if (pfvf->mqprio.rate_limit && + (channel->tx_count != pfvf->hw.tx_queues || + channel->rx_count != pfvf->hw.rx_queues)) { +netdev_info (dev, +"Not permitted to change channel count while MQ prio is active\n" ); +return -EINVAL ; + } +if (if_up) dev->netdev_ops->ndo_stop (dev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +17 -0
@@ -1980,6 +1980,16 @@ int otx2_open(struct net_device *netdev)if (err) goto err_free_mem; +/* TODO: otx2_mqprio_up() failure here aborts the entire ndo_open() +* path even though mqprio_rate_limit and the rate cache remain set. +* Routine ip link set up or driver reset with active mqprio offload +* can leave the interface stuck down until the qdisc is removed and +* reapplied. +*/ + err =otx2_mqprio_up (pf); +if (err) + goto err_free_hw; +/* Register NAPI handler */ for (qidx =0 ; qidx < pf->hw.cint_cnt; qidx++) { cq_poll = &qset->napi[qidx];
@@ -2140,6 +2150,7 @@ int otx2_open(struct net_device *netdev)free_irq (vec, pf); err_disable_napi:otx2_disable_napi (pf); +err_free_hw:otx2_free_hw_resources (pf); err_free_mem:otx2_free_queue_mem (qset);
@@ -2846,6 +2857,12 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog)bool if_up =netif_running (pf->netdev);struct bpf_prog *old_prog; +if (prog && pf->mqprio.rate_limit) { +netdev_err (dev, +"XDP: cannot attach while mqprio bandwidth offload is active\n" ); +return -EOPNOTSUPP ; + } +if (prog && dev->mtu >MAX_XDP_MTU ) {netdev_warn (dev,"Jumbo frames not yet supported with XDP\n" );return -EOPNOTSUPP ;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +604 -0
636 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/qos.c +15 -0
@@ -118,6 +118,9 @@ static void otx2_config_sched_shaping(struct otx2_nic *pfvf,/* configure PIR */ maxrate = (node->rate > node->ceil) ? node->rate : node->ceil; +/* 65536 is the kernel-side default burst when HTB does not supply an +* explicit value, not the NIX hardware maximum (CN10K_MAX_BURST_SIZE). +*/ cfg->regval[*num_regs] =otx2_get_txschq_rate_regval (pfvf, maxrate,65536 ); (*num_regs)++;
@@ -1729,11 +1732,23 @@ void otx2_qos_config_txschq(struct otx2_nic *pfvf)otx2_qos_root_destroy (pfvf); } +bool otx2_qos_htb_active (struct otx2_nic *pfvf) +{ +return otx2_sw_node_find (pfvf,OTX2_QOS_ROOT_CLASSID ); +} +int otx2_setup_tc_htb (struct net_device *ndev,struct tc_htb_qopt_offload *htb) {struct otx2_nic *pfvf =netdev_priv (ndev);int res; +if (pfvf->mqprio.rate_limit && + htb->command !=TC_HTB_DESTROY ) { +NL_SET_ERR_MSG_MOD (htb->extack, +"HTB offload cannot be used with mqprio bandwidth offload active" ); +return -EOPNOTSUPP ; + } +switch (htb->command) {case TC_HTB_CREATE : return otx2_qos_root_add(pfvf, htb->parent_classid,
drivers/net/ethernet/marvell/octeontx2/nic/qos.h +1 -0
@@ -23,6 +23,7 @@ enum qos_smq_operations {u64 otx2_get_txschq_rate_regval (struct otx2_nic *nic,u64 maxrate,u32 burst);int otx2_setup_tc_htb (struct net_device *ndev,struct tc_htb_qopt_offload *htb); +bool otx2_qos_htb_active (struct otx2_nic *pfvf);int otx2_qos_get_qid (struct otx2_nic *pfvf);void otx2_qos_free_qid (struct otx2_nic *pfvf,int qidx);int otx2_qos_enable_sq (struct otx2_nic *pfvf,int qidx);
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerQuoted 1 line · On Mon, 17 Aug 2026 08:57:47 +0530 Ratheesh Kannoth wrote:
Subject: [PATCH v9 net-next] octeontx2-pf: add mqprio bandwidth offload for NIX TX schedulers
## Form letter - net-next-closed
The merge window for v7.3 has started, and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We will only consider applying net-next patches which were posted before the announcement:
https://lore.kernel.org/[email protected]
Fixes are obviously welcome at any time. net-next patches may be sent for review and discussion only with an RFC tag.
Please repost when net-next reopens.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
Signature · 2 lines
pw-bot: defer pv-bot: closed
Ratheesh Kannoth
maintainerQuoted 10 lines · Jakub Kicinski
Quoted 1 line · On Mon, 17 Aug 2026 08:57:47 +0530 Ratheesh Kannoth wrote:
Subject: [PATCH v9 net-next] octeontx2-pf: add mqprio bandwidth offload for NIX TX schedulers
## Form letter - net-next-closed
The merge window for v7.3 has started, and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We will only consider applying net-next patches which were posted before the announcement:
Quoted 8 lines
https://lore.kernel.org/[email protected]
Fixes are obviously welcome at any time. net-next patches may be sent for review and discussion only with an RFC tag.
Please repost when net-next reopens.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
Jakub,
Will do. Thanks.
Resolving these pre-existing and error-handling issues from sashiko (see below table) will require additional time and refactoring. I've added temporary TODO comments and debug messages to track them.
If acceptable, we would prefer to re-submit v9 and a follow up patchset to address these fully post-merge of this patch. Please let me know if this approach acceptable you.
+-----+------------------+-----------------------+------------------------+------------------------+
| # | Location | Issue | Impact | TODO / user warn/debug |
+-----+------------------+-----------------------+------------------------+------------------------+
| 1 | otx2_common.c — | Stale | MQPRIO transmit queues | TODO: yes (lines |
| | otx2_txschq_conf | NIX_AF_TL4X_TOPOLOGY | may be unexpectedly | 790–797). User |
| | ig() | from HTB teardown is | starved until topology | message: no — no |
| | | not reset; MQPRIO | is reprogrammed or HTB | netdev_warn/err/debug |
| | | parents all MDQs | teardown restores | when stale TL4 |
| | | under TL4[0], which | defaults. | topology may starve |
| | | may retain HTB | | queues. |
| | | RR_PRIO/PRIO_ANCHOR | | {pre-existing issue) |
| | | settings. | | |
+-----+------------------+-----------------------+------------------------+------------------------+
| 2 | otx2_pf.c — | If otx2_mqprio_up() | Subsequent ip link set | TODO: yes (lines |
| | otx2_open() / | fails during | up or driver reset | 1983–1987). User |
| | otx2_mqprio_up() | ndo_open(), the | retries | message: partial — |
| | | driver aborts open | otx2_mqprio_up() | otx2_mqprio_up() logs |
| | | and tears down HW but | blindly; interface | netdev_err per failed |
| | | does not clear | stays administratively | txq shaper restore; no |
| | | mqprio.rate_limit or | down until the qdisc | message that |
| | | the rate caches. | is removed and | rate_limit/cache |
| | | | reapplied. | remain set or that the |
| | | | | interface may stay |
| | | | | stuck down. |
+-----+------------------+-----------------------+------------------------+------------------------+
| 3 | otx2_tc.c — otx2 | otx2_mqprio_clear_sw( | Software reports | TODO: yes (lines |
| | _mqprio_down() | ) runs | offload inactive while | 1684–1688). User |
| | | unconditionally even | some queues retain | message: yes — |
| | | when otx2_nix_tm_clea | programmed CIR/PIR — | netdev_err when |
| | | r_queue_shaper() | silent, persistent | clear_queue_shaper |
| | | fails partway through | rate limiting; later | fails, noting some TX |
| | | the MDQ batch. | mqprio_up() may shape | queues may retain |
| | | | with wrong effective | bandwidth limits. |
| | | | rates. | |
+-----+------------------+-----------------------+------------------------+------------------------+
| 4 | otx2_tc.c — otx2 | After ndo_open() | Driver sends mailbox | TODO: no (for this |
| | _mqprio_restart_ | fails, otx2_free_hw_r | messages to clear | path; separate TODO at |
| | netdev() error | esources() frees TX | shapers on freed | line 1749 covers live |
| | path | schedulers but | queues; AF rejects | reprogramming only). |
| | | otx2_mqprio_down() | them, causing spurious | User message: partial |
| | | still runs because | firmware errors. | — netdev_err on |
| | | netif_running() | | restart failure and on |
| | | remains true | | otx2_mqprio_down() |
| | | (dev_close skipped). | | failure after restart; |
| | | | | no message about |
| | | | | clearing shapers on |
| | | | | already-freed |
| | | | | scheduler queues. |
+-----+------------------+-----------------------+------------------------+------------------------+
| 5 | otx2_tc.c — otx2 | On failed tc qdisc | Kernel keeps old qdisc | TODO: yes (lines |
| | _setup_tc_mqprio | replace, otx2_mqprio_ | but driver uses new or | 1626–1629, 1900–1903, |
| | () cleanup / otx | alloc_cache() already | zeroed config — state | 2088–2095). User |
| | 2_teardown_tc_mq | freed the old rate | desynchronization and | message: yes — otx2_mq |
| | prio() | cache; cleanup sets | incorrect bandwidth | prio_replace_failed_ms |
| | | qopt->hw = 0 and | shaping. | g() netdev_err + |
| | | skips HW/cache | | NL_SET_ERR_MSG_MOD; ot |
| | | rollback. Similar | | x2_mqprio_pre_graft_re |
| | | bypass when mqprio_re | | ject_msg() netdev_err |
| | | place_pending is true | | on related reject |
| | | in teardown. | | path. |
+-----+------------------+-----------------------+------------------------+------------------------+Jakub Kicinski
maintainerQuoted 6 lines · On Wed, 19 Aug 2026 08:17:53 +0530 Ratheesh Kannoth wrote:
Resolving these pre-existing and error-handling issues from sashiko (see below table) will require additional time and refactoring. I've added temporary TODO comments and debug messages to track them.
If acceptable, we would prefer to re-submit v9 and a follow up patchset to address these fully post-merge of this patch. Please let me know if this approach acceptable you.
Fix the bugs first, please.
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
New issues:
- [High] tc qdisc replace operations result in irretrievable state desynchronization and data loss on failure or kernel rejection.
- [High] otx2_mqprio_down drops software state unconditionally, causing state desynchronization if clearing hardware shapers fails.
- [High] Network interface becomes permanently unusable if otx2_mqprio_up fails during otx2_open.
- [Medium] Error path in otx2_mqprio_restart_netdev attempts to configure hardware shaping on freed TX scheduler queues.
Pre-existing issues:
- [High] Stale TL4 topology from HTB teardown persists and can silently starve MQPRIO transmit queues. --
--- Patch [1]: [PATCH v9 net-next] octeontx2-pf: add mqprio bandwidth offload for NIX TX schedulers --- commit 21ed8a8824a04ea734aff8a63ea014ef8f15499f
Author: Ratheesh Kannoth <[email protected]>
Subject: octeontx2-pf: add mqprio bandwidth offload for NIX TX schedulers
This commit adds TC_SETUP_QDISC_MQPRIO handling for channel-mode mqprio with TC_MQPRIO_SHAPER_BW_RATE. It enables offloading programs for per-transmit-queue MDQ CIR/PIR shapers on non-QoS queues.
Quoted 3 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +0
-0
[ ... ]
Quoted 7 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3
-1@@ -786,7 +786,20 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool txschq_for req->num_regs++;/* MDQ config */ - parent = schq_list[NIX_TXSCH_LVL_TL4 ][prio]; +if (pfvf->mqprio.rate_limit) { +/* TODO: Not an mqprio bug - stale TL4 topology is left when +* HTB is torn down without clearing NIX_AF_TL4X_TOPOLOGY;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool txschq_for · line 800
Quoted 10 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +10
-0+* the AF does not reset it on schq realloc. MQPRIO parents +* every MDQ under TL4[0] with schedule priority 0, so a +* reused TL4 can retain HTB RR_PRIO/PRIO_ANCHOR and starve +* some TX queues until topology is reprogrammed here or HTB +* teardown is fixed to restore defaults. +*/ + parent = schq_list[NIX_TXSCH_LVL_TL4 ][0 ]; + }else { + parent = schq_list[NIX_TXSCH_LVL_TL4 ][prio]; + }
[Severity: High]
This isn't a bug introduced by this patch, but does reusing the TL4 node here without clearing the stale NIX_AF_TL4X_TOPOLOGY configuration left behind by HTB cause MQPRIO transmit queues to be unexpectedly starved?
When the HTB qdisc offload is torn down, the driver fails to reset the NIX_AF_TL4X_TOPOLOGY register. If MQPRIO is subsequently enabled, it explicitly parents all its MDQs under TL4[0]. Since TL4[0] was not reset, it retains the stale RR_PRIO or PRIO_ANCHOR settings from HTB, which could incorrectly affect the newly attached MQPRIO queues.
[ ... ]
Quoted 3 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +0
-0
[ ... ]
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c int otx2_open(struct net_device *netdev) · line 1991
Quoted 13 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +9
-0@@ -1980,6 +1980,16 @@ int otx2_open(struct net_device *netdev)if (err) goto err_free_mem; +/* TODO: otx2_mqprio_up() failure here aborts the entire ndo_open() +* path even though mqprio_rate_limit and the rate cache remain set. +* Routine ip link set up or driver reset with active mqprio offload +* can leave the interface stuck down until the qdisc is removed and +* reapplied. +*/ + err =otx2_mqprio_up (pf); +if (err) + goto err_free_hw;
[Severity: High]
Does a failure here leave the network interface permanently unusable?
If otx2_mqprio_up() encounters an error during otx2_open(), the driver aborts the interface open and tears down hardware resources via err_free_hw. However, it fails to clear pfvf->mqprio.rate_limit and the rate caches.
Any subsequent attempts to bring the interface up will blindly call otx2_mqprio_up() again, leaving the interface stuck in an administratively down state until the qdisc is manually removed.
[ ... ]
Quoted 3 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +0
-0
[ ... ]
Quoted 16 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +16
-0+int otx2_mqprio_down (struct otx2_nic *pfvf) +{ +int err =0 ; + +if (!pfvf->mqprio.rate_limit) +return 0 ; + +if (netif_running (pfvf->netdev) && +otx2_mqprio_mdq_allocated (pfvf)) + err =otx2_nix_tm_clear_queue_shaper (pfvf); + +if (err) +netdev_err (pfvf->netdev, +"mqprio: failed to clear hardware shapers: %d; some TX queues may retain bandwidth limits\n" , + err); +
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c static int otx2_setup_tc_block(struct net_device *netdev, · line 1693
Quoted 10 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +10
-0+/* TODO: mqprio_down() clears mqprio_rate_limit, netdev TC mappings, +* and the rate cache even when otx2_nix_tm_clear_queue_shaper() fails +* partway through the MDQ batch. Software then reports offload as +* inactive while some queues may retain programmed CIR/PIR, so a later +* mqprio_up() or re-setup can shape with the wrong effective rates. +*/ +otx2_mqprio_clear_sw (pfvf); + +return err; +}
[Severity: High]
Can clearing the software state unconditionally here lead to silent, persistent rate limiting if clearing the hardware shapers fails?
If a user deletes the MQPRIO qdisc or an error triggers otx2_mqprio_down(), and the hardware mailbox communication fails in otx2_nix_tm_clear_queue_shaper(), the function logs an error but still calls otx2_mqprio_clear_sw().
This completely wipes the driver's software state, making it impossible to clear the hardware limits in subsequent operations while the hardware shapers remain active.
[ ... ]
Quoted 2 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +2
-0+static int otx2_mqprio_restart_netdev (struct net_device *netdev,bool rate_limit) +{
[ ... ]
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c static int otx2_setup_tc_block(struct net_device *netdev, · line 1770
Quoted 8 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +8
-0+ err = ops->ndo_open (netdev); +if (err) { +int down_err; + +netdev_err (netdev, +"Failed to restart device after mqprio change: %d\n" , + err); + down_err =otx2_mqprio_down (pfvf);
[Severity: Medium]
Does this error path attempt to configure hardware shaping on freed TX scheduler queues?
If ops->ndo_open() fails, the error path executes otx2_free_hw_resources(), which frees the TX schedulers. It then calls otx2_mqprio_down() here, which sees netif_running() as true (because dev_close was skipped) and attempts to send mailbox messages to clear the shapers on the now-freed queues. The AF rejects these messages, resulting in spurious firmware errors.
[ ... ]
Quoted 3 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +3
-0+static int otx2_setup_tc_mqprio (struct net_device *netdev, +struct tc_mqprio_qopt_offload *mqprio) +{
[ ... ]
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c static int otx2_setup_tc_block(struct net_device *netdev, · line 2165
Quoted 11 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +11
-0+cleanup: +/* Clear hardware offload on this rejected request so a failed replace +* does not leave tc reporting offload for driver state that was torn +* down while the previous mqprio remains grafted. +*/ + qopt->hw =0 ; +if (replacing) { +otx2_mqprio_replace_failed_msg (netdev, extack); + pfvf->mqprio_replace_pending = false; +return err ? err : -EIO ; + }
[Severity: High]
Does this cleanup path fail to roll back hardware and software state to the old qdisc's configuration if a tc qdisc replace operation fails?
During a qdisc replace, otx2_mqprio_alloc_cache() is called earlier which immediately frees the old rate cache. If hardware programming fails, or if the kernel later rejects the qdisc before grafting, this cleanup path explicitly skips hardware and cache rollback.
The kernel retains the old qdisc, but the driver uses the new configuration or zeroes, leading to state desynchronization and incorrect bandwidth shaping. A similar bypass happens in otx2_teardown_tc_mqprio() when pfvf->mqprio_replace_pending is true, leaving the rejected config active.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1