From: Daniil Iskhakov <dish@amicon.ru>
To: Anatoly Burakov <anatoly.burakov@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>,
Daniil Iskhakov <dish@amicon.ru>, <sdl.dpdk@linuxtesting.org>,
<rrv@amicon.ru>
Subject: [PATCH] net/ixgbe: fix flow control frame byte adjustment
Date: Mon, 4 May 2026 17:55:02 +0300 [thread overview]
Message-ID: <20260504145502.160806-1-dish@amicon.ru> (raw)
LXONTXC and LXOFFTXC are 32-bit counters for transmitted XON and
XOFF packets. ixgbe_read_stats_registers() sums their deltas and uses
the result to adjust the transmitted byte counters by the minimum
Ethernet frame length.
The sum is currently computed as:
total = lxon + lxoff
Since both operands are 32-bit, the addition is performed in 32 bits
and may wrap before the result is stored in total. The wrapped value is
then used in the byte adjustment, which may make the software byte
counters incorrect.
Make total 64-bit and cast lxon before the addition so the XON/XOFF
packet sum and the following byte adjustment are computed without
32-bit overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Daniil Iskhakov <dish@amicon.ru>
---
Cc: sdl.dpdk@linuxtesting.org
Cc: rrv@amicon.ru
---
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 57d929cf2c..cff2dbd900 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -3181,7 +3181,8 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
uint64_t *total_missed_rx, uint64_t *total_qbrc,
uint64_t *total_qprc, uint64_t *total_qprdc)
{
- uint32_t bprc, lxon, lxoff, total;
+ uint32_t bprc, lxon, lxoff;
+ uint64_t total;
uint32_t delta_gprc = 0;
unsigned i;
/* Workaround for RX byte count not including CRC bytes when CRC
@@ -3310,7 +3311,7 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
hw_stats->lxontxc += lxon;
lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
hw_stats->lxofftxc += lxoff;
- total = lxon + lxoff;
+ total = (uint64_t)lxon + lxoff;
hw_stats->mptc += IXGBE_READ_REG(hw, IXGBE_MPTC);
hw_stats->ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64);
--
2.43.0
reply other threads:[~2026-05-05 13:18 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=20260504145502.160806-1-dish@amicon.ru \
--to=dish@amicon.ru \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=rrv@amicon.ru \
--cc=sdl.dpdk@linuxtesting.org \
--cc=stable@dpdk.org \
--cc=vladimir.medvedkin@intel.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