get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/60007/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 60007,
    "url": "http://patches.dpdk.org/api/patches/60007/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190927090948.32909-2-chenxux.di@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20190927090948.32909-2-chenxux.di@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190927090948.32909-2-chenxux.di@intel.com",
    "date": "2019-09-27T09:09:44",
    "name": "[v7,1/5] net/e1000: release port upon close",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "39353f42892faf10d627e89bf2333667bf1719a4",
    "submitter": {
        "id": 1409,
        "url": "http://patches.dpdk.org/api/people/1409/?format=api",
        "name": "Chenxu Di",
        "email": "chenxux.di@intel.com"
    },
    "delegate": {
        "id": 31221,
        "url": "http://patches.dpdk.org/api/users/31221/?format=api",
        "username": "yexl",
        "first_name": "xiaolong",
        "last_name": "ye",
        "email": "xiaolong.ye@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190927090948.32909-2-chenxux.di@intel.com/mbox/",
    "series": [
        {
            "id": 6578,
            "url": "http://patches.dpdk.org/api/series/6578/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6578",
            "date": "2019-09-27T09:09:43",
            "name": "drivers/net: release port upon close",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/6578/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/60007/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/60007/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 2C9831BEAA;\n\tFri, 27 Sep 2019 11:53:06 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 2E5D21B079\n\tfor <dev@dpdk.org>; Fri, 27 Sep 2019 11:52:57 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Sep 2019 02:52:56 -0700",
            "from intel.sh.intel.com ([10.239.255.149])\n\tby fmsmga002.fm.intel.com with ESMTP; 27 Sep 2019 02:52:55 -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,555,1559545200\"; d=\"scan'208\";a=\"219722073\"",
        "From": "Di ChenxuX <chenxux.di@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qiming.yang@intel.com,\n\tDi ChenxuX <chenxux.di@intel.com>",
        "Date": "Fri, 27 Sep 2019 09:09:44 +0000",
        "Message-Id": "<20190927090948.32909-2-chenxux.di@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190927090948.32909-1-chenxux.di@intel.com>",
        "References": "<20190827050142.16010-1-chenxux.di@intel.com>\n\t<20190927090948.32909-1-chenxux.di@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v7 1/5] net/e1000: 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 |   5 +\n drivers/net/e1000/em_ethdev.c          |  33 +++---\n drivers/net/e1000/igb_ethdev.c         | 144 ++++++++++++-------------\n 3 files changed, 94 insertions(+), 88 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst\nindex 1b8bd6f35..37cd5fe16 100644\n--- a/doc/guides/rel_notes/release_19_11.rst\n+++ b/doc/guides/rel_notes/release_19_11.rst\n@@ -64,6 +64,11 @@ New Features\n   * Added support for handling Receive Flex Descriptor.\n   * Added support for protocol extraction on per Rx queue.\n \n+* **Updated the Intel e1000 driver.**\n+\n+  Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.\n+\n+\n Removed Items\n -------------\n \ndiff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c\nindex 3c2178ad6..9a88b50b2 100644\n--- a/drivers/net/e1000/em_ethdev.c\n+++ b/drivers/net/e1000/em_ethdev.c\n@@ -297,6 +297,11 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)\n \trte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,\n \t\teth_dev->data->mac_addrs);\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@@ -313,27 +318,12 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)\n static int\n eth_em_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 e1000_adapter *adapter =\n-\t\tE1000_DEV_PRIVATE(eth_dev->data->dev_private);\n-\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n-\n \tPMD_INIT_FUNC_TRACE();\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn -EPERM;\n \n-\tif (adapter->stopped == 0)\n-\t\teth_em_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 uio intr before callback unregister */\n-\trte_intr_disable(intr_handle);\n-\trte_intr_callback_unregister(intr_handle,\n-\t\t\t\t     eth_em_interrupt_handler, eth_dev);\n+\teth_em_close(eth_dev);\n \n \treturn 0;\n }\n@@ -774,6 +764,8 @@ eth_em_close(struct rte_eth_dev *dev)\n \tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct e1000_adapter *adapter =\n \t\tE1000_DEV_PRIVATE(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 \teth_em_stop(dev);\n \tadapter->stopped = 1;\n@@ -781,6 +773,15 @@ eth_em_close(struct rte_eth_dev *dev)\n \te1000_phy_hw_reset(hw);\n \tem_release_manageability(hw);\n \tem_hw_control_release(hw);\n+\n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\t/* disable uio intr before callback unregister */\n+\trte_intr_disable(intr_handle);\n+\trte_intr_callback_unregister(intr_handle,\n+\t\t\t\t     eth_em_interrupt_handler, dev);\n }\n \n static int\ndiff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c\nindex 80f1e13d7..ce7c9e664 100644\n--- a/drivers/net/e1000/igb_ethdev.c\n+++ b/drivers/net/e1000/igb_ethdev.c\n@@ -843,6 +843,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)\n \trte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,\n \t\t\t&eth_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+\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@@ -912,61 +917,12 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)\n static int\n eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)\n {\n-\tstruct rte_pci_device *pci_dev;\n-\tstruct rte_intr_handle *intr_handle;\n-\tstruct e1000_hw *hw;\n-\tstruct e1000_adapter *adapter =\n-\t\tE1000_DEV_PRIVATE(eth_dev->data->dev_private);\n-\tstruct e1000_filter_info *filter_info =\n-\t\tE1000_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private);\n-\n \tPMD_INIT_FUNC_TRACE();\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn -EPERM;\n \n-\thw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);\n-\tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n-\tintr_handle = &pci_dev->intr_handle;\n-\n-\tif (adapter->stopped == 0)\n-\t\teth_igb_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/* Reset any pending lock */\n-\tigb_reset_swfw_lock(hw);\n-\n-\t/* uninitialize PF if max_vfs not zero */\n-\tigb_pf_host_uninit(eth_dev);\n-\n-\t/* disable uio intr before callback unregister */\n-\trte_intr_disable(intr_handle);\n-\trte_intr_callback_unregister(intr_handle,\n-\t\t\t\t     eth_igb_interrupt_handler, eth_dev);\n-\n-\t/* clear the SYN filter info */\n-\tfilter_info->syn_info = 0;\n-\n-\t/* clear the ethertype filters info */\n-\tfilter_info->ethertype_mask = 0;\n-\tmemset(filter_info->ethertype_filters, 0,\n-\t\tE1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));\n-\n-\t/* clear the rss filter info */\n-\tmemset(&filter_info->rss_info, 0,\n-\t\tsizeof(struct igb_rte_flow_rss_conf));\n-\n-\t/* remove all ntuple filters of the device */\n-\tigb_ntuple_filter_uninit(eth_dev);\n-\n-\t/* remove all flex filters of the device */\n-\tigb_flex_filter_uninit(eth_dev);\n-\n-\t/* clear all the filters list */\n-\tigb_filterlist_flush(eth_dev);\n+\teth_igb_close(eth_dev);\n \n \treturn 0;\n }\n@@ -1038,6 +994,11 @@ eth_igbvf_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\trte_eth_random_addr(perm_addr->addr_bytes);\n@@ -1077,27 +1038,12 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)\n static int\n eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)\n {\n-\tstruct e1000_adapter *adapter =\n-\t\tE1000_DEV_PRIVATE(eth_dev->data->dev_private);\n-\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n-\n \tPMD_INIT_FUNC_TRACE();\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn -EPERM;\n \n-\tif (adapter->stopped == 0)\n-\t\tigbvf_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 uio intr before callback unregister */\n-\trte_intr_disable(&pci_dev->intr_handle);\n-\trte_intr_callback_unregister(&pci_dev->intr_handle,\n-\t\t\t\t     eth_igbvf_interrupt_handler,\n-\t\t\t\t     (void *)eth_dev);\n+\tigbvf_dev_close(eth_dev);\n \n \treturn 0;\n }\n@@ -1506,6 +1452,11 @@ eth_igb_stop(struct rte_eth_dev *dev)\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \tstruct rte_eth_link link;\n \tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n+\tstruct e1000_adapter *adapter =\n+\t\tE1000_DEV_PRIVATE(dev->data->dev_private);\n+\n+\tif (adapter->stopped)\n+\t\treturn;\n \n \teth_igb_rxtx_control(dev, false);\n \n@@ -1547,6 +1498,8 @@ eth_igb_stop(struct rte_eth_dev *dev)\n \t\trte_free(intr_handle->intr_vec);\n \t\tintr_handle->intr_vec = NULL;\n \t}\n+\n+\tadapter->stopped = true;\n }\n \n static int\n@@ -1579,14 +1532,13 @@ static void\n eth_igb_close(struct rte_eth_dev *dev)\n {\n \tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct e1000_adapter *adapter =\n-\t\tE1000_DEV_PRIVATE(dev->data->dev_private);\n \tstruct rte_eth_link link;\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 e1000_filter_info *filter_info =\n+\t\tE1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);\n \n \teth_igb_stop(dev);\n-\tadapter->stopped = 1;\n \n \te1000_phy_hw_reset(hw);\n \tigb_release_manageability(hw);\n@@ -1610,6 +1562,40 @@ eth_igb_close(struct rte_eth_dev *dev)\n \n \tmemset(&link, 0, sizeof(link));\n \trte_eth_linkstatus_set(dev, &link);\n+\n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\t/* Reset any pending lock */\n+\tigb_reset_swfw_lock(hw);\n+\n+\t/* uninitialize PF if max_vfs not zero */\n+\tigb_pf_host_uninit(dev);\n+\n+\trte_intr_callback_unregister(intr_handle,\n+\t\t\t\t     eth_igb_interrupt_handler, dev);\n+\n+\t/* clear the SYN filter info */\n+\tfilter_info->syn_info = 0;\n+\n+\t/* clear the ethertype filters info */\n+\tfilter_info->ethertype_mask = 0;\n+\tmemset(filter_info->ethertype_filters, 0,\n+\t\tE1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));\n+\n+\t/* clear the rss filter info */\n+\tmemset(&filter_info->rss_info, 0,\n+\t\tsizeof(struct igb_rte_flow_rss_conf));\n+\n+\t/* remove all ntuple filters of the device */\n+\tigb_ntuple_filter_uninit(dev);\n+\n+\t/* remove all flex filters of the device */\n+\tigb_flex_filter_uninit(dev);\n+\n+\t/* clear all the filters list */\n+\tigb_filterlist_flush(dev);\n }\n \n /*\n@@ -3354,6 +3340,11 @@ igbvf_dev_stop(struct rte_eth_dev *dev)\n {\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 e1000_adapter *adapter =\n+\t\tE1000_DEV_PRIVATE(dev->data->dev_private);\n+\n+\tif (adapter->stopped)\n+\t\treturn;\n \n \tPMD_INIT_FUNC_TRACE();\n \n@@ -3376,22 +3367,23 @@ igbvf_dev_stop(struct rte_eth_dev *dev)\n \t\trte_free(intr_handle->intr_vec);\n \t\tintr_handle->intr_vec = NULL;\n \t}\n+\n+\tadapter->stopped = true;\n }\n \n static void\n igbvf_dev_close(struct rte_eth_dev *dev)\n {\n \tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct e1000_adapter *adapter =\n-\t\tE1000_DEV_PRIVATE(dev->data->dev_private);\n \tstruct rte_ether_addr addr;\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \n \tPMD_INIT_FUNC_TRACE();\n \n \te1000_reset_hw(hw);\n \n \tigbvf_dev_stop(dev);\n-\tadapter->stopped = 1;\n+\n \tigb_dev_free_queues(dev);\n \n \t/**\n@@ -3402,6 +3394,14 @@ igbvf_dev_close(struct rte_eth_dev *dev)\n \n \tmemset(&addr, 0, sizeof(addr));\n \tigbvf_default_mac_addr_set(dev, &addr);\n+\n+\tdev->dev_ops = NULL;\n+\tdev->rx_pkt_burst = NULL;\n+\tdev->tx_pkt_burst = NULL;\n+\n+\trte_intr_callback_unregister(&pci_dev->intr_handle,\n+\t\t\t\t     eth_igbvf_interrupt_handler,\n+\t\t\t\t     (void *)dev);\n }\n \n static int\n",
    "prefixes": [
        "v7",
        "1/5"
    ]
}