net/ice: check process type in reset operation

Message ID 20220926134405.304919-1-qiming.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series net/ice: check process type in reset operation |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-x86_64-compile-testing success Testing PASS
ci/intel-Testing fail Testing issues

Commit Message

Qiming Yang Sept. 26, 2022, 1:44 p.m. UTC
  The secondary processes are not allowed to release shared resources.
so the stop and reset operation are forbidden in a secondary process.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Qi Zhang Sept. 27, 2022, 2:07 a.m. UTC | #1
> -----Original Message-----
> From: Yang, Qiming <qiming.yang@intel.com>
> Sent: Monday, September 26, 2022 9:44 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Subject: [PATCH] net/ice: check process type in reset operation
> 
> The secondary processes are not allowed to release shared resources.
> so the stop and reset operation are forbidden in a secondary process.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  drivers/net/ice/ice_ethdev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> cf63ce1f32..d855e9ebe1 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -2504,6 +2504,9 @@ ice_dev_stop(struct rte_eth_dev *dev)
>  	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
>  	uint16_t i;
> 
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +               return 0;
> +

If we didn't explicitly deny dev_start from secondary process, then we'd better keep same for dev_stop
Any conflict should be handled inside the PMD.


>  	/* avoid stopping again */
>  	if (pf->adapter_stopped)
>  		return 0;
> @@ -3742,6 +3745,9 @@ ice_dev_reset(struct rte_eth_dev *dev)  {
>  	int ret;
> 
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +                return -ENOTSUP;
> +
>  	if (dev->data->sriov.active)
>  		return -ENOTSUP;
> 
> --
> 2.25.1
  

Patch

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index cf63ce1f32..d855e9ebe1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2504,6 +2504,9 @@  ice_dev_stop(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 	uint16_t i;
 
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
+
 	/* avoid stopping again */
 	if (pf->adapter_stopped)
 		return 0;
@@ -3742,6 +3745,9 @@  ice_dev_reset(struct rte_eth_dev *dev)
 {
 	int ret;
 
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+                return -ENOTSUP;
+
 	if (dev->data->sriov.active)
 		return -ENOTSUP;