From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ACA04A00C2; Wed, 30 Nov 2022 16:58:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6820342D7A; Wed, 30 Nov 2022 16:57:22 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 1ACFC42D6A for ; Wed, 30 Nov 2022 16:57:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669823838; 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=WgMAuU8L6aAWIbq/hWwgwDCEvOJBC4xLfSTtJCAEZh0=; b=ivot3+s5H9fV7puQR6UKmzI2aAmrL7LLV4XQbZSw7NlxaawfA/eLBAbfl5OxbnrdyrTmER SP/P8gztlIQI007U5KPelgyaGTEeuPdbr7j+XL6KttxxgNlZPX2tj+wTOgoPBguSZhETxE IlHKgdrKTGTvQUIMLMwkrjaZw2DR690= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-96-LnVWMh80M7GUNCTWu-HMxw-1; Wed, 30 Nov 2022 10:57:07 -0500 X-MC-Unique: LnVWMh80M7GUNCTWu-HMxw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24B91889047; Wed, 30 Nov 2022 15:57:06 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE61240C2144; Wed, 30 Nov 2022 15:57:04 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, eperezma@redhat.com Cc: Maxime Coquelin , stable@dpdk.org Subject: [PATCH v1 12/21] net/virtio-user: fix device starting failure handling Date: Wed, 30 Nov 2022 16:56:30 +0100 Message-Id: <20221130155639.150553-13-maxime.coquelin@redhat.com> In-Reply-To: <20221130155639.150553-1-maxime.coquelin@redhat.com> References: <20221130155639.150553-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If the device fails to start, read the status from the device and return early. Fixes: 57912824615f ("net/virtio-user: support vhost status setting") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_user_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index d32abec327..78b1ed9ace 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -90,10 +90,15 @@ virtio_user_set_status(struct virtio_hw *hw, uint8_t status) if (status & VIRTIO_CONFIG_STATUS_FEATURES_OK && ~old_status & VIRTIO_CONFIG_STATUS_FEATURES_OK) virtio_user_dev_set_features(dev); - if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) - virtio_user_start_device(dev); - else if (status == VIRTIO_CONFIG_STATUS_RESET) + + if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) { + if (virtio_user_start_device(dev)) { + virtio_user_dev_update_status(dev); + return; + } + } else if (status == VIRTIO_CONFIG_STATUS_RESET) { virtio_user_reset(hw); + } virtio_user_dev_set_status(dev, status); } -- 2.38.1