Skip to contentSkip to conversation

net/ice: add per-queue Tx rate limit support

PATCH Superseded Anurag Mandal 2 participants 7 messages Sep 10 – Sep 18 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: add per-queue Tx rate limit support

The Tx rate can be limited per queue with
ethdev operation ``rte_eth_set_queue_rate_limit()`` and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

---
 doc/guides/nics/features/ice.ini       |  1 +
 doc/guides/rel_notes/release_26_11.rst |  3 +
 drivers/net/intel/ice/ice_ethdev.c     | 77 ++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)
doc/guides/nics/features/ice.ini +1 -0
index 893d09e9ec..6b21d56144 100644
@@ -30,6 +30,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 VLAN filter          = Y
+Rate limitation      = Y
 Traffic manager      = Y
 CRC offload          = Y
 VLAN offload         = Y
doc/guides/rel_notes/release_26_11.rst +3 -0
index 907f9013ff..1567f93563 100644
@@ -64,6 +64,9 @@ New Features
   * Renamed the ``enable_ptype_lldp`` devarg to ``enable_lldp``.
     The old name is no longer accepted.
 
+* **Updated Intel ice driver.**
+
+  * Added support for Tx rate limiting per queue.
 
 Removed Items
 -------------
drivers/net/intel/ice/ice_ethdev.c +77 -0

95 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Quoted 22 lines · Anurag Mandal

The Tx rate can be limited per queue with
ethdev operation ``rte_eth_set_queue_rate_limit()`` and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

Quoted 7 lines
---
 doc/guides/nics/features/ice.ini       |  1 +
 doc/guides/rel_notes/release_26_11.rst |  3 +
 drivers/net/intel/ice/ice_ethdev.c     | 77 ++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)

Is this functionality not overlapping with what the rte_rm APIs provide for ice? Using the rte_rm hierarchies, it's possible to rate limit a queue, no?

/Bruce

#2 lore raw
Quoted 35 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: 10 September 2026 16:00
To: Mandal, Anurag <[email protected]>
Cc: [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [PATCH] net/ice: add per-queue Tx rate limit support

Quoted 20 lines · Anurag Mandal

The Tx rate can be limited per queue with ethdev operation ``rte_eth_set_queue_rate_limit()``
and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

Quoted 7 lines
---
 doc/guides/nics/features/ice.ini       |  1 +
 doc/guides/rel_notes/release_26_11.rst |  3 +
 drivers/net/intel/ice/ice_ethdev.c     | 77 ++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)
Quoted 4 lines

Is this functionality not overlapping with what the rte_rm APIs provide for ice? Using the rte_rm hierarchies, it's possible to rate limit a queue, no?

/Bruce

Hi Bruce,

I am guessing you meant rte_tm APIs instead of rte_rm.
Yes, the two paths ultimately program the same hardware field.
But, there are few reasons I still think the ethdev op is worth having:
1. rte_tm commit bounces the port. This does not.
So adjusting one queue's rate through rte_tm drops traffic on every queue and bounces the link.
2. VSI subtree is rebuilt for rte_tm :
a. Stop the port if running
b. Walk the VSI root up or down to the new layer, freeing sibling subtrees c. free_sched_node_recursive() - tear down the existing scheduler subtree d. create_sched_node_recursive() - rebuild it, ice_sched_add_elems() per node e. Recompute pf->main_vsi->nb_qps, then ice_alloc_lan_q_ctx() to resize queue contexts f. Restart the port
3. ixgbe & txgbe pmds also implement both.

Thanks,
Anurag M

#3 lore raw
Quoted 42 lines · Anurag
Quoted 35 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: 10 September 2026 16:00
To: Mandal, Anurag <[email protected]>
Cc: [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [PATCH] net/ice: add per-queue Tx rate limit support

Quoted 20 lines · Anurag Mandal

The Tx rate can be limited per queue with ethdev operation ``rte_eth_set_queue_rate_limit()``
and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

Quoted 7 lines
---
 doc/guides/nics/features/ice.ini       |  1 +
 doc/guides/rel_notes/release_26_11.rst |  3 +
 drivers/net/intel/ice/ice_ethdev.c     | 77 ++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)
Quoted 4 lines

Is this functionality not overlapping with what the rte_rm APIs provide for ice? Using the rte_rm hierarchies, it's possible to rate limit a queue, no?

/Bruce

Hi Bruce,

Quoted 14 lines

I am guessing you meant rte_tm APIs instead of rte_rm.
Yes, the two paths ultimately program the same hardware field.
But, there are few reasons I still think the ethdev op is worth having:
1. rte_tm commit bounces the port. This does not.
So adjusting one queue's rate through rte_tm drops traffic on every queue and bounces the link.
2. VSI subtree is rebuilt for rte_tm :
a. Stop the port if running
b. Walk the VSI root up or down to the new layer, freeing sibling subtrees c. free_sched_node_recursive() - tear down the existing scheduler subtree d. create_sched_node_recursive() - rebuild it, ice_sched_add_elems() per node e. Recompute pf->main_vsi->nb_qps, then ice_alloc_lan_q_ctx() to resize queue contexts f. Restart the port
3. ixgbe & txgbe pmds also implement both.

Yes, your logic makes sense.

However, one final concern, it appears that this feature doesn't interact in any way with the rte_tm one. Therefore, if a user configures a full hierarchy using rte_tm, and then uses this new API to tweak the Tx rates on queues, we could see problems later, e.g. losing all adjustments on apply of a slightly different hierarchy etc.

If the two features don't interact well, we may need to put in place some form of locking to ensure that you can't use one when you use the other. What do you think?

/Bruce

#4 lore raw
Quoted 79 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: 15 September 2026 22:43
To: Mandal, Anurag <[email protected]>
Cc: [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [PATCH] net/ice: add per-queue Tx rate limit support

Quoted 28 lines · Anurag
Quoted 28 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: 10 September 2026 16:00
To: Mandal, Anurag <[email protected]>
Cc: [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [PATCH] net/ice: add per-queue Tx rate limit support

Quoted 20 lines · Anurag Mandal

The Tx rate can be limited per queue with ethdev operation ``rte_eth_set_queue_rate_limit()``
and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 doc/guides/nics/features/ice.ini       |  1 +
 doc/guides/rel_notes/release_26_11.rst |  3 +
 drivers/net/intel/ice/ice_ethdev.c     | 77

++++++++++++++++++++++++++

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
 3 files changed, 81 insertions(+)

Is this functionality not overlapping with what the rte_rm APIs provide for ice? Using the rte_rm hierarchies, it's possible to rate limit a

queue, no?

Quoted 10 lines
Quoted 2 lines

/Bruce

Hi Bruce,

I am guessing you meant rte_tm APIs instead of rte_rm.
Yes, the two paths ultimately program the same hardware field. But, there are few reasons I still think the ethdev op is worth having:
1. rte_tm commit bounces the port. This does not.
So adjusting one queue's rate through rte_tm drops traffic on every queue

and bounces the link.

Quoted 3 lines

2. VSI subtree is rebuilt for rte_tm :
a. Stop the port if running
b. Walk the VSI root up or down to the new layer, freeing sibling

subtrees

Quoted 1 line

c. free_sched_node_recursive() - tear down the existing scheduler

subtree

Quoted 1 line

d. create_sched_node_recursive() - rebuild it, ice_sched_add_elems()

per node

Quoted 1 line
	e. Recompute pf->main_vsi->nb_qps, then ice_alloc_lan_q_ctx() to

resize queue contexts

Quoted 3 lines

f. Restart the port
3. ixgbe & txgbe pmds also implement both.

Yes, your logic makes sense.

However, one final concern, it appears that this feature doesn't interact in any way with the rte_tm one. Therefore, if a user configures a full hierarchy using rte_tm, and then uses this new API to tweak the Tx rates on queues, we could see problems later, e.g. losing all adjustments on apply of a slightly different hierarchy etc.

Quoted 5 lines

If the two features don't interact well, we may need to put in place some form of locking to ensure that you can't use one when you use the other. What do you think?

/Bruce

Hi Bruce,

Thank you for the review as well as feedback.
I have addressed them in v2.
Kindly check.

Thank you.

Regards,
Anurag M

#5 lore raw

PATCH v2 1/1 net/ice: add per-queue Tx rate limit support

In reply to Anurag Mandal

The Tx rate can be limited per queue with
ethdev operation ``rte_eth_set_queue_rate_limit()`` and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue or bouncing the port.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

This interface and the Traffic Management API are mutually exclusive.

---
V2: Addressed Bruce Richardson's feedback
- The per-queue Tx rate limit and Traffic Management APIs are mutually exclusive.

 doc/guides/nics/features/ice.ini       |   1 +
 doc/guides/nics/ice.rst                |  26 +++++++
 doc/guides/rel_notes/release_26_11.rst |   2 +
 drivers/net/intel/ice/ice_ethdev.c     | 100 +++++++++++++++++++++++++
 drivers/net/intel/ice/ice_ethdev.h     |   2 +
 drivers/net/intel/ice/ice_tm.c         |  14 ++++
 6 files changed, 145 insertions(+)
doc/guides/nics/features/ice.ini +1 -0
index 589916b2c1..2bf1b2a42d 100644
@@ -30,6 +30,7 @@ RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
 VLAN filter          = Y
+Rate limitation      = Y
 Traffic manager      = Y
 CRC offload          = Y
 VLAN offload         = Y
doc/guides/nics/ice.rst +26 -0
index bdb3d61c23..bfb67a2cd3 100644
@@ -925,6 +925,32 @@ Additional Options
       192.168.0.2', dst="192.168.0.3")/TCP(flags='S')/Raw(load='XXXXXXXXXX'), \
       iface="enp24s0f0", count=10)
 
+Per-Queue Tx Rate Limiting
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The maximum Tx rate of an individual queue can be capped using
+``rte_eth_set_queue_rate_limit()``, and read back using
+``rte_eth_get_queue_rate_limit()``.
+The rate is given in Mbps, and a rate of 0 removes the limit.
+
+The limit is applied to the queue's node in the Tx scheduler tree,
+which only exists while the queue is running,
+so the queue must be started before its rate can be set,
+and a configured rate is lost when the queue is stopped.
+
+This interface and the Traffic Management API are mutually exclusive,
+because both configure the bandwidth of the same scheduler nodes:
+
+* setting a queue rate limit fails while a Traffic Management
+  hierarchy is committed;
+
+* committing a Traffic Management hierarchy fails while any queue has
+  a rate limit set through ``rte_eth_set_queue_rate_limit()``.
+
+To switch from one to the other, clear the existing configuration first,
+either by setting the rate of each limited queue back to 0,
+or by deleting the Traffic Management hierarchy.
+
 Sample Application Notes
 ------------------------
 
doc/guides/rel_notes/release_26_11.rst +2 -0
index e725933fa7..19365fd0f2 100644
@@ -75,6 +75,8 @@ New Features
     paths, enabling QinQ tag insertion and outer IPv4/UDP checksum
     offloads on those paths.
 
+  * Added support for Tx rate limiting per queue.
+
 
 Removed Items
 -------------
drivers/net/intel/ice/ice_ethdev.c +100 -0

118 lines not on this page · raw message

drivers/net/intel/ice/ice_ethdev.h +2 -0
index 3cfd7afbae..e39757e842 100644
@@ -832,4 +832,6 @@ int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
 int
 ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32_t node_teid);
 
+uint32_t ice_txq_rate_limit_kbps(struct ice_pf *pf, uint16_t queue_idx);
+
 #endif /* _ICE_ETHDEV_H_ */
drivers/net/intel/ice/ice_tm.c +14 -0
index d93704dd3f..9566a36098 100644
@@ -903,8 +903,22 @@ ice_hierarchy_commit(struct rte_eth_dev *dev,
 				 int clear_on_fail,
 				 struct rte_tm_error *error)
 {
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	bool restart = false;
 
+	/*
+	 * A commit reapplies the bandwidth of every node, which would silently
+	 * discard any rate set through rte_eth_set_queue_rate_limit().
+	 */
+	for (uint16_t i = 0; i < dev->data->nb_tx_queues; i++) {
+		if (ice_txq_rate_limit_kbps(pf, i) != 0) {
+			error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
+			error->message =
+				"queue rate limit already set via rte_eth_set_queue_rate_limit";
+			return -EBUSY;
+		}
+	}
+
 	/* commit should only be done to topology before start
 	 * If port is already started, stop it and then restart when done.
 	 */
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#6 lore raw
Quoted 23 lines · Anurag Mandal

The Tx rate can be limited per queue with
ethdev operation ``rte_eth_set_queue_rate_limit()`` and can be read through ``rte_eth_get_queue_rate_limit()``.

This feature uses the hardware packet pacing mechanism to enforce a data rate on individual Tx queues without tearing down the queue or bouncing the port.

The rate is specified in Mbps.

ice_set_queue_rate_limit() applies the requested rate as the EIR (maximum bandwidth) limit of the queue scheduler node using ice_cfg_q_bw_lmt(), converting the Mbps value taken by the API to the Kbps expected by the scheduler.
A rate of 0 removes the limit and restores the default bandwidth via ice_cfg_q_bw_dflt_lmt().

ice_get_queue_rate_limit() reads back the value cached in the queue context by the scheduler on a successful set, and reports 0 when the queue runs unlimited.

Quoted 8 lines

This interface and the Traffic Management API are mutually exclusive.

---
V2: Addressed Bruce Richardson's feedback
- The per-queue Tx rate limit and Traffic Management APIs are mutually exclusive.

Patch applied to dpdk-next-net-intel.
Thanks,
/Bruce