DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com,
	schalla@marvell.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH v2 2/2] net/virtio: fix notification area initialization
Date: Wed, 13 Mar 2024 13:59:32 +0100	[thread overview]
Message-ID: <20240313125932.1878279-3-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20240313125932.1878279-1-maxime.coquelin@redhat.com>

Notification area is a Virtio feature that requires to be
negotiated because not all devices support it. Currently,
it is tried to be initialized as soon as the backend
implements the callback, so it assumes all Vhost-vDPA
devices support it.

This patch skips calling the notification area map callback
if the device does not advertise its support.

Fixes: 0fd2782660c8 ("net/virtio-user: support notification area mapping")

Reviewed-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 54187fedf5..4fdfe70e7c 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -445,8 +445,9 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev)
 		dev->kickfds[i] = kickfd;
 	}
 
-	if (dev->ops->map_notification_area)
-		if (dev->ops->map_notification_area(dev))
+	if (dev->device_features & (1ULL << VIRTIO_F_NOTIFICATION_DATA))
+		if (dev->ops->map_notification_area &&
+				dev->ops->map_notification_area(dev))
 			goto err;
 
 	return 0;
-- 
2.44.0


  parent reply	other threads:[~2024-03-13 12:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 12:59 [PATCH v2 0/2] net/virtio: vhost-vdpa fixes Maxime Coquelin
2024-03-13 12:59 ` [PATCH v2 1/2] net/virtio: fix vDPA device init advertising control queue Maxime Coquelin
2024-03-13 14:12   ` David Marchand
2024-03-13 12:59 ` Maxime Coquelin [this message]
2024-03-13 14:48 ` [PATCH v2 0/2] net/virtio: vhost-vdpa fixes David Marchand

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=20240313125932.1878279-3-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbox@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=schalla@marvell.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).