From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0B9DB2BF5 for ; Tue, 16 Oct 2018 02:15:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2018 17:15:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,386,1534834800"; d="scan'208";a="88605655" Received: from dpdk51.sh.intel.com ([10.67.110.190]) by FMSMGA003.fm.intel.com with ESMTP; 15 Oct 2018 17:15:37 -0700 From: Qi Zhang To: thomas@monjalon.net, gaetan.rivet@6wind.com, anatoly.burakov@intel.com, arybchenko@solarflare.com 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, Qi Zhang Date: Tue, 16 Oct 2018 08:16:31 +0800 Message-Id: <20181016001632.65357-6-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20181016001632.65357-1-qi.z.zhang@intel.com> References: <20180607123849.14439-1-qi.z.zhang@intel.com> <20181016001632.65357-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v17 5/6] drivers/net: enable device detach on secondary 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: Tue, 16 Oct 2018 00:15:40 -0000 With the enabling for hotplug on multi-process, rte_eth_dev_pci_generic_remove can be used to detach the device from a secondary process also. But we need to take care of the uninit callback parameter to make sure it handles the secondary case correctly. Signed-off-by: Qi Zhang --- drivers/net/bnxt/bnxt_ethdev.c | 6 +++++- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/virtio/virtio_ethdev.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 858e65d00..c11fe9c8c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3542,7 +3542,11 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, static int bnxt_pci_remove(struct rte_pci_device *pci_dev) { - return rte_eth_dev_pci_generic_remove(pci_dev, bnxt_dev_uninit); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + return rte_eth_dev_pci_generic_remove(pci_dev, + bnxt_dev_uninit); + else + return rte_eth_dev_pci_generic_remove(pci_dev, NULL); } static struct rte_pci_driver bnxt_rte_pmd = { diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index c255dc6db..c29a581e8 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1703,7 +1703,7 @@ static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) (struct ena_adapter *)(eth_dev->data->dev_private); if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return -EPERM; + return 0; if (adapter->state != ENA_ADAPTER_STATE_CLOSED) ena_close(eth_dev); diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 93e89007a..0f59e4475 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -2038,7 +2038,7 @@ lio_eth_dev_uninit(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return -EPERM; + return 0; /* lio_free_sc_buffer_pool */ lio_free_sc_buffer_pool(lio_dev); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index b81df0a99..730c41707 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1697,7 +1697,7 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); if (rte_eal_process_type() == RTE_PROC_SECONDARY) - return -EPERM; + return 0; virtio_dev_stop(eth_dev); virtio_dev_close(eth_dev); -- 2.13.6