Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Aug 2026 10:38:05 +0000
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 709426551c6a - main - igc: Work around I225 v1 minimum IPG erratum
Message-ID:  <6a706f8d.4471d.5271f968@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kbowling:

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

commit 709426551c6a3607fb5a33f5b8dbb87cfa9c8125
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-03 10:28:49 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-03 10:37:09 +0000

    igc: Work around I225 v1 minimum IPG erratum
    
    I225 v1 cannot receive the minimum inter-packet gap required at
    2.5 Gb/s.  For affected back-to-back links, Intel recommends using a
    15-byte transmit IPG instead of 12 bytes.
    
    Program TIPG.IPGT to 0xb for pre-v2 I225 devices at 2.5 Gb/s and
    restore the default at lower speeds.  Avoid penalizing fixed I225 and
    I226 parts.
    
    MFC after:      2 weeks
---
 sys/dev/igc/if_igc.c      | 29 +++++++++++++++++++++++++++++
 sys/dev/igc/igc_defines.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index 4a54d8ca7a6c..fa4f427a5710 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -128,6 +128,7 @@ static int	igc_if_rx_queue_intr_enable(if_ctx_t, uint16_t);
 static int	igc_if_tx_queue_intr_enable(if_ctx_t, uint16_t);
 static void	igc_if_multi_set(if_ctx_t);
 static void	igc_if_update_admin_status(if_ctx_t);
+static void	igc_apply_i225_ipg_workaround(struct igc_softc *);
 static void	igc_if_debug(if_ctx_t);
 static void	igc_update_stats_counters(struct igc_softc *);
 static void	igc_add_hw_stats(struct igc_softc *);
@@ -1400,6 +1401,33 @@ igc_if_timer(if_ctx_t ctx, uint16_t qid)
 	iflib_admin_intr_deferred(ctx);
 }
 
+static void
+igc_apply_i225_ipg_workaround(struct igc_softc *sc)
+{
+	struct igc_hw *hw = &sc->hw;
+	u32 ipgt, tipg;
+
+	/*
+	 * I225 v1 cannot receive the minimum IPG required at 2.5 Gb/s.
+	 * Intel's documented back-to-back workaround is for the transmitter
+	 * to use a 15-byte IPG instead of 12 bytes.  I225 v2 and later have
+	 * the receive-side fix and should retain the standard IPG.
+	 */
+	if (!igc_is_device_id_i225(hw) ||
+	    hw->revision_id >= IGC_REVISION_2)
+		return;
+
+	ipgt = sc->link_speed == SPEED_2500 ? IGC_I225_TIPG_IPGT_2P5 :
+	    DEFAULT_82543_TIPG_IPGT_COPPER;
+	tipg = IGC_READ_REG(hw, IGC_TIPG);
+	if ((tipg & IGC_TIPG_IPGT_MASK) == ipgt)
+		return;
+
+	tipg &= ~IGC_TIPG_IPGT_MASK;
+	tipg |= ipgt;
+	IGC_WRITE_REG(hw, IGC_TIPG, tipg);
+}
+
 static void
 igc_if_update_admin_status(if_ctx_t ctx)
 {
@@ -1445,6 +1473,7 @@ igc_if_update_admin_status(if_ctx_t ctx)
 		sc->link_active = 0;
 		iflib_link_state_change(ctx, LINK_STATE_DOWN, 0);
 	}
+	igc_apply_i225_ipg_workaround(sc);
 	igc_update_stats_counters(sc);
 }
 
diff --git a/sys/dev/igc/igc_defines.h b/sys/dev/igc/igc_defines.h
index 09f75fe2787e..3e6309176204 100644
--- a/sys/dev/igc/igc_defines.h
+++ b/sys/dev/igc/igc_defines.h
@@ -364,6 +364,7 @@
 /* Default values for the transmit IPG register */
 #define DEFAULT_82543_TIPG_IPGT_FIBER	9
 #define DEFAULT_82543_TIPG_IPGT_COPPER	8
+#define IGC_I225_TIPG_IPGT_2P5		0xB
 
 #define IGC_TIPG_IPGT_MASK		0x000003FF
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a706f8d.4471d.5271f968>