From patchwork Thu Jul 19 19:13:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 142379 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2093712ljj; Thu, 19 Jul 2018 12:13:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpevJXrR5ILXX3icQhde24NTTPUrU1qcrI/ezF8b1pSyQ8Lo1mogdodUZgl0B8J5X1dq+RtC X-Received: by 2002:a1c:369c:: with SMTP id y28-v6mr4819334wmh.34.1532027635125; Thu, 19 Jul 2018 12:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532027635; cv=none; d=google.com; s=arc-20160816; b=c5jloP0wUKSS9PnGO8gUpO/bTWNBcUa+S4eQ/TyvRtqBurN/gm8bTv9o85zPhKIMl4 TXaI1t9r68ClW+JxKek8HCU7tbRfmSsNQkVVnC57fFmMk4O7E211VFSfx6UwKFZPD0zV NRlahvLw5ITtkRlauXVC/OFgLkrlXVA45q/nuLuM4nm0iJVF1qLJXWbQCF3uXoXb4g0N zZAEp5SP04d16Vm1YJkVZi5GJdkiCue6o5rv8bOoXpM6B8IiSRQS8ebOMBFFUPlrjUBz Shi+nrWJIxjj2lVM01EMZsltJuIrIb84Boyi+ul1kUH5xePCvLI/4jfc8Lxa2ToFl3tP fhSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:dkim-signature :arc-authentication-results; bh=WCSiwYONcpbm/m1/uhhMkrStdpQpy+aMGCslI1fCi60=; b=Ujphx+o+Mc8L1malW4Mx4wk2+J8xe+LlW244E/Y2eIx5jVKVmKhi5LxJJMQRG9Ahzx 6cKBVeEBQ46cvh5zO8uFoXuwBHn0MZDlYeWvBHHgewy/dm7n/iR0yx2HZn54qJMxWOcf uYGLIMdL6QXrScwDC9YNuu4dj24r7KePCYPRsvVT215ebKNfPapSzlszCwccIKMBTdcy srAbhNJUBRx/hAgvXfyCyCG3WqgMUB7rSle16sb7wA8VutuqznE7SlMFt9HvGdKgF7JQ mPvDpFlxEDYtJtujlUv32+tpTxgInxfAVtqof6rb6haTktKgY47XEqqqS1rn4bcSzZHv 24zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AAoxIMhG; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id y124-v6si173761wmy.141.2018.07.19.12.13.54; Thu, 19 Jul 2018 12:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AAoxIMhG; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 467D65F12; Thu, 19 Jul 2018 21:13:44 +0200 (CEST) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 6FFCE5B2A for ; Thu, 19 Jul 2018 21:13:43 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id z13-v6so7465710wma.5 for ; Thu, 19 Jul 2018 12:13: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=WCSiwYONcpbm/m1/uhhMkrStdpQpy+aMGCslI1fCi60=; b=AAoxIMhGKdUATAMcrE9X73y8EizSiCANH7i/MvoWg3oylOHNc7exB0M6I9drGeGdCP Edj9W18mzzQGQJl2vnfYESpJwgVxLwkqvaov+r/nCYYBFTMYYI1UDeJKfNvV0yOCiPQ0 dkqCp2wYOiZS6uMVd5sWxux7HHHJW41sy/75WweEwYrwM21BeoqnP2GfG2lPFuDdXv8J dxJyaTYrgArhMUeidvDhB9IO+KekiMw+sDUZha8MQT9SMR0EVrtva2EuwooVZ4x9pan3 6kmPlDm65TSeWjiz48MMW5SkVqlNz9XmzG9lwntXJebuwb3AXyAang4xQLsqextdVLaF lCxg== 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=WCSiwYONcpbm/m1/uhhMkrStdpQpy+aMGCslI1fCi60=; b=j0Sd7BEbzf/xtD7Yz+WjeUxSe6/ryldPGvJc6VK+M7T1P9QRAlaoJMSY/4BAJ04iMS d97dfC3/a3rqWNFfyH7Ek1y4bgta0EePdvNcykS+OAitteaMlmoUJURnF98X0QIGSN3o Q1Sk61haeKSEJWQVlDNPItOMYlcs20FOxQBAQpKnSNVBRyVWiuuxPOUdIFZ85CLbGYXF HKwkViu2CQHJBvPojFRCeqDUxpCVArSrQO63s1E94zghuYRZbbJxp4pr6d/LgFwwawkM e4L9WIvUcGBvHfQy5vqIzpOtu2t1pVADFjsuT6QEZ/SYwjCfzErRz3b/G6UnJwiiDe/p iMRg== X-Gm-Message-State: AOUpUlEe5iEOTZpsCavqj9S33sjTTxKFa3yArYNQf1N+VAQjdLqONEZm QWuLCUE57J3le0Q6n6PeVIPRhOpG4DQ= X-Received: by 2002:a1c:d607:: with SMTP id n7-v6mr4927274wmg.150.1532027623001; Thu, 19 Jul 2018 12:13:43 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id h14-v6sm9296506wro.15.2018.07.19.12.13.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 12:13:42 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Thu, 19 Jul 2018 22:13:41 +0300 Message-ID: <153202762111.21481.10403768024279892271.stgit@T460> In-Reply-To: <153202755842.21481.1772155561595981441.stgit@T460> References: <153202755842.21481.1772155561595981441.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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(-) Reviewed-by: Maxime Coquelin diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index e97b2d563..b408460f0 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1015,6 +1015,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 void vhost_user_set_vring_kick(struct virtio_net **pdev, VhostUserMsg *msg) { @@ -1246,6 +1254,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 @@ -1689,8 +1704,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: @@ -1716,9 +1730,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: