From patchwork Mon Sep 24 20:17:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 45245 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 1EB091B19F; Mon, 24 Sep 2018 22:17:23 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 5A13F1B194 for ; Mon, 24 Sep 2018 22:17:21 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id z14-v6so3491460wrs.10 for ; Mon, 24 Sep 2018 13:17:21 -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=02phtoPLKMhvw1pfeICuDg0OkVyxO3opBE13Pyie90Y=; b=j9U9yDttZjlEu/eMdQr0JLzw24AJOT2eqT0DNniDNDdgFjbUj4Y79xtvKWhqZ6DOgk 4PbQsraYqlqi7lwkNt11RERDaZGUbrLleBk5JArunzsolr1awhlMBVDtY7XSbp5FaP18 FrOlVIs20n8Vt4Ko7zxIAp8HH66GmbSD4oPObHdtg11Ra2LMhMn4MfKRlIUCq/sfA82M YrHcuXRxxNkrUdfvnorxhaPjre/fyi/t/9e3a065xpQUPjXCSGrLd4h+P51QOWRKtRUt MMwnFKmcerI9XqpG1sDWXNXKLvSMZU5pMeuMyhxo5DBO+VzqflvJPBVpr8HCThn3a2Go r+hQ== 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=02phtoPLKMhvw1pfeICuDg0OkVyxO3opBE13Pyie90Y=; b=FT+BF782gZ7Bh6XcGxJ0Ci2XYOyyGK9PpCQyz+dP57+l2CD3ujEM+5BA+AfrTUJ8VV dptJwSl8E11CAmbwWGRqydUTAoBvjmR5sNmZ29UEaoLklWp7SUx8O5VfNQdISBhzZTx9 ls/0FoCsKsFwzjteCd1xkNcu8PwjURJ9nBZ1V2CGxSd+ELa8tcQhm37v2FCY+YrzPiar gQuApxZ1nSOACTJFABA4nR3FSyZZF3ez+kV2GIjxm6RHQQcZfMw+3vPVGmGuIvNMhz9Q hsOZp+e1CldfOf7uK9gKohGpyFnGJRcqv4q/kdrUFaW/dh+GW1usgfuJMcb8rlvenrlQ HuAQ== X-Gm-Message-State: ABuFfojdLSsM/d5drehZUP12ZG37GKbQDefPJ97RNSm73HvIQtnukI70 6Ut4+SU0UulWyvj6d1O/zdXzEOPCUcWZzg== X-Google-Smtp-Source: ACcGV61y1DrW7dsplvcxsdLONHa/7VosFegSfxefzgOmnSFxql1WVOUSRNIuSzKmCGCy1M0jD50fqg== X-Received: by 2002:a5d:5248:: with SMTP id p8-v6mr344894wrv.198.1537820240798; Mon, 24 Sep 2018 13:17:20 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id j66-v6sm443681wrj.28.2018.09.24.13.17.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 13:17:19 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, anatoly.burakov@intel.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Mon, 24 Sep 2018 23:17:18 +0300 Message-ID: <153782023810.27450.1072870890780678375.stgit@T460> In-Reply-To: <153782013094.27450.17651924330876922486.stgit@T460> References: <153782013094.27450.17651924330876922486.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 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 Reviewed-by: Anatoly Burakov --- 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 4ae7b9346..77905dda0 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 **pdev __rte_unused, + struct 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 **pdev __rte_unused, + struct 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: