From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"amorenoz@redhat.com" <amorenoz@redhat.com>,
"david.marchand@redhat.com" <david.marchand@redhat.com>
Subject: Re: [dpdk-dev] [PATCH 1/3] net/virtio: keep device and frontend features separated
Date: Wed, 16 Jun 2021 12:25:57 +0000 [thread overview]
Message-ID: <MN2PR11MB4063788AE78AC0672C25AD159C0F9@MN2PR11MB4063.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210608141405.52917-2-maxime.coquelin@redhat.com>
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, June 8, 2021 10:14 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; amorenoz@redhat.com;
> david.marchand@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH 1/3] net/virtio: keep device and frontend features separated
>
> This patch is preliminary rework to add support for getting
> and setting device's config space.
>
> In order to get or set a device config such as its MAC address,
> we need to know whether the device itself support the feature,
> or if it is emulated by the frontend.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> drivers/net/virtio/virtio_user/virtio_user_dev.c | 10 ++--------
> drivers/net/virtio/virtio_user_ethdev.c | 5 +++--
> 2 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index 364f43e21c..ed55cd7524 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -573,11 +573,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char
> *path, int queues,
> if (dev->backend_type == VIRTIO_USER_BACKEND_VHOST_USER)
> dev->frontend_features |= (1ull << VIRTIO_NET_F_STATUS);
>
> - /*
> - * Device features =
> - * (frontend_features | backend_features) & ~unsupported_features;
> - */
> - dev->device_features |= dev->frontend_features;
> + dev->frontend_features &= ~dev->unsupported_features;
> dev->device_features &= ~dev->unsupported_features;
>
> if (rte_mem_event_callback_register(VIRTIO_USER_MEM_EVENT_CLB_NAME,
> @@ -980,12 +976,10 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev
> *dev)
> return -1;
> }
>
> - dev->device_features |= dev->frontend_features;
> -
> /* unmask vhost-user unsupported features */
> dev->device_features &= ~(dev->unsupported_features);
>
> - dev->features &= dev->device_features;
> + dev->features &= (dev->device_features | dev->frontend_features);
>
> /* For packed ring, resetting queues is required in reconnection. */
> if (virtio_with_packed_queue(hw) &&
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> b/drivers/net/virtio/virtio_user_ethdev.c
> index e85906e9eb..3ecbb4184a 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -110,7 +110,8 @@ virtio_user_get_features(struct virtio_hw *hw)
> struct virtio_user_dev *dev = virtio_user_get_dev(hw);
>
> /* unmask feature bits defined in vhost user protocol */
> - return dev->device_features & VIRTIO_PMD_SUPPORTED_GUEST_FEATURES;
> + return (dev->device_features | dev->frontend_features) &
> + VIRTIO_PMD_SUPPORTED_GUEST_FEATURES;
> }
>
> static void
> @@ -118,7 +119,7 @@ virtio_user_set_features(struct virtio_hw *hw, uint64_t
> features)
> {
> struct virtio_user_dev *dev = virtio_user_get_dev(hw);
>
> - dev->features = features & dev->device_features;
> + dev->features = features & (dev->device_features | dev-
> >frontend_features);
> }
>
> static int
> --
> 2.31.1
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
next prev parent reply other threads:[~2021-06-16 12:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 14:14 [dpdk-dev] [PATCH 0/3] net/virtio: add vdpa device config support Maxime Coquelin
2021-06-08 14:14 ` [dpdk-dev] [PATCH 1/3] net/virtio: keep device and frontend features separated Maxime Coquelin
2021-06-16 12:25 ` Xia, Chenbo [this message]
2021-06-08 14:14 ` [dpdk-dev] [PATCH 2/3] net/virtio: add device config support to vDPA Maxime Coquelin
2021-06-16 12:26 ` Xia, Chenbo
2021-06-17 12:59 ` Maxime Coquelin
2021-06-08 14:14 ` [dpdk-dev] [PATCH 3/3] net/virtio: add MAC device config getter and setter Maxime Coquelin
2021-06-16 12:27 ` Xia, Chenbo
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=MN2PR11MB4063788AE78AC0672C25AD159C0F9@MN2PR11MB4063.namprd11.prod.outlook.com \
--to=chenbo.xia@intel.com \
--cc=amorenoz@redhat.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.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).