[2/2] examples/performance-thread: fix undef behavior
diff mbox series

Message ID 20201016060349.19940-2-honnappa.nagarahalli@arm.com
State Accepted, archived
Delegated to: David Marchand
Headers show
Series
  • [1/2] test/rcu: fix array subscript is above array bounds
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Honnappa Nagarahalli Oct. 16, 2020, 6:03 a.m. UTC
When the value of RTE_MAX_LCORE is small, it results in the
following compilation error.

../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
iteration 4 invokes undefined behavior
[-Werror=aggressive-loop-optimizations]

Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
Cc: ian.betts@intel.com
Cc: stable@dpdk.org

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/performance-thread/l3fwd-thread/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lukasz Wojciechowski Oct. 20, 2020, 10:46 p.m. UTC | #1
Looks good!

W dniu 16.10.2020 o 08:03, Honnappa Nagarahalli pisze:
> When the value of RTE_MAX_LCORE is small, it results in the
> following compilation error.
>
> ../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
> iteration 4 invokes undefined behavior
> [-Werror=aggressive-loop-optimizations]
>
> Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
> Cc: ian.betts@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
     Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
     Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> ---
>   examples/performance-thread/l3fwd-thread/main.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
> index 818e483d2..dc34d4893 100644
> --- a/examples/performance-thread/l3fwd-thread/main.c
> +++ b/examples/performance-thread/l3fwd-thread/main.c
> @@ -599,8 +599,8 @@ struct thread_rx_conf rx_thread[MAX_RX_THREAD];
>   struct thread_tx_conf {
>   	struct thread_conf conf;
>   
> -	uint16_t tx_queue_id[RTE_MAX_LCORE];
> -	struct mbuf_table tx_mbufs[RTE_MAX_LCORE];
> +	uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
> +	struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
>   
>   	struct rte_ring *ring;
>   	struct lthread_cond **ready;
David Marchand Oct. 30, 2020, 2:26 p.m. UTC | #2
On Fri, Oct 16, 2020 at 8:04 AM Honnappa Nagarahalli
<honnappa.nagarahalli@arm.com> wrote:
>
> When the value of RTE_MAX_LCORE is small, it results in the
> following compilation error.
>
> ../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
> iteration 4 invokes undefined behavior
> [-Werror=aggressive-loop-optimizations]

Lucky to catch this incorrect array size because of a change in
RTE_MAX_LCORE :-).

>
> Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
> Cc: ian.betts@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  examples/performance-thread/l3fwd-thread/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
> index 818e483d2..dc34d4893 100644
> --- a/examples/performance-thread/l3fwd-thread/main.c
> +++ b/examples/performance-thread/l3fwd-thread/main.c
> @@ -599,8 +599,8 @@ struct thread_rx_conf rx_thread[MAX_RX_THREAD];
>  struct thread_tx_conf {
>         struct thread_conf conf;
>
> -       uint16_t tx_queue_id[RTE_MAX_LCORE];
> -       struct mbuf_table tx_mbufs[RTE_MAX_LCORE];
> +       uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
> +       struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
>
>         struct rte_ring *ring;
>         struct lthread_cond **ready;
> --
> 2.17.1
>

Reviewed-by: David Marchand <david.marchand@redhat.com>

Patch
diff mbox series

diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 818e483d2..dc34d4893 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -599,8 +599,8 @@  struct thread_rx_conf rx_thread[MAX_RX_THREAD];
 struct thread_tx_conf {
 	struct thread_conf conf;
 
-	uint16_t tx_queue_id[RTE_MAX_LCORE];
-	struct mbuf_table tx_mbufs[RTE_MAX_LCORE];
+	uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
+	struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
 
 	struct rte_ring *ring;
 	struct lthread_cond **ready;