get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 111610,
    "url": "http://patches.dpdk.org/api/patches/111610/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1653298524-232138-4-git-send-email-andy.pei@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": "<1653298524-232138-4-git-send-email-andy.pei@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1653298524-232138-4-git-send-email-andy.pei@intel.com",
    "date": "2022-05-23T09:35:14",
    "name": "[v9,03/13] vhost: add vhost msg support for get/set config",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ecea09eba3f65a1e70d78eca70cf238be7408017",
    "submitter": {
        "id": 1185,
        "url": "http://patches.dpdk.org/api/people/1185/?format=api",
        "name": "Pei, Andy",
        "email": "andy.pei@intel.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/1653298524-232138-4-git-send-email-andy.pei@intel.com/mbox/",
    "series": [
        {
            "id": 23091,
            "url": "http://patches.dpdk.org/api/series/23091/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23091",
            "date": "2022-05-23T09:35:11",
            "name": "add virtio_blk device support to vdpa/ifc",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/23091/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/111610/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/111610/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 5B401A04FD;\n\tMon, 23 May 2022 12:22:48 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2679D42685;\n\tMon, 23 May 2022 12:22:40 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id 2C2B442685\n for <dev@dpdk.org>; Mon, 23 May 2022 12:22:38 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 May 2022 03:22:37 -0700",
            "from dpdk-dipei.sh.intel.com ([10.67.110.238])\n by orsmga006.jf.intel.com with ESMTP; 23 May 2022 03:22:35 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1653301358; x=1684837358;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=bmUC8oiGHBtoKQtKt6JczWEAS2m3rLR/99gZZGUBd9E=;\n b=AzZJwUP6ipZLDGU1iX1zu3ISa3gm6ieyahr7FkuKjmB63jIxNnPoz/80\n zjQEvyN8Kbw8tXkfUgJUaFhd4qVwu3OfBv6ra4rm8pDtXslaMvzjjwTJs\n dEyBqPIANVRgX2SYMoeT4c2iEbeYX0ZlWC76tPa5ujwFLKs5RXrnfi2So\n rOQcYoSW5M4pa1THr/OS/r1JzTK+2J7PWFukcjd4uAVDQ0uehM+Wb5odB\n JI0teChEApTQCYQQEItXf1zoUfXOFhZzFM3DEqAyzGorFqlgLVo8Uqa8d\n Hdf/lqqKWPBSuFZZmcAFkNb0xrScHJJQSJlCTYV8twXu4ZOFsDTt/zvho A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10355\"; a=\"255239283\"",
            "E=Sophos;i=\"5.91,246,1647327600\"; d=\"scan'208\";a=\"255239283\"",
            "E=Sophos;i=\"5.91,246,1647327600\"; d=\"scan'208\";a=\"547889392\""
        ],
        "X-ExtLoop1": "1",
        "From": "Andy Pei <andy.pei@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com,\n changpeng.liu@intel.com, rosen.xu@intel.com, qimaix.xiao@intel.com",
        "Subject": "[PATCH v9 03/13] vhost: add vhost msg support for get/set config",
        "Date": "Mon, 23 May 2022 17:35:14 +0800",
        "Message-Id": "<1653298524-232138-4-git-send-email-andy.pei@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1653298524-232138-1-git-send-email-andy.pei@intel.com>",
        "References": "<1643093258-47258-2-git-send-email-andy.pei@intel.com>\n <1653298524-232138-1-git-send-email-andy.pei@intel.com>",
        "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"
    },
    "content": "Add support for VHOST_USER_GET_CONFIG and VHOST_USER_SET_CONFIG.\nVHOST_USER_GET_CONFIG and VHOST_USER_SET_CONFIG message is only\nsupported by virtio blk VDPA device.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\n---\n lib/vhost/vhost_user.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++\n lib/vhost/vhost_user.h | 13 ++++++++\n 2 files changed, 101 insertions(+)",
    "diff": "diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c\nindex 850848c..b37d814 100644\n--- a/lib/vhost/vhost_user.c\n+++ b/lib/vhost/vhost_user.c\n@@ -2468,6 +2468,92 @@ static int is_vring_iotlb(struct virtio_net *dev,\n }\n \n static int\n+vhost_user_get_config(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n+\t\t\tint main_fd __rte_unused)\n+{\n+\tstruct virtio_net *dev = *pdev;\n+\tstruct rte_vdpa_device *vdpa_dev = dev->vdpa_dev;\n+\tint ret = 0;\n+\n+\tif (validate_msg_fds(dev, ctx, 0) != 0)\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\n+\tif (!vdpa_dev) {\n+\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\t \"(%s) is not vDPA device!\\n\",\n+\t\t\t\t dev->ifname);\n+\t\tgoto out;\n+\t}\n+\n+\tif (vdpa_dev->ops->get_config) {\n+\t\tret = vdpa_dev->ops->get_config(dev->vid,\n+\t\t\t\t\t   ctx->msg.payload.cfg.region,\n+\t\t\t\t\t   ctx->msg.payload.cfg.size);\n+\t\tif (ret != 0) {\n+\t\t\tctx->msg.size = 0;\n+\t\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\t\t \"(%s) get_config() return error!\\n\",\n+\t\t\t\t\t dev->ifname);\n+\t\t}\n+\t} else {\n+\t\tVHOST_LOG_CONFIG(ERR, \"(%s) get_config() not supported!\\n\",\n+\t\t\t\t dev->ifname);\n+\t}\n+\n+out:\n+\treturn RTE_VHOST_MSG_RESULT_REPLY;\n+}\n+\n+static int\n+vhost_user_set_config(struct virtio_net **pdev,\n+\t\t\tstruct vhu_msg_context *ctx,\n+\t\t\tint main_fd __rte_unused)\n+{\n+\tstruct virtio_net *dev = *pdev;\n+\tstruct rte_vdpa_device *vdpa_dev = dev->vdpa_dev;\n+\tint ret = 0;\n+\n+\tif (validate_msg_fds(dev, ctx, 0) != 0)\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\n+\tif (ctx->msg.payload.cfg.size > VHOST_USER_MAX_CONFIG_SIZE) {\n+\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\"(%s) vhost_user_config size: %\"PRIu32\", should not be larger than %d\\n\",\n+\t\t\tdev->ifname, ctx->msg.payload.cfg.size,\n+\t\t\tVHOST_USER_MAX_CONFIG_SIZE);\n+\t\tgoto out;\n+\t}\n+\n+\tif (!vdpa_dev) {\n+\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\t \"(%s) is not vDPA device!\\n\",\n+\t\t\t\t dev->ifname);\n+\t\tgoto out;\n+\t}\n+\n+\tif (vdpa_dev->ops->set_config) {\n+\t\tret = vdpa_dev->ops->set_config(dev->vid,\n+\t\t\tctx->msg.payload.cfg.region,\n+\t\t\tctx->msg.payload.cfg.offset,\n+\t\t\tctx->msg.payload.cfg.size,\n+\t\t\tctx->msg.payload.cfg.flags);\n+\t\tif (ret)\n+\t\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\t\t \"(%s) set_config() return error!\\n\",\n+\t\t\t\t\t dev->ifname);\n+\t} else {\n+\t\tVHOST_LOG_CONFIG(ERR, \"(%s) set_config() not supported!\\n\",\n+\t\t\t\t dev->ifname);\n+\t}\n+\n+\treturn RTE_VHOST_MSG_RESULT_OK;\n+\n+out:\n+\treturn RTE_VHOST_MSG_RESULT_ERR;\n+}\n+\n+static int\n vhost_user_iotlb_msg(struct virtio_net **pdev,\n \t\t\tstruct vhu_msg_context *ctx,\n \t\t\tint main_fd __rte_unused)\n@@ -2686,6 +2772,8 @@ static int is_vring_iotlb(struct virtio_net *dev,\n VHOST_MESSAGE_HANDLER(VHOST_USER_NET_SET_MTU, vhost_user_net_set_mtu, false) \\\n VHOST_MESSAGE_HANDLER(VHOST_USER_SET_SLAVE_REQ_FD, vhost_user_set_req_fd, true) \\\n VHOST_MESSAGE_HANDLER(VHOST_USER_IOTLB_MSG, vhost_user_iotlb_msg, false) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_CONFIG, vhost_user_get_config, false) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_CONFIG, vhost_user_set_config, false) \\\n VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_ADVISE, vhost_user_set_postcopy_advise, false) \\\n VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_LISTEN, vhost_user_set_postcopy_listen, false) \\\n VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_END, vhost_user_postcopy_end, false) \\\ndiff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h\nindex ba1c5c7..c4d091e 100644\n--- a/lib/vhost/vhost_user.h\n+++ b/lib/vhost/vhost_user.h\n@@ -50,6 +50,8 @@\n \tVHOST_USER_NET_SET_MTU = 20,\n \tVHOST_USER_SET_SLAVE_REQ_FD = 21,\n \tVHOST_USER_IOTLB_MSG = 22,\n+\tVHOST_USER_GET_CONFIG = 24,\n+\tVHOST_USER_SET_CONFIG = 25,\n \tVHOST_USER_CRYPTO_CREATE_SESS = 26,\n \tVHOST_USER_CRYPTO_CLOSE_SESS = 27,\n \tVHOST_USER_POSTCOPY_ADVISE = 28,\n@@ -123,6 +125,16 @@\n \tuint16_t queue_size;\n } VhostUserInflight;\n \n+#define VHOST_USER_MAX_CONFIG_SIZE\t\t256\n+\n+/** Get/set config msg payload */\n+struct vhost_user_config {\n+\tuint32_t offset;\n+\tuint32_t size;\n+\tuint32_t flags;\n+\tuint8_t region[VHOST_USER_MAX_CONFIG_SIZE];\n+};\n+\n typedef struct VhostUserMsg {\n \tunion {\n \t\tuint32_t master; /* a VhostUserRequest value */\n@@ -146,6 +158,7 @@\n \t\tVhostUserCryptoSessionParam crypto_session;\n \t\tVhostUserVringArea area;\n \t\tVhostUserInflight inflight;\n+\t\tstruct vhost_user_config cfg;\n \t} payload;\n \t/* Nothing should be added after the payload */\n } __rte_packed VhostUserMsg;\n",
    "prefixes": [
        "v9",
        "03/13"
    ]
}