patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] eventdev: fix Rx SW adapter stop
@ 2018-06-04 12:55 Nikhil Rao
  2018-06-11 12:19 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Rao @ 2018-06-04 12:55 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev, Nikhil Rao, stable

The Rx adapter stop call does not guarantee that the
SW service function will not execute after the
rte_event_eth_rx_adapter_stop() call.

Add a "started" flag to prevent the adapter from executing
if stop has been called.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
CC: stable@dpdk.org
---
 lib/librte_eventdev/rte_event_eth_rx_adapter.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index d03f870..7b39e39 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -91,6 +91,8 @@ struct rte_event_eth_rx_adapter {
 	int socket_id;
 	/* Per adapter EAL service */
 	uint32_t service_id;
+	/* Adapter started flag */
+	uint8_t rxa_started;
 } __rte_cache_aligned;
 
 /* Per eth device */
@@ -556,6 +558,10 @@ static uint16_t gcd_u16(uint16_t a, uint16_t b)
 
 	if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
 		return 0;
+	if (!rx_adapter->rxa_started) {
+		return 0;
+		rte_spinlock_unlock(&rx_adapter->rx_lock);
+	}
 	eth_rx_poll(rx_adapter);
 	rte_spinlock_unlock(&rx_adapter->rx_lock);
 	return 0;
@@ -847,8 +853,12 @@ static int add_rx_queue(struct rte_event_eth_rx_adapter *rx_adapter,
 						&rte_eth_devices[i]);
 	}
 
-	if (use_service)
+	if (use_service) {
+		rte_spinlock_lock(&rx_adapter->rx_lock);
+		rx_adapter->rxa_started = start;
 		rte_service_runstate_set(rx_adapter->service_id, start);
+		rte_spinlock_unlock(&rx_adapter->rx_lock);
+	}
 
 	return 0;
 }
-- 
1.8.3.1

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

* Re: [dpdk-stable] [PATCH] eventdev: fix Rx SW adapter stop
  2018-06-04 12:55 [dpdk-stable] [PATCH] eventdev: fix Rx SW adapter stop Nikhil Rao
@ 2018-06-11 12:19 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2018-06-11 12:19 UTC (permalink / raw)
  To: Nikhil Rao; +Cc: dev, stable

-----Original Message-----
> Date: Mon, 4 Jun 2018 18:25:17 +0530
> From: Nikhil Rao <nikhil.rao@intel.com>
> To: jerin.jacob@caviumnetworks.com
> CC: dev@dpdk.org, Nikhil Rao <nikhil.rao@intel.com>, stable@dpdk.org
> Subject: [PATCH] eventdev: fix Rx SW adapter stop
> X-Mailer: git-send-email 1.8.3.1
> 
> The Rx adapter stop call does not guarantee that the
> SW service function will not execute after the
> rte_event_eth_rx_adapter_stop() call.
> 
> Add a "started" flag to prevent the adapter from executing
> if stop has been called.
> 
> Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> CC: stable@dpdk.org

Applied to dpdk-next-eventdev/master. Thanks.

> ---
>  lib/librte_eventdev/rte_event_eth_rx_adapter.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> index d03f870..7b39e39 100644
> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> @@ -91,6 +91,8 @@ struct rte_event_eth_rx_adapter {
>  	int socket_id;
>  	/* Per adapter EAL service */
>  	uint32_t service_id;
> +	/* Adapter started flag */
> +	uint8_t rxa_started;
>  } __rte_cache_aligned;
>  
>  /* Per eth device */
> @@ -556,6 +558,10 @@ static uint16_t gcd_u16(uint16_t a, uint16_t b)
>  
>  	if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0)
>  		return 0;
> +	if (!rx_adapter->rxa_started) {
> +		return 0;
> +		rte_spinlock_unlock(&rx_adapter->rx_lock);
> +	}
>  	eth_rx_poll(rx_adapter);
>  	rte_spinlock_unlock(&rx_adapter->rx_lock);
>  	return 0;
> @@ -847,8 +853,12 @@ static int add_rx_queue(struct rte_event_eth_rx_adapter *rx_adapter,
>  						&rte_eth_devices[i]);
>  	}
>  
> -	if (use_service)
> +	if (use_service) {
> +		rte_spinlock_lock(&rx_adapter->rx_lock);
> +		rx_adapter->rxa_started = start;
>  		rte_service_runstate_set(rx_adapter->service_id, start);
> +		rte_spinlock_unlock(&rx_adapter->rx_lock);
> +	}
>  
>  	return 0;
>  }
> -- 
> 1.8.3.1
> 

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

end of thread, other threads:[~2018-06-11 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 12:55 [dpdk-stable] [PATCH] eventdev: fix Rx SW adapter stop Nikhil Rao
2018-06-11 12:19 ` 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).