Skip to contentSkip to conversation

DLB2: cq_weight fixes

PATCH Superseded Timothy McDaniel 2 participants 10 messages Jul 6, 2022 – Jul 11, 2022

lore
Share & tools
lore
#0 lore raw

cover DLB2: cq_weight fixes

This patch series contains the following:
- fix coverity issue 379234
- improve error reporting for cq_weight feature

Timothy McDaniel (2):
event/dlb2: fix cq_weight array overflow
event/dlb2: improve cq_weight error messages

 drivers/event/dlb2/dlb2.c                  | 8 ++++----
 drivers/event/dlb2/dlb2_priv.h             | 2 +-
 drivers/event/dlb2/pf/base/dlb2_resource.c | 3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 event/dlb2: fix cq_weight array overflow

The cq_weight array must be sized for the maximum number of eventdev ports, not the the maximum number of DLB2 load balanced ports.

This commit fixes the above array sizing bug and resultant coverity warning.

Coverity issue: 379234

Fixes ffa46fc4a2b5 ("event/dlb2: support CQ weight")
---
 drivers/event/dlb2/dlb2.c      | 4 ++--
 drivers/event/dlb2/dlb2_priv.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
index 26af75beb8..93bf215762 100644
@@ -137,7 +137,7 @@ set_cq_weight(const char *key __rte_unused,
 	 */
 	if (sscanf(value, "all:%d", &weight) == 1) {
 		first = 0;
-		last = DLB2_MAX_NUM_LDB_PORTS - 1;
+		last = DLB2_MAX_NUM_PORTS_ALL - 1;
 	} else if (sscanf(value, "%d-%d:%d", &first, &last, &weight) == 3) {
 		/* we have everything we need */
 	} else if (sscanf(value, "%d:%d", &first, &weight) == 2) {
@@ -148,7 +148,7 @@ set_cq_weight(const char *key __rte_unused,
 	}
 
 	if (first > last || first < 0 ||
-		last >= DLB2_MAX_NUM_LDB_PORTS) {
+		last >= DLB2_MAX_NUM_PORTS_ALL) {
 		DLB2_LOG_ERR("Error parsing ldb port qe weight arg, invalid port value\n");
 		return -EINVAL;
 	}
drivers/event/dlb2/dlb2_priv.h +1 -1
index 1edea83a5b..db431f7d8b 100644
@@ -641,7 +641,7 @@ struct dlb2_qid_depth_thresholds {
 };
 
 struct dlb2_cq_weight {
-	int limit[DLB2_MAX_NUM_LDB_PORTS];
+	int limit[DLB2_MAX_NUM_PORTS_ALL];
 };
 
 struct dlb2_port_cos {
Signature · 1 line
2.25.1
#2 lore raw

v2 cover DLB2: cq_weight fixes

This patch series contains the following:
- fix coverity issue 379234
- improve error reporting for cq_weight feature

Changes since V1
- fixed a repeated word in the commit message of patch 1

Timothy McDaniel (2):
event/dlb2: fix cq_weight array overflow
event/dlb2: improve cq_weight error messages

 drivers/event/dlb2/dlb2.c                  | 8 ++++----
 drivers/event/dlb2/dlb2_priv.h             | 2 +-
 drivers/event/dlb2/pf/base/dlb2_resource.c | 3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 1/2 event/dlb2: fix cq_weight array overflow

The cq_weight array must be sized for the maximum number of eventdev ports, not the maximum number of DLB2 load balanced ports.

This commit fixes the above array sizing bug and resultant coverity warning.

Coverity issue: 379234

Fixes ffa46fc4a2b5 ("event/dlb2: support CQ weight")
---
 drivers/event/dlb2/dlb2.c      | 4 ++--
 drivers/event/dlb2/dlb2_priv.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
index 26af75beb8..93bf215762 100644
@@ -137,7 +137,7 @@ set_cq_weight(const char *key __rte_unused,
 	 */
 	if (sscanf(value, "all:%d", &weight) == 1) {
 		first = 0;
-		last = DLB2_MAX_NUM_LDB_PORTS - 1;
+		last = DLB2_MAX_NUM_PORTS_ALL - 1;
 	} else if (sscanf(value, "%d-%d:%d", &first, &last, &weight) == 3) {
 		/* we have everything we need */
 	} else if (sscanf(value, "%d:%d", &first, &weight) == 2) {
@@ -148,7 +148,7 @@ set_cq_weight(const char *key __rte_unused,
 	}
 
 	if (first > last || first < 0 ||
-		last >= DLB2_MAX_NUM_LDB_PORTS) {
+		last >= DLB2_MAX_NUM_PORTS_ALL) {
 		DLB2_LOG_ERR("Error parsing ldb port qe weight arg, invalid port value\n");
 		return -EINVAL;
 	}
drivers/event/dlb2/dlb2_priv.h +1 -1
index 1edea83a5b..db431f7d8b 100644
@@ -641,7 +641,7 @@ struct dlb2_qid_depth_thresholds {
 };
 
 struct dlb2_cq_weight {
-	int limit[DLB2_MAX_NUM_LDB_PORTS];
+	int limit[DLB2_MAX_NUM_PORTS_ALL];
 };
 
 struct dlb2_port_cos {
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 2/2 event/dlb2: improve cq_weight error messages

In reply to Timothy McDaniel

This commit changes 2 error messages to better describe cq_weight related errors, should one occur.

Fixes ffa46fc4a2b5 ("event/dlb2: support CQ weight")
---
 drivers/event/dlb2/dlb2.c                  | 4 ++--
 drivers/event/dlb2/pf/base/dlb2_resource.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
index 93bf215762..5a443acff8 100644
@@ -1527,8 +1527,8 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2,
 
 	if (dlb2->version == DLB2_HW_V2 && ev_port->cq_weight != 0 &&
 	    ev_port->cq_weight > dequeue_depth) {
-		DLB2_LOG_ERR("dlb2: invalid cq depth, must be >= cq weight%d\n",
-			     DLB2_MIN_ENQUEUE_DEPTH);
+		DLB2_LOG_ERR("dlb2: invalid cq dequeue depth %d, must be >= cq weight %d\n",
+			     dequeue_depth, ev_port->cq_weight);
 		return -EINVAL;
 	}
 
drivers/event/dlb2/pf/base/dlb2_resource.c +3 -0
index e73d289445..0731416a43 100644
@@ -6397,6 +6397,9 @@ dlb2_verify_enable_cq_weight_args(struct dlb2_hw *hw,
 	struct dlb2_ldb_port *port;
 
 	if (hw->ver == DLB2_HW_V2) {
+		DLB2_HW_ERR(hw,
+			    "[%s():%d] CQ weight feature requires DLB 2.5 or later\n",
+			    __func__, __LINE__);
 		resp->status = DLB2_ST_FEATURE_UNAVAILABLE;
 		return -EINVAL;
 	}
Signature · 1 line
2.25.1
#5 lore raw
In reply to Timothy McDaniel

06/07/2022 23:46, Timothy McDaniel:

Quoted 10 lines

This patch series contains the following:
- fix coverity issue 379234
- improve error reporting for cq_weight feature

Changes since V1
- fixed a repeated word in the commit message of patch 1

Timothy McDaniel (2):
event/dlb2: fix cq_weight array overflow
event/dlb2: improve cq_weight error messages

Should we merge those patches in 22.07-rc4? No risk?

#6 lore raw
Quoted 15 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, July 8, 2022 9:26 AM
To: McDaniel, Timothy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 0/2] DLB2: cq_weight fixes

06/07/2022 23:46, Timothy McDaniel:

Quoted 4 lines

This patch series contains the following:
- fix coverity issue 379234
- improve error reporting for cq_weight feature

Quoted 8 lines
Quoted 6 lines

Changes since V1
- fixed a repeated word in the commit message of patch 1

Timothy McDaniel (2):
event/dlb2: fix cq_weight array overflow
event/dlb2: improve cq_weight error messages

Should we merge those patches in 22.07-rc4? No risk?

I see no risk in merging these changes. I retested with them, and one fixes a coverity issue.

#7 lore raw

08/07/2022 17:02, McDaniel, Timothy:

Quoted 9 lines

From: Thomas Monjalon <[email protected]>

Quoted 8 lines

06/07/2022 23:46, Timothy McDaniel:

Quoted 7 lines

This patch series contains the following:
- fix coverity issue 379234
- improve error reporting for cq_weight feature

Changes since V1
- fixed a repeated word in the commit message of patch 1

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Timothy McDaniel (2):
event/dlb2: fix cq_weight array overflow
event/dlb2: improve cq_weight error messages

Should we merge those patches in 22.07-rc4? No risk?

I see no risk in merging these changes. I retested with them, and one fixes a coverity issue.

Applied, thanks.

#8 lore raw
Quoted 24 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, July 11, 2022 3:31 PM
To: McDaniel, Timothy <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 0/2] DLB2: cq_weight fixes

08/07/2022 17:02, McDaniel, Timothy:

Quoted 13 lines

From: Thomas Monjalon <[email protected]>

Quoted 12 lines

06/07/2022 23:46, Timothy McDaniel:

Quoted 10 lines

This patch series contains the following:
- fix coverity issue 379234
- improve error reporting for cq_weight feature

Changes since V1
- fixed a repeated word in the commit message of patch 1

Timothy McDaniel (2):
event/dlb2: fix cq_weight array overflow
event/dlb2: improve cq_weight error messages

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Should we merge those patches in 22.07-rc4? No risk?

I see no risk in merging these changes. I retested with them, and one fixes a

coverity issue.

Applied, thanks.

Thank you, Thomas!

--Tim

#9 lore raw

PATCH 2/2 event/dlb2: improve cq_weight error messages

In reply to Timothy McDaniel

This commit changes 2 error messages to better describe cq_weight related errors, should one occur.

Fixes ffa46fc4a2b5 ("event/dlb2: support CQ weight")
---
 drivers/event/dlb2/dlb2.c                  | 4 ++--
 drivers/event/dlb2/pf/base/dlb2_resource.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/event/dlb2/dlb2.c +2 -2
index 93bf215762..5a443acff8 100644
@@ -1527,8 +1527,8 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2,
 
 	if (dlb2->version == DLB2_HW_V2 && ev_port->cq_weight != 0 &&
 	    ev_port->cq_weight > dequeue_depth) {
-		DLB2_LOG_ERR("dlb2: invalid cq depth, must be >= cq weight%d\n",
-			     DLB2_MIN_ENQUEUE_DEPTH);
+		DLB2_LOG_ERR("dlb2: invalid cq dequeue depth %d, must be >= cq weight %d\n",
+			     dequeue_depth, ev_port->cq_weight);
 		return -EINVAL;
 	}
 
drivers/event/dlb2/pf/base/dlb2_resource.c +3 -0
index e73d289445..0731416a43 100644
@@ -6397,6 +6397,9 @@ dlb2_verify_enable_cq_weight_args(struct dlb2_hw *hw,
 	struct dlb2_ldb_port *port;
 
 	if (hw->ver == DLB2_HW_V2) {
+		DLB2_HW_ERR(hw,
+			    "[%s():%d] CQ weight feature requires DLB 2.5 or later\n",
+			    __func__, __LINE__);
 		resp->status = DLB2_ST_FEATURE_UNAVAILABLE;
 		return -EINVAL;
 	}
Signature · 1 line
2.25.1