get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 12286,
    "url": "http://patches.dpdk.org/api/patches/12286/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1461870241-83333-3-git-send-email-jianfeng.tan@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": "<1461870241-83333-3-git-send-email-jianfeng.tan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1461870241-83333-3-git-send-email-jianfeng.tan@intel.com",
    "date": "2016-04-28T19:04:01",
    "name": "[dpdk-dev,v2,2/2] virtio: fix memory leak of virtqueue memzones",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a30e9f52e4b45a1f4c259f330d3a0e7ff92b38f3",
    "submitter": {
        "id": 313,
        "url": "http://patches.dpdk.org/api/people/313/?format=api",
        "name": "Jianfeng Tan",
        "email": "jianfeng.tan@intel.com"
    },
    "delegate": {
        "id": 355,
        "url": "http://patches.dpdk.org/api/users/355/?format=api",
        "username": "yliu",
        "first_name": "Yuanhan",
        "last_name": "Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1461870241-83333-3-git-send-email-jianfeng.tan@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/12286/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/12286/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id C7C565685;\n\tThu, 28 Apr 2016 21:04:16 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 396205677\n\tfor <dev@dpdk.org>; Thu, 28 Apr 2016 21:04:14 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga103.fm.intel.com with ESMTP; 28 Apr 2016 12:04:04 -0700",
            "from dpdk06.sh.intel.com ([10.239.128.225])\n\tby orsmga003.jf.intel.com with ESMTP; 28 Apr 2016 12:04:02 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.24,547,1455004800\"; d=\"scan'208\";a=\"794483793\"",
        "From": "Jianfeng Tan <jianfeng.tan@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "huawei.xie@intel.com, yuanhan.liu@linux.intel.com,\n\tJianfeng Tan <jianfeng.tan@intel.com>",
        "Date": "Thu, 28 Apr 2016 19:04:01 +0000",
        "Message-Id": "<1461870241-83333-3-git-send-email-jianfeng.tan@intel.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1461870241-83333-1-git-send-email-jianfeng.tan@intel.com>",
        "References": "<1461673932-128879-1-git-send-email-jianfeng.tan@intel.com>\n\t<1461870241-83333-1-git-send-email-jianfeng.tan@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/2] virtio: fix memory leak of virtqueue\n\tmemzones",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Issue: When virtio was proposed in DPDK, there is no API to free memzones.\nBut this has changed since rte_memzone_free() has been implemented by\ncommit ff909fe21f0a (\"mem: introduce memzone freeing\").\n\nThis patch is to make sure memzones in struct virtqueue, like mz and\nvirtio_net_hdr_mz, are freed when queue is released or setup fails.\n\nSigned-off-by: Jianfeng Tan <jianfeng.tan@intel.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 21 ++++++++++++++-------\n drivers/net/virtio/virtqueue.h     |  2 ++\n 2 files changed, 16 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 0553b67..a14cc88 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -260,12 +260,18 @@ virtio_set_multiple_queues(struct rte_eth_dev *dev, uint16_t nb_queues)\n }\n \n void\n-virtio_dev_queue_release(struct virtqueue *vq) {\n+virtio_dev_queue_release(struct virtqueue *vq)\n+{\n \tstruct virtio_hw *hw;\n \n \tif (vq) {\n \t\thw = vq->hw;\n-\t\thw->vtpci_ops->del_queue(hw, vq);\n+\t\tif (vq->started)\n+\t\t\thw->vtpci_ops->del_queue(hw, vq);\n+\n+\t\trte_memzone_free(vq->mz);\n+\t\tif (vq->virtio_net_hdr_mz)\n+\t\t\trte_memzone_free(vq->virtio_net_hdr_mz);\n \n \t\trte_free(vq->sw_ring);\n \t\trte_free(vq);\n@@ -330,7 +336,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \t\t\t\t\t\t socket_id);\n \t\tif (!vq->sw_ring) {\n \t\t\tPMD_INIT_LOG(ERR, \"Can not allocate RX soft ring\");\n-\t\t\trte_free(vq);\n+\t\t\tvirtio_dev_queue_release(vq);\n \t\t\treturn -ENOMEM;\n \t\t}\n \t}\n@@ -358,7 +364,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \t\tif (rte_errno == EEXIST)\n \t\t\tmz = rte_memzone_lookup(vq_name);\n \t\tif (mz == NULL) {\n-\t\t\trte_free(vq);\n+\t\t\tvirtio_dev_queue_release(vq);\n \t\t\treturn -ENOMEM;\n \t\t}\n \t}\n@@ -370,7 +376,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \t */\n \tif ((mz->phys_addr + vq->vq_ring_size - 1) >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {\n \t\tPMD_INIT_LOG(ERR, \"vring address shouldn't be above 16TB!\");\n-\t\trte_free(vq);\n+\t\tvirtio_dev_queue_release(vq);\n \t\treturn -ENOMEM;\n \t}\n \n@@ -402,7 +408,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \t\t\tif (rte_errno == EEXIST)\n \t\t\t\thdr_mz = rte_memzone_lookup(vq_name);\n \t\t\tif (hdr_mz == NULL) {\n-\t\t\t\trte_free(vq);\n+\t\t\t\tvirtio_dev_queue_release(vq);\n \t\t\t\treturn -ENOMEM;\n \t\t\t}\n \t\t}\n@@ -436,7 +442,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \t\t\t\tvq->virtio_net_hdr_mz =\n \t\t\t\t\trte_memzone_lookup(vq_name);\n \t\t\tif (vq->virtio_net_hdr_mz == NULL) {\n-\t\t\t\trte_free(vq);\n+\t\t\t\tvirtio_dev_queue_release(vq);\n \t\t\t\treturn -ENOMEM;\n \t\t\t}\n \t\t}\n@@ -447,6 +453,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \n \thw->vtpci_ops->setup_queue(hw, vq);\n \n+\tvq->started = 1;\n \t*pvq = vq;\n \treturn 0;\n }\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex 4e9239e..83d89ca 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -201,6 +201,8 @@ struct virtqueue {\n \n \tuint16_t\t*notify_addr;\n \n+\tint\t\tstarted;\n+\n \tstruct vq_desc_extra {\n \t\tvoid              *cookie;\n \t\tuint16_t          ndescs;\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "2/2"
    ]
}