From: Eli Cohen <elic@nvidia.com>
To: Si-Wei Liu <si-wei.liu@oracle.com>,
mst@redhat.com, jasowang@redhat.com, parav@nvidia.com
Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/6] vdpa: conditionally read STATUS in config space
Date: Sun, 5 Feb 2023 10:26:00 +0200 [thread overview]
Message-ID: <0f158916-aaab-0afd-6cd0-382f54ef26d9@nvidia.com> (raw)
In-Reply-To: <1675400523-12519-3-git-send-email-si-wei.liu@oracle.com>
On 03/02/2023 7:01, Si-Wei Liu wrote:
> The spec says:
> status only exists if VIRTIO_NET_F_STATUS is set
>
> Similar to MAC and MTU, vdpa_dev_net_config_fill() should read
> STATUS conditionally depending on the feature bits.
>
> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>
> ---
> drivers/vdpa/vdpa.c | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> index 3a82ca78..21c8aa3 100644
> --- a/drivers/vdpa/vdpa.c
> +++ b/drivers/vdpa/vdpa.c
> @@ -843,18 +843,25 @@ static int vdpa_dev_net_mac_config_fill(struct sk_buff *msg, u64 features,
> sizeof(config->mac), config->mac);
> }
>
> +static int vdpa_dev_net_status_config_fill(struct sk_buff *msg, u64 features,
> + const struct virtio_net_config *config)
> +{
> + u16 val_u16;
> +
> + if ((features & BIT_ULL(VIRTIO_NET_F_STATUS)) == 0)
> + return 0;
Instead of returning 0 here, it would be better to explicitly put 0 in
the message field for
VDPA_ATTR_DEV_NET_STATUS
> +
> + val_u16 = __virtio16_to_cpu(true, config->status);
> + return nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16);
> +}
> +
> static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg)
> {
> struct virtio_net_config config = {};
> u64 features_device;
> - u16 val_u16;
>
> vdev->config->get_config(vdev, 0, &config, sizeof(config));
>
> - val_u16 = __virtio16_to_cpu(true, config.status);
> - if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16))
> - return -EMSGSIZE;
> -
> features_device = vdev->config->get_device_features(vdev);
>
> if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_FEATURES, features_device,
> @@ -867,6 +874,9 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
> if (vdpa_dev_net_mac_config_fill(msg, features_device, &config))
> return -EMSGSIZE;
>
> + if (vdpa_dev_net_status_config_fill(msg, features_device, &config))
> + return -EMSGSIZE;
> +
> return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
> }
>
next prev parent reply other threads:[~2023-02-05 8:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 5:01 [PATCH v3 0/6] features provisioning fixes and mlx5_vdpa support Si-Wei Liu
2023-02-03 5:01 ` [PATCH v3 1/6] vdpa: fix improper error message when adding vdpa dev Si-Wei Liu
2023-02-03 5:01 ` [PATCH v3 2/6] vdpa: conditionally read STATUS in config space Si-Wei Liu
2023-02-05 8:26 ` Eli Cohen [this message]
2023-02-06 4:53 ` Si-Wei Liu
2023-02-06 6:48 ` Eli Cohen
2023-02-03 5:02 ` [PATCH v3 3/6] vdpa: validate provisioned device features against specified attribute Si-Wei Liu
2023-02-05 8:31 ` Eli Cohen
2023-02-03 5:02 ` [PATCH v3 4/6] vdpa: validate device feature provisioning against supported class Si-Wei Liu
2023-02-03 5:02 ` [PATCH v3 5/6] vdpa/mlx5: conditionally show MTU and STATUS in config space Si-Wei Liu
2023-02-05 9:36 ` Eli Cohen
2023-02-06 4:53 ` Si-Wei Liu
2023-02-06 6:52 ` Eli Cohen
2023-02-03 5:02 ` [PATCH v3 6/6] vdpa/mlx5: support device features provisioning Si-Wei Liu
2023-02-06 6:53 ` Eli Cohen
2023-02-06 23:07 [PATCH v4 0/6] features provisioning fixes and mlx5_vdpa support Si-Wei Liu
2023-02-06 23:07 ` [PATCH v3 2/6] vdpa: conditionally read STATUS in config space Si-Wei Liu
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=0f158916-aaab-0afd-6cd0-382f54ef26d9@nvidia.com \
--to=elic@nvidia.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=parav@nvidia.com \
--cc=si-wei.liu@oracle.com \
--cc=virtualization@lists.linux-foundation.org \
/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
all inboxes | Powered by JetHome®