git: f3e20eb8d8f0 - releng/13.1 - ixgbe: workaround errata about UDP frames with zero checksum

From: Gordon Tetlow <gordon_at_FreeBSD.org>
Date: Wed, 08 Feb 2023 18:15:19 UTC
The branch releng/13.1 has been updated by gordon:

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

commit f3e20eb8d8f0b87ae828741c48e9ebd7913086ac
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2022-11-10 09:34:40 +0000
Commit:     Gordon Tetlow <gordon@FreeBSD.org>
CommitDate: 2023-02-08 16:30:38 +0000

    ixgbe: workaround errata about UDP frames with zero checksum
    
    Intel 82599 has errata related to IPv4 UDP frames with zero checksum.
    It reports such datagrams with L4 integrity errors in IXGBE_XEC
    register. And after afb1aa4e6df2 commit such errors are reported
    via IFCOUNTER_IERRORS. This confuses users, since actually all frames
    are handled correctly by the system.
    To workaround the problem, let's ignore the XEC register value for
    82599 cards for now.
    
    PR:             266048
    Discussed with: erj
    Sponsored by:   Yandex LLC
    Approved by:    so
    Security:       FreeBSD-EN-23:04.ixgbe
    
    (cherry picked from commit 8526120ad41ca47367b43f8f4459e0fa61285571)
    (cherry picked from commit daf3d88ac1849c9a6c5f05d2a663c7fe57453b37)
---
 sys/dev/ixgbe/if_ix.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 3077fc9ac4f8..abfdc1f5ba60 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -1585,8 +1585,12 @@ ixgbe_update_stats_counters(struct ixgbe_softc *sc)
 	 * - fragmented packets count,
 	 * - oversized packets count,
 	 * - jabber count.
+	 *
+	 * Ignore XEC errors for 82599 to workaround errata about
+	 * UDP frames with zero checksum.
 	 */
-	IXGBE_SET_IERRORS(sc, stats->crcerrs + stats->illerrc + stats->xec +
+	IXGBE_SET_IERRORS(sc, stats->crcerrs + stats->illerrc +
+	    (hw->mac.type != ixgbe_mac_82599EB ? stats->xec : 0) +
 	    stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + stats->roc +
 	    stats->rjc);
 } /* ixgbe_update_stats_counters */