From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 878C7C32C for ; Thu, 22 Oct 2015 16:28:52 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 22 Oct 2015 07:28:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,182,1444719600"; d="scan'208";a="833038915" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 22 Oct 2015 07:28:51 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t9MESoTb003922; Thu, 22 Oct 2015 15:28:50 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t9MESo4v029559; Thu, 22 Oct 2015 15:28:50 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id t9MESoJ5029555; Thu, 22 Oct 2015 15:28:50 +0100 From: Bernard Iremonger To: dev@dpdk.org Date: Thu, 22 Oct 2015 15:28:47 +0100 Message-Id: <1445524127-29517-2-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1445524127-29517-1-git-send-email-bernard.iremonger@intel.com> References: <1445524127-29517-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v2 1/1] vmxnet3: add PCI Port Hotplug support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2015 14:28:52 -0000 Signed-off-by: Bernard Iremonger --- doc/guides/rel_notes/release_2_2.rst | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 4f75cff..9b0c046 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -9,6 +9,7 @@ New Features * Added support for Jumbo Frames. * Optimize forwarding performance for Chelsio T5 40GbE cards. +* **Added port hotplug support to the vmxnet3 PMD.** Resolved Issues --------------- diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index a70be5c..d5337ac 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -70,6 +70,7 @@ #define PROCESS_SYS_EVENTS 0 static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev); +static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev); static int vmxnet3_dev_configure(struct rte_eth_dev *dev); static int vmxnet3_dev_start(struct rte_eth_dev *dev); static void vmxnet3_dev_stop(struct rte_eth_dev *dev); @@ -294,13 +295,37 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return 0; } +static int +eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev) +{ + struct vmxnet3_hw *hw = eth_dev->data->dev_private; + + PMD_INIT_FUNC_TRACE(); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + if (hw->adapter_stopped == 0) + vmxnet3_dev_close(eth_dev); + + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; + + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; + + return 0; +} + static struct eth_driver rte_vmxnet3_pmd = { .pci_drv = { .name = "rte_vmxnet3_pmd", .id_table = pci_id_vmxnet3_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, }, .eth_dev_init = eth_vmxnet3_dev_init, + .eth_dev_uninit = eth_vmxnet3_dev_uninit, .dev_private_size = sizeof(struct vmxnet3_hw), }; @@ -579,7 +604,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - if (hw->adapter_stopped == TRUE) { + if (hw->adapter_stopped == 1) { PMD_INIT_LOG(DEBUG, "Device already closed."); return; } @@ -595,7 +620,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev) /* reset the device */ VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV); PMD_INIT_LOG(DEBUG, "Device reset."); - hw->adapter_stopped = FALSE; + hw->adapter_stopped = 0; vmxnet3_dev_clear_queues(dev); @@ -615,7 +640,7 @@ vmxnet3_dev_close(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); vmxnet3_dev_stop(dev); - hw->adapter_stopped = TRUE; + hw->adapter_stopped = 1; } static void -- 1.9.1