From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61289A04BC; Tue, 29 Sep 2020 18:16:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 956E31DA10; Tue, 29 Sep 2020 18:14:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 1B0EE1DA10 for ; Tue, 29 Sep 2020 18:14:38 +0200 (CEST) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601396076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uk5Z++jNb5ORlGF2Y2DrAYWD0sDKu1ioMIYZNnS4s34=; b=cG4CxUPk9NDlF1W6hru9S3CtDjdYorE2dBHbUg/4GhAl31dlO/FOoP1Ee+82P61IFZrdcU GzBuPr0cMQD0puW8hkQmRHQ+fzP9dRaQ/mbMD/GRSZv2Dm+4/ClL4idTpy8DgG3CgX9DhJ uKET1mHSRQ3ibcS09H4xhpyaVV/PFIo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-511-QQm97YsJMye_f2u1P7a79Q-1; Tue, 29 Sep 2020 12:14:32 -0400 X-MC-Unique: QQm97YsJMye_f2u1P7a79Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95BB91040C24; Tue, 29 Sep 2020 16:14:31 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.110.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 911235C896; Tue, 29 Sep 2020 16:14:20 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, patrick.fu@intel.com, amorenoz@redhat.com Cc: Maxime Coquelin Date: Tue, 29 Sep 2020 18:14:01 +0200 Message-Id: <20200929161404.124580-6-maxime.coquelin@redhat.com> In-Reply-To: <20200929161404.124580-1-maxime.coquelin@redhat.com> References: <20200929161404.124580-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH v3 5/8] net/virtio: check protocol feature in user backend 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" When sending set status message, move protocol feature check to vhost_user to be compatible with different backend types. Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/vhost_user.c | 6 +++++- drivers/net/virtio/virtio_user/virtio_user_dev.c | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index 12b6c7dbcf..ef290c357b 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -277,9 +277,13 @@ vhost_user_sock(struct virtio_user_dev *dev, msg.size = 0; switch (req) { + case VHOST_USER_GET_STATUS: + if (!(dev->protocol_features & + (1ULL << VHOST_USER_PROTOCOL_F_STATUS))) + return 0; + /* Fallthrough */ case VHOST_USER_GET_FEATURES: case VHOST_USER_GET_PROTOCOL_FEATURES: - case VHOST_USER_GET_STATUS: need_reply = 1; break; diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index b79a9f84aa..d7cd6b0346 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -788,9 +788,6 @@ virtio_user_send_status_update(struct virtio_user_dev *dev, uint8_t status) if (dev->backend_type != VIRTIO_USER_BACKEND_VHOST_USER) return 0; - if (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS))) - return 0; - ret = dev->ops->send_request(dev, VHOST_USER_SET_STATUS, &arg); if (ret) { PMD_INIT_LOG(ERR, "VHOST_USER_SET_STATUS failed (%d): %s", ret, @@ -811,9 +808,6 @@ virtio_user_update_status(struct virtio_user_dev *dev) if (dev->backend_type != VIRTIO_USER_BACKEND_VHOST_USER) return 0; - if (!(dev->protocol_features & (1UL << VHOST_USER_PROTOCOL_F_STATUS))) - return 0; - err = dev->ops->send_request(dev, VHOST_USER_GET_STATUS, &ret); if (err) { PMD_INIT_LOG(ERR, "VHOST_USER_GET_STATUS failed (%d): %s", err, -- 2.26.2