get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 12287,
    "url": "http://patches.dpdk.org/api/patches/12287/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1461890926-16727-2-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": "<1461890926-16727-2-git-send-email-jianfeng.tan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1461890926-16727-2-git-send-email-jianfeng.tan@intel.com",
    "date": "2016-04-29T00:48:45",
    "name": "[dpdk-dev,v3,1/2] virtio: cleanup virtio_dev_queue_setup()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "266d2fa6edb69f7f8eb8cf2639aec39f3f581faa",
    "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/1461890926-16727-2-git-send-email-jianfeng.tan@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/12287/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/12287/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 E76AB5690;\n\tFri, 29 Apr 2016 02:48:49 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 9E2B337B1\n\tfor <dev@dpdk.org>; Fri, 29 Apr 2016 02:48:47 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga103.jf.intel.com with ESMTP; 28 Apr 2016 17:48:47 -0700",
            "from dpdk06.sh.intel.com ([10.239.128.225])\n\tby orsmga003.jf.intel.com with ESMTP; 28 Apr 2016 17:48:46 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.24,549,1455004800\"; d=\"scan'208\";a=\"794650059\"",
        "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": "Fri, 29 Apr 2016 00:48:45 +0000",
        "Message-Id": "<1461890926-16727-2-git-send-email-jianfeng.tan@intel.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1461890926-16727-1-git-send-email-jianfeng.tan@intel.com>",
        "References": "<1461673932-128879-1-git-send-email-jianfeng.tan@intel.com>\n\t<1461890926-16727-1-git-send-email-jianfeng.tan@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 1/2] virtio: cleanup virtio_dev_queue_setup()",
        "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": "Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 47 +++++++++++++++++++-------------------\n 1 file changed, 24 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 1fe90ae..b3f4158 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -285,6 +285,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \tunsigned int vq_size, size;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n \tstruct virtqueue *vq = NULL;\n+\tconst char *queue_names[] = {\"rvq\", \"txq\", \"cvq\"};\n \n \tPMD_INIT_LOG(DEBUG, \"setting up queue: %u\", vtpci_queue_idx);\n \n@@ -304,34 +305,34 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,\n \t\treturn -EINVAL;\n \t}\n \n-\tif (queue_type == VTNET_RQ) {\n-\t\tsnprintf(vq_name, sizeof(vq_name), \"port%d_rvq%d\",\n-\t\t\tdev->data->port_id, queue_idx);\n-\t\tvq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +\n-\t\t\tvq_size * sizeof(struct vq_desc_extra), RTE_CACHE_LINE_SIZE);\n-\t\tvq->sw_ring = rte_zmalloc_socket(\"rxq->sw_ring\",\n-\t\t\t(RTE_PMD_VIRTIO_RX_MAX_BURST + vq_size) *\n-\t\t\tsizeof(vq->sw_ring[0]), RTE_CACHE_LINE_SIZE, socket_id);\n-\t} else if (queue_type == VTNET_TQ) {\n-\t\tsnprintf(vq_name, sizeof(vq_name), \"port%d_tvq%d\",\n-\t\t\tdev->data->port_id, queue_idx);\n-\t\tvq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +\n-\t\t\tvq_size * sizeof(struct vq_desc_extra), RTE_CACHE_LINE_SIZE);\n-\t} else if (queue_type == VTNET_CQ) {\n-\t\tsnprintf(vq_name, sizeof(vq_name), \"port%d_cvq\",\n-\t\t\tdev->data->port_id);\n-\t\tvq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +\n-\t\t\tvq_size * sizeof(struct vq_desc_extra),\n-\t\t\tRTE_CACHE_LINE_SIZE);\n+\tif (queue_type < VTNET_RQ || queue_type > VTNET_CQ) {\n+\t\tPMD_INIT_LOG(ERR, \"invalid queue type: %d\", queue_type);\n+\t\treturn -EINVAL;\n \t}\n+\n+\tsnprintf(vq_name, sizeof(vq_name), \"port%d_%s%d\",\n+\t\t dev->data->port_id, queue_names[queue_type], queue_idx);\n+\tvq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +\n+\t\t\t vq_size * sizeof(struct vq_desc_extra),\n+\t\t\t RTE_CACHE_LINE_SIZE);\n \tif (vq == NULL) {\n \t\tPMD_INIT_LOG(ERR, \"Can not allocate virtqueue\");\n \t\treturn -ENOMEM;\n \t}\n-\tif (queue_type == VTNET_RQ && vq->sw_ring == NULL) {\n-\t\tPMD_INIT_LOG(ERR, \"Can not allocate RX soft ring\");\n-\t\trte_free(vq);\n-\t\treturn -ENOMEM;\n+\n+\tif (queue_type == VTNET_RQ) {\n+\t\tsize_t sz_sw;\n+\n+\t\tsz_sw = (RTE_PMD_VIRTIO_RX_MAX_BURST + vq_size) *\n+\t\t\tsizeof(vq->sw_ring[0]);\n+\t\tvq->sw_ring = rte_zmalloc_socket(\"rxq->sw_ring\", sz_sw,\n+\t\t\t\t\t\t RTE_CACHE_LINE_SIZE,\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\treturn -ENOMEM;\n+\t\t}\n \t}\n \n \tvq->hw = hw;\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "1/2"
    ]
}