get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 110233,
    "url": "https://patches.dpdk.org/api/patches/110233/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220425125431.26464-1-david.marchand@redhat.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": "<20220425125431.26464-1-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220425125431.26464-1-david.marchand@redhat.com",
    "date": "2022-04-25T12:54:29",
    "name": "[1/2] vhost: remove unneeded max enums",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "d345920c002d2c1db877567c467586be779061ff",
    "submitter": {
        "id": 1173,
        "url": "https://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220425125431.26464-1-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 22659,
            "url": "https://patches.dpdk.org/api/series/22659/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=22659",
            "date": "2022-04-25T12:54:29",
            "name": "[1/2] vhost: remove unneeded max enums",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/22659/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/110233/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/110233/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 BFB17A00BE;\n\tMon, 25 Apr 2022 14:54:42 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 992D241151;\n\tMon, 25 Apr 2022 14:54:42 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id DB40C41109\n for <dev@dpdk.org>; Mon, 25 Apr 2022 14:54:40 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-83-7k16LcEvPlaBaSF-BLU4Tg-1; Mon, 25 Apr 2022 08:54:39 -0400",
            "from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com\n [10.11.54.8])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED50E80005D;\n Mon, 25 Apr 2022 12:54:38 +0000 (UTC)",
            "from dmarchan.remote.csb (unknown [10.40.193.200])\n by smtp.corp.redhat.com (Postfix) with ESMTP id F34FBC28107;\n Mon, 25 Apr 2022 12:54:37 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1650891280;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=zXgXdPAVWNFrupoYStjQfBWcaFMaoqZO5u4qdcFXdcY=;\n b=IHUcJ3LgnFD64h5GlTFyCumJSdb4nGjibmFIwMaVWs3E8VxHm+v2t/nn7eDGYFq6c1SPRR\n UmyTFh7svCyQJQJhCZG81hvLcQzumyGTcxabECy7GUMBC5PDVeD0WbMRA78FKGJf4aGkfc\n e9byQ2kYxDsmtqMm2Z3dIcGm4hvyVC8=",
        "X-MC-Unique": "7k16LcEvPlaBaSF-BLU4Tg-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "maxime.coquelin@redhat.com,\n\tchenbo.xia@intel.com",
        "Subject": "[PATCH 1/2] vhost: remove unneeded max enums",
        "Date": "Mon, 25 Apr 2022 14:54:29 +0200",
        "Message-Id": "<20220425125431.26464-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.85 on 10.11.54.8",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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": "Move message handler description and callbacks into a single array and\nremove unneeded VHOST_USER_MAX and VHOST_SLAVE_MAX enums.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n drivers/net/virtio/virtio_user/vhost_user.c |   1 -\n examples/vhost_blk/blk_spec.h               |   1 -\n lib/vhost/vhost_user.c                      | 175 +++++++++-----------\n lib/vhost/vhost_user.h                      |   2 -\n 4 files changed, 76 insertions(+), 103 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c\nindex 00d0dcaa74..7d1749114d 100644\n--- a/drivers/net/virtio/virtio_user/vhost_user.c\n+++ b/drivers/net/virtio/virtio_user/vhost_user.c\n@@ -78,7 +78,6 @@ enum vhost_user_request {\n \tVHOST_USER_SET_VRING_ENABLE = 18,\n \tVHOST_USER_SET_STATUS = 39,\n \tVHOST_USER_GET_STATUS = 40,\n-\tVHOST_USER_MAX\n };\n \n struct vhost_user_msg {\ndiff --git a/examples/vhost_blk/blk_spec.h b/examples/vhost_blk/blk_spec.h\nindex 594bd6a29b..3c54f70eaf 100644\n--- a/examples/vhost_blk/blk_spec.h\n+++ b/examples/vhost_blk/blk_spec.h\n@@ -56,7 +56,6 @@ enum vhost_user_request {\n \tVHOST_USER_SET_PROTOCOL_FEATURES = 16,\n \tVHOST_USER_GET_QUEUE_NUM = 17,\n \tVHOST_USER_SET_VRING_ENABLE = 18,\n-\tVHOST_USER_MAX\n };\n \n /** Get/set config msg payload */\ndiff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c\nindex 1d390677fa..17cfeafa16 100644\n--- a/lib/vhost/vhost_user.c\n+++ b/lib/vhost/vhost_user.c\n@@ -56,40 +56,12 @@\n #define INFLIGHT_ALIGNMENT\t64\n #define INFLIGHT_VERSION\t0x1\n \n-static const char *vhost_message_str[VHOST_USER_MAX] = {\n-\t[VHOST_USER_NONE] = \"VHOST_USER_NONE\",\n-\t[VHOST_USER_GET_FEATURES] = \"VHOST_USER_GET_FEATURES\",\n-\t[VHOST_USER_SET_FEATURES] = \"VHOST_USER_SET_FEATURES\",\n-\t[VHOST_USER_SET_OWNER] = \"VHOST_USER_SET_OWNER\",\n-\t[VHOST_USER_RESET_OWNER] = \"VHOST_USER_RESET_OWNER\",\n-\t[VHOST_USER_SET_MEM_TABLE] = \"VHOST_USER_SET_MEM_TABLE\",\n-\t[VHOST_USER_SET_LOG_BASE] = \"VHOST_USER_SET_LOG_BASE\",\n-\t[VHOST_USER_SET_LOG_FD] = \"VHOST_USER_SET_LOG_FD\",\n-\t[VHOST_USER_SET_VRING_NUM] = \"VHOST_USER_SET_VRING_NUM\",\n-\t[VHOST_USER_SET_VRING_ADDR] = \"VHOST_USER_SET_VRING_ADDR\",\n-\t[VHOST_USER_SET_VRING_BASE] = \"VHOST_USER_SET_VRING_BASE\",\n-\t[VHOST_USER_GET_VRING_BASE] = \"VHOST_USER_GET_VRING_BASE\",\n-\t[VHOST_USER_SET_VRING_KICK] = \"VHOST_USER_SET_VRING_KICK\",\n-\t[VHOST_USER_SET_VRING_CALL] = \"VHOST_USER_SET_VRING_CALL\",\n-\t[VHOST_USER_SET_VRING_ERR]  = \"VHOST_USER_SET_VRING_ERR\",\n-\t[VHOST_USER_GET_PROTOCOL_FEATURES]  = \"VHOST_USER_GET_PROTOCOL_FEATURES\",\n-\t[VHOST_USER_SET_PROTOCOL_FEATURES]  = \"VHOST_USER_SET_PROTOCOL_FEATURES\",\n-\t[VHOST_USER_GET_QUEUE_NUM]  = \"VHOST_USER_GET_QUEUE_NUM\",\n-\t[VHOST_USER_SET_VRING_ENABLE]  = \"VHOST_USER_SET_VRING_ENABLE\",\n-\t[VHOST_USER_SEND_RARP]  = \"VHOST_USER_SEND_RARP\",\n-\t[VHOST_USER_NET_SET_MTU]  = \"VHOST_USER_NET_SET_MTU\",\n-\t[VHOST_USER_SET_SLAVE_REQ_FD]  = \"VHOST_USER_SET_SLAVE_REQ_FD\",\n-\t[VHOST_USER_IOTLB_MSG]  = \"VHOST_USER_IOTLB_MSG\",\n-\t[VHOST_USER_CRYPTO_CREATE_SESS] = \"VHOST_USER_CRYPTO_CREATE_SESS\",\n-\t[VHOST_USER_CRYPTO_CLOSE_SESS] = \"VHOST_USER_CRYPTO_CLOSE_SESS\",\n-\t[VHOST_USER_POSTCOPY_ADVISE]  = \"VHOST_USER_POSTCOPY_ADVISE\",\n-\t[VHOST_USER_POSTCOPY_LISTEN]  = \"VHOST_USER_POSTCOPY_LISTEN\",\n-\t[VHOST_USER_POSTCOPY_END]  = \"VHOST_USER_POSTCOPY_END\",\n-\t[VHOST_USER_GET_INFLIGHT_FD] = \"VHOST_USER_GET_INFLIGHT_FD\",\n-\t[VHOST_USER_SET_INFLIGHT_FD] = \"VHOST_USER_SET_INFLIGHT_FD\",\n-\t[VHOST_USER_SET_STATUS] = \"VHOST_USER_SET_STATUS\",\n-\t[VHOST_USER_GET_STATUS] = \"VHOST_USER_GET_STATUS\",\n-};\n+typedef struct vhost_message_handler {\n+\tconst char *description;\n+\tint (*callback)(struct virtio_net **pdev, struct vhu_msg_context *ctx,\n+\t\tint main_fd);\n+} vhost_message_handler_t;\n+static vhost_message_handler_t vhost_message_handlers[];\n \n static int send_vhost_reply(struct virtio_net *dev, int sockfd, struct vhu_msg_context *ctx);\n static int read_vhost_message(struct virtio_net *dev, int sockfd, struct vhu_msg_context *ctx);\n@@ -122,7 +94,7 @@ validate_msg_fds(struct virtio_net *dev, struct vhu_msg_context *ctx, int expect\n \n \tVHOST_LOG_CONFIG(ERR, \"(%s) expect %d FDs for request %s, received %d\\n\",\n \t\tdev->ifname, expected_fds,\n-\t\tvhost_message_str[ctx->msg.request.master],\n+\t\tvhost_message_handlers[ctx->msg.request.master].description,\n \t\tctx->fd_num);\n \n \tclose_msg_fds(ctx);\n@@ -2754,42 +2726,44 @@ vhost_user_set_status(struct virtio_net **pdev,\n \treturn RTE_VHOST_MSG_RESULT_OK;\n }\n \n-typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,\n-\t\t\t\t\tstruct vhu_msg_context *ctx,\n-\t\t\t\t\tint main_fd);\n-\n-static vhost_message_handler_t vhost_message_handlers[VHOST_USER_MAX] = {\n-\t[VHOST_USER_NONE] = NULL,\n-\t[VHOST_USER_GET_FEATURES] = vhost_user_get_features,\n-\t[VHOST_USER_SET_FEATURES] = vhost_user_set_features,\n-\t[VHOST_USER_SET_OWNER] = vhost_user_set_owner,\n-\t[VHOST_USER_RESET_OWNER] = vhost_user_reset_owner,\n-\t[VHOST_USER_SET_MEM_TABLE] = vhost_user_set_mem_table,\n-\t[VHOST_USER_SET_LOG_BASE] = vhost_user_set_log_base,\n-\t[VHOST_USER_SET_LOG_FD] = vhost_user_set_log_fd,\n-\t[VHOST_USER_SET_VRING_NUM] = vhost_user_set_vring_num,\n-\t[VHOST_USER_SET_VRING_ADDR] = vhost_user_set_vring_addr,\n-\t[VHOST_USER_SET_VRING_BASE] = vhost_user_set_vring_base,\n-\t[VHOST_USER_GET_VRING_BASE] = vhost_user_get_vring_base,\n-\t[VHOST_USER_SET_VRING_KICK] = vhost_user_set_vring_kick,\n-\t[VHOST_USER_SET_VRING_CALL] = vhost_user_set_vring_call,\n-\t[VHOST_USER_SET_VRING_ERR] = vhost_user_set_vring_err,\n-\t[VHOST_USER_GET_PROTOCOL_FEATURES] = vhost_user_get_protocol_features,\n-\t[VHOST_USER_SET_PROTOCOL_FEATURES] = vhost_user_set_protocol_features,\n-\t[VHOST_USER_GET_QUEUE_NUM] = vhost_user_get_queue_num,\n-\t[VHOST_USER_SET_VRING_ENABLE] = vhost_user_set_vring_enable,\n-\t[VHOST_USER_SEND_RARP] = vhost_user_send_rarp,\n-\t[VHOST_USER_NET_SET_MTU] = vhost_user_net_set_mtu,\n-\t[VHOST_USER_SET_SLAVE_REQ_FD] = vhost_user_set_req_fd,\n-\t[VHOST_USER_IOTLB_MSG] = vhost_user_iotlb_msg,\n-\t[VHOST_USER_POSTCOPY_ADVISE] = vhost_user_set_postcopy_advise,\n-\t[VHOST_USER_POSTCOPY_LISTEN] = vhost_user_set_postcopy_listen,\n-\t[VHOST_USER_POSTCOPY_END] = vhost_user_postcopy_end,\n-\t[VHOST_USER_GET_INFLIGHT_FD] = vhost_user_get_inflight_fd,\n-\t[VHOST_USER_SET_INFLIGHT_FD] = vhost_user_set_inflight_fd,\n-\t[VHOST_USER_SET_STATUS] = vhost_user_set_status,\n-\t[VHOST_USER_GET_STATUS] = vhost_user_get_status,\n+#define VHOST_MESSAGE_HANDLERS \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_NONE, NULL) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_FEATURES, vhost_user_get_features) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_FEATURES, vhost_user_set_features) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_OWNER, vhost_user_set_owner) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_RESET_OWNER, vhost_user_reset_owner) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_MEM_TABLE, vhost_user_set_mem_table) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_LOG_BASE, vhost_user_set_log_base) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_LOG_FD, vhost_user_set_log_fd) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_NUM, vhost_user_set_vring_num) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_ADDR, vhost_user_set_vring_addr) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_BASE, vhost_user_set_vring_base) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_VRING_BASE, vhost_user_get_vring_base) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_KICK, vhost_user_set_vring_kick) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_CALL, vhost_user_set_vring_call) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_ERR, vhost_user_set_vring_err) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_PROTOCOL_FEATURES, vhost_user_get_protocol_features) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_PROTOCOL_FEATURES, vhost_user_set_protocol_features) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_QUEUE_NUM, vhost_user_get_queue_num) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_VRING_ENABLE, vhost_user_set_vring_enable) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SEND_RARP, vhost_user_send_rarp) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_NET_SET_MTU, vhost_user_net_set_mtu) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_SLAVE_REQ_FD, vhost_user_set_req_fd) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_IOTLB_MSG, vhost_user_iotlb_msg) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_ADVISE, vhost_user_set_postcopy_advise) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_LISTEN, vhost_user_set_postcopy_listen) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_END, vhost_user_postcopy_end) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_INFLIGHT_FD, vhost_user_get_inflight_fd) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_INFLIGHT_FD, vhost_user_set_inflight_fd) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_SET_STATUS, vhost_user_set_status) \\\n+VHOST_MESSAGE_HANDLER(VHOST_USER_GET_STATUS, vhost_user_get_status)\n+\n+#define VHOST_MESSAGE_HANDLER(id, handler) \\\n+\t[id] = { #id, handler },\n+static vhost_message_handler_t vhost_message_handlers[] = {\n+\tVHOST_MESSAGE_HANDLERS\n };\n+#undef VHOST_MESSAGE_HANDLER\n \n /* return bytes# of read on success or negative val on failure. */\n static int\n@@ -2946,11 +2920,12 @@ vhost_user_msg_handler(int vid, int fd)\n {\n \tstruct virtio_net *dev;\n \tstruct vhu_msg_context ctx;\n+\tvhost_message_handler_t *msg_handler;\n \tstruct rte_vdpa_device *vdpa_dev;\n \tint ret;\n \tint unlock_required = 0;\n \tbool handled;\n-\tint request;\n+\tuint32_t request;\n \tuint32_t i;\n \n \tdev = get_device(vid);\n@@ -2978,14 +2953,18 @@ vhost_user_msg_handler(int vid, int fd)\n \n \tret = 0;\n \trequest = ctx.msg.request.master;\n-\tif (request > VHOST_USER_NONE && request < VHOST_USER_MAX &&\n-\t\t\tvhost_message_str[request]) {\n+\tif (request > VHOST_USER_NONE && request < RTE_DIM(vhost_message_handlers))\n+\t\tmsg_handler = &vhost_message_handlers[request];\n+\telse\n+\t\tmsg_handler = NULL;\n+\n+\tif (msg_handler != NULL && msg_handler->description != NULL) {\n \t\tif (request != VHOST_USER_IOTLB_MSG)\n \t\t\tVHOST_LOG_CONFIG(INFO, \"(%s) read message %s\\n\",\n-\t\t\t\tdev->ifname, vhost_message_str[request]);\n+\t\t\t\tdev->ifname, msg_handler->description);\n \t\telse\n \t\t\tVHOST_LOG_CONFIG(DEBUG, \"(%s) read message %s\\n\",\n-\t\t\t\tdev->ifname, vhost_message_str[request]);\n+\t\t\t\tdev->ifname, msg_handler->description);\n \t} else {\n \t\tVHOST_LOG_CONFIG(DEBUG, \"(%s) external request %d\\n\", dev->ifname, request);\n \t}\n@@ -3048,31 +3027,29 @@ vhost_user_msg_handler(int vid, int fd)\n \t\t}\n \t}\n \n-\tif (request > VHOST_USER_NONE && request < VHOST_USER_MAX) {\n-\t\tif (!vhost_message_handlers[request])\n-\t\t\tgoto skip_to_post_handle;\n-\t\tret = vhost_message_handlers[request](&dev, &ctx, fd);\n+\tif (msg_handler == NULL || msg_handler->callback == NULL)\n+\t\tgoto skip_to_post_handle;\n \n-\t\tswitch (ret) {\n-\t\tcase RTE_VHOST_MSG_RESULT_ERR:\n-\t\t\tVHOST_LOG_CONFIG(ERR, \"(%s) processing %s failed.\\n\",\n-\t\t\t\t\tdev->ifname, vhost_message_str[request]);\n-\t\t\thandled = true;\n-\t\t\tbreak;\n-\t\tcase RTE_VHOST_MSG_RESULT_OK:\n-\t\t\tVHOST_LOG_CONFIG(DEBUG, \"(%s) processing %s succeeded.\\n\",\n-\t\t\t\t\tdev->ifname, vhost_message_str[request]);\n-\t\t\thandled = true;\n-\t\t\tbreak;\n-\t\tcase RTE_VHOST_MSG_RESULT_REPLY:\n-\t\t\tVHOST_LOG_CONFIG(DEBUG, \"(%s) processing %s succeeded and needs reply.\\n\",\n-\t\t\t\t\tdev->ifname, vhost_message_str[request]);\n-\t\t\tsend_vhost_reply(dev, fd, &ctx);\n-\t\t\thandled = true;\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tbreak;\n-\t\t}\n+\tret = msg_handler->callback(&dev, &ctx, fd);\n+\tswitch (ret) {\n+\tcase RTE_VHOST_MSG_RESULT_ERR:\n+\t\tVHOST_LOG_CONFIG(ERR, \"(%s) processing %s failed.\\n\",\n+\t\t\tdev->ifname, msg_handler->description);\n+\t\thandled = true;\n+\t\tbreak;\n+\tcase RTE_VHOST_MSG_RESULT_OK:\n+\t\tVHOST_LOG_CONFIG(DEBUG, \"(%s) processing %s succeeded.\\n\",\n+\t\t\tdev->ifname, msg_handler->description);\n+\t\thandled = true;\n+\t\tbreak;\n+\tcase RTE_VHOST_MSG_RESULT_REPLY:\n+\t\tVHOST_LOG_CONFIG(DEBUG, \"(%s) processing %s succeeded and needs reply.\\n\",\n+\t\t\tdev->ifname, msg_handler->description);\n+\t\tsend_vhost_reply(dev, fd, &ctx);\n+\t\thandled = true;\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n \t}\n \n skip_to_post_handle:\ndiff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h\nindex c946cc2ef4..ba1c5c7969 100644\n--- a/lib/vhost/vhost_user.h\n+++ b/lib/vhost/vhost_user.h\n@@ -59,7 +59,6 @@ typedef enum VhostUserRequest {\n \tVHOST_USER_SET_INFLIGHT_FD = 32,\n \tVHOST_USER_SET_STATUS = 39,\n \tVHOST_USER_GET_STATUS = 40,\n-\tVHOST_USER_MAX = 41\n } VhostUserRequest;\n \n typedef enum VhostUserSlaveRequest {\n@@ -67,7 +66,6 @@ typedef enum VhostUserSlaveRequest {\n \tVHOST_USER_SLAVE_IOTLB_MSG = 1,\n \tVHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,\n \tVHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,\n-\tVHOST_USER_SLAVE_MAX\n } VhostUserSlaveRequest;\n \n typedef struct VhostUserMemoryRegion {\n",
    "prefixes": [
        "1/2"
    ]
}