[v1] app/test: fix segfault in Tx adapter autotest

Message ID 20240226083003.317553-1-ganapati.kundapura@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v1] app/test: fix segfault in Tx adapter autotest |

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/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Ganapati Kundapura Feb. 26, 2024, 8:30 a.m. UTC
  Uninitialized mbufs are enqueued to eventdev which causes segfault
on freeing the mbuf in tx adapter.
Fixed by initializing mbufs before enqueuing to eventdev.

Fixes: 46cf97e4bbfa ("eventdev: add test for eth Tx adapter")

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
  

Comments

Pavan Nikhilesh Bhagavatula Feb. 26, 2024, 1 p.m. UTC | #1
> Uninitialized mbufs are enqueued to eventdev which causes segfault
> on freeing the mbuf in tx adapter.
> Fixed by initializing mbufs before enqueuing to eventdev.
> 
> Fixes: 46cf97e4bbfa ("eventdev: add test for eth Tx adapter")
> 
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

> 
> diff --git a/app/test/test_event_eth_tx_adapter.c
> b/app/test/test_event_eth_tx_adapter.c
> index dbd22f6..482b8e6 100644
> --- a/app/test/test_event_eth_tx_adapter.c
> +++ b/app/test/test_event_eth_tx_adapter.c
> @@ -484,6 +484,10 @@ tx_adapter_service(void)
>  	int internal_port;
>  	uint32_t cap;
> 
> +	/* Initialize mbufs */
> +	for (i = 0; i < RING_SIZE; i++)
> +		rte_pktmbuf_reset(&bufs[i]);
> +
>  	memset(&dev_conf, 0, sizeof(dev_conf));
>  	err = rte_event_eth_tx_adapter_caps_get(TEST_DEV_ID,
> TEST_ETHDEV_ID,
>  						&cap);
> --
> 2.6.4
  
Jerin Jacob Feb. 28, 2024, 9:55 a.m. UTC | #2
On Mon, Feb 26, 2024 at 6:30 PM Pavan Nikhilesh Bhagavatula
<pbhagavatula@marvell.com> wrote:
>
> > Uninitialized mbufs are enqueued to eventdev which causes segfault
> > on freeing the mbuf in tx adapter.
> > Fixed by initializing mbufs before enqueuing to eventdev.
> >
> > Fixes: 46cf97e4bbfa ("eventdev: add test for eth Tx adapter")
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
>
> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Applied to dpdk-next-eventdev/for-main. Thanks


>
> >
> > diff --git a/app/test/test_event_eth_tx_adapter.c
> > b/app/test/test_event_eth_tx_adapter.c
> > index dbd22f6..482b8e6 100644
> > --- a/app/test/test_event_eth_tx_adapter.c
> > +++ b/app/test/test_event_eth_tx_adapter.c
> > @@ -484,6 +484,10 @@ tx_adapter_service(void)
> >       int internal_port;
> >       uint32_t cap;
> >
> > +     /* Initialize mbufs */
> > +     for (i = 0; i < RING_SIZE; i++)
> > +             rte_pktmbuf_reset(&bufs[i]);
> > +
> >       memset(&dev_conf, 0, sizeof(dev_conf));
> >       err = rte_event_eth_tx_adapter_caps_get(TEST_DEV_ID,
> > TEST_ETHDEV_ID,
> >                                               &cap);
> > --
> > 2.6.4
>
  

Patch

diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index dbd22f6..482b8e6 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -484,6 +484,10 @@  tx_adapter_service(void)
 	int internal_port;
 	uint32_t cap;
 
+	/* Initialize mbufs */
+	for (i = 0; i < RING_SIZE; i++)
+		rte_pktmbuf_reset(&bufs[i]);
+
 	memset(&dev_conf, 0, sizeof(dev_conf));
 	err = rte_event_eth_tx_adapter_caps_get(TEST_DEV_ID, TEST_ETHDEV_ID,
 						&cap);