get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 58230,
    "url": "http://patches.dpdk.org/api/patches/58230/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190829080000.20806-13-maxime.coquelin@redhat.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": "<20190829080000.20806-13-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190829080000.20806-13-maxime.coquelin@redhat.com",
    "date": "2019-08-29T07:59:57",
    "name": "[12/15] net/virtio: add vDPA op to set features",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "97e24f8427964743a2740e23f2d2fea8626bcbaf",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190829080000.20806-13-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 6163,
            "url": "http://patches.dpdk.org/api/series/6163/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6163",
            "date": "2019-08-29T07:59:45",
            "name": "Introduce Virtio vDPA driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/6163/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/58230/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/58230/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 0E6981DFF0;\n\tThu, 29 Aug 2019 10:01:02 +0200 (CEST)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id B82491D17E;\n\tThu, 29 Aug 2019 10:00:59 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 151E510F23E8;\n\tThu, 29 Aug 2019 08:00:59 +0000 (UTC)",
            "from localhost.localdomain (ovpn-112-52.ams2.redhat.com\n\t[10.36.112.52])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id ABDD95D6B2;\n\tThu, 29 Aug 2019 08:00:56 +0000 (UTC)"
        ],
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "tiwei.bie@intel.com, zhihong.wang@intel.com, amorenoz@redhat.com,\n\txiao.w.wang@intel.com, dev@dpdk.org, jfreimann@redhat.com",
        "Cc": "stable@dpdk.org,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Thu, 29 Aug 2019 09:59:57 +0200",
        "Message-Id": "<20190829080000.20806-13-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20190829080000.20806-1-maxime.coquelin@redhat.com>",
        "References": "<20190829080000.20806-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.6.2\n\t(mx1.redhat.com [10.5.110.66]); Thu, 29 Aug 2019 08:00:59 +0000 (UTC)",
        "Subject": "[dpdk-dev] [PATCH 12/15] net/virtio: add vDPA op to set features",
        "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": "On top of that, it allocates the control virtqueue if\nmultiqueue has been negotiated.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/net/virtio/virtio_vdpa.c | 155 +++++++++++++++++++++++++++++++\n 1 file changed, 155 insertions(+)",
    "diff": "diff --git a/drivers/net/virtio/virtio_vdpa.c b/drivers/net/virtio/virtio_vdpa.c\nindex 691844906..9b61688a1 100644\n--- a/drivers/net/virtio/virtio_vdpa.c\n+++ b/drivers/net/virtio/virtio_vdpa.c\n@@ -521,12 +521,167 @@ virtio_vdpa_dev_close(int vid)\n \treturn 0;\n }\n \n+\n+static void\n+virtio_vdpa_free_ctrl_vq(struct virtio_vdpa_device *dev)\n+{\n+\tif (!dev->cvq)\n+\t\treturn;\n+\n+\trte_memzone_free(dev->cvq->cq.virtio_net_hdr_mz);\n+\trte_memzone_free(dev->cvq->cq.mz);\n+\trte_free(dev->cvq);\n+\n+\tdev->hw.cvq = NULL;\n+}\n+\n+static int\n+virtio_vdpa_allocate_ctrl_vq(struct virtio_vdpa_device *dev)\n+{\n+\tstruct virtio_hw *hw = &dev->hw;\n+\tchar vq_name[VIRTQUEUE_MAX_NAME_SZ];\n+\tchar vq_hdr_name[VIRTQUEUE_MAX_NAME_SZ];\n+\tint numa_node = dev->pdev->device.numa_node;\n+\tconst struct rte_memzone *mz = NULL, *hdr_mz = NULL;\n+\tuint16_t ctrl_queue_idx = dev->max_queue_pairs * 2;\n+\tuint16_t ctrl_queue_sz;\n+\tint size, ret;\n+\n+\tif (dev->cvq)\n+\t\tvirtio_vdpa_free_ctrl_vq(dev);\n+\n+\tctrl_queue_sz = VTPCI_OPS(hw)->get_queue_num(hw, ctrl_queue_idx);\n+\tif (ctrl_queue_sz == 0) {\n+\t\tDRV_LOG(ERR, \"Ctrl VQ does not exist\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tdev->cvq = rte_zmalloc_socket(vq_name, sizeof(*dev->cvq),\n+\t\t\tRTE_CACHE_LINE_SIZE, numa_node);\n+\tif (!dev->cvq)\n+\t\treturn -ENOMEM;\n+\n+\tdev->cvq->hw = &dev->hw;\n+\tdev->cvq->vq_queue_index = ctrl_queue_idx;\n+\tdev->cvq->vq_nentries = ctrl_queue_sz;\n+\n+\tif (vtpci_packed_queue(hw)) {\n+\t\tdev->cvq->vq_packed.used_wrap_counter = 1;\n+\t\tdev->cvq->vq_packed.cached_flags = VRING_PACKED_DESC_F_AVAIL;\n+\t\tdev->cvq->vq_packed.event_flags_shadow = 0;\n+\t}\n+\n+\tsize = vring_size(hw, ctrl_queue_sz, VIRTIO_PCI_VRING_ALIGN);\n+\tdev->cvq->vq_ring_size = RTE_ALIGN_CEIL(size, VIRTIO_PCI_VRING_ALIGN);\n+\n+\tsnprintf(vq_name, sizeof(vq_name), \"vdpa_ctrlvq%d\",\n+\t\t dev->did);\n+\n+\tmz = rte_memzone_reserve_aligned(vq_name, dev->cvq->vq_ring_size,\n+\t\t\tnuma_node, RTE_MEMZONE_IOVA_CONTIG,\n+\t\t\tVIRTIO_PCI_VRING_ALIGN);\n+\tif (mz == NULL) {\n+\t\tif (rte_errno == EEXIST)\n+\t\t\tmz = rte_memzone_lookup(vq_name);\n+\t\tif (mz == NULL) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto out_free_cvq;\n+\t\t}\n+\t}\n+\n+\tmemset(mz->addr, 0, mz->len);\n+\tdev->cvq->vq_ring_virt_mem = mz->addr;\n+\n+\tvirtio_init_vring(dev->cvq);\n+\n+\tsnprintf(vq_hdr_name, sizeof(vq_hdr_name), \"vdpa_ctrlvq%d_hdr\",\n+\t\t dev->did);\n+\n+\thdr_mz = rte_memzone_reserve_aligned(vq_hdr_name, PAGE_SIZE * 2,\n+\t\t\tnuma_node, RTE_MEMZONE_IOVA_CONTIG,\n+\t\t\tVIRTIO_PCI_VRING_ALIGN);\n+\tif (hdr_mz == NULL) {\n+\t\tif (rte_errno == EEXIST)\n+\t\t\thdr_mz = rte_memzone_lookup(vq_hdr_name);\n+\t\tif (hdr_mz == NULL) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto out_free_mz;\n+\t\t}\n+\t}\n+\n+\tmemset(hdr_mz->addr, 0, hdr_mz->len);\n+\n+\tdev->cvq->cq.vq = dev->cvq;\n+\tdev->cvq->cq.mz = mz;\n+\tdev->cvq->cq.virtio_net_hdr_mz = hdr_mz;\n+\tdev->hw.cvq = &dev->cvq->cq;\n+\n+\treturn 0;\n+\n+out_free_mz:\n+\trte_memzone_free(mz);\n+out_free_cvq:\n+\trte_free(dev->cvq);\n+\tdev->cvq = NULL;\n+\n+\treturn ret;\n+}\n+\n+static int\n+virtio_vdpa_set_features(int vid)\n+{\n+\tuint64_t features;\n+\tint did, ret;\n+\tstruct internal_list *list;\n+\tstruct virtio_vdpa_device *dev;\n+\tstruct virtio_hw *hw;\n+\n+\tdid = rte_vhost_get_vdpa_device_id(vid);\n+\tlist = find_internal_resource_by_did(did);\n+\tif (list == NULL) {\n+\t\tDRV_LOG(ERR, \"Invalid device id: %d\", did);\n+\t\treturn -1;\n+\t}\n+\n+\tdev = list->dev;\n+\thw = &dev->hw;\n+\trte_vhost_get_negotiated_features(vid, &features);\n+\n+\tfeatures |= (1ULL << VIRTIO_F_IOMMU_PLATFORM);\n+\tif (dev->has_ctrl_vq)\n+\t\tfeatures |= (1ULL << VIRTIO_NET_F_CTRL_VQ);\n+\n+\tVTPCI_OPS(&dev->hw)->set_features(&dev->hw, features);\n+\thw->guest_features = features;\n+\n+\tif (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VQ)) {\n+\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MQ)) {\n+\t\t\tvtpci_read_dev_config(hw,\n+\t\t\t\toffsetof(struct virtio_net_config,\n+\t\t\t\t\tmax_virtqueue_pairs),\n+\t\t\t\t&dev->max_queue_pairs,\n+\t\t\t\tsizeof(dev->max_queue_pairs));\n+\t\t} else {\n+\t\t\tdev->max_queue_pairs = 1;\n+\t\t}\n+\n+\t\tret = virtio_vdpa_allocate_ctrl_vq(dev);\n+\t\tif (ret) {\n+\t\t\tDRV_LOG(ERR, \"Failed to allocate ctrl vq\");\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n static struct rte_vdpa_dev_ops virtio_vdpa_ops = {\n \t.get_queue_num = virtio_vdpa_get_queue_num,\n \t.get_features = virtio_vdpa_get_features,\n \t.get_protocol_features = virtio_vdpa_get_protocol_features,\n \t.dev_conf = virtio_vdpa_dev_config,\n \t.dev_close = virtio_vdpa_dev_close,\n+\t.set_features = virtio_vdpa_set_features,\n };\n \n static inline int\n",
    "prefixes": [
        "12/15"
    ]
}