From: Dragos Tatulea <dtatulea@nvidia.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Carlos Bilbao <carlos.bilbao.osdev@gmail.com>
Cc: jasowang@redhat.com, shannon.nelson@amd.com, sashal@kernel.org,
alvaro.karsz@solid-run.com, christophe.jaillet@wanadoo.fr,
steven.sistare@oracle.com, bilbao@vt.edu,
xuanzhuo@linux.alibaba.com, johnah.palmer@oracle.com,
eperezma@redhat.com, cratiu@nvidia.com,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
Carlos Bilbao <cbilbao@digitalocean.com>
Subject: Re: [PATCH v3 1/2] vdpa/mlx5: Set speed and duplex of vDPA devices to UNKNOWN
Date: Fri, 8 Nov 2024 10:31:58 +0100 [thread overview]
Message-ID: <f1d671ff-0429-4cb5-a6e8-309a8567924c@nvidia.com> (raw)
In-Reply-To: <20241107164932-mutt-send-email-mst@kernel.org>
On 07.11.24 22:50, Michael S. Tsirkin wrote:
> On Wed, Sep 04, 2024 at 10:11:14AM -0500, Carlos Bilbao wrote:
>> From: Carlos Bilbao <cbilbao@digitalocean.com>
>>
>> Initialize the speed and duplex fields in virtio_net_config to UNKNOWN.
>> This is needed because mlx5_vdpa vDPA devices currently do not support the
>> VIRTIO_NET_F_SPEED_DUPLEX feature which reports speed and duplex.
>
> I see no logic here. Without this feature bit, guests will not read
> this field, why do we suddenly need to initialize it?
>
IIRC, Carlos was reading data via ioctl VHOST_VDPA_GET_CONFIG which calls
.get_config() directly, always exposing the speed and duplex config fields [0].
Carlos, was this the case?
[0] https://lore.kernel.org/lkml/afcbf041-7613-48e6-8088-9d52edd907ff@nvidia.com/T/
Thanks,
Dragos
>> Add
>> needed helper cpu_to_mlx5vdpa32() to convert endianness of speed.
>>
>> Signed-off-by: Carlos Bilbao <cbilbao@digitalocean.com>
>> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
>> ---
>> drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> index b56aae3f7be3..41ca268d43ff 100644
>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> @@ -173,6 +173,11 @@ static __virtio16 cpu_to_mlx5vdpa16(struct mlx5_vdpa_dev *mvdev, u16 val)
>> return __cpu_to_virtio16(mlx5_vdpa_is_little_endian(mvdev), val);
>> }
>>
>> +static __virtio32 cpu_to_mlx5vdpa32(struct mlx5_vdpa_dev *mvdev, u32 val)
>> +{
>> + return __cpu_to_virtio32(mlx5_vdpa_is_little_endian(mvdev), val);
>> +}
>> +
>> static u16 ctrl_vq_idx(struct mlx5_vdpa_dev *mvdev)
>> {
>> if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_MQ)))
>> @@ -3433,6 +3438,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
>> init_rwsem(&ndev->reslock);
>> config = &ndev->config;
>>
>> + /*
>> + * mlx5_vdpa vDPA devices currently don't support reporting or
>> + * setting the speed or duplex.
>> + */
>> + config->speed = cpu_to_mlx5vdpa32(mvdev, SPEED_UNKNOWN);
>> + config->duplex = DUPLEX_UNKNOWN;
>> +
>> if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) {
>> err = config_func_mtu(mdev, add_config->net.mtu);
>> if (err)
>> --
>> 2.34.1
>
next prev parent reply other threads:[~2024-11-08 9:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 15:11 [PATCH v3 0/2] Properly initialize speed/duplex and remove vDPA config updates Carlos Bilbao
2024-09-04 15:11 ` [PATCH v3 1/2] vdpa/mlx5: Set speed and duplex of vDPA devices to UNKNOWN Carlos Bilbao
2024-09-05 2:26 ` Jason Wang
2024-11-07 21:50 ` Michael S. Tsirkin
2024-11-08 9:31 ` Dragos Tatulea [this message]
2024-11-08 11:51 ` Michael S. Tsirkin
2024-11-08 23:44 ` Carlos Bilbao
2024-09-04 15:11 ` [PATCH v3 2/2] vdpa: Remove ioctl VHOST_VDPA_SET_CONFIG per spec compliance Carlos Bilbao
2024-09-05 2:25 ` Jason Wang
2024-09-10 6:29 ` [PATCH v3 0/2] Properly initialize speed/duplex and remove vDPA config updates Michael S. Tsirkin
2024-09-11 3:42 ` Jason Wang
2024-09-11 16:55 ` Carlos Bilbao
2024-09-30 20:37 ` Carlos Bilbao
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=f1d671ff-0429-4cb5-a6e8-309a8567924c@nvidia.com \
--to=dtatulea@nvidia.com \
--cc=alvaro.karsz@solid-run.com \
--cc=bilbao@vt.edu \
--cc=carlos.bilbao.osdev@gmail.com \
--cc=cbilbao@digitalocean.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=cratiu@nvidia.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=johnah.palmer@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashal@kernel.org \
--cc=shannon.nelson@amd.com \
--cc=steven.sistare@oracle.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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
all inboxes | Powered by JetHome®