From patchwork Sat Sep 15 05:20:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 44752 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 461D55689; Sat, 15 Sep 2018 07:20:47 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 4C996532C for ; Sat, 15 Sep 2018 07:20:43 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id 20-v6so12339905wrb.12 for ; Fri, 14 Sep 2018 22:20:43 -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=wSyLR66ibmeohSkyjhR+kIs69sar6ev7WV4Pnz8Oy5Y=; b=OHayr3e1ejOlHnAsCRH91rZUob31mx9Ulc/2UT9KoE9s7mOUByjJUbUbkouexeK4q/ HzZd1DiHdOX7ylUCmZqZYEI5IjAzrvCJ3y85tl/dbEuG6xjFREdLVSa8RZsrJBazyKNM JIi4jTbANWSBFPCVDsBoqBb/+pevHfsL8tm3L6BJ/w+OGbpmHZHq3ha3P6iQMBh4oRi2 8TWgPM3VRlGxwkha7nuXfcffPaXC5Imx2d1M2TcH8yBO1tM0dVE6S5OqSDYHgDfAWLbP 2yhP1lWofWKkyx4PVNln9bd2AayA+x8YjNeOnktO7eeQY/1CnfnBodZQ5NvaPgzJ7B1c frJQ== 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=wSyLR66ibmeohSkyjhR+kIs69sar6ev7WV4Pnz8Oy5Y=; b=oKXKihcmkSMCDgDdZ2t6lNKNpTfjxQ9BZKKxT5pRCB1TuiJhpYjZZ4PzAkP6q94YRG NFVCN+TNmDVRvlCZRqQN/HGr1G0ddKNpqs/IiNS/CPVx9ZT/KAqyDBMQH+b3EdOuqJrV Q90ILJea90XVzGuKJMLJBaoXKXMpQnhbgbwSZMzDSsRvzsJkFQ7xkoO8w/OBjKYFeXP5 EQAJXEol2rVVfEy2Pfwmz3szl4GQw+9DNT6jKk5hsZFGAC5ZXZ+ax45m8gbPni1AUy9V PdT3n2e3H8NM7Gmya6uGooOGjq3yTOs0XAcdi9U5ha3Kv2U3GAlUAw0xZjrbG2uEQnX9 YcQg== X-Gm-Message-State: APzg51BpBjM6mPa5A4/noPZ/qUfAfGSIaj/E/ESnlgyNhsAyKSmDhzSh J+yEwse2UaBsqU8jCxIOPwTCpmXIExrn3Q== X-Google-Smtp-Source: ANB0VdYIqwZmgvy9j32pLc5/2qnuThJi7sUkMZnuEFawnW5G76D6vtL7oOp7zkpd/FVB0Dd6Pdn73w== X-Received: by 2002:adf:add0:: with SMTP id w74-v6mr12399288wrc.73.1536988842801; Fri, 14 Sep 2018 22:20:42 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id j133-v6sm1996725wmd.12.2018.09.14.22.20.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Sep 2018 22:20:42 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Sat, 15 Sep 2018 08:20:40 +0300 Message-ID: <153698884084.23049.3225944257155202776.stgit@T460> In-Reply-To: <153698873346.23049.10966616323159180622.stgit@T460> References: <153698873346.23049.10966616323159180622.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 3a00d53cf..c38b0fd70 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, 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, VhostUserMsg *msg) { @@ -1259,6 +1267,13 @@ vhost_user_set_log_base(struct virtio_net *dev, 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 @@ -1703,8 +1718,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: @@ -1732,9 +1746,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: