eventdev/eth_rx: fix return of rx adapter instance get

Message ID f4064ff0ebf4063203d6105bd86dfd2f72d74ec4.1672751275.git.sthotton@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series eventdev/eth_rx: fix return of rx adapter instance get |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Shijith Thotton Jan. 3, 2023, 1:09 p.m. UTC
  The API to get rx adapter instance is returning error for event devices
with internal port capability and eth_rx_adapter_instance_get op
undefined. But as the Rx adapter is internally maintaining the queue
information needed to find the instance id, event devices can opt out
from defining the op. Modified code to match this logic.

Fixes: a1793ee8aba0 ("eventdev/eth_rx: add adapter instance get API")

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
  

Comments

Jerin Jacob Jan. 17, 2023, 3:19 p.m. UTC | #1
On Tue, Jan 3, 2023 at 6:39 PM Shijith Thotton <sthotton@marvell.com> wrote:
>
> The API to get rx adapter instance is returning error for event devices
> with internal port capability and eth_rx_adapter_instance_get op
> undefined. But as the Rx adapter is internally maintaining the queue
> information needed to find the instance id, event devices can opt out
> from defining the op. Modified code to match this logic.
>
> Fixes: a1793ee8aba0 ("eventdev/eth_rx: add adapter instance get API")
>
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>

@Naga Harish K, S V (rx_adapter maintainer) please review this patch.

> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index cf7bbd4d69..170823a03c 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -3415,14 +3415,10 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
>                 if (!rte_event_eth_rx_adapter_caps_get(rx_adapter->eventdev_id,
>                                                       eth_dev_id,
>                                                       &caps)) {
> -                       if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
> -                               ret = rxa_dev_instance_get(rx_adapter) ?
> -                                               rxa_dev_instance_get(rx_adapter)
> -                                                               (eth_dev_id,
> -                                                                rx_queue_id,
> -                                                                rxa_inst_id)
> -                                                       : -EINVAL;
> -                       }
> +                       if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT &&
> +                           rxa_dev_instance_get(rx_adapter))
> +                               ret = rxa_dev_instance_get(rx_adapter)(eth_dev_id, rx_queue_id,
> +                                                                      rxa_inst_id);
>                 }
>
>                 /* return if entry found */
> --
> 2.25.1
>
  
Jerin Jacob Feb. 7, 2023, 7:17 a.m. UTC | #2
On Tue, Jan 3, 2023 at 6:39 PM Shijith Thotton <sthotton@marvell.com> wrote:
>
> The API to get rx adapter instance is returning error for event devices
> with internal port capability and eth_rx_adapter_instance_get op
> undefined. But as the Rx adapter is internally maintaining the queue
> information needed to find the instance id, event devices can opt out
> from defining the op. Modified code to match this logic.
>
> Fixes: a1793ee8aba0 ("eventdev/eth_rx: add adapter instance get API")
>
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>


Updated the git commit as follows and applied to
dpdk-next-net-eventdev/for-main. Thanks

    eventdev/eth_rx: fix return adapter instance get

    The API to get rx adapter instance is returning error for event devices
    with internal port capability and eth_rx_adapter_instance_get op
    undefined. But as the Rx adapter is internally maintaining the queue
    information needed to find the instance id, event devices can opt out
    from defining the op. Modified code to match this logic.

    Fixes: a1793ee8aba0 ("eventdev/eth_rx: add adapter instance get API")
    Cc: stable@dpdk.org

    Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index cf7bbd4d69..170823a03c 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -3415,14 +3415,10 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
>                 if (!rte_event_eth_rx_adapter_caps_get(rx_adapter->eventdev_id,
>                                                       eth_dev_id,
>                                                       &caps)) {
> -                       if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
> -                               ret = rxa_dev_instance_get(rx_adapter) ?
> -                                               rxa_dev_instance_get(rx_adapter)
> -                                                               (eth_dev_id,
> -                                                                rx_queue_id,
> -                                                                rxa_inst_id)
> -                                                       : -EINVAL;
> -                       }
> +                       if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT &&
> +                           rxa_dev_instance_get(rx_adapter))
> +                               ret = rxa_dev_instance_get(rx_adapter)(eth_dev_id, rx_queue_id,
> +                                                                      rxa_inst_id);
>                 }
>
>                 /* return if entry found */
> --
> 2.25.1
>
  

Patch

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index cf7bbd4d69..170823a03c 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -3415,14 +3415,10 @@  rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
 		if (!rte_event_eth_rx_adapter_caps_get(rx_adapter->eventdev_id,
 						      eth_dev_id,
 						      &caps)) {
-			if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) {
-				ret = rxa_dev_instance_get(rx_adapter) ?
-						rxa_dev_instance_get(rx_adapter)
-								(eth_dev_id,
-								 rx_queue_id,
-								 rxa_inst_id)
-							: -EINVAL;
-			}
+			if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT &&
+			    rxa_dev_instance_get(rx_adapter))
+				ret = rxa_dev_instance_get(rx_adapter)(eth_dev_id, rx_queue_id,
+								       rxa_inst_id);
 		}
 
 		/* return if entry found */