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: 147325 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1157238ljw; Sat, 22 Sep 2018 14:16:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV61sSBvp88DEwy9A7B6Q+Xjj+k3xKRqmwQBehdtJV3uTNCJagnTVhtz8pg3WGAbZqkbqVn/K X-Received: by 2002:adf:b6a0:: with SMTP id j32-v6mr2950996wre.55.1537651018053; Sat, 22 Sep 2018 14:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537651018; cv=none; d=google.com; s=arc-20160816; b=tn4ufzX61VWPf2JRg/XPw8rmTs2acKRxFBymeEjoLo7zpKiW1bLDTzRLWKxVBVMEcf ypah15hxe7dbhNpaaa8RSYkf3vkZbqMcd2FWUG6VMfUQlCab6uFTS+2JRWtgG03dTODv BcGdkDu3Pmuz7Izr8QArAv8OigS/rFZbe+p/chA+Tnuuvh0ZKxJn07oPv3avVX61KTjB IG7NePmmXVCpq5l41Jc2jFS9VfPMnt5RZvGpC0JksIcwUGkl5AEPzPo9Bb4noRK/Cd9d /nSWWdYG2J3YuBAjBPw2UsEEi6xVcUg8n6CTbIl388bo6B00dEvPL6N8T8n0L67bs8cW AFzA== 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; bh=xlNkP16vTsVBNdVBiKpcF81N1Bc6u5DP2AlK37efpxI=; b=RxkgoC7VI2GPjCHeMpPXoPr5xbB/3tdJqhrfzpOX4sP1Ru2qp/TNSh3R8634EKF7SN b3FPMWBlE3rwmWeEcl0mCiD+SqllWPyn73PFEw2xRsb1ePTAI1HG7yx/mwrvmgsvo4aF 480ov50fMjJsrB7jYsAu8M3X3hIhZZd1X4lBvCxhHBNy9U72nvZsrIMq8Cz48AHQ44lG e8X494kITgWRYaIAAcyScwKSIXQFBCTNIBH+E+xXpl+3TfBBmwu13pV9bYLzHspOS12g ZQLgAizzI1/REQutZ+UOO6X5ju04KwDFWm8DUw4v2tdM7z2gxxuLS0U9SNqDHYoR+DrJ wCpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Tc76SrCM; 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 ([92.243.14.124]) by mx.google.com with ESMTP id t4-v6si32231615wrm.351.2018.09.22.14.16.57; Sat, 22 Sep 2018 14:16:58 -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=Tc76SrCM; 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 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-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: