From patchwork Sat Sep 22 21:16:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 45176 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 00CA44C93; Sat, 22 Sep 2018 23:16:47 +0200 (CEST) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id D9CD54CA7 for ; Sat, 22 Sep 2018 23:16:45 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id e1-v6so16041356wrt.3 for ; Sat, 22 Sep 2018 14:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=xlNkP16vTsVBNdVBiKpcF81N1Bc6u5DP2AlK37efpxI=; b=Tc76SrCMHJLrfrGRphHEPOqU3wR8qx7olO0ccompxQJbKC+HeqItKDC91TZIjBo0qL 78wD+Q4yzmQv61vEXMrQEpC60P2UH6Vp6+oaFYsv53MpNGxWPYine/ntD8LHk9Jmtr9u 1E4uEhzBeOzLD4M6FPDSHTugEQQS1NaPAgwOcZK4ip7Q7EjILSZT1DhV3lljBNuH32Lj PmQKKuBV00IzfHXTavzQnryJcIMALej3O1dUx7eWh97raXgt7irYJV7AjsLlAsYUSTvO r05QZq6CensQiwEwHxx9Qdkv1q73tSHUHYZSW+l3P/bVc9iuQfzhGhotjpy2Ksu2jn6P vueA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=xlNkP16vTsVBNdVBiKpcF81N1Bc6u5DP2AlK37efpxI=; b=QLjz0j5WD9YwUHQ+0Esj1dij2ti+xhtbQOV7/c6Pk/jqbFAo3WgGE9xrn8YzZHp4Oh UO2mHUkevMknu1l5gu9an/eUL0WgrxT6myAKFKKxj07LfI2/hWrYPuJvjhttF9y8T8U/ hSB5+6onEIYtHfq0p6RYtnFLJpqAfftmO30jhaBjVLLRw2uySJ1cv5NI1+r34/J43JZv 3pwEhl8+EF/qB8Vp5o71fx57I/w2g1JHBpPY9A5sSdS/j9PcMO0Bi71QlMSIfFrKmHXk MhZ+3uqiHWO81mP3djFkYOHIoc7nbpCSGZR+wYstYEl19LyVrMYTRVPrq/wRWJE1v30Y 4FOA== X-Gm-Message-State: ABuFfogeOs2pGBzz6drkwUlTMr7riq6CDphpwFffke37tbuvqgDxcjUm v/7lHznzpnMA3Cnkpg71+12bYwd0Gng+yQ== X-Google-Smtp-Source: ACcGV63OFkOxHLi/niR/sbs8lcvjwQyMAtzRb6hqy6dPUmjqeiB01Ujbo4LyERkodDleuPkrepYmGA== X-Received: by 2002:adf:f14e:: with SMTP id y14-v6mr2951695wro.29.1537651005281; Sat, 22 Sep 2018 14:16:45 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id s131-v6sm14184940wmf.2.2018.09.22.14.16.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 14:16:44 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Sun, 23 Sep 2018 00:16:43 +0300 Message-ID: <153765100349.29126.292928643166129355.stgit@T460> In-Reply-To: <153765091094.29126.1031571146095035538.stgit@T460> References: <153765091094.29126.1031571146095035538.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 3/5] vhost: handle unsupported message types in functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add new functions to handle the unsupported vhost message types: - vhost_user_set_vring_err - vhost_user_set_log_fd Signed-off-by: Nikolay Nikolaev --- lib/librte_vhost/vhost_user.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index b20aa6adc..1627d594e 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1022,6 +1022,14 @@ vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *msg) vq->callfd = file.fd; } +static void vhost_user_set_vring_err(struct virtio_net *dev __rte_unused, + VhostUserMsg *msg) +{ + if (!(msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)) + close(msg->fds[0]); + RTE_LOG(INFO, VHOST_CONFIG, "not implemented\n"); +} + static int vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg) { @@ -1259,6 +1267,13 @@ vhost_user_set_log_base(struct virtio_net *dev, struct VhostUserMsg *msg) return 0; } +static void +vhost_user_set_log_fd(struct virtio_net *dev __rte_unused, VhostUserMsg *msg) +{ + close(msg->fds[0]); + RTE_LOG(INFO, VHOST_CONFIG, "not implemented.\n"); +} + /* * An rarp packet is constructed and broadcasted to notify switches about * the new location of the migrated VM, so that packets from outside will @@ -1704,8 +1719,7 @@ vhost_user_msg_handler(int vid, int fd) send_vhost_reply(fd, &msg); break; case VHOST_USER_SET_LOG_FD: - close(msg.fds[0]); - RTE_LOG(INFO, VHOST_CONFIG, "not implemented.\n"); + vhost_user_set_log_fd(dev, &msg); break; case VHOST_USER_SET_VRING_NUM: @@ -1733,9 +1747,7 @@ vhost_user_msg_handler(int vid, int fd) break; case VHOST_USER_SET_VRING_ERR: - if (!(msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK)) - close(msg.fds[0]); - RTE_LOG(INFO, VHOST_CONFIG, "not implemented\n"); + vhost_user_set_vring_err(dev, &msg); break; case VHOST_USER_GET_QUEUE_NUM: