DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zaiyu Wang <zaiyuwang@trustnetic.com>
To: dev@dpdk.org
Cc: Zaiyu Wang <zaiyuwang@trustnetic.com>,
	stable@dpdk.org, Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH v6 05/21] net/txgbe: fix inaccuracy in Tx rate limiting
Date: Tue, 16 Jun 2026 20:20:13 +0800	[thread overview]
Message-ID: <20260616122030.9688-6-zaiyuwang@trustnetic.com> (raw)
In-Reply-To: <20260616122030.9688-1-zaiyuwang@trustnetic.com>

Amber-lite NIC's TX rate limiting has large deviations for small
packets. To address this, the following changes are made:

1. Set TDM_RL_ADJ (0x1820c) to 21B (includes 7B Ethernet preamble,
   1B SFD, 1B EFD, and 12B IPG).
2) Remove the rate offset in the driver (e.g., 105 / 100, a rough
   compensation value from Linux kernel driver tests).

After these changes, accuracy deviation for 64B packets is within
~5%, while large packets show lower deviation.

Fixes: a309ab43acf3 ("net/txgbe: support Tx queue rate limiting for Amber-Lite")
Cc: stable@dpdk.org

Signed-off-by: Zaiyu Wang <zaiyuwang@trustnetic.com>
---
 drivers/net/txgbe/base/txgbe_regs.h | 3 +++
 drivers/net/txgbe/txgbe_ethdev.c    | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/txgbe/base/txgbe_regs.h b/drivers/net/txgbe/base/txgbe_regs.h
index 95c585a025..3d1bc88430 100644
--- a/drivers/net/txgbe/base/txgbe_regs.h
+++ b/drivers/net/txgbe/base/txgbe_regs.h
@@ -1670,6 +1670,9 @@ enum txgbe_5tuple_protocol {
 #define   TXGBE_TDM_FACTOR_INT_SHIFT    16
 #define   TXGBE_TDM_FACTOR_FRA_SHIFT    2
 
+#define TXGBE_TDM_RL_ADJ                0x1820C
+ /* Ethernet framing overhead: 7B Ethernet preamble + 1B SFD + 1B EFD + 12B IPG */
+#define   TXGBE_FRAME_OVERHEAD          21
 #define TXGBE_TDM_RL_VM_IDX             0x018218
 #define TXGBE_TDM_RL_VM_CFG             0x01821C
 #define TXGBE_TDM_RL_CFG                0x018400
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 779874aac9..099341b5ab 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -4314,7 +4314,6 @@ txgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
 			u16 frac;
 
 			link_speed = dev->data->dev_link.link_speed;
-			tx_rate  = tx_rate * 105 / 100;
 			/* Calculate the rate factor values to set */
 			factor_int = link_speed / tx_rate;
 			frac = (link_speed % tx_rate) * 10000 / tx_rate;
@@ -4324,6 +4323,7 @@ txgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
 				factor_fra = 0;
 			}
 
+			wr32(hw, TXGBE_TDM_RL_ADJ, TXGBE_FRAME_OVERHEAD);
 			wr32(hw, TXGBE_TDM_RL_QUEUE_IDX, queue_idx);
 			wr32m(hw, TXGBE_TDM_RL_QUEUE_CFG,
 			      TXGBE_TDM_FACTOR_INT_MASK, factor_int << TXGBE_TDM_FACTOR_INT_SHIFT);
-- 
2.21.0.windows.1


  parent reply	other threads:[~2026-06-16 12:21 UTC|newest]

Thread overview: 162+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23  3:40 [PATCH 00/18] Wangxun Fixes Zaiyu Wang
2026-04-23  3:40 ` [PATCH 01/18] net/txgbe: remove duplicate xstats counters Zaiyu Wang
2026-04-23  3:40 ` [PATCH 02/18] net/ngbe: " Zaiyu Wang
2026-04-23  3:40 ` [PATCH 03/18] net/ngbe: add missing CDR config for YT PHY Zaiyu Wang
2026-04-23  3:40 ` [PATCH 04/18] net/ngbe: fix VF promiscuous and allmulticast Zaiyu Wang
2026-04-23  3:40 ` [PATCH 05/18] net/txgbe: fix inaccuracy in TX rate limiting Zaiyu Wang
2026-04-23  3:40 ` [PATCH 06/18] net/txgbe: fix link status check condition Zaiyu Wang
2026-04-23  3:40 ` [PATCH 07/18] net/txgbe: fix Tx desc free logic Zaiyu Wang
2026-04-23  3:40 ` [PATCH 08/18] net/txgbe: fix link flow control registers for Amber-Lite Zaiyu Wang
2026-04-23  7:54   ` Jiawen Wu
2026-04-23  3:40 ` [PATCH 09/18] net/txgbe: fix link flow control config for Sapphire Zaiyu Wang
2026-04-23  3:40 ` [PATCH 10/18] net/txgbe: fix a mass of unknown interrupts Zaiyu Wang
2026-04-23  3:40 ` [PATCH 11/18] net/txgbe: fix traffic class priority configuration Zaiyu Wang
2026-04-23  3:40 ` [PATCH 12/18] net/txgbe: fix link stability for 25G NIC Zaiyu Wang
2026-04-23  8:22   ` Jiawen Wu
2026-04-23  3:40 ` [PATCH 13/18] net/txgbe: fix link stability for 40G NIC Zaiyu Wang
2026-04-23  3:40 ` [PATCH 14/18] net/txgbe: fix link stability for Amber-Lite backplane mode Zaiyu Wang
2026-04-23  3:40 ` [PATCH 15/18] net/txgbe: fix FEC mode configuration on 25G NIC Zaiyu Wang
2026-04-23  3:40 ` [PATCH 16/18] net/txgbe: fix SFP module identification Zaiyu Wang
2026-04-23  3:40 ` [PATCH 17/18] net/txgbe: fix get module info operation Zaiyu Wang
2026-04-23  3:40 ` [PATCH 18/18] net/txgbe: fix get eeprom operation Zaiyu Wang
2026-04-24 21:59   ` Stephen Hemminger
2026-04-29 10:24 ` [PATCH v2 00/20] Wangxun Fixes Zaiyu Wang
2026-04-29 10:24   ` [PATCH v2 01/20] net/txgbe: remove duplicate xstats counters Zaiyu Wang
2026-04-29 10:24   ` [PATCH v2 02/20] net/ngbe: " Zaiyu Wang
2026-04-29 10:24   ` [PATCH v2 03/20] net/ngbe: add missing CDR config for YT PHY Zaiyu Wang
2026-04-29 10:24   ` [PATCH v2 04/20] net/ngbe: fix VF promiscuous and allmulticast Zaiyu Wang
2026-04-29 10:24   ` [PATCH v2 05/20] net/txgbe: fix inaccuracy in TX rate limiting Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 06/20] net/txgbe: fix link status check condition Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 07/20] net/txgbe: fix Tx desc free logic Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 08/20] net/txgbe: fix link flow control registers for Amber-Lite Zaiyu Wang
2026-04-29 15:10     ` Stephen Hemminger
2026-04-29 10:25   ` [PATCH v2 09/20] net/txgbe: fix link flow control config for Sapphire Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 10/20] net/txgbe: fix a mass of unknown interrupts Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 11/20] net/txgbe: fix traffic class priority configuration Zaiyu Wang
2026-04-29 15:11     ` Stephen Hemminger
2026-05-09 11:06       ` Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 12/20] net/txgbe: fix link stability for 25G NIC Zaiyu Wang
2026-04-29 15:12     ` Stephen Hemminger
2026-04-29 10:25   ` [PATCH v2 13/20] net/txgbe: fix link stability for 40G NIC Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 14/20] net/txgbe: fix link stability for Amber-Lite backplane mode Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 15/20] net/txgbe: fix FEC mode configuration on 25G NIC Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 16/20] net/txgbe: fix SFP module identification Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 17/20] net/txgbe: fix get module info operation Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 18/20] net/txgbe: fix get eeprom operation Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 19/20] net/txgbe: fix to reset Tx write-back pointer Zaiyu Wang
2026-04-29 10:25   ` [PATCH v2 20/20] net/txgbe: fix to enable Tx desc check Zaiyu Wang
2026-05-09 11:28 ` [PATCH v3 00/20] Wangxun Fixes Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 01/20] net/txgbe: remove duplicate xstats counters Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 02/20] net/ngbe: " Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 03/20] net/ngbe: add missing CDR config for YT PHY Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 04/20] net/ngbe: fix VF promiscuous and allmulticast Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 05/20] net/txgbe: fix inaccuracy in TX rate limiting Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 06/20] net/txgbe: fix link status check condition Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 07/20] net/txgbe: fix Tx desc free logic Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 08/20] net/txgbe: fix link flow control registers for Amber-Lite Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 09/20] net/txgbe: fix link flow control config for Sapphire Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 10/20] net/txgbe: fix a mass of unknown interrupts Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 11/20] net/txgbe: fix traffic class priority configuration Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 12/20] net/txgbe: fix link stability for 25G NIC Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 13/20] net/txgbe: fix link stability for 40G NIC Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 14/20] net/txgbe: fix link stability for Amber-Lite backplane mode Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 15/20] net/txgbe: fix FEC mode configuration on 25G NIC Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 16/20] net/txgbe: fix SFP module identification Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 17/20] net/txgbe: fix get module info operation Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 18/20] net/txgbe: fix get eeprom operation Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 19/20] net/txgbe: fix to reset Tx write-back pointer Zaiyu Wang
2026-05-09 11:28   ` [PATCH v3 20/20] net/txgbe: fix to enable Tx desc check Zaiyu Wang
2026-05-09 15:44   ` [PATCH v3 00/20] Wangxun Fixes Stephen Hemminger
2026-05-09 17:07   ` Stephen Hemminger
2026-05-11 10:28     ` Zaiyu Wang
2026-05-11 10:35 ` [PATCH v4 " Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 01/20] net/txgbe: remove duplicate xstats counters Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 02/20] net/ngbe: " Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 03/20] net/ngbe: add missing CDR config for YT PHY Zaiyu Wang
2026-05-17 23:37     ` Stephen Hemminger
2026-05-27 11:06       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 04/20] net/ngbe: fix VF promiscuous and allmulticast Zaiyu Wang
2026-05-17 23:39     ` Stephen Hemminger
2026-05-27 11:09       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 05/20] net/txgbe: fix inaccuracy in Tx rate limiting Zaiyu Wang
2026-05-17 23:40     ` Stephen Hemminger
2026-05-27 11:07       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 06/20] net/txgbe: fix link status check condition Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 07/20] net/txgbe: fix Tx desc free logic Zaiyu Wang
2026-05-17 23:44     ` Stephen Hemminger
2026-05-27 11:06       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 08/20] net/txgbe: fix link flow control registers for Amber-Lite Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 09/20] net/txgbe: fix link flow control config for Sapphire Zaiyu Wang
2026-05-17 23:46     ` Stephen Hemminger
2026-05-27 11:11       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 10/20] net/txgbe: fix a mass of unknown interrupts Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 11/20] net/txgbe: fix traffic class priority configuration Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 12/20] net/txgbe: fix link stability for 25G NIC Zaiyu Wang
2026-05-17 23:49     ` Stephen Hemminger
2026-05-27 11:45       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 13/20] net/txgbe: fix link stability for 40G NIC Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 14/20] net/txgbe: fix link stability for Amber-Lite backplane mode Zaiyu Wang
2026-05-17 23:50     ` Stephen Hemminger
2026-05-27 11:45       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 15/20] net/txgbe: fix FEC mode configuration on 25G NIC Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 16/20] net/txgbe: fix SFP module identification Zaiyu Wang
2026-05-17 23:52     ` Stephen Hemminger
2026-05-27 11:21       ` Zaiyu Wang
2026-05-11 10:35   ` [PATCH v4 17/20] net/txgbe: fix get module info operation Zaiyu Wang
2026-05-17 23:53     ` Stephen Hemminger
2026-05-27 11:18       ` Zaiyu Wang
2026-05-11 10:36   ` [PATCH v4 18/20] net/txgbe: fix get EEPROM operation Zaiyu Wang
2026-05-17 23:54     ` Stephen Hemminger
2026-05-27 11:11       ` Zaiyu Wang
2026-05-11 10:36   ` [PATCH v4 19/20] net/txgbe: fix to reset Tx write-back pointer Zaiyu Wang
2026-05-11 10:36   ` [PATCH v4 20/20] net/txgbe: fix to enable Tx desc check Zaiyu Wang
2026-05-17 23:55     ` Stephen Hemminger
2026-05-27 11:14       ` Zaiyu Wang
2026-05-18 14:54   ` [PATCH v4 00/20] Wangxun Fixes Stephen Hemminger
2026-05-19  6:56     ` Zaiyu Wang
2026-05-27 13:02 ` [PATCH v5 00/21] " Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 01/21] net/txgbe: remove duplicate xstats counters Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 02/21] net/ngbe: " Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 03/21] net/ngbe: add missing CDR config for YT PHY Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 04/21] net/ngbe: fix VF promiscuous and allmulticast Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 05/21] net/txgbe: fix inaccuracy in Tx rate limiting Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 06/21] net/txgbe: fix link status check condition Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 07/21] net/txgbe: fix Tx desc free logic Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 08/21] net/txgbe: fix link flow control registers for Amber-Lite Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 09/21] net/txgbe: fix link flow control config for Sapphire Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 10/21] net/txgbe: fix a mass of unknown interrupts Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 11/21] net/txgbe: fix traffic class priority configuration Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 12/21] net/txgbe: fix link stability for 25G NIC Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 13/21] net/txgbe: fix link stability for 40G NIC Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 14/21] net/txgbe: fix link stability for Amber-Lite backplane mode Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 15/21] net/txgbe: fix FEC mode configuration on 25G NIC Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 16/21] net/txgbe: fix SFP module identification Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 17/21] net/txgbe: fix get module info operation Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 18/21] net/txgbe: fix get EEPROM operation Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 19/21] net/txgbe: fix to reset Tx write-back pointer Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 20/21] net/txgbe: fix to enable Tx desc check Zaiyu Wang
2026-05-27 13:02   ` [PATCH v5 21/21] net/txgbe: fix temperature track for AML NIC Zaiyu Wang
2026-05-27 15:22   ` [PATCH v5 00/21] Wangxun Fixes Stephen Hemminger
2026-06-16 12:16     ` Zaiyu Wang
2026-06-16 12:20 ` [PATCH v6 " Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 01/21] net/txgbe: remove duplicate xstats counters Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 02/21] net/ngbe: " Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 03/21] net/ngbe: add missing CDR config for YT PHY Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 04/21] net/ngbe: fix VF promiscuous and allmulticast Zaiyu Wang
2026-06-16 12:20   ` Zaiyu Wang [this message]
2026-06-16 12:20   ` [PATCH v6 06/21] net/txgbe: fix link status check condition Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 07/21] net/txgbe: fix Tx desc free logic Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 08/21] net/txgbe: fix link flow control registers for Amber-Lite Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 09/21] net/txgbe: fix link flow control config for Sapphire Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 10/21] net/txgbe: fix a mass of unknown interrupts Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 11/21] net/txgbe: fix traffic class priority configuration Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 12/21] net/txgbe: fix link stability for 25G NIC Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 13/21] net/txgbe: fix link stability for 40G NIC Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 14/21] net/txgbe: fix link stability for Amber-Lite backplane mode Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 15/21] net/txgbe: fix FEC mode configuration on 25G NIC Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 16/21] net/txgbe: fix SFP module identification Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 17/21] net/txgbe: fix get module info operation Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 18/21] net/txgbe: fix get EEPROM operation Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 19/21] net/txgbe: fix to reset Tx write-back pointer Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 20/21] net/txgbe: fix to enable Tx desc check Zaiyu Wang
2026-06-16 12:20   ` [PATCH v6 21/21] net/txgbe: fix temperature track for AML NIC Zaiyu Wang

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=20260616122030.9688-6-zaiyuwang@trustnetic.com \
    --to=zaiyuwang@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=stable@dpdk.org \
    /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