git: d535381ea414 - stable/14 - ixgbe: avoid flow control counter overflow

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a767bd5.4052c.3fff3bab__49173.2742449798$1786149935$gmane$org@gitrepo.freebsd.org>
The branch stable/14 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=d535381ea414ec12163339d8438ff03cbabdf7e9

commit d535381ea414ec12163339d8438ff03cbabdf7e9
Author:     Daniil Iskhakov <[email protected]>
AuthorDate: 2026-07-28 11:07:33 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-08 00:41:23 +0000

    ixgbe: avoid flow control counter overflow
    
    DPDK commit message
    
    net/ixgbe: fix flow control frame byte adjustment
    
    LXONTXC and LXOFFTXC are 32-bit counters for transmitted XON and XOFF
    packets.  Their deltas are summed and used to adjust the transmitted
    packet and byte counters.
    
    Perform the addition in 64 bits so it cannot wrap before the result is
    used for the byte adjustment.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes:          af75078fece3 ("first public release")
    Cc: [email protected]
    
    Signed-off-by: Daniil Iskhakov <[email protected]>
    Acked-by: Bruce Richardson <[email protected]>
    
    Obtained from:  DPDK (bdf8608559)
    
    (cherry picked from commit 21e03ab39603fbab4bcef1dd61fe75e9e9276079)
---
 sys/dev/ixgbe/if_ix.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 05448da71604..eb7e2ab00d3f 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -1871,9 +1871,9 @@ ixgbe_update_stats_counters(struct ixgbe_softc *sc)
 {
 	struct ixgbe_hw *hw = &sc->hw;
 	struct ixgbe_hw_stats *stats = &sc->stats.pf;
-	u32 missed_rx = 0, bprc, lxon, lxoff, total;
+	u32 missed_rx = 0, bprc, lxon, lxoff;
 	u32 lxoffrxc;
-	u64 total_missed_rx = 0;
+	u64 total_missed_rx = 0, total;
 
 	stats->crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
 	stats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
@@ -1942,7 +1942,7 @@ ixgbe_update_stats_counters(struct ixgbe_softc *sc)
 	stats->lxontxc += lxon;
 	lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
 	stats->lxofftxc += lxoff;
-	total = lxon + lxoff;
+	total = (u64)lxon + lxoff;
 
 	stats->gptc += IXGBE_READ_REG(hw, IXGBE_GPTC);
 	stats->mptc += IXGBE_READ_REG(hw, IXGBE_MPTC);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.