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: 147384 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1129708lji; Mon, 24 Sep 2018 13:17:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV60zgokqTaZ/nIWLAUiJn4z3hqttFOlOp8/zq5dlc19hVFnldr1CpXrrG3IxSQ7sEXALEjgN X-Received: by 2002:adf:a708:: with SMTP id c8-v6mr350642wrd.56.1537820243850; Mon, 24 Sep 2018 13:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537820243; cv=none; d=google.com; s=arc-20160816; b=lgpReByvf9xhLlppIXZ7tf99V4Q/V4Au7ZbOX0rucKXoJeV/+98RmxeWLYCsEuetNx LDmQZhVN5GuafJpU/Xx0HvMHjHTxbedc8yzyVQoIN1a+4j6HXwHN04q+10bXZRNPyUyH z2+8EDoe/pGysuowKHxRt6TTHhr/un7ytIDlRcbVjnVukqwWdvnKoz7LlYFJZ6lItB89 mFtDZpLYCJwxYRQfHi8UUKC1JSioKpFyn9fzYAl2hxXcxob5E3u9n1rcUk7e5MXjdXBi A0kqVE/gdLu6tsduNRlg5Yg7TaTp1g5CUnX3uHbIaL4o8IV0cxHO3xh0jc/X8boC/T4A BFzg== 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=02phtoPLKMhvw1pfeICuDg0OkVyxO3opBE13Pyie90Y=; b=O4ga6LyTxJ4tcbyFPeMdd/jzHOvPTZ4K/kH8HEySz/zGzvsqYvaWQ6eoAcHWh4BR2E L6CzT+x7ModHFp1IVvP6TSkJPW54vpizHwSRaMV1PqTt9yA2Pn5o47U9OBs9jOiRwfyO 6fHr1E9OtED9d7+Q6USn0PdiFqFLl5e7RcPLPS855BKExqKu4jrE0C3RTr5AqTwMEYRv VJGFftoYB0KvBeDEboTbQ4HfifoeQhn638LhpZsCO/wywNVPZKtEmAW179JM+ap6x8Qk PrDYKYP0JUmVaGNScpT9nnrbPlORW8VjSlkgf3e4dYnykjBxML0kn0vBYRHfYHvQcELa N4ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=j9U9yDtt; 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 o14-v6si270073wrs.141.2018.09.24.13.17.23; Mon, 24 Sep 2018 13:17:23 -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=j9U9yDtt; 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 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-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 --- lib/librte_vhost/vhost_user.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) Reviewed-by: Anatoly Burakov 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: