From: Si-Wei Liu <si-wei.liu@oracle.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
Wu Zongyong <wuzongyong@linux.alibaba.com>
Subject: Re: [PATCH v2 2/4] vdpa: pass initial config to _vdpa_register_device()
Date: Thu, 20 Oct 2022 10:42:48 -0700 [thread overview]
Message-ID: <68312622-0206-f456-146e-e242e36be04d@oracle.com> (raw)
In-Reply-To: <CACGkMEuT7O1xLrB9=eYHAtuHYdwbNXxqtC+Mh4qkWSkLM+QTjg@mail.gmail.com>
On 10/19/2022 10:20 PM, Jason Wang wrote:
> On Wed, Oct 19, 2022 at 8:56 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote:
>> Just as _vdpa_register_device taking @nvqs as the number of queues
> I wonder if it's better to embed nvqs in the config structure.
Hmmm, the config structure is mostly for containing the configurables
specified in the 'vdpa dev add' command, while each field is
conditionally set and guarded by a corresponding mask bit. If @nvqs
needs to be folded into a structure, I feel it might be better to use
another struct for holding the informational fields (i.e. those are
read-only and always exist). But doing this would make @nvqs a weird
solo member in that struct with no extra benefit, and all the other
informational fields shown in the 'vdpa dev show' command would be
gotten from the device through config_ops directly. Maybe do this until
another read-only field comes around?
>
>> to feed userspace inquery via vdpa_dev_fill(), we can follow the
>> same to stash config attributes in struct vdpa_device at the time
>> of vdpa registration.
>>
>> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
>> ---
>> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
>> drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
>> drivers/vdpa/vdpa.c | 15 +++++++++++----
>> drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 2 +-
>> drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 2 +-
>> drivers/vdpa/vdpa_user/vduse_dev.c | 2 +-
>> drivers/vdpa/virtio_pci/vp_vdpa.c | 3 ++-
>> include/linux/vdpa.h | 3 ++-
>> 8 files changed, 20 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
>> index f9c0044..c54ab2c 100644
>> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
>> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
>> @@ -771,7 +771,7 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
>> else
>> ret = dev_set_name(&vdpa_dev->dev, "vdpa%u", vdpa_dev->index);
>>
>> - ret = _vdpa_register_device(&adapter->vdpa, vf->nr_vring);
>> + ret = _vdpa_register_device(&adapter->vdpa, vf->nr_vring, config);
>> if (ret) {
>> put_device(&adapter->vdpa.dev);
>> IFCVF_ERR(pdev, "Failed to register to vDPA bus");
>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> index 9091336..376082e 100644
>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> @@ -3206,7 +3206,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
>> mlx5_notifier_register(mdev, &ndev->nb);
>> ndev->nb_registered = true;
>> mvdev->vdev.mdev = &mgtdev->mgtdev;
>> - err = _vdpa_register_device(&mvdev->vdev, max_vqs + 1);
>> + err = _vdpa_register_device(&mvdev->vdev, max_vqs + 1, add_config);
>> if (err)
>> goto err_reg;
>>
>> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>> index febdc99..566c1c6 100644
>> --- a/drivers/vdpa/vdpa.c
>> +++ b/drivers/vdpa/vdpa.c
>> @@ -215,11 +215,16 @@ static int vdpa_name_match(struct device *dev, const void *data)
>> return (strcmp(dev_name(&vdev->dev), data) == 0);
>> }
>>
>> -static int __vdpa_register_device(struct vdpa_device *vdev, u32 nvqs)
>> +static int __vdpa_register_device(struct vdpa_device *vdev, u32 nvqs,
>> + const struct vdpa_dev_set_config *cfg)
>> {
>> struct device *dev;
>>
>> vdev->nvqs = nvqs;
>> + if (cfg)
>> + vdev->vdev_cfg = *cfg;
>> + else
>> + vdev->vdev_cfg.mask = 0ULL;
> I think it would be nice if we can convert eni to use netlink then we
> don't need any workaround like this.
Yes, Alibaba ENI is the only consumer of the old vdpa_register_device()
API without being ported to the netlink API. Not sure what is needed but
it seems another work to make netlink API committed to support a legacy
compatible model?
-Siwei
>
> Thanks
>
next prev parent reply other threads:[~2022-10-20 18:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 23:50 [PATCH v2 0/4] vDPA: dev config export via "vdpa dev show" command Si-Wei Liu
2022-10-18 23:50 ` [PATCH v2 1/4] vdpa: save vdpa_dev_set_config in struct vdpa_device Si-Wei Liu
2022-10-20 4:38 ` Jason Wang
2022-10-18 23:50 ` [PATCH v2 2/4] vdpa: pass initial config to _vdpa_register_device() Si-Wei Liu
2022-10-20 5:20 ` Jason Wang
2022-10-20 17:42 ` Si-Wei Liu [this message]
2022-10-21 2:51 ` Jason Wang
2022-10-22 0:31 ` Si-Wei Liu
2022-10-18 23:50 ` [PATCH v2 3/4] vdpa: show dev config as-is in "vdpa dev show" output Si-Wei Liu
2022-10-20 5:25 ` Jason Wang
2022-10-20 18:12 ` Si-Wei Liu
2022-10-20 21:13 ` Parav Pandit
2022-10-18 23:50 ` [PATCH v2 4/4] vdpa: fix improper error message when adding vdpa dev Si-Wei Liu
2022-10-20 5:40 ` Jason Wang
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=68312622-0206-f456-146e-e242e36be04d@oracle.com \
--to=si-wei.liu@oracle.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=wuzongyong@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®