Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/59865/?format=api
https://patches.dpdk.org/api/patches/59865/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190926100015.53088-6-chenxux.di@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20190926100015.53088-6-chenxux.di@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190926100015.53088-6-chenxux.di@intel.com", "date": "2019-09-26T10:00:15", "name": "[v6,5/5] net/ixgbe: release port upon close", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2aa06478398cf8d98dae9261f266d9c6970be0b2", "submitter": { "id": 1409, "url": "https://patches.dpdk.org/api/people/1409/?format=api", "name": "Chenxu Di", "email": "chenxux.di@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190926100015.53088-6-chenxux.di@intel.com/mbox/", "series": [ { "id": 6547, "url": "https://patches.dpdk.org/api/series/6547/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6547", "date": "2019-09-26T10:00:10", "name": "drivers/net: release port upon close", "version": 6, "mbox": "https://patches.dpdk.org/series/6547/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/59865/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/59865/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 077211BEBF;\n\tThu, 26 Sep 2019 12:47:33 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 64FED324D\n\tfor <dev@dpdk.org>; Thu, 26 Sep 2019 12:47:24 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t26 Sep 2019 03:47:24 -0700", "from intel.sh.intel.com ([10.239.255.149])\n\tby fmsmga002.fm.intel.com with ESMTP; 26 Sep 2019 03:47:23 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.64,551,1559545200\"; d=\"scan'208\";a=\"219322245\"", "From": "Di ChenxuX <chenxux.di@intel.com>", "To": "dev@dpdk.org", "Cc": "qiming.yang@intel.com,\n\tDi ChenxuX <chenxux.di@intel.com>", "Date": "Thu, 26 Sep 2019 10:00:15 +0000", "Message-Id": "<20190926100015.53088-6-chenxux.di@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190926100015.53088-1-chenxux.di@intel.com>", "References": "<20190827050142.16010-1-chenxux.di@intel.com>\n\t<20190926100015.53088-1-chenxux.di@intel.com>", "Subject": "[dpdk-dev] [PATCH v6 5/5] net/ixgbe: release port upon close", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources\n for the port can be freed by rte_eth_dev_close().\n\nSigned-off-by: Di ChenxuX <chenxux.di@intel.com>\n---\n doc/guides/rel_notes/release_19_11.rst | 4 +\n drivers/net/ixgbe/ixgbe_ethdev.c | 167 +++++++++++++------------\n 2 files changed, 89 insertions(+), 82 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst\nindex 751606440..44011085d 100644\n--- a/doc/guides/rel_notes/release_19_11.rst\n+++ b/doc/guides/rel_notes/release_19_11.rst\n@@ -77,6 +77,10 @@ New Features\n \n Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.\n \n+* **Updated the Intel ixgbe driver.**\n+\n+ Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.\n+\n \n Removed Items\n -------------\ndiff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex 023b267d7..e6879c4b0 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -1245,6 +1245,11 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)\n \t\treturn -ENOMEM;\n \t}\n \n+\t/* Pass the information to the rte_eth_dev_close() that it should also\n+\t * release the private port resources.\n+\t */\n+\teth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;\n+\n \t/* initialize the vfta */\n \tmemset(shadow_vfta, 0, sizeof(*shadow_vfta));\n \n@@ -1311,73 +1316,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)\n static int\n eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)\n {\n-\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n-\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n-\tstruct ixgbe_hw *hw;\n-\tint retries = 0;\n-\tint ret;\n-\n \tPMD_INIT_FUNC_TRACE();\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\n \n-\thw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);\n-\n-\tif (hw->adapter_stopped == 0)\n-\t\tixgbe_dev_close(eth_dev);\n-\n-\teth_dev->dev_ops = NULL;\n-\teth_dev->rx_pkt_burst = NULL;\n-\teth_dev->tx_pkt_burst = NULL;\n-\n-\t/* Unlock any pending hardware semaphore */\n-\tixgbe_swfw_lock_reset(hw);\n-\n-\t/* disable uio intr before callback unregister */\n-\trte_intr_disable(intr_handle);\n-\n-\tdo {\n-\t\tret = rte_intr_callback_unregister(intr_handle,\n-\t\t\t\tixgbe_dev_interrupt_handler, eth_dev);\n-\t\tif (ret >= 0) {\n-\t\t\tbreak;\n-\t\t} else if (ret != -EAGAIN) {\n-\t\t\tPMD_INIT_LOG(ERR,\n-\t\t\t\t\"intr callback unregister failed: %d\",\n-\t\t\t\tret);\n-\t\t\treturn ret;\n-\t\t}\n-\t\trte_delay_ms(100);\n-\t} while (retries++ < (10 + IXGBE_LINK_UP_TIME));\n-\n-\t/* cancel the delay handler before remove dev */\n-\trte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, eth_dev);\n-\n-\t/* cancel the link handler before remove dev */\n-\trte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, eth_dev);\n-\n-\t/* uninitialize PF if max_vfs not zero */\n-\tixgbe_pf_host_uninit(eth_dev);\n-\n-\t/* remove all the fdir filters & hash */\n-\tixgbe_fdir_filter_uninit(eth_dev);\n-\n-\t/* remove all the L2 tunnel filters & hash */\n-\tixgbe_l2_tn_filter_uninit(eth_dev);\n-\n-\t/* Remove all ntuple filters of the device */\n-\tixgbe_ntuple_filter_uninit(eth_dev);\n-\n-\t/* clear all the filters list */\n-\tixgbe_filterlist_flush();\n-\n-\t/* Remove all Traffic Manager configuration */\n-\tixgbe_tm_conf_uninit(eth_dev);\n-\n-#ifdef RTE_LIBRTE_SECURITY\n-\trte_free(eth_dev->security_ctx);\n-#endif\n+\tixgbe_dev_close(eth_dev);\n \n \treturn 0;\n }\n@@ -1711,6 +1655,11 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)\n \t\treturn -ENOMEM;\n \t}\n \n+\t/* Pass the information to the rte_eth_dev_close() that it should also\n+\t * release the private port resources.\n+\t */\n+\teth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;\n+\n \t/* Generate a random MAC address, if none was assigned by PF. */\n \tif (rte_is_zero_ether_addr(perm_addr)) {\n \t\tgenerate_random_mac_addr(perm_addr);\n@@ -1762,30 +1711,12 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)\n static int\n eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)\n {\n-\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n-\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n-\tstruct ixgbe_hw *hw;\n-\n \tPMD_INIT_FUNC_TRACE();\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\n \n-\thw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);\n-\n-\tif (hw->adapter_stopped == 0)\n-\t\tixgbevf_dev_close(eth_dev);\n-\n-\teth_dev->dev_ops = NULL;\n-\teth_dev->rx_pkt_burst = NULL;\n-\teth_dev->tx_pkt_burst = NULL;\n-\n-\t/* Disable the interrupts for VF */\n-\tixgbevf_intr_disable(eth_dev);\n-\n-\trte_intr_disable(intr_handle);\n-\trte_intr_callback_unregister(intr_handle,\n-\t\t\t\t ixgbevf_dev_interrupt_handler, eth_dev);\n+\tixgbevf_dev_close(eth_dev);\n \n \treturn 0;\n }\n@@ -2876,6 +2807,9 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)\n \tstruct ixgbe_tm_conf *tm_conf =\n \t\tIXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);\n \n+\tif (hw->adapter_stopped)\n+\t\treturn;\n+\n \tPMD_INIT_FUNC_TRACE();\n \n \trte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);\n@@ -2928,6 +2862,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)\n \ttm_conf->committed = false;\n \n \tadapter->rss_reta_updated = 0;\n+\n+\thw->adapter_stopped = true;\n }\n \n /*\n@@ -2998,13 +2934,16 @@ ixgbe_dev_close(struct rte_eth_dev *dev)\n {\n \tstruct ixgbe_hw *hw =\n \t\tIXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n+\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n+\tint retries = 0;\n+\tint ret;\n \n \tPMD_INIT_FUNC_TRACE();\n \n \tixgbe_pf_reset_hw(hw);\n \n \tixgbe_dev_stop(dev);\n-\thw->adapter_stopped = 1;\n \n \tixgbe_dev_free_queues(dev);\n \n@@ -3012,6 +2951,55 @@ ixgbe_dev_close(struct rte_eth_dev *dev)\n \n \t/* reprogram the RAR[0] in case user changed it. */\n \tixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);\n+\n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\t/* Unlock any pending hardware semaphore */\n+\tixgbe_swfw_lock_reset(hw);\n+\n+\t/* disable uio intr before callback unregister */\n+\trte_intr_disable(intr_handle);\n+\n+\tdo {\n+\t\tret = rte_intr_callback_unregister(intr_handle,\n+\t\t\t\tixgbe_dev_interrupt_handler, dev);\n+\t\tif (ret >= 0) {\n+\t\t\tbreak;\n+\t\t} else if (ret != -EAGAIN) {\n+\t\t\tPMD_INIT_LOG(ERR,\n+\t\t\t\t\"intr callback unregister failed: %d\",\n+\t\t\t\tret);\n+\t\t}\n+\t\trte_delay_ms(100);\n+\t} while (retries++ < (10 + IXGBE_LINK_UP_TIME));\n+\n+\t/* cancel the delay handler before remove dev */\n+\trte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, dev);\n+\n+\t/* uninitialize PF if max_vfs not zero */\n+\tixgbe_pf_host_uninit(dev);\n+\n+\t/* remove all the fdir filters & hash */\n+\tixgbe_fdir_filter_uninit(dev);\n+\n+\t/* remove all the L2 tunnel filters & hash */\n+\tixgbe_l2_tn_filter_uninit(dev);\n+\n+\t/* Remove all ntuple filters of the device */\n+\tixgbe_ntuple_filter_uninit(dev);\n+\n+\t/* clear all the filters list */\n+\tixgbe_filterlist_flush();\n+\n+\t/* Remove all Traffic Manager configuration */\n+\tixgbe_tm_conf_uninit(dev);\n+\n+#ifdef RTE_LIBRTE_SECURITY\n+\trte_free(dev->security_ctx);\n+#endif\n+\n }\n \n /*\n@@ -5244,6 +5232,8 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)\n \t */\n \tixgbevf_dev_link_update(dev, 0);\n \n+\thw->adapter_stopped = false;\n+\n \treturn 0;\n }\n \n@@ -5255,6 +5245,9 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n \n+\tif (hw->adapter_stopped)\n+\t\treturn;\n+\n \tPMD_INIT_FUNC_TRACE();\n \n \trte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);\n@@ -5289,6 +5282,8 @@ static void\n ixgbevf_dev_close(struct rte_eth_dev *dev)\n {\n \tstruct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n+\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n \n \tPMD_INIT_FUNC_TRACE();\n \n@@ -5304,6 +5299,14 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)\n \t * after stop, close and detach of the VF\n \t **/\n \tixgbevf_remove_mac_addr(dev, 0);\n+\n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\trte_intr_disable(intr_handle);\n+\trte_intr_callback_unregister(intr_handle,\n+\t\t\t\t ixgbevf_dev_interrupt_handler, dev);\n }\n \n /*\n", "prefixes": [ "v6", "5/5" ] }{ "id": 59865, "url": "