DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH v2] eventdev: fix port link and unlink
Date: Tue, 3 Oct 2023 20:38:29 +0530	[thread overview]
Message-ID: <20231003150829.8257-1-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20231003150131.6786-1-pbhagavatula@marvell.com>

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Port link and unlink rely on info get API to validate max
supported profiles, the default max profiles is initialized
in ``rte_dev_info_get`` API, use it instead of invoking
driver callback.

Fixes: 162aa4e1b479 ("eventdev: introduce link profiles")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/eventdev/rte_eventdev.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 5ee8bd665b..64fd5a70ae 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -995,10 +995,10 @@ rte_event_port_profile_links_set(uint8_t dev_id, uint8_t port_id, const uint8_t
 	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, EINVAL, 0);
 	dev = &rte_eventdevs[dev_id];
 
-	if (*dev->dev_ops->dev_infos_get == NULL)
-		return -ENOTSUP;
+	diag = rte_event_dev_info_get(dev_id, &info);
+	if (diag < 0)
+		return diag;
 
-	(*dev->dev_ops->dev_infos_get)(dev, &info);
 	if (profile_id >= RTE_EVENT_MAX_PROFILES_PER_PORT ||
 	    profile_id >= info.max_profiles_per_port) {
 		RTE_EDEV_LOG_ERR("Invalid profile_id=%" PRIu8, profile_id);
@@ -1083,10 +1083,10 @@ rte_event_port_profile_unlink(uint8_t dev_id, uint8_t port_id, uint8_t queues[],
 	RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, EINVAL, 0);
 	dev = &rte_eventdevs[dev_id];
 
-	if (*dev->dev_ops->dev_infos_get == NULL)
-		return -ENOTSUP;
+	diag = rte_event_dev_info_get(dev_id, &info);
+	if (diag < 0)
+		return diag;
 
-	(*dev->dev_ops->dev_infos_get)(dev, &info);
 	if (profile_id >= RTE_EVENT_MAX_PROFILES_PER_PORT ||
 	    profile_id >= info.max_profiles_per_port) {
 		RTE_EDEV_LOG_ERR("Invalid profile_id=%" PRIu8, profile_id);
@@ -1219,16 +1219,16 @@ rte_event_port_profile_links_get(uint8_t dev_id, uint8_t port_id, uint8_t queues
 {
 	struct rte_event_dev_info info;
 	struct rte_eventdev *dev;
+	int i, diag, count = 0;
 	uint16_t *links_map;
-	int i, count = 0;
 
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-
 	dev = &rte_eventdevs[dev_id];
-	if (*dev->dev_ops->dev_infos_get == NULL)
-		return -ENOTSUP;
 
-	(*dev->dev_ops->dev_infos_get)(dev, &info);
+	diag = rte_event_dev_info_get(dev_id, &info);
+	if (diag < 0)
+		return diag;
+
 	if (profile_id >= RTE_EVENT_MAX_PROFILES_PER_PORT ||
 	    profile_id >= info.max_profiles_per_port) {
 		RTE_EDEV_LOG_ERR("Invalid profile_id=%" PRIu8, profile_id);
-- 
2.25.1


      reply	other threads:[~2023-10-03 15:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 15:01 [PATCH] " pbhagavatula
2023-10-03 15:08 ` pbhagavatula [this message]

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=20231003150829.8257-1-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=bruce.richardson@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).