Si-Wei Liu
2022-Oct-18 23:50 UTC
[PATCH v2 1/4] vdpa: save vdpa_dev_set_config in struct vdpa_device
In order to allow live migration orchestration software to export the initial set of vdpa attributes with which the device was created, it will be useful if the vdpa tool can report the config on demand with simple query. This will ease the orchestration software implementation so that it doesn't have to keep track of vdpa config change, or have to persist vdpa attributes across failure and recovery, in fear of being killed due to accidental software error. This commit attempts to make struct vdpa_device contain the struct vdpa_dev_set_config, where all config attributes upon vdpa creation are carried over. Which will be used in subsequent commits. Signed-off-by: Si-Wei Liu <si-wei.liu at oracle.com> --- include/linux/vdpa.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 6d0f5e4..f1838f5 100644 --- a/include/linux/vdpa.h +++ b/include/linux/vdpa.h @@ -58,6 +58,16 @@ struct vdpa_vq_state { }; }; +struct vdpa_dev_set_config { + u64 device_features; + struct { + u8 mac[ETH_ALEN]; + u16 mtu; + u16 max_vq_pairs; + } net; + u64 mask; +}; + struct vdpa_mgmt_dev; /** @@ -77,6 +87,8 @@ struct vdpa_vq_state { * @nvqs: maximum number of supported virtqueues * @mdev: management device pointer; caller must setup when registering device as part * of dev_add() mgmtdev ops callback before invoking _vdpa_register_device(). + * @vdev_cfg: initial device config on vdpa creation; useful when instantiate with + * the exact same config is needed. */ struct vdpa_device { struct device dev; @@ -91,6 +103,7 @@ struct vdpa_device { struct vdpa_mgmt_dev *mdev; unsigned int ngroups; unsigned int nas; + struct vdpa_dev_set_config vdev_cfg; }; /** @@ -103,16 +116,6 @@ struct vdpa_iova_range { u64 last; }; -struct vdpa_dev_set_config { - u64 device_features; - struct { - u8 mac[ETH_ALEN]; - u16 mtu; - u16 max_vq_pairs; - } net; - u64 mask; -}; - /** * Corresponding file area for device memory mapping * @file: vma->vm_file for the mapping -- 1.8.3.1
Jason Wang
2022-Oct-20 04:38 UTC
[PATCH v2 1/4] vdpa: save vdpa_dev_set_config in struct vdpa_device
On Wed, Oct 19, 2022 at 8:56 AM Si-Wei Liu <si-wei.liu at oracle.com> wrote:> > In order to allow live migration orchestration software to export the > initial set of vdpa attributes with which the device was created, it > will be useful if the vdpa tool can report the config on demand with > simple query. This will ease the orchestration software implementation > so that it doesn't have to keep track of vdpa config change, or have > to persist vdpa attributes across failure and recovery, in fear of > being killed due to accidental software error. > > This commit attempts to make struct vdpa_device contain the struct > vdpa_dev_set_config, where all config attributes upon vdpa creation > are carried over. Which will be used in subsequent commits. > > Signed-off-by: Si-Wei Liu <si-wei.liu at oracle.com> > --- > include/linux/vdpa.h | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index 6d0f5e4..f1838f5 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -58,6 +58,16 @@ struct vdpa_vq_state { > }; > }; > > +struct vdpa_dev_set_config { > + u64 device_features; > + struct { > + u8 mac[ETH_ALEN]; > + u16 mtu; > + u16 max_vq_pairs; > + } net;Not for this patch but I think there should be a union container for this structure to make it usable for other types of devices.> + u64 mask; > +}; > + > struct vdpa_mgmt_dev; > > /** > @@ -77,6 +87,8 @@ struct vdpa_vq_state { > * @nvqs: maximum number of supported virtqueues > * @mdev: management device pointer; caller must setup when registering device as part > * of dev_add() mgmtdev ops callback before invoking _vdpa_register_device(). > + * @vdev_cfg: initial device config on vdpa creation; useful when instantiate with > + * the exact same config is needed.Not a native speaker, but I guess it should be better named as "init_cfg"? Thanks> */ > struct vdpa_device { > struct device dev; > @@ -91,6 +103,7 @@ struct vdpa_device { > struct vdpa_mgmt_dev *mdev; > unsigned int ngroups; > unsigned int nas; > + struct vdpa_dev_set_config vdev_cfg; > }; > > /** > @@ -103,16 +116,6 @@ struct vdpa_iova_range { > u64 last; > }; > > -struct vdpa_dev_set_config { > - u64 device_features; > - struct { > - u8 mac[ETH_ALEN]; > - u16 mtu; > - u16 max_vq_pairs; > - } net; > - u64 mask; > -}; > - > /** > * Corresponding file area for device memory mapping > * @file: vma->vm_file for the mapping > -- > 1.8.3.1 >