git: ea2e8b056b45 - main - e1000: fix semaphore timeout value

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

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

commit ea2e8b056b455e92830bd1bae56b4d72a42018c3
Author:     Pawel Malinowski <pawel.malinowski@intel.com>
AuthorDate: 2025-02-06 16:08:37 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-11 20:09:06 +0000

    e1000: fix semaphore timeout value
    
    DPDK commit message
    
    net/e1000/base: fix semaphore timeout value
    
    According to datasheet, software ownership of SWSM.SWESMBI bit should
    not exceed 100ms. Current implementation caused incorrect timeout
    counter values, where each iteration equals 50us delay. Because of that
    driver was allowed to wait for semaphore even for 1.5s. This might
    trigger DPC timeout.
    
    This implementation hardcodes value to 2000, which multiplied by 50us,
    gives 100ms of possible wait time.
    
    Fixes: af75078fece3 ("first public release")
    Cc: stable@dpdk.org
    
    Signed-off-by: Pawel Malinowski <pawel.malinowski@intel.com>
    Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
    Acked-by: Bruce Richardson <bruce.richardson@intel.com>
    
    Obtained from:  DPDK (c8bcaf0f2a)
    MFC after:      2 weeks
---
 sys/dev/e1000/e1000_defines.h | 1 +
 sys/dev/e1000/e1000_mac.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h
index fb21ad3d24b0..afa8bb4cce0d 100644
--- a/sys/dev/e1000/e1000_defines.h
+++ b/sys/dev/e1000/e1000_defines.h
@@ -536,6 +536,7 @@
 /* SW Semaphore Register */
 #define E1000_SWSM_SMBI		0x00000001 /* Driver Semaphore bit */
 #define E1000_SWSM_SWESMBI	0x00000002 /* FW Semaphore bit */
+#define E1000_SWSM_TIMEOUT	2000       /* 100 ms at 50 us per poll */
 #define E1000_SWSM_DRV_LOAD	0x00000008 /* Driver Loaded Bit */
 
 #define E1000_SWSM2_LOCK	0x00000002 /* Secondary driver semaphore bit */
diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c
index a2e05498c681..c61f5b47b746 100644
--- a/sys/dev/e1000/e1000_mac.c
+++ b/sys/dev/e1000/e1000_mac.c
@@ -2198,7 +2198,7 @@ s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg,
 s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw)
 {
 	u32 swsm;
-	s32 timeout = hw->nvm.word_size + 1;
+	s32 timeout = E1000_SWSM_TIMEOUT;
 	s32 i = 0;
 	
 	DEBUGFUNC("e1000_get_hw_semaphore_generic");