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 4A03FA04DD for ; Mon, 26 Oct 2020 17:40:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5CCD42C27; Mon, 26 Oct 2020 17:40:17 +0100 (CET) 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 11AA54C8F for ; Mon, 26 Oct 2020 17:40:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603730407; 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=KcKnldrg5r1IYW680vebzNxN2juPi1C+sMIxNOUlHYE=; b=GC3P2Rko3yTZUnVmws7FVuIHCErGb0JRAVf+KkOCDWQ0ZKHcQgIK99Xnv5RFDuYZuQGBFI x5jok+1+Mo/V5JMzLZ/GOpgzLdAJrDI0BRF6Qqi9iQWq/dXjSSo/uB/8YuKtDGxxH1rmpW g4V5hwH+f5m7pkFnW6YkK7nPDVzZuec= 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-211-3s1kcLgQNV24PqAdi4-NJA-1; Mon, 26 Oct 2020 12:40:05 -0400 X-MC-Unique: 3s1kcLgQNV24PqAdi4-NJA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F9C0804B94; Mon, 26 Oct 2020 16:40:04 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (ovpn-114-135.ams2.redhat.com [10.36.114.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E2E45576E; Mon, 26 Oct 2020 16:39:57 +0000 (UTC) From: Adrian Moreno To: dev@dpdk.org Cc: yinan.wang@intel.com, patrick.fu@intel.com, chenbo.xia@intel.com, zhihong.wang@intel.com, maxime.coquelin@redhat.com, Adrian Moreno , stable@dpdk.org Date: Mon, 26 Oct 2020 17:39:30 +0100 Message-Id: <20201026163930.94032-7-amorenoz@redhat.com> In-Reply-To: <20201026163930.94032-1-amorenoz@redhat.com> References: <20201026163930.94032-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@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-stable] [PATCH v3 6/6] net/virtio-user: set status on socket reconnect 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" Newer vhost-user backends will rely on SET_STATUS to start the device so this required to support them. 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_ethdev.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 142bdc0bd..40345193e 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -67,8 +67,7 @@ virtio_user_reset_queues_packed(struct rte_eth_dev *dev) static int virtio_user_server_reconnect(struct virtio_user_dev *dev) { - int ret; - int connectfd; + int ret, connectfd, old_status; struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id]; struct virtio_hw *hw = eth_dev->data->dev_private; uint64_t protocol_features; @@ -78,6 +77,14 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) return -1; dev->vhostfd = connectfd; + old_status = vtpci_get_status(hw); + + vtpci_reset(hw); + + vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK); + + vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); + if (dev->ops->send_request(dev, VHOST_USER_GET_FEATURES, &dev->device_features) < 0) { PMD_INIT_LOG(ERR, "get_features failed: %s", @@ -116,14 +123,17 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) /* For packed ring, resetting queues is required in reconnection. */ if (vtpci_packed_queue(hw) && - (vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_DRIVER_OK)) { + (old_status & VIRTIO_CONFIG_STATUS_DRIVER_OK)) { PMD_INIT_LOG(NOTICE, "Packets on the fly will be dropped" " when packed ring reconnecting."); virtio_user_reset_queues_packed(eth_dev); } - ret = virtio_user_start_device(dev); - if (ret < 0) + vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK); + + /* Start the device */ + vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER_OK); + if (!dev->started) return -1; if (dev->queue_pairs > 1) { -- 2.26.2