Message ID | 20220927030117.5635-4-lingshan.zhu@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Conditionally read fields in dev cfg space | expand |
On Tue, Sep 27, 2022 at 11:09 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote: > > virtio 1.2 spec says: > max_virtqueue_pairs only exists if VIRTIO_NET_F_MQ or > VIRTIO_NET_F_RSS is set. > > So when reporint MQ to userspace, it should check both > VIRTIO_NET_F_MQ and VIRTIO_NET_F_RSS. > > unused parameter struct vdpa_device *vdev is removed > > Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> Acked-by: Jason Wang <jasowang@redhat.com> > --- > drivers/vdpa/vdpa.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c > index e7765953307f..829fd4cfc038 100644 > --- a/drivers/vdpa/vdpa.c > +++ b/drivers/vdpa/vdpa.c > @@ -800,13 +800,13 @@ static int vdpa_nl_cmd_dev_get_dumpit(struct sk_buff *msg, struct netlink_callba > return msg->len; > } > > -static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev, > - struct sk_buff *msg, u64 features, > +static int vdpa_dev_net_mq_config_fill(struct sk_buff *msg, u64 features, > const struct virtio_net_config *config) > { > u16 val_u16; > > - if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0) > + if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0 && > + (features & BIT_ULL(VIRTIO_NET_F_RSS)) == 0) > return 0; > > val_u16 = le16_to_cpu(config->max_virtqueue_pairs); > -- > 2.31.1 >
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index e7765953307f..829fd4cfc038 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -800,13 +800,13 @@ static int vdpa_nl_cmd_dev_get_dumpit(struct sk_buff *msg, struct netlink_callba return msg->len; } -static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev, - struct sk_buff *msg, u64 features, +static int vdpa_dev_net_mq_config_fill(struct sk_buff *msg, u64 features, const struct virtio_net_config *config) { u16 val_u16; - if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0) + if ((features & BIT_ULL(VIRTIO_NET_F_MQ)) == 0 && + (features & BIT_ULL(VIRTIO_NET_F_RSS)) == 0) return 0; val_u16 = le16_to_cpu(config->max_virtqueue_pairs);
virtio 1.2 spec says: max_virtqueue_pairs only exists if VIRTIO_NET_F_MQ or VIRTIO_NET_F_RSS is set. So when reporint MQ to userspace, it should check both VIRTIO_NET_F_MQ and VIRTIO_NET_F_RSS. unused parameter struct vdpa_device *vdev is removed Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> --- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)