DPDK patches and discussions
 help / color / mirror / Atom feed
From: Abdullah Sevincer <abdullah.sevincer@intel.com>
To: dev@dpdk.org
Cc: jerinj@marvell.com, Abdullah Sevincer <abdullah.sevincer@intel.com>
Subject: [PATCH v2 2/4] event/dlb2: add check valid producer coremask
Date: Wed, 12 Oct 2022 18:50:35 -0500	[thread overview]
Message-ID: <20221012235037.3293072-2-abdullah.sevincer@intel.com> (raw)
In-Reply-To: <20221012235037.3293072-1-abdullah.sevincer@intel.com>

This commit add checks during port probing
for validating producer core masks if
they are a subset of eal coremask. Error
is returned if producer coremask is not a subset
of eal coremask.

Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>
---
 drivers/event/dlb2/pf/base/dlb2_resource.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c
index 3f36acb6a4..dd8390a013 100644
--- a/drivers/event/dlb2/pf/base/dlb2_resource.c
+++ b/drivers/event/dlb2/pf/base/dlb2_resource.c
@@ -918,9 +918,8 @@ int
 dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args)
 {
 	const struct dlb2_devargs *args = (const struct dlb2_devargs *)probe_args;
-	const char *mask = NULL;
-	int cpu = 0, cnt = 0, cores[RTE_MAX_LCORE];
-	int i;
+	const char *mask = args ? args->producer_coremask : NULL;
+	int cpu = 0, cnt = 0, cores[RTE_MAX_LCORE], i;
 
 	if (args) {
 		mask = (const char *)args->producer_coremask;
@@ -933,16 +932,17 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args)
 
 	hw->num_prod_cores = 0;
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		bool is_pcore = (mask && cores[i] != -1);
+
 		if (rte_lcore_is_enabled(i)) {
-			if (mask) {
+			if (is_pcore) {
 				/*
 				 * Populate the producer cores from parsed
 				 * coremask
 				 */
-				if (cores[i] != -1) {
-					hw->prod_core_list[cores[i]] = i;
-					hw->num_prod_cores++;
-				}
+				hw->prod_core_list[cores[i]] = i;
+				hw->num_prod_cores++;
+
 			} else if ((++cnt == DLB2_EAL_PROBE_CORE ||
 			   rte_lcore_count() < DLB2_EAL_PROBE_CORE)) {
 				/*
@@ -952,7 +952,12 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args)
 				cpu = i;
 				break;
 			}
+		} else if (is_pcore) {
+			DLB2_LOG_ERR("Producer coremask(%s) must be a subset of EAL coremask",
+				     mask);
+			return -1;
 		}
+
 	}
 	/* Use the first core in producer coremask to probe */
 	if (hw->num_prod_cores)
-- 
2.25.1


  reply	other threads:[~2022-10-12 23:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221012143247.3239356-1-abdullah.sevincer@intel.com, shivani.doneria@intel.com>
2022-10-12 23:50 ` [PATCH v2 1/4] event/dlb2: remove cos from port probing Abdullah Sevincer
2022-10-12 23:50   ` Abdullah Sevincer [this message]
2022-10-12 23:50   ` [PATCH v2 3/4] event/dlb2: remove cos from devargs Abdullah Sevincer
2022-10-12 23:50   ` [PATCH v2 4/4] event/dlb2: fix port cos override calculation Abdullah Sevincer
2022-10-13  6:44     ` 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=20221012235037.3293072-2-abdullah.sevincer@intel.com \
    --to=abdullah.sevincer@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).