patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop
@ 2022-07-26  4:22 Naga Harish K S V
  2022-07-26  4:22 ` [PATCH 2/2] eventdev/eth_tx: fix adapter stop Naga Harish K S V
  2022-08-01  6:53 ` [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Jayatheerthan, Jay
  0 siblings, 2 replies; 6+ messages in thread
From: Naga Harish K S V @ 2022-07-26  4:22 UTC (permalink / raw)
  To: jay.jayatheerthan, jerinj; +Cc: dev, stable

add spinlock protection for tx adapter stop and start APIs
add null check for tx adapter service pointer in adapter start/stop apis.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 lib/eventdev/rte_event_eth_tx_adapter.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index a237e8edba..3251dad61f 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -44,7 +44,7 @@
 #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \
 do { \
 	if (!txa_valid_id(id)) { \
-		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
+		RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \
 		return retval; \
 	} \
 } while (0)
@@ -468,10 +468,13 @@ txa_service_ctrl(uint8_t id, int start)
 	struct txa_service_data *txa;
 
 	txa = txa_service_id_to_data(id);
-	if (txa->service_id == TXA_INVALID_SERVICE_ID)
+	if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID)
 		return 0;
 
+	rte_spinlock_lock(&txa->tx_lock);
 	ret = rte_service_runstate_set(txa->service_id, start);
+	rte_spinlock_unlock(&txa->tx_lock);
+
 	if (ret == 0 && !start) {
 		while (rte_service_may_be_active(txa->service_id))
 			rte_pause();
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] eventdev/eth_tx: fix adapter stop
  2022-07-26  4:22 [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Naga Harish K S V
@ 2022-07-26  4:22 ` Naga Harish K S V
  2022-08-01  6:54   ` Jayatheerthan, Jay
  2022-08-01  6:53 ` [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Jayatheerthan, Jay
  1 sibling, 1 reply; 6+ messages in thread
From: Naga Harish K S V @ 2022-07-26  4:22 UTC (permalink / raw)
  To: jay.jayatheerthan, jerinj; +Cc: dev, stable

adapter_stop function is stopping the adapter service using
rte_service_runstate_set() api and waiting until
rte_service_may_be_active() api returns stopped state in an
infinite loop.

This results in hang issues if application calls
rte_service_lcore_stop() before adapter stop.

remove the state check after setting the service state which
avoids running into hang issues. This also makes tx adapter stop
inline with remaining adapters.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 lib/eventdev/rte_event_eth_tx_adapter.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index 3251dad61f..41509ba750 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -475,10 +475,6 @@ txa_service_ctrl(uint8_t id, int start)
 	ret = rte_service_runstate_set(txa->service_id, start);
 	rte_spinlock_unlock(&txa->tx_lock);
 
-	if (ret == 0 && !start) {
-		while (rte_service_may_be_active(txa->service_id))
-			rte_pause();
-	}
 	return ret;
 }
 
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop
  2022-07-26  4:22 [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Naga Harish K S V
  2022-07-26  4:22 ` [PATCH 2/2] eventdev/eth_tx: fix adapter stop Naga Harish K S V
@ 2022-08-01  6:53 ` Jayatheerthan, Jay
  2022-09-09  5:38   ` Naga Harish K, S V
  1 sibling, 1 reply; 6+ messages in thread
From: Jayatheerthan, Jay @ 2022-08-01  6:53 UTC (permalink / raw)
  To: Naga Harish K, S V, jerinj; +Cc: dev, stable

> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Tuesday, July 26, 2022 9:52 AM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinj@marvell.com
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop
> 
> add spinlock protection for tx adapter stop and start APIs
> add null check for tx adapter service pointer in adapter start/stop apis.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
>  lib/eventdev/rte_event_eth_tx_adapter.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index a237e8edba..3251dad61f 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -44,7 +44,7 @@
>  #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \
>  do { \
>  	if (!txa_valid_id(id)) { \
> -		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
> +		RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \
>  		return retval; \
>  	} \
>  } while (0)
> @@ -468,10 +468,13 @@ txa_service_ctrl(uint8_t id, int start)
>  	struct txa_service_data *txa;
> 
>  	txa = txa_service_id_to_data(id);
> -	if (txa->service_id == TXA_INVALID_SERVICE_ID)
> +	if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID)
>  		return 0;
> 
> +	rte_spinlock_lock(&txa->tx_lock);
>  	ret = rte_service_runstate_set(txa->service_id, start);
> +	rte_spinlock_unlock(&txa->tx_lock);
> +
>  	if (ret == 0 && !start) {
>  		while (rte_service_may_be_active(txa->service_id))
>  			rte_pause();
> --
> 2.23.0

There are three different changes in this patch. But since they are quite small, it should be ok.

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/2] eventdev/eth_tx: fix adapter stop
  2022-07-26  4:22 ` [PATCH 2/2] eventdev/eth_tx: fix adapter stop Naga Harish K S V
@ 2022-08-01  6:54   ` Jayatheerthan, Jay
  0 siblings, 0 replies; 6+ messages in thread
From: Jayatheerthan, Jay @ 2022-08-01  6:54 UTC (permalink / raw)
  To: Naga Harish K, S V, jerinj; +Cc: dev, stable

> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Tuesday, July 26, 2022 9:52 AM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; jerinj@marvell.com
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH 2/2] eventdev/eth_tx: fix adapter stop
> 
> adapter_stop function is stopping the adapter service using
> rte_service_runstate_set() api and waiting until
> rte_service_may_be_active() api returns stopped state in an
> infinite loop.
> 
> This results in hang issues if application calls
> rte_service_lcore_stop() before adapter stop.
> 
> remove the state check after setting the service state which
> avoids running into hang issues. This also makes tx adapter stop
> inline with remaining adapters.
> 
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
>  lib/eventdev/rte_event_eth_tx_adapter.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index 3251dad61f..41509ba750 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -475,10 +475,6 @@ txa_service_ctrl(uint8_t id, int start)
>  	ret = rte_service_runstate_set(txa->service_id, start);
>  	rte_spinlock_unlock(&txa->tx_lock);
> 
> -	if (ret == 0 && !start) {
> -		while (rte_service_may_be_active(txa->service_id))
> -			rte_pause();
> -	}
>  	return ret;
>  }
> 
> --
> 2.23.0

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop
  2022-08-01  6:53 ` [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Jayatheerthan, Jay
@ 2022-09-09  5:38   ` Naga Harish K, S V
  2022-09-13 16:04     ` Jerin Jacob
  0 siblings, 1 reply; 6+ messages in thread
From: Naga Harish K, S V @ 2022-09-09  5:38 UTC (permalink / raw)
  To: Jayatheerthan, Jay, jerinj; +Cc: dev, stable

Hi Jerin,
   This patch set is acked by maintainers.
Please review and do the needful.

-Harish

> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Monday, August 1, 2022 12:23 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; jerinj@marvell.com
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter
> start/stop
> 
> > -----Original Message-----
> > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Sent: Tuesday, July 26, 2022 9:52 AM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> > jerinj@marvell.com
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter
> > start/stop
> >
> > add spinlock protection for tx adapter stop and start APIs add null
> > check for tx adapter service pointer in adapter start/stop apis.
> >
> > Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > ---
> >  lib/eventdev/rte_event_eth_tx_adapter.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > index a237e8edba..3251dad61f 100644
> > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > @@ -44,7 +44,7 @@
> >  #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval)
> \
> > do { \
> >  	if (!txa_valid_id(id)) { \
> > -		RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
> > +		RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \
> >  		return retval; \
> >  	} \
> >  } while (0)
> > @@ -468,10 +468,13 @@ txa_service_ctrl(uint8_t id, int start)
> >  	struct txa_service_data *txa;
> >
> >  	txa = txa_service_id_to_data(id);
> > -	if (txa->service_id == TXA_INVALID_SERVICE_ID)
> > +	if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID)
> >  		return 0;
> >
> > +	rte_spinlock_lock(&txa->tx_lock);
> >  	ret = rte_service_runstate_set(txa->service_id, start);
> > +	rte_spinlock_unlock(&txa->tx_lock);
> > +
> >  	if (ret == 0 && !start) {
> >  		while (rte_service_may_be_active(txa->service_id))
> >  			rte_pause();
> > --
> > 2.23.0
> 
> There are three different changes in this patch. But since they are quite
> small, it should be ok.
> 
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop
  2022-09-09  5:38   ` Naga Harish K, S V
@ 2022-09-13 16:04     ` Jerin Jacob
  0 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2022-09-13 16:04 UTC (permalink / raw)
  To: Naga Harish K, S V; +Cc: Jayatheerthan, Jay, jerinj, dev, stable

On Fri, Sep 9, 2022 at 11:09 AM Naga Harish K, S V
<s.v.naga.harish.k@intel.com> wrote:
>
> Hi Jerin,
>    This patch set is acked by maintainers.
> Please review and do the needful.


Series applied to dpdk-next-net-eventdev/for-main. Thanks



>
> -Harish
>
> > -----Original Message-----
> > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Sent: Monday, August 1, 2022 12:23 PM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>; jerinj@marvell.com
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: RE: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter
> > start/stop
> >
> > > -----Original Message-----
> > > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Sent: Tuesday, July 26, 2022 9:52 AM
> > > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>;
> > > jerinj@marvell.com
> > > Cc: dev@dpdk.org; stable@dpdk.org
> > > Subject: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter
> > > start/stop
> > >
> > > add spinlock protection for tx adapter stop and start APIs add null
> > > check for tx adapter service pointer in adapter start/stop apis.
> > >
> > > Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > > ---
> > >  lib/eventdev/rte_event_eth_tx_adapter.c | 7 +++++--
> > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > index a237e8edba..3251dad61f 100644
> > > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > @@ -44,7 +44,7 @@
> > >  #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval)
> > \
> > > do { \
> > >     if (!txa_valid_id(id)) { \
> > > -           RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
> > > +           RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \
> > >             return retval; \
> > >     } \
> > >  } while (0)
> > > @@ -468,10 +468,13 @@ txa_service_ctrl(uint8_t id, int start)
> > >     struct txa_service_data *txa;
> > >
> > >     txa = txa_service_id_to_data(id);
> > > -   if (txa->service_id == TXA_INVALID_SERVICE_ID)
> > > +   if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID)
> > >             return 0;
> > >
> > > +   rte_spinlock_lock(&txa->tx_lock);
> > >     ret = rte_service_runstate_set(txa->service_id, start);
> > > +   rte_spinlock_unlock(&txa->tx_lock);
> > > +
> > >     if (ret == 0 && !start) {
> > >             while (rte_service_may_be_active(txa->service_id))
> > >                     rte_pause();
> > > --
> > > 2.23.0
> >
> > There are three different changes in this patch. But since they are quite
> > small, it should be ok.
> >
> > Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-13 16:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26  4:22 [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Naga Harish K S V
2022-07-26  4:22 ` [PATCH 2/2] eventdev/eth_tx: fix adapter stop Naga Harish K S V
2022-08-01  6:54   ` Jayatheerthan, Jay
2022-08-01  6:53 ` [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Jayatheerthan, Jay
2022-09-09  5:38   ` Naga Harish K, S V
2022-09-13 16:04     ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).