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

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by kbowling:

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

commit 8e8755e011955d12abab7c2be324429cccf0b975
Author:     Sasha Neftin <[email protected]>
AuthorDate: 2025-02-07 12:45:22 +0000
Commit:     Kevin Bowling <[email protected]>
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 <[email protected]>
    Signed-off-by: Anatoly Burakov <[email protected]>
    Acked-by: Bruce Richardson <[email protected]>
    
    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);
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.