get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 86888,
    "url": "https://patches.dpdk.org/api/patches/86888/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210119115616.1807-3-heinrich.kuhn@netronome.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": "<20210119115616.1807-3-heinrich.kuhn@netronome.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210119115616.1807-3-heinrich.kuhn@netronome.com",
    "date": "2021-01-19T11:56:17",
    "name": "[2/2] net/nfp: free port private data in dev close callback",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1d8e6a7bb7ae8f3fffc8c2429d2a5346e01b73e2",
    "submitter": {
        "id": 1523,
        "url": "https://patches.dpdk.org/api/people/1523/?format=api",
        "name": "Heinrich Kuhn",
        "email": "heinrich.kuhn@netronome.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210119115616.1807-3-heinrich.kuhn@netronome.com/mbox/",
    "series": [
        {
            "id": 14846,
            "url": "https://patches.dpdk.org/api/series/14846/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14846",
            "date": "2021-01-19T11:56:14",
            "name": "free port private data in dev_close callback",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/14846/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/86888/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/86888/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4E8C9A0A05;\n\tTue, 19 Jan 2021 12:57:26 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 244D2140D94;\n\tTue, 19 Jan 2021 12:57:21 +0100 (CET)",
            "from mail-ej1-f54.google.com (mail-ej1-f54.google.com\n [209.85.218.54])\n by mails.dpdk.org (Postfix) with ESMTP id 8AB65140DA5\n for <dev@dpdk.org>; Tue, 19 Jan 2021 12:57:19 +0100 (CET)",
            "by mail-ej1-f54.google.com with SMTP id hs11so25773088ejc.1\n for <dev@dpdk.org>; Tue, 19 Jan 2021 03:57:19 -0800 (PST)",
            "from localhost.localdomain (dsl-197-245-67-23.voxdsl.co.za.\n [197.245.67.23])\n by smtp.gmail.com with ESMTPSA id b17sm2406467ejj.83.2021.01.19.03.57.17\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Tue, 19 Jan 2021 03:57:18 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=netronome-com.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=dYh5zA6mfDKxUZ6+iSuzC93WGzYMzqo4Fc7JQXkjqD4=;\n b=y/ZzWJ3OOi3jeFOR7Z0+9Sn5Ew9xYdSRR58Fm/G4cxTNSIf3ZynOtEkLTWMoH7aJnx\n 4je+NXQDVorYWybyPLgOGkDUe+IhmxP7rU2kxJSXpXqLIIP/lNE64ei8hDaqQrs2SBn6\n kbcKnfB8eZ/7cVpqAwymtmwyUEk9TqvP5xQvD1oMKH/X/UZqEb9iPYBUP0Z976k0kR+4\n AJO1H5oBL8TaN3/Ruz614wQ9eSQuRf+rVYA6MGGPPBlij1Tgic6QcNA3BCcm+eSjKVDu\n f35sO+H3oLd3Z1uCnh8nco6iavUMlblGRN9uB/z/i4PaEdF+k3Su3m81+Bmku3iyyqT5\n X8OQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=dYh5zA6mfDKxUZ6+iSuzC93WGzYMzqo4Fc7JQXkjqD4=;\n b=erc51WjnrsMj/iCPya7TYVDdtlwv3dlm+o7nJNQRVvMoF1e+OWUj20V0F741Pk5hK3\n 5WXRoe576MaHc8E4BkdfteDz5aziem1YHpCQN1IEnXo9HpFP58ze90mUDBUhh0ZGhry3\n AQfOBp+TUN1bfmC6ovYVwMLRSQ3B0+5aXPEcMKOleumfeUl3QfzmnVHlpLik1G0NbKul\n eIViEhZqfHuCDDdjDyLNFIXaXHGVkOGtBH2aMewH1ldrGMIcbKawxU5tgn2rFo3GT3dp\n JypBvFI3tQ1tU7cettj4HbaOSU0wjeo4Dc3P/DMbchnScRfVbFGgG2eH/bgNG4mI+yKy\n Mqdg==",
        "X-Gm-Message-State": "AOAM531Lu/lkzjbvDivY8auS6yUErbQ4cPtNs/hQizAwnl5StH1ctA28\n WWvfprMmDDx5xwELeObXSmyZ0FAkfmRbbSy3ceEngLRWZmS9RDPs/74XXRAYCPx+29OzPrWzIGN\n zeJ5Q8JXing5NU2WOpUGLvi6VTpe/mapS5zCjVBFWNPTa9h75lod4ILknUsxGoQdQGyQ=",
        "X-Google-Smtp-Source": "\n ABdhPJxJOJ2jELmLXuOdDY4qL62hRX+fTwSvLAnXDC+RT92QW4MxyG8VH5EIipbITaFMQnch6/igBQ==",
        "X-Received": "by 2002:a17:906:68d0:: with SMTP id\n y16mr2949804ejr.128.1611057439141;\n Tue, 19 Jan 2021 03:57:19 -0800 (PST)",
        "From": "Heinrich Kuhn <heinrich.kuhn@netronome.com>",
        "To": "dev@dpdk.org",
        "Cc": "Heinrich Kuhn <heinrich.kuhn@netronome.com>,\n Louis Peens <louis.peens@netronome.com>,\n Simon Horman <simon.horman@netronome.com>",
        "Date": "Tue, 19 Jan 2021 13:56:17 +0200",
        "Message-Id": "<20210119115616.1807-3-heinrich.kuhn@netronome.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20210119115616.1807-1-heinrich.kuhn@netronome.com>",
        "References": "<20210119115616.1807-1-heinrich.kuhn@netronome.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 2/2] net/nfp: free port private data in dev close\n callback",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Free the private data of a port when the .dev_close() callback is\ninvoked. For NFP6000/4000 devices multiple ports may exist under a\nsingle PF device. In this situation the PF resources will only be freed\nwhen all the ports associated with the PF has been freed too.\n\nPF hot plugging isn't explicitly supported for NFP6000/4000 devices but\nall the private data of all the ports under the PF in question will be\nfreed upon device removal.\n\nSigned-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>\nReviewed-by: Louis Peens <louis.peens@netronome.com>\nSigned-off-by: Simon Horman <simon.horman@netronome.com>\n---\n drivers/net/nfp/nfp_net.c | 63 ++++++++++++++++++++++++++++++++-------\n 1 file changed, 52 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c\nindex 9b9bd9e3d..b2cebf3e7 100644\n--- a/drivers/net/nfp/nfp_net.c\n+++ b/drivers/net/nfp/nfp_net.c\n@@ -59,6 +59,7 @@ static int nfp_net_infos_get(struct rte_eth_dev *dev,\n \t\t\t     struct rte_eth_dev_info *dev_info);\n static int nfp_net_init(struct rte_eth_dev *eth_dev);\n static int nfp_pf_init(struct rte_eth_dev *eth_dev);\n+static int nfp_pci_uninit(struct rte_eth_dev *eth_dev);\n static int nfp_init_phyports(struct nfp_pf_dev *pf_dev);\n static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);\n static int nfp_net_promisc_enable(struct rte_eth_dev *dev);\n@@ -909,8 +910,34 @@ nfp_net_close(struct rte_eth_dev *dev)\n \t\t\t(struct nfp_net_rxq *)dev->data->rx_queues[i]);\n \t}\n \n+\t/* Only free PF resources after all physical ports have been closed */\n+\tif (pci_dev->id.device_id == PCI_DEVICE_ID_NFP4000_PF_NIC ||\n+\t    pci_dev->id.device_id == PCI_DEVICE_ID_NFP6000_PF_NIC) {\n+\t\tstruct nfp_pf_dev *pf_dev;\n+\t\tpf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\n+\t\t/* Mark this port as unused and free device priv resources*/\n+\t\tnn_cfg_writeb(hw, NFP_NET_CFG_LSC, 0xff);\n+\t\tpf_dev->ports[hw->idx] = NULL;\n+\t\trte_eth_dev_release_port(dev);\n+\n+\t\tfor (i = 0; i < pf_dev->total_phyports; i++) {\n+\t\t\t/* Check to see if ports are still in use */\n+\t\t\tif (pf_dev->ports[i])\n+\t\t\t\treturn 0;\n+\t\t}\n+\n+\t\t/* Now it is safe to free all PF resources */\n+\t\tPMD_INIT_LOG(INFO, \"Freeing PF resources\");\n+\t\tnfp_cpp_area_free(pf_dev->ctrl_area);\n+\t\tnfp_cpp_area_free(pf_dev->hwqueues_area);\n+\t\tfree(pf_dev->hwinfo);\n+\t\tfree(pf_dev->sym_tbl);\n+\t\tnfp_cpp_free(pf_dev->cpp);\n+\t\trte_free(pf_dev);\n+\t}\n+\n \trte_intr_disable(&pci_dev->intr_handle);\n-\tnn_cfg_writeb(hw, NFP_NET_CFG_LSC, 0xff);\n \n \t/* unregister callback func from eal lib */\n \trte_intr_callback_unregister(&pci_dev->intr_handle,\n@@ -3765,6 +3792,29 @@ static const struct rte_pci_id pci_id_nfp_vf_net_map[] = {\n \t},\n };\n \n+static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct rte_pci_device *pci_dev;\n+\tuint16_t port_id;\n+\n+\tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n+\n+\tif (pci_dev->id.device_id == PCI_DEVICE_ID_NFP4000_PF_NIC ||\n+\t    pci_dev->id.device_id == PCI_DEVICE_ID_NFP6000_PF_NIC) {\n+\t\t/* Free up all physical ports under PF */\n+\t\tRTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device)\n+\t\t\trte_eth_dev_close(port_id);\n+\t\t/*\n+\t\t * Ports can be closed and freed but hotplugging is not\n+\t\t * currently supported\n+\t\t */\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\t/* VF cleanup, just free private port data */\n+\treturn nfp_net_close(eth_dev);\n+}\n+\n static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \tstruct rte_pci_device *pci_dev)\n {\n@@ -3774,16 +3824,7 @@ static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \n static int eth_nfp_pci_remove(struct rte_pci_device *pci_dev)\n {\n-\tstruct rte_eth_dev *eth_dev;\n-\n-\teth_dev = rte_eth_dev_allocated(pci_dev->device.name);\n-\tif (eth_dev == NULL)\n-\t\treturn 0; /* port already released */\n-\tif ((pci_dev->id.device_id == PCI_DEVICE_ID_NFP4000_PF_NIC) ||\n-\t    (pci_dev->id.device_id == PCI_DEVICE_ID_NFP6000_PF_NIC))\n-\t\treturn -ENOTSUP;\n-\n-\treturn rte_eth_dev_pci_generic_remove(pci_dev, NULL);\n+\treturn rte_eth_dev_pci_generic_remove(pci_dev, nfp_pci_uninit);\n }\n \n static struct rte_pci_driver rte_nfp_net_pf_pmd = {\n",
    "prefixes": [
        "2/2"
    ]
}