Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/59863/?format=api
https://patches.dpdk.org/api/patches/59863/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190926100015.53088-4-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-4-chenxux.di@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190926100015.53088-4-chenxux.di@intel.com", "date": "2019-09-26T10:00:13", "name": "[v6,3/5] net/i40e: release port upon close", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "de7385196836833631986c53031c8da2cf4cf652", "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-4-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/59863/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/59863/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 AB7C71BE82;\n\tThu, 26 Sep 2019 12:47:27 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id E47379E4\n\tfor <dev@dpdk.org>; Thu, 26 Sep 2019 12:47:21 +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:21 -0700", "from intel.sh.intel.com ([10.239.255.149])\n\tby fmsmga002.fm.intel.com with ESMTP; 26 Sep 2019 03:47:20 -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=\"219322233\"", "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:13 +0000", "Message-Id": "<20190926100015.53088-4-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 3/5] net/i40e: 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/i40e/i40e_ethdev.c | 128 ++++++++++++-------------\n drivers/net/i40e/i40e_ethdev_vf.c | 25 +++--\n 3 files changed, 81 insertions(+), 76 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst\nindex 177cd9b4a..7e3290665 100644\n--- a/doc/guides/rel_notes/release_19_11.rst\n+++ b/doc/guides/rel_notes/release_19_11.rst\n@@ -72,6 +72,10 @@ New Features\n \n Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.\n \n+* **Updated the Intel i40e driver.**\n+\n+ Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.\n+\n \n Removed Items\n -------------\ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 8b9e23659..4953d3aaa 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -1590,6 +1590,11 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)\n \trte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr,\n \t\t\t\t\t&dev->data->mac_addrs[0]);\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+\tdev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;\n+\n \t/* Init dcb to sw mode by default */\n \tret = i40e_dcb_init_configure(dev, TRUE);\n \tif (ret != I40E_SUCCESS) {\n@@ -1759,85 +1764,18 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)\n static int\n eth_i40e_dev_uninit(struct rte_eth_dev *dev)\n {\n-\tstruct i40e_pf *pf;\n-\tstruct rte_pci_device *pci_dev;\n-\tstruct rte_intr_handle *intr_handle;\n \tstruct i40e_hw *hw;\n-\tstruct i40e_filter_control_settings settings;\n-\tstruct rte_flow *p_flow;\n-\tint ret;\n-\tuint8_t aq_fail = 0;\n-\tint retries = 0;\n \n \tPMD_INIT_FUNC_TRACE();\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\n \n-\tpf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \thw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tpci_dev = RTE_ETH_DEV_TO_PCI(dev);\n-\tintr_handle = &pci_dev->intr_handle;\n-\n-\tret = rte_eth_switch_domain_free(pf->switch_domain_id);\n-\tif (ret)\n-\t\tPMD_INIT_LOG(WARNING, \"failed to free switch domain: %d\", ret);\n \n \tif (hw->adapter_closed == 0)\n \t\ti40e_dev_close(dev);\n \n-\tdev->dev_ops = NULL;\n-\tdev->rx_pkt_burst = NULL;\n-\tdev->tx_pkt_burst = NULL;\n-\n-\t/* Clear PXE mode */\n-\ti40e_clear_pxe_mode(hw);\n-\n-\t/* Unconfigure filter control */\n-\tmemset(&settings, 0, sizeof(settings));\n-\tret = i40e_set_filter_control(hw, &settings);\n-\tif (ret)\n-\t\tPMD_INIT_LOG(WARNING, \"setup_pf_filter_control failed: %d\",\n-\t\t\t\t\tret);\n-\n-\t/* Disable flow control */\n-\thw->fc.requested_mode = I40E_FC_NONE;\n-\ti40e_set_fc(hw, &aq_fail, TRUE);\n-\n-\t/* uninitialize pf host driver */\n-\ti40e_pf_host_uninit(dev);\n-\n-\t/* disable uio intr before callback unregister */\n-\trte_intr_disable(intr_handle);\n-\n-\t/* unregister callback func to eal lib */\n-\tdo {\n-\t\tret = rte_intr_callback_unregister(intr_handle,\n-\t\t\t\ti40e_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\t ret);\n-\t\t\treturn ret;\n-\t\t}\n-\t\ti40e_msec_delay(500);\n-\t} while (retries++ < 5);\n-\n-\ti40e_rm_ethtype_filter_list(pf);\n-\ti40e_rm_tunnel_filter_list(pf);\n-\ti40e_rm_fdir_filter_list(pf);\n-\n-\t/* Remove all flows */\n-\twhile ((p_flow = TAILQ_FIRST(&pf->flow_list))) {\n-\t\tTAILQ_REMOVE(&pf->flow_list, p_flow, node);\n-\t\trte_free(p_flow);\n-\t}\n-\n-\t/* Remove all Traffic Manager configuration */\n-\ti40e_tm_conf_uninit(dev);\n-\n \treturn 0;\n }\n \n@@ -2535,12 +2473,21 @@ i40e_dev_close(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 \tstruct i40e_mirror_rule *p_mirror;\n+\tstruct i40e_filter_control_settings settings;\n+\tstruct rte_flow *p_flow;\n \tuint32_t reg;\n \tint i;\n \tint ret;\n+\tuint8_t aq_fail = 0;\n+\tint retries = 0;\n \n \tPMD_INIT_FUNC_TRACE();\n \n+\tret = rte_eth_switch_domain_free(pf->switch_domain_id);\n+\tif (ret)\n+\t\tPMD_INIT_LOG(WARNING, \"failed to free switch domain: %d\", ret);\n+\n+\n \ti40e_dev_stop(dev);\n \n \t/* Remove all mirror rules */\n@@ -2605,6 +2552,53 @@ i40e_dev_close(struct rte_eth_dev *dev)\n \t\t\t(reg | I40E_PFGEN_CTRL_PFSWR_MASK));\n \tI40E_WRITE_FLUSH(hw);\n \n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\t/* Clear PXE mode */\n+\ti40e_clear_pxe_mode(hw);\n+\n+\t/* Unconfigure filter control */\n+\tmemset(&settings, 0, sizeof(settings));\n+\tret = i40e_set_filter_control(hw, &settings);\n+\tif (ret)\n+\t\tPMD_INIT_LOG(WARNING, \"setup_pf_filter_control failed: %d\",\n+\t\t\t\t\tret);\n+\n+\t/* Disable flow control */\n+\thw->fc.requested_mode = I40E_FC_NONE;\n+\ti40e_set_fc(hw, &aq_fail, TRUE);\n+\n+\t/* uninitialize pf host driver */\n+\ti40e_pf_host_uninit(dev);\n+\n+\tdo {\n+\t\tret = rte_intr_callback_unregister(intr_handle,\n+\t\t\t\ti40e_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\t ret);\n+\t\t}\n+\t\ti40e_msec_delay(500);\n+\t} while (retries++ < 5);\n+\n+\ti40e_rm_ethtype_filter_list(pf);\n+\ti40e_rm_tunnel_filter_list(pf);\n+\ti40e_rm_fdir_filter_list(pf);\n+\n+\t/* Remove all flows */\n+\twhile ((p_flow = TAILQ_FIRST(&pf->flow_list))) {\n+\t\tTAILQ_REMOVE(&pf->flow_list, p_flow, node);\n+\t\trte_free(p_flow);\n+\t}\n+\n+\t/* Remove all Traffic Manager configuration */\n+\ti40e_tm_conf_uninit(dev);\n+\n \thw->adapter_closed = 1;\n }\n \ndiff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c\nindex 22e5e1409..4395a011e 100644\n--- a/drivers/net/i40e/i40e_ethdev_vf.c\n+++ b/drivers/net/i40e/i40e_ethdev_vf.c\n@@ -1310,17 +1310,12 @@ i40evf_init_vf(struct rte_eth_dev *dev)\n static int\n i40evf_uninit_vf(struct rte_eth_dev *dev)\n {\n-\tstruct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n \tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \n \tPMD_INIT_FUNC_TRACE();\n \n \tif (hw->adapter_closed == 0)\n \t\ti40evf_dev_close(dev);\n-\trte_free(vf->vf_res);\n-\tvf->vf_res = NULL;\n-\trte_free(vf->aq_resp);\n-\tvf->aq_resp = NULL;\n \n \treturn 0;\n }\n@@ -1498,6 +1493,11 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)\n \thw->adapter_stopped = 0;\n \thw->adapter_closed = 0;\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 \tif(i40evf_init_vf(eth_dev) != 0) {\n \t\tPMD_INIT_LOG(ERR, \"Init vf failed\");\n \t\treturn -1;\n@@ -1534,10 +1534,6 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)\n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn -EPERM;\n \n-\teth_dev->dev_ops = NULL;\n-\teth_dev->rx_pkt_burst = NULL;\n-\teth_dev->tx_pkt_burst = NULL;\n-\n \tif (i40evf_uninit_vf(eth_dev) != 0) {\n \t\tPMD_INIT_LOG(ERR, \"i40evf_uninit_vf failed\");\n \t\treturn -1;\n@@ -2334,6 +2330,7 @@ static void\n i40evf_dev_close(struct rte_eth_dev *dev)\n {\n \tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n \n \ti40evf_dev_stop(dev);\n \ti40e_dev_free_queues(dev);\n@@ -2349,6 +2346,16 @@ i40evf_dev_close(struct rte_eth_dev *dev)\n \ti40evf_reset_vf(dev);\n \ti40e_shutdown_adminq(hw);\n \ti40evf_disable_irq0(hw);\n+\n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\trte_free(vf->vf_res);\n+\tvf->vf_res = NULL;\n+\trte_free(vf->aq_resp);\n+\tvf->aq_resp = NULL;\n+\n \thw->adapter_closed = 1;\n }\n \n", "prefixes": [ "v6", "3/5" ] }{ "id": 59863, "url": "