[dpdk-dev] [PATCH v3 15/23] net/failsafe: enable port detach on secondary process

Matan Azrad matan at mellanox.com
Wed Jun 27 10:28:54 CEST 2018


Hi Qi

From: Qi Zhang
> Previously, detach port on secondary process will mess primary process and
> cause same device can't be attached again, by take advantage of
> rte_eth_release_port_private, we can support this with minor change.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>

Failsafe doesn't support secondary process,
I don't think we need this adjustment for drivers which don't support secondary process.
 
> ---
>  drivers/net/failsafe/failsafe.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index
> eafbb75df..c5e8651f6 100644
> --- a/drivers/net/failsafe/failsafe.c
> +++ b/drivers/net/failsafe/failsafe.c
> @@ -328,6 +328,7 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
>  		}
>  		/* TODO: request info from primary to set up Rx and Tx */
>  		eth_dev->dev_ops = &failsafe_ops;
> +		eth_dev->device = &vdev->device;
>  		rte_eth_dev_probing_finish(eth_dev);
>  		return 0;
>  	}
> @@ -338,10 +339,25 @@ rte_pmd_failsafe_probe(struct rte_vdev_device
> *vdev)  static int  rte_pmd_failsafe_remove(struct rte_vdev_device *vdev)  {
> +	struct rte_eth_dev *eth_dev;
>  	const char *name;
> 
>  	name = rte_vdev_device_name(vdev);
>  	INFO("Uninitializing " FAILSAFE_DRIVER_NAME " for %s", name);
> +
> +	eth_dev = rte_eth_dev_allocated(name);
> +	if (!eth_dev)
> +		return -ENODEV;
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> +		/* detach device on local pprocess only */
> +		if (strlen(rte_vdev_device_args(vdev)) == 0)
> +			return rte_eth_dev_release_port_private(eth_dev);
> +		/**
> +		 * else this is a private device for current process
> +		 * so continue with normal detach scenario.
> +		 */
> +	}
> +
>  	return fs_rte_eth_free(name);
>  }
> 
> --
> 2.13.6



More information about the dev mailing list