git: 8e8755e01195 - main - e1000: improve NVM checksum handling

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Tue, 11 Aug 2026 19:46:18 UTC
The branch main has been updated by kbowling:

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

commit 8e8755e011955d12abab7c2be324429cccf0b975
Author:     Sasha Neftin <sasha.neftin@intel.com>
AuthorDate: 2025-02-07 12:45:22 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-11 19:43:36 +0000

    e1000: improve NVM checksum handling
    
    DPDK commit message
    
    net/e1000/base: improve NVM checksum handling
    
    When reading NVM checksum, we may encounter the following scenarios:
    
    - Checksum may be invalid, and can be updated
    - Checksum may be invalid but cannot be updated because NVM is read-only
    
    For the latter case, we should just ignore invalid checksum and not
    attempt to update it.
    
    Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
    Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
    Acked-by: Bruce Richardson <bruce.richardson@intel.com>
    
    Obtained from:  DPDK (5241c17f0d)
    MFC after:      2 weeks
---
 sys/dev/e1000/e1000_ich8lan.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c
index d454b2ede3dc..1a67f4d8f42d 100644
--- a/sys/dev/e1000/e1000_ich8lan.c
+++ b/sys/dev/e1000/e1000_ich8lan.c
@@ -4436,13 +4436,20 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
 		return ret_val;
 
 	if (!(data & valid_csum_mask)) {
-		data |= valid_csum_mask;
-		ret_val = hw->nvm.ops.write(hw, word, 1, &data);
-		if (ret_val)
-			return ret_val;
-		ret_val = hw->nvm.ops.update(hw);
-		if (ret_val)
-			return ret_val;
+		DEBUGOUT("NVM checksum valid bit not set\n");
+
+		if (hw->mac.type < e1000_pch_tgp) {
+			data |= valid_csum_mask;
+			ret_val = hw->nvm.ops.write(hw, word, 1, &data);
+			if (ret_val)
+				return ret_val;
+			ret_val = hw->nvm.ops.update(hw);
+			if (ret_val)
+				return ret_val;
+		} else if (hw->mac.type == e1000_pch_tgp) {
+			/* Transitional TGP images may omit the valid bit. */
+			return E1000_SUCCESS;
+		}
 	}
 
 	return e1000_validate_nvm_checksum_generic(hw);