From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH v5 23/24] net/vhost: enable port detach on secondary process Date: Wed, 27 Jun 2018 10:24:25 +0200 Message-ID: References: <20180607123849.14439-1-qi.z.zhang@intel.com> <20180627071740.19870-1-qi.z.zhang@intel.com> <20180627071740.19870-24-qi.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, benjamin.h.shelton@intel.com, narender.vangati@intel.com To: Qi Zhang , thomas@monjalon.net, anatoly.burakov@intel.com Return-path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 8091C1BE8D for ; Wed, 27 Jun 2018 10:24:31 +0200 (CEST) In-Reply-To: <20180627071740.19870-24-qi.z.zhang@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 06/27/2018 09:17 AM, Qi Zhang wrote: > 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 > --- > drivers/net/vhost/rte_eth_vhost.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c > index ba9d768a0..f773711b4 100644 > --- a/drivers/net/vhost/rte_eth_vhost.c > +++ b/drivers/net/vhost/rte_eth_vhost.c > @@ -1353,6 +1353,7 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) > } > /* TODO: request info from primary to set up Rx and Tx */ > eth_dev->dev_ops = &ops; > + eth_dev->device = &dev->device; > rte_eth_dev_probing_finish(eth_dev); > return 0; > } > @@ -1435,6 +1436,16 @@ rte_pmd_vhost_remove(struct rte_vdev_device *dev) > if (eth_dev == NULL) > return -ENODEV; > > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > + /* detach device on local pprocess only */ > + if (strlen(rte_vdev_device_args(dev)) == 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 > + */ > + } > + IMHO, the driver shouldn't have to manage primary/secondary process stuff. It does not look like the right place to me. > eth_dev_close(eth_dev); > > rte_free(vring_states[eth_dev->data->port_id]); >