DPDK patches and discussions
 help / color / mirror / Atom feed
From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: jerinj@marvell.com
Cc: dev@dpdk.org, timothy.mcdaniel@intel.com
Subject: [PATCH v3 5/5] event/dlb2: fix port COS initialization
Date: Sat,  2 Jul 2022 11:22:39 -0500	[thread overview]
Message-ID: <20220702162239.1646548-6-timothy.mcdaniel@intel.com> (raw)
In-Reply-To: <20220702162239.1646548-1-timothy.mcdaniel@intel.com>

Fix cos initialization, handling the default case too.

Substitute the semicolon for the comma
that was expected in the cos_bw command line override.
Commas are not allowed within a multifield option.
The new format is cos_bw=%d:%d:%d:%d, where the sum of
the 4 decimal values must be less than or equal to 100.

Corrected probe-time initialization order.

Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS")
Cc: timothy.mcdaniel@intel.com

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb2/dlb2.c                  | 63 ++++++++++++----------
 drivers/event/dlb2/pf/base/dlb2_resource.c |  3 --
 drivers/event/dlb2/pf/dlb2_pf.c            |  4 ++
 3 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 8a68c25c93..26af75beb8 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -170,10 +170,11 @@ dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos)
 {
 	int q;
 
-	for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) {
-		dlb2->ev_ports[q].cos_id = port_cos[q];
-		dlb2->cos_ports[port_cos[q]]++;
-	}
+	for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++)
+		if (port_cos[q] != DLB2_COS_DEFAULT) {
+			dlb2->ev_ports[q].cos_id = port_cos[q];
+			dlb2->cos_ports[port_cos[q]]++;
+		}
 }
 
 static void
@@ -181,6 +182,17 @@ dlb2_init_cos_bw(struct dlb2_eventdev *dlb2,
 		 struct dlb2_cos_bw *cos_bw)
 {
 	int q;
+
+
+	/* If cos_bw not set, then split evenly */
+	if (cos_bw->val[0] == 0 && cos_bw->val[1] == 0 &&
+		cos_bw->val[2] == 0 && cos_bw->val[3] == 0) {
+		cos_bw->val[0] = 25;
+		cos_bw->val[1] = 25;
+		cos_bw->val[2] = 25;
+		cos_bw->val[3] = 25;
+	}
+
 	for (q = 0; q < DLB2_COS_NUM_VALS; q++)
 		dlb2->cos_bw[q] = cos_bw->val[q];
 
@@ -464,19 +476,15 @@ set_port_cos(const char *key __rte_unused,
 	}
 
 	/* command line override may take one of the following 3 forms:
-	 * port_cos=all:<cos_id> ... all ports
 	 * port_cos=port-port:<cos_id> ... a range of ports
 	 * port_cos=port:<cos_id> ... just one port
 	 */
-	if (sscanf(value, "all:%d", &cos_id) == 1) {
-		first = 0;
-		last = DLB2_MAX_NUM_LDB_PORTS - 1;
-	} else if (sscanf(value, "%d-%d:%d", &first, &last, &cos_id) == 3) {
+	if (sscanf(value, "%d-%d:%d", &first, &last, &cos_id) == 3) {
 		/* we have everything we need */
 	} else if (sscanf(value, "%d:%d", &first, &cos_id) == 2) {
 		last = first;
 	} else {
-		DLB2_LOG_ERR("Error parsing ldb port port_cos devarg. Should be all:val, port-port:val, or port:val\n");
+		DLB2_LOG_ERR("Error parsing ldb port port_cos devarg. Should be port-port:val, or port:val\n");
 		return -EINVAL;
 	}
 
@@ -511,13 +519,13 @@ set_cos_bw(const char *key __rte_unused,
 
 	/* format must be %d,%d,%d,%d */
 
-	if (sscanf(value, "%d,%d,%d,%d", &cos_bw->val[0], &cos_bw->val[1],
+	if (sscanf(value, "%d:%d:%d:%d", &cos_bw->val[0], &cos_bw->val[1],
 		   &cos_bw->val[2], &cos_bw->val[3]) != 4) {
-		DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0,bw1,bw2,bw3 where all values combined are <= 100\n");
+		DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0:bw1:bw2:bw3 where all values combined are <= 100\n");
 		return -EINVAL;
 	}
 	if (cos_bw->val[0] + cos_bw->val[1] + cos_bw->val[2] + cos_bw->val[3] > 100) {
-		DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0,bw1,bw2,bw3  where all values combined are <= 100\n");
+		DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0:bw1:bw2:bw3  where all values combined are <= 100\n");
 		return -EINVAL;
 	}
 
@@ -781,9 +789,9 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2,
 
 	/* LDB ports */
 
-	/* tally of ports with non default COS */
-	cos_ports = dlb2->cos_ports[1] + dlb2->cos_ports[2] +
-		    dlb2->cos_ports[3];
+	/* tally of COS ports from cmd line */
+	cos_ports = dlb2->cos_ports[0] + dlb2->cos_ports[1] +
+		    dlb2->cos_ports[2] + dlb2->cos_ports[3];
 
 	if (cos_ports > resources_asked->num_ldb_ports) {
 		DLB2_LOG_ERR("dlb2: num_ldb_ports < nonzero cos_ports\n");
@@ -4552,6 +4560,17 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,
 	evdev_dlb2_default_info.max_event_port_enqueue_depth =
 		dlb2->max_enq_depth;
 
+	dlb2_init_queue_depth_thresholds(dlb2,
+					 dlb2_args->qid_depth_thresholds.val);
+
+	dlb2_init_cq_weight(dlb2,
+			    dlb2_args->cq_weight.limit);
+
+	dlb2_init_port_cos(dlb2,
+			   dlb2_args->port_cos.cos_id);
+
+	dlb2_init_cos_bw(dlb2,
+			 &dlb2_args->cos_bw);
 
 	err = dlb2_iface_open(&dlb2->qm_instance, name);
 	if (err < 0) {
@@ -4623,18 +4642,6 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,
 
 	dlb2_entry_points_init(dev);
 
-	dlb2_init_queue_depth_thresholds(dlb2,
-					 dlb2_args->qid_depth_thresholds.val);
-
-	dlb2_init_cq_weight(dlb2,
-			    dlb2_args->cq_weight.limit);
-
-	dlb2_init_port_cos(dlb2,
-			   dlb2_args->port_cos.cos_id);
-
-	dlb2_init_cos_bw(dlb2,
-			 &dlb2_args->cos_bw);
-
 	return 0;
 }
 
diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c
index da1949c763..e73d289445 100644
--- a/drivers/event/dlb2/pf/base/dlb2_resource.c
+++ b/drivers/event/dlb2/pf/base/dlb2_resource.c
@@ -236,9 +236,6 @@ int dlb2_resource_init(struct dlb2_hw *hw, enum dlb2_hw_ver ver)
 		hw->rsrcs.sn_groups[i].slot_use_bitmap = 0;
 	}
 
-	for (i = 0; i < DLB2_NUM_COS_DOMAINS; i++)
-		hw->cos_reservation[i] = 100 / DLB2_NUM_COS_DOMAINS;
-
 	return 0;
 
 unwind:
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 086d4a1cc7..dd3f2b8ece 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -712,10 +712,14 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev)
 		.max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH
 	};
 	struct dlb2_eventdev *dlb2;
+	int q;
 
 	DLB2_LOG_DBG("Enter with dev_id=%d socket_id=%d",
 		     eventdev->data->dev_id, eventdev->data->socket_id);
 
+	for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++)
+		dlb2_args.port_cos.cos_id[q] = DLB2_COS_DEFAULT;
+
 	dlb2_pf_iface_fn_ptrs_init();
 
 	pci_dev = RTE_DEV_TO_PCI(eventdev->dev);
-- 
2.25.1


  parent reply	other threads:[~2022-07-02 16:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29 15:36 [PATCH 0/2] DLB2 Bug Fixes Timothy McDaniel
2022-06-29 15:36 ` [PATCH 1/2] event/dlb2: fix port_cos array sizing Timothy McDaniel
2022-06-29 15:36 ` [PATCH 2/2] event/dlb2: Fix initialization of cos bandwidth args Timothy McDaniel
2022-07-02 16:03 ` [PATCH v2 0/5] DLB2 Bug Fixes Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 1/5] event/dlb2: fix port_cos array sizing Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 2/5] event/dlb2: fix initialization of cos bandwidth args Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 3/5] event/dlb2: fix cq depth override Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 4/5] event/dlb2: fix cq depth override credit deadlock Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 5/5] event/dlb2: fix port COS initialization Timothy McDaniel
2022-07-02 16:22 ` [PATCH v3 0/5] DLB2 Bug Fixes Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 1/5] event/dlb2: fix port_cos array sizing Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 2/5] event/dlb2: fix initialization of cos bandwidth args Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 3/5] event/dlb2: fix cq depth override Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 4/5] event/dlb2: fix cq depth override credit deadlock Timothy McDaniel
2022-07-02 16:22   ` Timothy McDaniel [this message]
2022-07-04 16:11     ` [PATCH v3 5/5] event/dlb2: fix port COS initialization Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220702162239.1646548-6-timothy.mcdaniel@intel.com \
    --to=timothy.mcdaniel@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).