diff mbox

test: perf: add assert since src_idx cannot be negative

Message ID 1482410624-6163-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit 5ffbdadc12513adb3e8847692d51963cab223084
Headers show

Commit Message

Bill Fischofer Dec. 22, 2016, 12:43 p.m. UTC
Address Bug https://bugs.linaro.org/show_bug.cgi?id=2790 by adding an
assert. odp_packet_input_index() only returns a negative value if the
packet did not originate on an I/O interface, which is known to be false
here.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
 test/common_plat/performance/odp_l2fwd.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.7.4

Comments

Balasubramanian Manoharan Jan. 11, 2017, 1:29 p.m. UTC | #1
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>


On 22 December 2016 at 18:13, Bill Fischofer <bill.fischofer@linaro.org> wrote:
> Address Bug https://bugs.linaro.org/show_bug.cgi?id=2790 by adding an

> assert. odp_packet_input_index() only returns a negative value if the

> packet did not originate on an I/O interface, which is known to be false

> here.

>

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  test/common_plat/performance/odp_l2fwd.c | 2 ++

>  1 file changed, 2 insertions(+)

>

> diff --git a/test/common_plat/performance/odp_l2fwd.c b/test/common_plat/performance/odp_l2fwd.c

> index 651ed10..1fee9ff 100644

> --- a/test/common_plat/performance/odp_l2fwd.c

> +++ b/test/common_plat/performance/odp_l2fwd.c

> @@ -20,6 +20,7 @@

>  #include <unistd.h>

>  #include <errno.h>

>  #include <inttypes.h>

> +#include <assert.h>

>

>  #include <test_debug.h>

>

> @@ -353,6 +354,7 @@ static int run_worker_sched_mode(void *arg)

>

>                 /* packets from the same queue are from the same interface */

>                 src_idx = odp_packet_input_index(pkt_tbl[0]);

> +               assert(src_idx >= 0);

>                 dst_idx = gbl_args->dst_port_from_idx[src_idx];

>                 fill_eth_addrs(pkt_tbl, pkts, dst_idx);

>

> --

> 2.7.4

>
diff mbox

Patch

diff --git a/test/common_plat/performance/odp_l2fwd.c b/test/common_plat/performance/odp_l2fwd.c
index 651ed10..1fee9ff 100644
--- a/test/common_plat/performance/odp_l2fwd.c
+++ b/test/common_plat/performance/odp_l2fwd.c
@@ -20,6 +20,7 @@ 
 #include <unistd.h>
 #include <errno.h>
 #include <inttypes.h>
+#include <assert.h>
 
 #include <test_debug.h>
 
@@ -353,6 +354,7 @@  static int run_worker_sched_mode(void *arg)
 
 		/* packets from the same queue are from the same interface */
 		src_idx = odp_packet_input_index(pkt_tbl[0]);
+		assert(src_idx >= 0);
 		dst_idx = gbl_args->dst_port_from_idx[src_idx];
 		fill_eth_addrs(pkt_tbl, pkts, dst_idx);