On Tue, Dec 7, 2021 at 9:03 PM Eli Cohen <elic@xxxxxxxxxx> wrote: > > Hi Jason, > > I noticed the lack of interface to get the currently configured > features. > > Does the below patch make sense to you? If so I can post it along with > a patch that implements the function for all current vdpa drivers. Yes. > > > > Current code relys on features published by the uplink driver to build > configuration information. These features are not necessarily the > configured features. > > Introduce a callback to provide the configured features. > > Fixes: ad69dd0bf26b ("vdpa: Introduce query of device config layout") > Signed-off-by: Eli Cohen <elic@xxxxxxxxxx> > --- > drivers/vdpa/vdpa.c | 4 +++- > include/linux/vdpa.h | 1 + > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c > index 7332a74a4b00..41486c6bce2f 100644 > --- a/drivers/vdpa/vdpa.c > +++ b/drivers/vdpa/vdpa.c > @@ -733,8 +733,10 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms > if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) > return -EMSGSIZE; > > - features = vdev->config->get_features(vdev); > + if (!vdev->config->get_cur_features) > + return -EOPNOTSUPP; > > + features = vdev->config->get_cur_features(vdev); To be aligned with the virito spec, I think we need name it as get_driver_features(), and while at it, rename 1) set_features() to set_driver_features() and 2) get_features() to get_device_features() Thanks > return vdpa_dev_net_mq_config_fill(vdev, msg, features, &config); > } > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index c3011ccda430..daf22aed1006 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -278,6 +278,7 @@ struct vdpa_config_ops { > u32 (*get_vq_align)(struct vdpa_device *vdev); > u64 (*get_features)(struct vdpa_device *vdev); > int (*set_features)(struct vdpa_device *vdev, u64 features); > + u64 (*get_cur_features)(struct vdpa_device *vdev); > void (*set_config_cb)(struct vdpa_device *vdev, > struct vdpa_callback *cb); > u16 (*get_vq_num_max)(struct vdpa_device *vdev); > -- > 2.32.0 > _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization