patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Adrian Moreno <amorenoz@redhat.com>
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 <amorenoz@redhat.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH v3 5/6] net/virtio-user: don't assume vhost status feature
Date: Mon, 26 Oct 2020 17:39:29 +0100	[thread overview]
Message-ID: <20201026163930.94032-6-amorenoz@redhat.com> (raw)
In-Reply-To: <20201026163930.94032-1-amorenoz@redhat.com>

There are some status reads and updates that need to happen before the
protocol features are negotiated. Therefore, assuming the backend does
support this feature can lead to failures.

On server mode, do not assume the backend supports
VHOST_USER_PROTOCOL_F_STATUS. Activate it back on reconnection and
cleare it on disconnection.

Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
Cc: maxime.coquelin@redhat.com
Cc: stable@dpdk.org

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 6 ++++++
 drivers/net/virtio/virtio_user_ethdev.c          | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 36e5619df..053f0267c 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -523,6 +523,12 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		 * later.
 		 */
 		dev->device_features = VIRTIO_USER_SUPPORTED_FEATURES;
+
+		/* We cannot assume VHOST_USER_PROTOCOL_F_STATUS is supported
+		 * until it's negotiated
+		 */
+		dev->protocol_features &=
+			~(1ULL << VHOST_USER_PROTOCOL_F_STATUS);
 	}
 
 
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 97ddc5651..142bdc0bd 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -92,6 +92,9 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
 					&protocol_features))
 			return -1;
 
+		/* Offer VHOST_USER_PROTOCOL_F_STATUS */
+		dev->protocol_features |=
+			(1ULL << VHOST_USER_PROTOCOL_F_STATUS);
 		dev->protocol_features &= protocol_features;
 
 		if (dev->ops->send_request(dev,
@@ -168,6 +171,11 @@ virtio_user_delayed_handler(void *param)
 		if (dev->vhostfd >= 0) {
 			close(dev->vhostfd);
 			dev->vhostfd = -1;
+			/* Until the featuers are negotiated again, don't assume
+			 * the backend supports VHOST_USER_PROTOCOL_F_STATUS
+			 */
+			dev->protocol_features &=
+				~(1ULL << VHOST_USER_PROTOCOL_F_STATUS);
 		}
 		eth_dev->intr_handle->fd = dev->listenfd;
 		rte_intr_callback_register(eth_dev->intr_handle,
-- 
2.26.2


  parent reply	other threads:[~2020-10-26 16:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201026163930.94032-1-amorenoz@redhat.com>
2020-10-26 16:39 ` [dpdk-stable] [PATCH v3 1/6] net/virtio-user: fix backend selection if stat fails Adrian Moreno
2020-10-26 16:39 ` [dpdk-stable] [PATCH v3 2/6] net/virtio-user: don't set/get_status until FEATURES_OK Adrian Moreno
2020-10-26 16:39 ` Adrian Moreno [this message]
2020-10-28 10:37   ` [dpdk-stable] [PATCH v3 5/6] net/virtio-user: don't assume vhost status feature Maxime Coquelin
2020-10-26 16:39 ` [dpdk-stable] [PATCH v3 6/6] net/virtio-user: set status on socket reconnect Adrian Moreno
2020-10-28 11:01   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201026163930.94032-6-amorenoz@redhat.com \
    --to=amorenoz@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=patrick.fu@intel.com \
    --cc=stable@dpdk.org \
    --cc=yinan.wang@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).