From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id CC1F03195 for ; Mon, 25 Jun 2018 12:01:33 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 9A294B40067; Mon, 25 Jun 2018 10:01:31 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Mon, 25 Jun 2018 11:01:24 +0100 To: Qi Zhang , , CC: , , , , , References: <20180607123849.14439-1-qi.z.zhang@intel.com> <20180625071745.16810-1-qi.z.zhang@intel.com> <20180625071745.16810-9-qi.z.zhang@intel.com> From: Andrew Rybchenko Message-ID: <735a0339-577c-fc26-386d-aba15b61f04c@solarflare.com> Date: Mon, 25 Jun 2018 13:01:20 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180625071745.16810-9-qi.z.zhang@intel.com> Content-Language: en-GB X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23928.003 X-TM-AS-Result: No--15.169800-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1529920892-txNs7EI8NZim Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3 08/23] net/i40e: enable port detach on secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2018 10:01:34 -0000 On 06/25/2018 10: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/i40e/i40e_ethdev.c | 2 ++ > drivers/net/i40e/i40e_ethdev_vf.c | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 13c5d3296..7d1f98422 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -678,6 +678,8 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev) > if (!ethdev) > return -ENODEV; > > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return rte_eth_dev_release_port_private(ethdev); > > if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) > return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit); > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c > index 804e44530..fc6f079d5 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1500,6 +1500,15 @@ static int eth_i40evf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > > static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev) > { > + struct rte_eth_dev *ethdev; > + ethdev = rte_eth_dev_allocated(pci_dev->device.name); Above two lines looks strange. Is alignment incorrect? > + > + if (!ethdev) > + return -ENODEV; > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return rte_eth_dev_release_port_private(ethdev); > + These 9 lines are duplicated in 5 changeset (this one and 4 following). Shouldn't it be done in rte_eth_dev_pci_generic_remove()? > return rte_eth_dev_pci_generic_remove(pci_dev, i40evf_dev_uninit); > }