Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/12285/?format=api
https://patches.dpdk.org/api/patches/12285/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1461870241-83333-2-git-send-email-jianfeng.tan@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": "<1461870241-83333-2-git-send-email-jianfeng.tan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1461870241-83333-2-git-send-email-jianfeng.tan@intel.com", "date": "2016-04-28T19:04:00", "name": "[dpdk-dev,v2,1/2] virtio: cleanup virtio_dev_queue_setup()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "22b078bd11c034311616647fc033ab94ba5d98a6", "submitter": { "id": 313, "url": "https://patches.dpdk.org/api/people/313/?format=api", "name": "Jianfeng Tan", "email": "jianfeng.tan@intel.com" }, "delegate": { "id": 355, "url": "https://patches.dpdk.org/api/users/355/?format=api", "username": "yliu", "first_name": "Yuanhan", "last_name": "Liu", "email": "yuanhan.liu@linux.intel.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1461870241-83333-2-git-send-email-jianfeng.tan@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/12285/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/12285/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 B86BF567F;\n\tThu, 28 Apr 2016 21:04:15 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 12753559C\n\tfor <dev@dpdk.org>; Thu, 28 Apr 2016 21:04:13 +0200 (CEST)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga103.fm.intel.com with ESMTP; 28 Apr 2016 12:04:03 -0700", "from dpdk06.sh.intel.com ([10.239.128.225])\n\tby orsmga003.jf.intel.com with ESMTP; 28 Apr 2016 12:04:01 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.24,547,1455004800\"; d=\"scan'208\";a=\"794483745\"", "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:00 +0000", "Message-Id": "<1461870241-83333-2-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 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..0553b67 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_RQ) {\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", "v2", "1/2" ] }{ "id": 12285, "url": "