patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v3 020/129] net/ice/base: fix memory leak when checking firmware version
       [not found] ` <cover.1719313663.git.anatoly.burakov@intel.com>
@ 2024-06-25 11:12   ` Anatoly Burakov
  2024-06-25 11:12   ` [PATCH v3 035/129] net/ice/base: fix sign-extension Anatoly Burakov
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Anatoly Burakov @ 2024-06-25 11:12 UTC (permalink / raw)
  To: dev, Paul Greenwalt, Qi Zhang, Qiming Yang
  Cc: Eric Joyner, bruce.richardson, ian.stokes, stable

From: Eric Joyner <eric.joyner@intel.com>

If ice_cfg_phy_fec() goes through case ICE_FEC_DIS_AUTO but the underlying
device firmware isn't the correct version, then the memory used to hold the PHY
capabilities output from the firmware isn't freed.

Fix this by making sure the memory is freed by jumping to the label that frees
the memory instead of returning from the version check immediately.

Fixes: 4b6ede113f55 ("net/ice/base: support auto FEC with FEC disabled")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Eric Joyner <eric.joyner@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 3d787d2a29..ef6696cddf 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -3843,8 +3843,10 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
 		break;
 	case ICE_FEC_DIS_AUTO:
 		/* Set No FEC and auto FEC */
-		if (!ice_fw_supports_fec_dis_auto(hw))
-			return ICE_ERR_NOT_SUPPORTED;
+		if (!ice_fw_supports_fec_dis_auto(hw)) {
+			status = ICE_ERR_NOT_SUPPORTED;
+			goto out;
+		}
 		cfg->link_fec_opt |= ICE_AQC_PHY_FEC_DIS;
 		/* fall-through */
 	case ICE_FEC_AUTO:
-- 
2.43.0


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

* [PATCH v3 035/129] net/ice/base: fix sign-extension
       [not found] ` <cover.1719313663.git.anatoly.burakov@intel.com>
  2024-06-25 11:12   ` [PATCH v3 020/129] net/ice/base: fix memory leak when checking firmware version Anatoly Burakov
@ 2024-06-25 11:12   ` Anatoly Burakov
  2024-06-25 11:14   ` [PATCH v3 115/129] net/ice/base: fix ice_get_ctx() issue Anatoly Burakov
       [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Anatoly Burakov @ 2024-06-25 11:12 UTC (permalink / raw)
  To: dev, Dan Nowlin, Paul M Stillwell Jr, Xiaolong Ye, Qi Zhang
  Cc: Jesse Brandeburg, bruce.richardson, ian.stokes, stable

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

Fix a static analysis warning where if the 16-bit value in mask has the high-bit
set, it will be sign extended by the shift left (which converts it to a signed
integer). Avoid this by casting to a u32 to make sure the conversion happens
before the shift and that it stays unsigned.

Fixes: 9467486f179f ("net/ice/base: enable masking for RSS and FD field vectors")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index e06dbb0885..413b6f8ece 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -1534,16 +1534,14 @@ ice_write_prof_mask_reg(struct ice_hw *hw, enum ice_block blk, u16 mask_idx,
 	switch (blk) {
 	case ICE_BLK_RSS:
 		offset = GLQF_HMASK(mask_idx);
-		val = (idx << GLQF_HMASK_MSK_INDEX_S) &
-			GLQF_HMASK_MSK_INDEX_M;
-		val |= (mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
+		val = (idx << GLQF_HMASK_MSK_INDEX_S) & GLQF_HMASK_MSK_INDEX_M;
+		val |= ((u32)mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
 		break;
 	case ICE_BLK_FD:
 		offset = GLQF_FDMASK(mask_idx);
 		val = (idx << GLQF_FDMASK_MSK_INDEX_S) &
 			GLQF_FDMASK_MSK_INDEX_M;
-		val |= (mask << GLQF_FDMASK_MASK_S) &
-			GLQF_FDMASK_MASK_M;
+		val |= ((u32)mask << GLQF_FDMASK_MASK_S) & GLQF_FDMASK_MASK_M;
 		break;
 	default:
 		ice_debug(hw, ICE_DBG_PKG, "No profile masks for block %d\n",
-- 
2.43.0


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

* [PATCH v3 115/129] net/ice/base: fix ice_get_ctx() issue
       [not found] ` <cover.1719313663.git.anatoly.burakov@intel.com>
  2024-06-25 11:12   ` [PATCH v3 020/129] net/ice/base: fix memory leak when checking firmware version Anatoly Burakov
  2024-06-25 11:12   ` [PATCH v3 035/129] net/ice/base: fix sign-extension Anatoly Burakov
@ 2024-06-25 11:14   ` Anatoly Burakov
       [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Anatoly Burakov @ 2024-06-25 11:14 UTC (permalink / raw)
  To: dev, Qiming Yang, Paul M Stillwell Jr, Wenzhuo Lu, Qi Zhang
  Cc: Yahui Cao, bruce.richardson, ian.stokes, stable

From: Yahui Cao <yahui.cao@intel.com>

No need to invert mask since we only reserve the masked bits instead of clear
them.

Fixes: a03c714bfe0b ("net/ice/base: add two helper functions")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Yahui Cao <yahui.cao@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index ad9b95f75e..8fcd27a594 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -5033,7 +5033,7 @@ ice_read_byte(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 
 	ice_memcpy(&dest_byte, src, sizeof(dest_byte), ICE_NONDMA_TO_NONDMA);
 
-	dest_byte &= ~(mask);
+	dest_byte &= mask;
 
 	dest_byte >>= shift_width;
 
@@ -5073,7 +5073,7 @@ ice_read_word(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_word &= ~(CPU_TO_LE16(mask));
+	src_word &= CPU_TO_LE16(mask);
 
 	/* get the data back into host order before shifting */
 	dest_word = LE16_TO_CPU(src_word);
@@ -5124,7 +5124,7 @@ ice_read_dword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_dword &= ~(CPU_TO_LE32(mask));
+	src_dword &= CPU_TO_LE32(mask);
 
 	/* get the data back into host order before shifting */
 	dest_dword = LE32_TO_CPU(src_dword);
@@ -5175,7 +5175,7 @@ ice_read_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_qword &= ~(CPU_TO_LE64(mask));
+	src_qword &= CPU_TO_LE64(mask);
 
 	/* get the data back into host order before shifting */
 	dest_qword = LE64_TO_CPU(src_qword);
-- 
2.43.0


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

* [PATCH v4 015/103] net/ice/base: fix sign-extension
       [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
@ 2024-06-26 11:41     ` Anatoly Burakov
  2024-06-26 11:41     ` [PATCH v4 050/103] net/ice/base: fix wrong definition of board type Anatoly Burakov
  2024-06-26 11:42     ` [PATCH v4 086/103] net/ice/base: fix masking in ice_get_ctx() Anatoly Burakov
  2 siblings, 0 replies; 6+ messages in thread
From: Anatoly Burakov @ 2024-06-26 11:41 UTC (permalink / raw)
  To: dev, Paul M Stillwell Jr, Qi Zhang, Dan Nowlin, Xiaolong Ye
  Cc: Jesse Brandeburg, ian.stokes, bruce.richardson, stable

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

Fix a static analysis warning where if the 16-bit value in mask has the high-bit
set, it will be sign extended by the shift left (which converts it to a signed
integer). Avoid this by casting to a u32 to make sure the conversion happens
before the shift and that it stays unsigned.

Fixes: 9467486f179f ("net/ice/base: enable masking for RSS and FD field vectors")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index e06dbb0885..413b6f8ece 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -1534,16 +1534,14 @@ ice_write_prof_mask_reg(struct ice_hw *hw, enum ice_block blk, u16 mask_idx,
 	switch (blk) {
 	case ICE_BLK_RSS:
 		offset = GLQF_HMASK(mask_idx);
-		val = (idx << GLQF_HMASK_MSK_INDEX_S) &
-			GLQF_HMASK_MSK_INDEX_M;
-		val |= (mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
+		val = (idx << GLQF_HMASK_MSK_INDEX_S) & GLQF_HMASK_MSK_INDEX_M;
+		val |= ((u32)mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
 		break;
 	case ICE_BLK_FD:
 		offset = GLQF_FDMASK(mask_idx);
 		val = (idx << GLQF_FDMASK_MSK_INDEX_S) &
 			GLQF_FDMASK_MSK_INDEX_M;
-		val |= (mask << GLQF_FDMASK_MASK_S) &
-			GLQF_FDMASK_MASK_M;
+		val |= ((u32)mask << GLQF_FDMASK_MASK_S) & GLQF_FDMASK_MASK_M;
 		break;
 	default:
 		ice_debug(hw, ICE_DBG_PKG, "No profile masks for block %d\n",
-- 
2.43.0


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

* [PATCH v4 050/103] net/ice/base: fix wrong definition of board type
       [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
  2024-06-26 11:41     ` [PATCH v4 015/103] net/ice/base: fix sign-extension Anatoly Burakov
@ 2024-06-26 11:41     ` Anatoly Burakov
  2024-06-26 11:42     ` [PATCH v4 086/103] net/ice/base: fix masking in ice_get_ctx() Anatoly Burakov
  2 siblings, 0 replies; 6+ messages in thread
From: Anatoly Burakov @ 2024-06-26 11:41 UTC (permalink / raw)
  To: dev, Qi Zhang, Xiaolong Ye, Paul Greenwalt, Paul M Stillwell Jr
  Cc: Waldemar Dworakowski, ian.stokes, bruce.richardson, stable

From: Waldemar Dworakowski <waldemar.dworakowski@intel.com>

The new version is compliant with implementation and documentation.

Fixes: f4f79aa849b5 ("net/ice/base: add AQC get link topology handle support")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Waldemar Dworakowski <waldemar.dworakowski@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_adminq_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
index c431b82784..d90a5b0d34 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -1746,8 +1746,8 @@ struct ice_aqc_link_topo_addr {
 #define ICE_AQC_LINK_TOPO_HANDLE_M	(0x3FF << ICE_AQC_LINK_TOPO_HANDLE_S)
 /* Used to decode the handle field */
 #define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_M	BIT(9)
-#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_LOM	BIT(9)
-#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ	0
+#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_LOM	0
+#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ	BIT(9)
 #define ICE_AQC_LINK_TOPO_HANDLE_NODE_S		0
 /* In case of a Mezzanine type */
 #define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_NODE_M	\
-- 
2.43.0


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

* [PATCH v4 086/103] net/ice/base: fix masking in ice_get_ctx()
       [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
  2024-06-26 11:41     ` [PATCH v4 015/103] net/ice/base: fix sign-extension Anatoly Burakov
  2024-06-26 11:41     ` [PATCH v4 050/103] net/ice/base: fix wrong definition of board type Anatoly Burakov
@ 2024-06-26 11:42     ` Anatoly Burakov
  2 siblings, 0 replies; 6+ messages in thread
From: Anatoly Burakov @ 2024-06-26 11:42 UTC (permalink / raw)
  To: dev, Qiming Yang, Qi Zhang, Paul M Stillwell Jr, Wenzhuo Lu
  Cc: Yahui Cao, ian.stokes, bruce.richardson, stable

From: Yahui Cao <yahui.cao@intel.com>

No need to invert mask since we only reserve the masked bits instead of clear
them.

Fixes: a03c714bfe0b ("net/ice/base: add two helper functions")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Yahui Cao <yahui.cao@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index c14f66d55b..9a9c8f86e5 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -5014,7 +5014,7 @@ ice_read_byte(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 
 	ice_memcpy(&dest_byte, src, sizeof(dest_byte), ICE_NONDMA_TO_NONDMA);
 
-	dest_byte &= ~(mask);
+	dest_byte &= mask;
 
 	dest_byte >>= shift_width;
 
@@ -5054,7 +5054,7 @@ ice_read_word(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_word &= ~(CPU_TO_LE16(mask));
+	src_word &= CPU_TO_LE16(mask);
 
 	/* get the data back into host order before shifting */
 	dest_word = LE16_TO_CPU(src_word);
@@ -5105,7 +5105,7 @@ ice_read_dword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_dword &= ~(CPU_TO_LE32(mask));
+	src_dword &= CPU_TO_LE32(mask);
 
 	/* get the data back into host order before shifting */
 	dest_dword = LE32_TO_CPU(src_dword);
@@ -5156,7 +5156,7 @@ ice_read_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_qword &= ~(CPU_TO_LE64(mask));
+	src_qword &= CPU_TO_LE64(mask);
 
 	/* get the data back into host order before shifting */
 	dest_qword = LE64_TO_CPU(src_qword);
-- 
2.43.0


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

end of thread, other threads:[~2024-06-26 11:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1718204528.git.anatoly.burakov@intel.com>
     [not found] ` <cover.1719313663.git.anatoly.burakov@intel.com>
2024-06-25 11:12   ` [PATCH v3 020/129] net/ice/base: fix memory leak when checking firmware version Anatoly Burakov
2024-06-25 11:12   ` [PATCH v3 035/129] net/ice/base: fix sign-extension Anatoly Burakov
2024-06-25 11:14   ` [PATCH v3 115/129] net/ice/base: fix ice_get_ctx() issue Anatoly Burakov
     [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
2024-06-26 11:41     ` [PATCH v4 015/103] net/ice/base: fix sign-extension Anatoly Burakov
2024-06-26 11:41     ` [PATCH v4 050/103] net/ice/base: fix wrong definition of board type Anatoly Burakov
2024-06-26 11:42     ` [PATCH v4 086/103] net/ice/base: fix masking in ice_get_ctx() 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).