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 2CA3EA04DD for ; Tue, 20 Oct 2020 18:17:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 15E49A967; Tue, 20 Oct 2020 18:17:56 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 15547A965 for ; Tue, 20 Oct 2020 18:17:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603210673; 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=Ue8y8YScUIGjvm6mavpcmjYNggt1Rw2Yl3AI0exypiI=; b=U+oh+wPamKVVu0nqpKNGLNbOv2ehNiZqGS4/rK9Vulr4d3OyAk4llOKEwDsAC17fezQv0K qGQisUsfG+D++JN23X/zbtdBGd/vrc5idEAPGmDTF3LMnEsj3+IWmIkHS0ZYOrkcCJ9i3j rf6gHkFz4GHBKOYD0jUv04QK5LDo8VM= 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-164-2icWfTcDPtCAkPZip1S-MA-1; Tue, 20 Oct 2020 12:17:49 -0400 X-MC-Unique: 2icWfTcDPtCAkPZip1S-MA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6BEA58049DF; Tue, 20 Oct 2020 16:17:48 +0000 (UTC) Received: from [10.36.110.40] (unknown [10.36.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 822FF5B4B3; Tue, 20 Oct 2020 16:17:43 +0000 (UTC) To: Adrian Moreno , dev@dpdk.org Cc: yinan.wang@intel.com, patrick.fu@intel.com, stable@dpdk.org, Chenbo Xia , Zhihong Wang References: <20201020152052.389446-1-amorenoz@redhat.com> <20201020152052.389446-3-amorenoz@redhat.com> From: Maxime Coquelin Message-ID: <55e535eb-1392-4d65-dacc-1f5a8843d8be@redhat.com> Date: Tue, 20 Oct 2020 18:17:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201020152052.389446-3-amorenoz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH v2 2/3] virtio_user: don't set/get_status until FEATURES_OK X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 10/20/20 5:20 PM, Adrian Moreno wrote: > According to the virtio spec, ACK and DRIVER status bits should be set > before feature negotiation. > > However, until the protocol features are negotiated, the driver does not > know if the device actually supports the those vhost-user messages. s/the those/those/ > Therefore, until FEATURES_OK is set, the GET/SET_STATUS messages should > not be sent. > > Fixes: 57912824615f ("net/virtio-user: support vhost status setting") > Cc: maxime.coquelin@redhat.com > Cc: stable@dpdk.org > > Signed-off-by: Adrian Moreno > --- > drivers/net/virtio/virtio_user/vhost_user.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c > index ef290c357..450d77e92 100644 > --- a/drivers/net/virtio/virtio_user/vhost_user.c > +++ b/drivers/net/virtio/virtio_user/vhost_user.c > @@ -278,8 +278,9 @@ vhost_user_sock(struct virtio_user_dev *dev, > > switch (req) { > case VHOST_USER_GET_STATUS: > - if (!(dev->protocol_features & > - (1ULL << VHOST_USER_PROTOCOL_F_STATUS))) > + if (!(dev->status & VIRTIO_CONFIG_STATUS_FEATURES_OK) || > + (!(dev->protocol_features & > + (1ULL << VHOST_USER_PROTOCOL_F_STATUS)))) > return 0; > /* Fallthrough */ > case VHOST_USER_GET_FEATURES: > @@ -288,8 +289,9 @@ vhost_user_sock(struct virtio_user_dev *dev, > break; > > case VHOST_USER_SET_STATUS: > - if (!(dev->protocol_features & > - (1ULL << VHOST_USER_PROTOCOL_F_STATUS))) > + if (!(dev->status & VIRTIO_CONFIG_STATUS_FEATURES_OK) || > + (!(dev->protocol_features & > + (1ULL << VHOST_USER_PROTOCOL_F_STATUS)))) > return 0; > > if (has_reply_ack) > Reviewed-by: Maxime Coquelin Thanks, Maxime