From: Pavan Nikhilesh <pbhagavat...@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 <pbhagavat...@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 via email to