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 AA976A0542; Wed, 15 Jul 2020 19:19:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B1DBA1BEA5; Wed, 15 Jul 2020 19:18:58 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 01A6D1BE90 for ; Wed, 15 Jul 2020 19:18:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594833533; 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=SEKOofi4qCm27Ivd9+Wz9xJhMN+2baE5fdKBe1wXMxw=; b=hjX1jKAeGO0ZnT4Xv8ZOGCNO3duVsqrCsNe5ujXiIm3/r8OHS5kR7hj49Y+iNWjD9SUq5k kbZYdfHn7Nn3A7CVL5s7WJvWjG1Ff6oewx0t9yskIRbqyNarq4fZ4KEryoF1PH7zCsB3Gg m7kuNy2dKjnROKe6b0f++C1WVzI55FQ= 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-149-EgyCw3YzPRuVDQBvv3MRNg-1; Wed, 15 Jul 2020 13:18:49 -0400 X-MC-Unique: EgyCw3YzPRuVDQBvv3MRNg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86FF380BCAB; Wed, 15 Jul 2020 17:18:48 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (ovpn-113-28.ams2.redhat.com [10.36.113.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00E2860BF1; Wed, 15 Jul 2020 17:18:46 +0000 (UTC) From: Adrian Moreno To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, amorenoz@redhat.com, chenbo.xia@intel.com Date: Wed, 15 Jul 2020 19:18:28 +0200 Message-Id: <20200715171828.95887-6-amorenoz@redhat.com> In-Reply-To: <20200715171828.95887-1-amorenoz@redhat.com> References: <20200715171828.95887-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 5/5] net/virtio: enable feature checking on virtio-user 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" virtio 1.0 introduced a mechanism for the driver to verify that the feature bits it sets are accepted by the device. This mechanism consists in setting the VIRTIO_STATUS_FEATURE_OK status bit and re-reading it, whitch gives a chance for the device to clear it if the the features were not accepted. This is currently being done only in modern virtio-pci devices but since the appropriate vhost-user messages have been added, it can also be done in virtio-user (vhost-user only). This patch activates this mechanism on virtio-user. Signed-off-by: Adrian Moreno --- drivers/net/virtio/virtio_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index dc0093bdf..9063bfeb2 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1355,12 +1355,13 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features) PMD_INIT_LOG(DEBUG, "features after negotiate = %" PRIx64, hw->guest_features); - if (hw->modern) { - if (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { - PMD_INIT_LOG(ERR, - "VIRTIO_F_VERSION_1 features is not enabled."); - return -1; - } + if (hw->modern && !vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) { + PMD_INIT_LOG(ERR, + "VIRTIO_F_VERSION_1 features is not enabled."); + return -1; + } + + if (hw->modern || hw->virtio_user_dev) { vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK); if (!(vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) { PMD_INIT_LOG(ERR, -- 2.26.2