test: tm: do lookup first then open

Message ID 1479497905-9650-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Nov. 18, 2016, 7:38 p.m.
First tests will open pktio and all others will look up
handle by name. Change order of open/lookup to not call
fail opens.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
 .../validation/api/traffic_mngr/traffic_mngr.c            | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

-- 
2.7.1.250.gff4ea60

Comments

Mike Holmes Nov. 29, 2016, 1:48 p.m. | #1
Bala, can you review this one as TM lead

On 18 November 2016 at 14:38, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> First tests will open pktio and all others will look up

> handle by name. Change order of open/lookup to not call

> fail opens.

>

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

> ---

>  .../validation/api/traffic_mngr/traffic_mngr.c            | 15

> ++++++++-------

>  1 file changed, 8 insertions(+), 7 deletions(-)

>

> diff --git a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c

> b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c

> index c7bde40..2829662 100644

> --- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c

> +++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c

> @@ -497,14 +497,15 @@ static int open_pktios(void)

>                 }

>

>                 pools[iface] = pkt_pool;

> -               pktio = odp_pktio_open(iface_name[iface], pkt_pool,

> -                                      &pktio_param);

> +

> +               pktio = odp_pktio_lookup(iface_name[iface]);

>                 if (pktio == ODP_PKTIO_INVALID)

> -                       pktio = odp_pktio_lookup(iface_name[iface]);

> -               if (pktio == ODP_PKTIO_INVALID) {

> -                       LOG_ERR("odp_pktio_open() failed\n");

> -                       return -1;

> -               }

> +                       pktio = odp_pktio_open(iface_name[iface],

> pkt_pool,

> +                                              &pktio_param);

> +                       if (pktio == ODP_PKTIO_INVALID) {

> +                               LOG_ERR("odp_pktio_open() failed\n");

> +                               return -1;

> +                       }

>

>                 /* Set defaults for PktIn and PktOut queues */

>                 (void)odp_pktin_queue_config(pktio, NULL);

> --

> 2.7.1.250.gff4ea60

>

>



-- 
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"

Patch

diff --git a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c
index c7bde40..2829662 100644
--- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c
+++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c
@@ -497,14 +497,15 @@  static int open_pktios(void)
 		}
 
 		pools[iface] = pkt_pool;
-		pktio = odp_pktio_open(iface_name[iface], pkt_pool,
-				       &pktio_param);
+
+		pktio = odp_pktio_lookup(iface_name[iface]);
 		if (pktio == ODP_PKTIO_INVALID)
-			pktio = odp_pktio_lookup(iface_name[iface]);
-		if (pktio == ODP_PKTIO_INVALID) {
-			LOG_ERR("odp_pktio_open() failed\n");
-			return -1;
-		}
+			pktio = odp_pktio_open(iface_name[iface], pkt_pool,
+					       &pktio_param);
+			if (pktio == ODP_PKTIO_INVALID) {
+				LOG_ERR("odp_pktio_open() failed\n");
+				return -1;
+			}
 
 		/* Set defaults for PktIn and PktOut queues */
 		(void)odp_pktin_queue_config(pktio, NULL);