patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1 01/42] net/e1000/base: fix semaphore timeout value
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 14/42] net/e1000/base: correct mPHY access logic Anatoly Burakov
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Pawel Malinowski <pawel.malinowski@intel.com>

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>
---
 drivers/net/intel/e1000/base/e1000_defines.h | 1 +
 drivers/net/intel/e1000/base/e1000_mac.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/e1000/base/e1000_defines.h b/drivers/net/intel/e1000/base/e1000_defines.h
index 3fbb6c8ea4..97cc2797b2 100644
--- a/drivers/net/intel/e1000/base/e1000_defines.h
+++ b/drivers/net/intel/e1000/base/e1000_defines.h
@@ -504,6 +504,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       /* Driver Semaphore max timeout counter */
 #define E1000_SWSM_DRV_LOAD	0x00000008 /* Driver Loaded Bit */
 
 #define E1000_SWSM2_LOCK	0x00000002 /* Secondary driver semaphore bit */
diff --git a/drivers/net/intel/e1000/base/e1000_mac.c b/drivers/net/intel/e1000/base/e1000_mac.c
index d3b3a6bac9..cf0a9f21e1 100644
--- a/drivers/net/intel/e1000/base/e1000_mac.c
+++ b/drivers/net/intel/e1000/base/e1000_mac.c
@@ -1688,7 +1688,7 @@ s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw E1000_UNUSED
 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");
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 14/42] net/e1000/base: correct mPHY access logic
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
  2025-01-31 12:58 ` [PATCH v1 01/42] net/e1000/base: fix semaphore timeout value Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 34/42] net/e1000/base: fix iterator type Anatoly Burakov
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev, Markos Chandras; +Cc: stable

The original code had incorrect indentation, and the fix was applied to
follow the indentation, i.e. adding brackets making the indentation valid.
However, the actual issue was incorrect indentation and not missing braces,
so the fix was incorrect.

This fix restores the original logic and corrects indentation.

Fixes: d5e39d1ca460 ("net/e1000/base: fix build with gcc 6")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_phy.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_phy.c b/drivers/net/intel/e1000/base/e1000_phy.c
index 60d6bdfa4e..102fae6bf0 100644
--- a/drivers/net/intel/e1000/base/e1000_phy.c
+++ b/drivers/net/intel/e1000/base/e1000_phy.c
@@ -4285,13 +4285,12 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 *data)
 	*data = E1000_READ_REG(hw, E1000_MPHY_DATA);
 
 	/* Disable access to mPHY if it was originally disabled */
-	if (locked) {
+	if (locked)
 		ready = e1000_is_mphy_ready(hw);
-		if (!ready)
-			return -E1000_ERR_PHY;
-		E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
-				E1000_MPHY_DIS_ACCESS);
-	}
+	if (!ready)
+		return -E1000_ERR_PHY;
+	E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
+			E1000_MPHY_DIS_ACCESS);
 
 	return E1000_SUCCESS;
 }
@@ -4351,13 +4350,12 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data,
 	E1000_WRITE_REG(hw, E1000_MPHY_DATA, data);
 
 	/* Disable access to mPHY if it was originally disabled */
-	if (locked) {
+	if (locked)
 		ready = e1000_is_mphy_ready(hw);
-		if (!ready)
-			return -E1000_ERR_PHY;
-		E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
-				E1000_MPHY_DIS_ACCESS);
-	}
+	if (!ready)
+		return -E1000_ERR_PHY;
+	E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
+			E1000_MPHY_DIS_ACCESS);
 
 	return E1000_SUCCESS;
 }
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 34/42] net/e1000/base: fix iterator type
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
  2025-01-31 12:58 ` [PATCH v1 01/42] net/e1000/base: fix semaphore timeout value Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 14/42] net/e1000/base: correct mPHY access logic Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 35/42] net/e1000/base: fix static analysis warnings Anatoly Burakov
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Amir Avivi <amir.avivi@intel.com>

Fix static analysis warning about comparison between types of
incompatible width, which might lead to an infinite loop due to overflow.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Amir Avivi <amir.avivi@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/e1000/base/e1000_phy.c b/drivers/net/intel/e1000/base/e1000_phy.c
index e9df7ec873..1fc7eb375e 100644
--- a/drivers/net/intel/e1000/base/e1000_phy.c
+++ b/drivers/net/intel/e1000/base/e1000_phy.c
@@ -2442,7 +2442,8 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
 			       u32 usec_interval, bool *success)
 {
 	s32 ret_val = E1000_SUCCESS;
-	u16 i, phy_status;
+	u16 phy_status;
+	u32 i;
 
 	DEBUGFUNC("e1000_phy_has_link_generic");
 
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 35/42] net/e1000/base: fix static analysis warnings
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
                   ` (2 preceding siblings ...)
  2025-01-31 12:58 ` [PATCH v1 34/42] net/e1000/base: fix iterator type Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 36/42] net/e1000/base: fix reset for 82580 Anatoly Burakov
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Przemysław Ciesielski <przemyslaw.ciesielski@intel.com>

There are some static analysis warnings due to wrong data types being used
for various operations. Fix them with explicit typecasts.

Fixes: 5a32a257f957 ("e1000: more NICs in base driver")
Fixes: 38db3f7f50bd ("e1000: update base driver")
Cc: stable@dpdk.org

Signed-off-by: Przemysław Ciesielski <przemyslaw.ciesielski@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_80003es2lan.c | 2 +-
 drivers/net/intel/e1000/base/e1000_nvm.c         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_80003es2lan.c b/drivers/net/intel/e1000/base/e1000_80003es2lan.c
index b1f2df3803..1cbce5bedd 100644
--- a/drivers/net/intel/e1000/base/e1000_80003es2lan.c
+++ b/drivers/net/intel/e1000/base/e1000_80003es2lan.c
@@ -426,7 +426,7 @@ STATIC void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
 		; /* Empty */
 
 	swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
-	swfw_sync &= ~mask;
+	swfw_sync &= ~(u32)mask;
 	E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
 
 	e1000_put_hw_semaphore_generic(hw);
diff --git a/drivers/net/intel/e1000/base/e1000_nvm.c b/drivers/net/intel/e1000/base/e1000_nvm.c
index 2b38bbc117..1b49586c74 100644
--- a/drivers/net/intel/e1000/base/e1000_nvm.c
+++ b/drivers/net/intel/e1000/base/e1000_nvm.c
@@ -935,14 +935,14 @@ s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num)
 		DEBUGOUT("NVM Not Supported\n");
 		return -E1000_NOT_IMPLEMENTED;
 	}
-	*pba_num = (u32)(nvm_data << 16);
+	*pba_num = ((u32)nvm_data << 16);
 
 	ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
 	if (ret_val) {
 		DEBUGOUT("NVM Read Error\n");
 		return ret_val;
 	}
-	*pba_num |= nvm_data;
+	*pba_num |= (u32)nvm_data;
 
 	return E1000_SUCCESS;
 }
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 36/42] net/e1000/base: fix reset for 82580
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
                   ` (3 preceding siblings ...)
  2025-01-31 12:58 ` [PATCH v1 35/42] net/e1000/base: fix static analysis warnings Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 37/42] net/e1000/base: fix mac addr hash bit_shift Anatoly Burakov
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Barbara Skobiej <barbara.skobiej@intel.com>

Fix setting device reset status bit in e1000_reset_hw_82580() function
for 82580 by first reading the register value, and then setting the
device reset bit.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Barbara Skobiej <barbara.skobiej@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_82575.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_82575.c b/drivers/net/intel/e1000/base/e1000_82575.c
index ff5a5cad80..34b315a540 100644
--- a/drivers/net/intel/e1000/base/e1000_82575.c
+++ b/drivers/net/intel/e1000/base/e1000_82575.c
@@ -2272,7 +2272,7 @@ STATIC s32 e1000_reset_hw_82580(struct e1000_hw *hw)
 	s32 ret_val = E1000_SUCCESS;
 	/* BH SW mailbox bit in SW_FW_SYNC */
 	u16 swmbsw_mask = E1000_SW_SYNCH_MB;
-	u32 ctrl;
+	u32 ctrl, status;
 	bool global_device_reset = hw->dev_spec._82575.global_device_reset;
 
 	DEBUGFUNC("e1000_reset_hw_82580");
@@ -2337,7 +2337,8 @@ STATIC s32 e1000_reset_hw_82580(struct e1000_hw *hw)
 	}
 
 	/* clear global device reset status bit */
-	E1000_WRITE_REG(hw, E1000_STATUS, E1000_STAT_DEV_RST_SET);
+	status = E1000_READ_REG(hw, E1000_STATUS);
+	E1000_WRITE_REG(hw, E1000_STATUS, status | E1000_STAT_DEV_RST_SET);
 
 	/* Clear any pending interrupt events. */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 37/42] net/e1000/base: fix mac addr hash bit_shift
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
                   ` (4 preceding siblings ...)
  2025-01-31 12:58 ` [PATCH v1 36/42] net/e1000/base: fix reset for 82580 Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 38/42] net/e1000/base: fix uninitialized variable usage Anatoly Burakov
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Loktionov Aleksandr <aleksandr.loktionov@intel.com>

In e1000_hash_mc_addr_generic() the expression:

	"mc_addr[4] >> 8 - bit_shift", right shifting "mc_addr[4]"

shift by more than 7 bits always yields zero, so hash becomes not so
different. Add initialization with bit_shift = 1, and add a loop condition
to ensure bit_shift will be always in [1..8] range.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_mac.c | 4 ++--
 drivers/net/intel/e1000/base/e1000_vf.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_mac.c b/drivers/net/intel/e1000/base/e1000_mac.c
index 0ba03e6a04..4ec7cab7ab 100644
--- a/drivers/net/intel/e1000/base/e1000_mac.c
+++ b/drivers/net/intel/e1000/base/e1000_mac.c
@@ -488,7 +488,7 @@ int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
 u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
 {
 	u32 hash_value, hash_mask;
-	u8 bit_shift = 0;
+	u8 bit_shift = 1;
 
 	DEBUGFUNC("e1000_hash_mc_addr_generic");
 
@@ -498,7 +498,7 @@ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
 	/* For a mc_filter_type of 0, bit_shift is the number of left-shifts
 	 * where 0xFF would still fall within the hash mask.
 	 */
-	while (hash_mask >> bit_shift != 0xFF)
+	while (hash_mask >> bit_shift != 0xFF && bit_shift < 4)
 		bit_shift++;
 
 	/* The portion of the address that is used for the hash table
diff --git a/drivers/net/intel/e1000/base/e1000_vf.c b/drivers/net/intel/e1000/base/e1000_vf.c
index 7d20150b59..bb314e2f12 100644
--- a/drivers/net/intel/e1000/base/e1000_vf.c
+++ b/drivers/net/intel/e1000/base/e1000_vf.c
@@ -331,7 +331,7 @@ STATIC int e1000_rar_set_vf(struct e1000_hw *hw, u8 *addr,
 STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
 {
 	u32 hash_value, hash_mask;
-	u8 bit_shift = 0;
+	u8 bit_shift = 1;
 
 	DEBUGFUNC("e1000_hash_mc_addr_generic");
 
@@ -342,7 +342,7 @@ STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
 	 * The bit_shift is the number of left-shifts
 	 * where 0xFF would still fall within the hash mask.
 	 */
-	while (hash_mask >> bit_shift != 0xFF)
+	while (hash_mask >> bit_shift != 0xFF && bit_shift < 4)
 		bit_shift++;
 
 	hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 38/42] net/e1000/base: fix uninitialized variable usage
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
                   ` (5 preceding siblings ...)
  2025-01-31 12:58 ` [PATCH v1 37/42] net/e1000/base: fix mac addr hash bit_shift Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 39/42] net/e1000/base: fix unchecked return Anatoly Burakov
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Jakub Buchocki <101559614+jbuchocx@users.noreply.github.com>

Coverity has detected potential usage of uninitialized values inside the
array. Fix the warning by initializing array.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Jakub Buchocki <jakubx.buchocki@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/intel/e1000/base/e1000_vf.c b/drivers/net/intel/e1000/base/e1000_vf.c
index bb314e2f12..e0c95aa130 100644
--- a/drivers/net/intel/e1000/base/e1000_vf.c
+++ b/drivers/net/intel/e1000/base/e1000_vf.c
@@ -374,7 +374,7 @@ STATIC void e1000_write_msg_read_ack(struct e1000_hw *hw,
 void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,
 				  u8 *mc_addr_list, u32 mc_addr_count)
 {
-	u32 msgbuf[E1000_VFMAILBOX_SIZE];
+	u32 msgbuf[E1000_VFMAILBOX_SIZE] = {0};
 	u16 *hash_list = (u16 *)&msgbuf[1];
 	u32 hash_value;
 	u32 i;
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 39/42] net/e1000/base: fix unchecked return
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
                   ` (6 preceding siblings ...)
  2025-01-31 12:58 ` [PATCH v1 38/42] net/e1000/base: fix uninitialized variable usage Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
  2025-01-31 12:58 ` [PATCH v1 40/42] net/e1000/base: fix data type in MAC hash Anatoly Burakov
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev, Wenzhuo Lu; +Cc: stable

From: Dima Ruinskiy <dima.ruinskiy@intel.com>

Static analysis has detected a write that is not checked for errors,
leading to ignored error return value. Add a check.

Fixes: edcdb3c5f71b ("e1000/base: fix link flap on 82579")
Cc: stable@dpdk.org

Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_ich8lan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/intel/e1000/base/e1000_ich8lan.c b/drivers/net/intel/e1000/base/e1000_ich8lan.c
index c3449a3f45..6b7eb245a6 100644
--- a/drivers/net/intel/e1000/base/e1000_ich8lan.c
+++ b/drivers/net/intel/e1000/base/e1000_ich8lan.c
@@ -989,6 +989,8 @@ s32 e1000_set_eee_pchlan(struct e1000_hw *hw)
 		data &= ~I82579_LPI_100_PLL_SHUT;
 		ret_val = e1000_write_emi_reg_locked(hw, I82579_LPI_PLL_SHUT,
 						     data);
+		if (ret_val)
+			goto release;
 	}
 
 	/* R/Clr IEEE MMD 3.1 bits 11:10 - Tx/Rx LPI Received */
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v1 40/42] net/e1000/base: fix data type in MAC hash
       [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
                   ` (7 preceding siblings ...)
  2025-01-31 12:58 ` [PATCH v1 39/42] net/e1000/base: fix unchecked return Anatoly Burakov
@ 2025-01-31 12:58 ` Anatoly Burakov
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
  9 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-01-31 12:58 UTC (permalink / raw)
  To: dev; +Cc: stable

From: Barbara Skobiej <barbara.skobiej@intel.com>

One of the bit shifts in MAC hash calculation triggers a static analysis
warning about a potential overflow. Fix the data type to avoid this.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Barbara Skobiej <barbara.skobiej@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_mac.c | 6 ++++--
 drivers/net/intel/e1000/base/e1000_vf.c  | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_mac.c b/drivers/net/intel/e1000/base/e1000_mac.c
index 4ec7cab7ab..2fa97d12a9 100644
--- a/drivers/net/intel/e1000/base/e1000_mac.c
+++ b/drivers/net/intel/e1000/base/e1000_mac.c
@@ -541,8 +541,10 @@ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
 		break;
 	}
 
-	hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
-				  (((u16) mc_addr[5]) << bit_shift)));
+	hash_value = (u32)mc_addr[4];
+	hash_value = hash_value >> (8 - bit_shift);
+	hash_value |= (((u32)mc_addr[5]) << bit_shift);
+	hash_value &= hash_mask;
 
 	return hash_value;
 }
diff --git a/drivers/net/intel/e1000/base/e1000_vf.c b/drivers/net/intel/e1000/base/e1000_vf.c
index e0c95aa130..b02459900b 100644
--- a/drivers/net/intel/e1000/base/e1000_vf.c
+++ b/drivers/net/intel/e1000/base/e1000_vf.c
@@ -345,8 +345,10 @@ STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
 	while (hash_mask >> bit_shift != 0xFF && bit_shift < 4)
 		bit_shift++;
 
-	hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
-				  (((u16) mc_addr[5]) << bit_shift)));
+	hash_value = (u32)mc_addr[4];
+	hash_value = hash_value >> (8 - bit_shift);
+	hash_value |= (((u32)mc_addr[5]) << bit_shift);
+	hash_value &= hash_mask;
 
 	return hash_value;
 }
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 25/54] net/e1000/base: fix semaphore timeout value
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 26/54] net/e1000/base: correct mPHY access logic Anatoly Burakov
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Pawel Malinowski <pawel.malinowski@intel.com>

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>
---
 drivers/net/intel/e1000/base/e1000_defines.h | 1 +
 drivers/net/intel/e1000/base/e1000_i225.c    | 2 +-
 drivers/net/intel/e1000/base/e1000_mac.c     | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_defines.h b/drivers/net/intel/e1000/base/e1000_defines.h
index 8dfdce7dad..2c3b806c92 100644
--- a/drivers/net/intel/e1000/base/e1000_defines.h
+++ b/drivers/net/intel/e1000/base/e1000_defines.h
@@ -521,6 +521,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       /* Driver Semaphore max timeout counter */
 #define E1000_SWSM_DRV_LOAD	0x00000008 /* Driver Loaded Bit */
 
 #define E1000_SWSM2_LOCK	0x00000002 /* Secondary driver semaphore bit */
diff --git a/drivers/net/intel/e1000/base/e1000_i225.c b/drivers/net/intel/e1000/base/e1000_i225.c
index a4f5b73724..c8d3114c28 100644
--- a/drivers/net/intel/e1000/base/e1000_i225.c
+++ b/drivers/net/intel/e1000/base/e1000_i225.c
@@ -395,7 +395,7 @@ s32 e1000_setup_copper_link_i225(struct e1000_hw *hw)
 static s32 e1000_get_hw_semaphore_i225(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_i225");
diff --git a/drivers/net/intel/e1000/base/e1000_mac.c b/drivers/net/intel/e1000/base/e1000_mac.c
index 7e53da613c..0db114c0df 100644
--- a/drivers/net/intel/e1000/base/e1000_mac.c
+++ b/drivers/net/intel/e1000/base/e1000_mac.c
@@ -1702,7 +1702,7 @@ s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw E1000_UNUSED
 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");
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 26/54] net/e1000/base: correct mPHY access logic
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
  2025-02-04 15:10   ` [PATCH v2 25/54] net/e1000/base: fix semaphore timeout value Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 46/54] net/e1000/base: fix iterator type Anatoly Burakov
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev, Markos Chandras; +Cc: bruce.richardson, stable

The original code had incorrect indentation, and the fix was applied to
follow the indentation, i.e. adding brackets making the indentation valid.
However, the actual issue was incorrect indentation and not missing braces,
so the fix was incorrect.

This fix restores the original logic and corrects indentation.

Fixes: d5e39d1ca460 ("net/e1000/base: fix build with gcc 6")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_phy.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_phy.c b/drivers/net/intel/e1000/base/e1000_phy.c
index 1b5fd76ada..5ac8322af3 100644
--- a/drivers/net/intel/e1000/base/e1000_phy.c
+++ b/drivers/net/intel/e1000/base/e1000_phy.c
@@ -4284,13 +4284,12 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 *data)
 	*data = E1000_READ_REG(hw, E1000_MPHY_DATA);
 
 	/* Disable access to mPHY if it was originally disabled */
-	if (locked) {
+	if (locked)
 		ready = e1000_is_mphy_ready(hw);
-		if (!ready)
-			return -E1000_ERR_PHY;
-		E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
-				E1000_MPHY_DIS_ACCESS);
-	}
+	if (!ready)
+		return -E1000_ERR_PHY;
+	E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
+			E1000_MPHY_DIS_ACCESS);
 
 	return E1000_SUCCESS;
 }
@@ -4350,13 +4349,12 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data,
 	E1000_WRITE_REG(hw, E1000_MPHY_DATA, data);
 
 	/* Disable access to mPHY if it was originally disabled */
-	if (locked) {
+	if (locked)
 		ready = e1000_is_mphy_ready(hw);
-		if (!ready)
-			return -E1000_ERR_PHY;
-		E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
-				E1000_MPHY_DIS_ACCESS);
-	}
+	if (!ready)
+		return -E1000_ERR_PHY;
+	E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
+			E1000_MPHY_DIS_ACCESS);
 
 	return E1000_SUCCESS;
 }
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 46/54] net/e1000/base: fix iterator type
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
  2025-02-04 15:10   ` [PATCH v2 25/54] net/e1000/base: fix semaphore timeout value Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 26/54] net/e1000/base: correct mPHY access logic Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 47/54] net/e1000/base: fix static analysis warnings Anatoly Burakov
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Amir Avivi <amir.avivi@intel.com>

Fix static analysis warning about comparison between types of
incompatible width, which might lead to an infinite loop due to overflow.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Amir Avivi <amir.avivi@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/e1000/base/e1000_phy.c b/drivers/net/intel/e1000/base/e1000_phy.c
index 06505d855e..b449c6ef42 100644
--- a/drivers/net/intel/e1000/base/e1000_phy.c
+++ b/drivers/net/intel/e1000/base/e1000_phy.c
@@ -2441,7 +2441,8 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
 			       u32 usec_interval, bool *success)
 {
 	s32 ret_val = E1000_SUCCESS;
-	u16 i, phy_status;
+	u16 phy_status;
+	u32 i;
 
 	DEBUGFUNC("e1000_phy_has_link_generic");
 
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 47/54] net/e1000/base: fix static analysis warnings
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
                     ` (2 preceding siblings ...)
  2025-02-04 15:10   ` [PATCH v2 46/54] net/e1000/base: fix iterator type Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 48/54] net/e1000/base: fix reset for 82580 Anatoly Burakov
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Przemysław Ciesielski <przemyslaw.ciesielski@intel.com>

There are some static analysis warnings due to wrong data types being used
for various operations. Fix them with explicit typecasts.

Fixes: 5a32a257f957 ("e1000: more NICs in base driver")
Fixes: 38db3f7f50bd ("e1000: update base driver")
Cc: stable@dpdk.org

Signed-off-by: Przemysław Ciesielski <przemyslaw.ciesielski@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_80003es2lan.c | 2 +-
 drivers/net/intel/e1000/base/e1000_nvm.c         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_80003es2lan.c b/drivers/net/intel/e1000/base/e1000_80003es2lan.c
index b1f2df3803..1cbce5bedd 100644
--- a/drivers/net/intel/e1000/base/e1000_80003es2lan.c
+++ b/drivers/net/intel/e1000/base/e1000_80003es2lan.c
@@ -426,7 +426,7 @@ STATIC void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
 		; /* Empty */
 
 	swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
-	swfw_sync &= ~mask;
+	swfw_sync &= ~(u32)mask;
 	E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
 
 	e1000_put_hw_semaphore_generic(hw);
diff --git a/drivers/net/intel/e1000/base/e1000_nvm.c b/drivers/net/intel/e1000/base/e1000_nvm.c
index 0d43a49c14..70259da090 100644
--- a/drivers/net/intel/e1000/base/e1000_nvm.c
+++ b/drivers/net/intel/e1000/base/e1000_nvm.c
@@ -934,14 +934,14 @@ s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num)
 		DEBUGOUT("NVM Not Supported\n");
 		return -E1000_NOT_IMPLEMENTED;
 	}
-	*pba_num = (u32)(nvm_data << 16);
+	*pba_num = ((u32)nvm_data << 16);
 
 	ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
 	if (ret_val) {
 		DEBUGOUT("NVM Read Error\n");
 		return ret_val;
 	}
-	*pba_num |= nvm_data;
+	*pba_num |= (u32)nvm_data;
 
 	return E1000_SUCCESS;
 }
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 48/54] net/e1000/base: fix reset for 82580
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
                     ` (3 preceding siblings ...)
  2025-02-04 15:10   ` [PATCH v2 47/54] net/e1000/base: fix static analysis warnings Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 49/54] net/e1000/base: fix mac addr hash bit_shift Anatoly Burakov
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Barbara Skobiej <barbara.skobiej@intel.com>

Fix setting device reset status bit in e1000_reset_hw_82580() function
for 82580 by first reading the register value, and then setting the
device reset bit.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Barbara Skobiej <barbara.skobiej@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_82575.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_82575.c b/drivers/net/intel/e1000/base/e1000_82575.c
index ff5a5cad80..34b315a540 100644
--- a/drivers/net/intel/e1000/base/e1000_82575.c
+++ b/drivers/net/intel/e1000/base/e1000_82575.c
@@ -2272,7 +2272,7 @@ STATIC s32 e1000_reset_hw_82580(struct e1000_hw *hw)
 	s32 ret_val = E1000_SUCCESS;
 	/* BH SW mailbox bit in SW_FW_SYNC */
 	u16 swmbsw_mask = E1000_SW_SYNCH_MB;
-	u32 ctrl;
+	u32 ctrl, status;
 	bool global_device_reset = hw->dev_spec._82575.global_device_reset;
 
 	DEBUGFUNC("e1000_reset_hw_82580");
@@ -2337,7 +2337,8 @@ STATIC s32 e1000_reset_hw_82580(struct e1000_hw *hw)
 	}
 
 	/* clear global device reset status bit */
-	E1000_WRITE_REG(hw, E1000_STATUS, E1000_STAT_DEV_RST_SET);
+	status = E1000_READ_REG(hw, E1000_STATUS);
+	E1000_WRITE_REG(hw, E1000_STATUS, status | E1000_STAT_DEV_RST_SET);
 
 	/* Clear any pending interrupt events. */
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 49/54] net/e1000/base: fix mac addr hash bit_shift
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
                     ` (4 preceding siblings ...)
  2025-02-04 15:10   ` [PATCH v2 48/54] net/e1000/base: fix reset for 82580 Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 50/54] net/e1000/base: fix uninitialized variable usage Anatoly Burakov
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Loktionov Aleksandr <aleksandr.loktionov@intel.com>

In e1000_hash_mc_addr_generic() the expression:

	"mc_addr[4] >> 8 - bit_shift", right shifting "mc_addr[4]"

shift by more than 7 bits always yields zero, so hash becomes not so
different. Add initialization with bit_shift = 1, and add a loop condition
to ensure bit_shift will be always in [1..8] range.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_mac.c | 4 ++--
 drivers/net/intel/e1000/base/e1000_vf.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_mac.c b/drivers/net/intel/e1000/base/e1000_mac.c
index 0ba03e6a04..4ec7cab7ab 100644
--- a/drivers/net/intel/e1000/base/e1000_mac.c
+++ b/drivers/net/intel/e1000/base/e1000_mac.c
@@ -488,7 +488,7 @@ int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
 u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
 {
 	u32 hash_value, hash_mask;
-	u8 bit_shift = 0;
+	u8 bit_shift = 1;
 
 	DEBUGFUNC("e1000_hash_mc_addr_generic");
 
@@ -498,7 +498,7 @@ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
 	/* For a mc_filter_type of 0, bit_shift is the number of left-shifts
 	 * where 0xFF would still fall within the hash mask.
 	 */
-	while (hash_mask >> bit_shift != 0xFF)
+	while (hash_mask >> bit_shift != 0xFF && bit_shift < 4)
 		bit_shift++;
 
 	/* The portion of the address that is used for the hash table
diff --git a/drivers/net/intel/e1000/base/e1000_vf.c b/drivers/net/intel/e1000/base/e1000_vf.c
index 7d20150b59..bb314e2f12 100644
--- a/drivers/net/intel/e1000/base/e1000_vf.c
+++ b/drivers/net/intel/e1000/base/e1000_vf.c
@@ -331,7 +331,7 @@ STATIC int e1000_rar_set_vf(struct e1000_hw *hw, u8 *addr,
 STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
 {
 	u32 hash_value, hash_mask;
-	u8 bit_shift = 0;
+	u8 bit_shift = 1;
 
 	DEBUGFUNC("e1000_hash_mc_addr_generic");
 
@@ -342,7 +342,7 @@ STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
 	 * The bit_shift is the number of left-shifts
 	 * where 0xFF would still fall within the hash mask.
 	 */
-	while (hash_mask >> bit_shift != 0xFF)
+	while (hash_mask >> bit_shift != 0xFF && bit_shift < 4)
 		bit_shift++;
 
 	hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 50/54] net/e1000/base: fix uninitialized variable usage
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
                     ` (5 preceding siblings ...)
  2025-02-04 15:10   ` [PATCH v2 49/54] net/e1000/base: fix mac addr hash bit_shift Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 51/54] net/e1000/base: fix unchecked return Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 52/54] net/e1000/base: fix data type in MAC hash Anatoly Burakov
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Jakub Buchocki <101559614+jbuchocx@users.noreply.github.com>

Coverity has detected potential usage of uninitialized values inside the
array. Fix the warning by initializing array.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Jakub Buchocki <jakubx.buchocki@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/intel/e1000/base/e1000_vf.c b/drivers/net/intel/e1000/base/e1000_vf.c
index bb314e2f12..e0c95aa130 100644
--- a/drivers/net/intel/e1000/base/e1000_vf.c
+++ b/drivers/net/intel/e1000/base/e1000_vf.c
@@ -374,7 +374,7 @@ STATIC void e1000_write_msg_read_ack(struct e1000_hw *hw,
 void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,
 				  u8 *mc_addr_list, u32 mc_addr_count)
 {
-	u32 msgbuf[E1000_VFMAILBOX_SIZE];
+	u32 msgbuf[E1000_VFMAILBOX_SIZE] = {0};
 	u16 *hash_list = (u16 *)&msgbuf[1];
 	u32 hash_value;
 	u32 i;
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 51/54] net/e1000/base: fix unchecked return
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
                     ` (6 preceding siblings ...)
  2025-02-04 15:10   ` [PATCH v2 50/54] net/e1000/base: fix uninitialized variable usage Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  2025-02-04 15:10   ` [PATCH v2 52/54] net/e1000/base: fix data type in MAC hash Anatoly Burakov
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev, Wenzhuo Lu; +Cc: bruce.richardson, stable

From: Dima Ruinskiy <dima.ruinskiy@intel.com>

Static analysis has detected a write that is not checked for errors,
leading to ignored error return value. Add a check.

Fixes: edcdb3c5f71b ("e1000/base: fix link flap on 82579")
Cc: stable@dpdk.org

Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_ich8lan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/intel/e1000/base/e1000_ich8lan.c b/drivers/net/intel/e1000/base/e1000_ich8lan.c
index c3449a3f45..6b7eb245a6 100644
--- a/drivers/net/intel/e1000/base/e1000_ich8lan.c
+++ b/drivers/net/intel/e1000/base/e1000_ich8lan.c
@@ -989,6 +989,8 @@ s32 e1000_set_eee_pchlan(struct e1000_hw *hw)
 		data &= ~I82579_LPI_100_PLL_SHUT;
 		ret_val = e1000_write_emi_reg_locked(hw, I82579_LPI_PLL_SHUT,
 						     data);
+		if (ret_val)
+			goto release;
 	}
 
 	/* R/Clr IEEE MMD 3.1 bits 11:10 - Tx/Rx LPI Received */
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 52/54] net/e1000/base: fix data type in MAC hash
       [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
                     ` (7 preceding siblings ...)
  2025-02-04 15:10   ` [PATCH v2 51/54] net/e1000/base: fix unchecked return Anatoly Burakov
@ 2025-02-04 15:10   ` Anatoly Burakov
  8 siblings, 0 replies; 18+ messages in thread
From: Anatoly Burakov @ 2025-02-04 15:10 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, stable

From: Barbara Skobiej <barbara.skobiej@intel.com>

One of the bit shifts in MAC hash calculation triggers a static analysis
warning about a potential overflow. Fix the data type to avoid this.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Barbara Skobiej <barbara.skobiej@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/e1000/base/e1000_mac.c | 6 ++++--
 drivers/net/intel/e1000/base/e1000_vf.c  | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_mac.c b/drivers/net/intel/e1000/base/e1000_mac.c
index 4ec7cab7ab..2fa97d12a9 100644
--- a/drivers/net/intel/e1000/base/e1000_mac.c
+++ b/drivers/net/intel/e1000/base/e1000_mac.c
@@ -541,8 +541,10 @@ u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
 		break;
 	}
 
-	hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
-				  (((u16) mc_addr[5]) << bit_shift)));
+	hash_value = (u32)mc_addr[4];
+	hash_value = hash_value >> (8 - bit_shift);
+	hash_value |= (((u32)mc_addr[5]) << bit_shift);
+	hash_value &= hash_mask;
 
 	return hash_value;
 }
diff --git a/drivers/net/intel/e1000/base/e1000_vf.c b/drivers/net/intel/e1000/base/e1000_vf.c
index e0c95aa130..b02459900b 100644
--- a/drivers/net/intel/e1000/base/e1000_vf.c
+++ b/drivers/net/intel/e1000/base/e1000_vf.c
@@ -345,8 +345,10 @@ STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
 	while (hash_mask >> bit_shift != 0xFF && bit_shift < 4)
 		bit_shift++;
 
-	hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
-				  (((u16) mc_addr[5]) << bit_shift)));
+	hash_value = (u32)mc_addr[4];
+	hash_value = hash_value >> (8 - bit_shift);
+	hash_value |= (((u32)mc_addr[5]) << bit_shift);
+	hash_value &= hash_mask;
 
 	return hash_value;
 }
-- 
2.43.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-02-04 15:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1738328106.git.anatoly.burakov@intel.com>
2025-01-31 12:58 ` [PATCH v1 01/42] net/e1000/base: fix semaphore timeout value Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 14/42] net/e1000/base: correct mPHY access logic Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 34/42] net/e1000/base: fix iterator type Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 35/42] net/e1000/base: fix static analysis warnings Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 36/42] net/e1000/base: fix reset for 82580 Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 37/42] net/e1000/base: fix mac addr hash bit_shift Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 38/42] net/e1000/base: fix uninitialized variable usage Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 39/42] net/e1000/base: fix unchecked return Anatoly Burakov
2025-01-31 12:58 ` [PATCH v1 40/42] net/e1000/base: fix data type in MAC hash Anatoly Burakov
     [not found] ` <cover.1738681725.git.anatoly.burakov@intel.com>
2025-02-04 15:10   ` [PATCH v2 25/54] net/e1000/base: fix semaphore timeout value Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 26/54] net/e1000/base: correct mPHY access logic Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 46/54] net/e1000/base: fix iterator type Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 47/54] net/e1000/base: fix static analysis warnings Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 48/54] net/e1000/base: fix reset for 82580 Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 49/54] net/e1000/base: fix mac addr hash bit_shift Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 50/54] net/e1000/base: fix uninitialized variable usage Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 51/54] net/e1000/base: fix unchecked return Anatoly Burakov
2025-02-04 15:10   ` [PATCH v2 52/54] net/e1000/base: fix data type in MAC hash Anatoly Burakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).