Message ID | 20220602023845.2596397-7-lingshan.zhu@intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ifcvf/vDPA: support query device config space through netlink | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Thu, Jun 2, 2022 at 10:48 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote: > > This commit fixes spars warnings: cast to restricted __le16 > in function vdpa_dev_net_config_fill() > > Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> > --- > drivers/vdpa/vdpa.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c > index 50a11ece603e..2719ce9962fc 100644 > --- a/drivers/vdpa/vdpa.c > +++ b/drivers/vdpa/vdpa.c > @@ -837,11 +837,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms > config.mac)) > return -EMSGSIZE; > > - val_u16 = le16_to_cpu(config.status); > + val_u16 = le16_to_cpu((__force __le16)config.status); Can we use virtio accessors like virtio16_to_cpu()? Thanks > if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) > return -EMSGSIZE; > > - val_u16 = le16_to_cpu(config.mtu); > + val_u16 = le16_to_cpu((__force __le16)config.mtu); > if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) > return -EMSGSIZE; > > -- > 2.31.1 >
On 6/2/2022 3:40 PM, Jason Wang wrote: > On Thu, Jun 2, 2022 at 10:48 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote: >> This commit fixes spars warnings: cast to restricted __le16 >> in function vdpa_dev_net_config_fill() >> >> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> >> --- >> drivers/vdpa/vdpa.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c >> index 50a11ece603e..2719ce9962fc 100644 >> --- a/drivers/vdpa/vdpa.c >> +++ b/drivers/vdpa/vdpa.c >> @@ -837,11 +837,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms >> config.mac)) >> return -EMSGSIZE; >> >> - val_u16 = le16_to_cpu(config.status); >> + val_u16 = le16_to_cpu((__force __le16)config.status); > Can we use virtio accessors like virtio16_to_cpu()? I will work out a vdpa16_to_cpu() Thanks, Zhu Lingshan > > Thanks > >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) >> return -EMSGSIZE; >> >> - val_u16 = le16_to_cpu(config.mtu); >> + val_u16 = le16_to_cpu((__force __le16)config.mtu); >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) >> return -EMSGSIZE; >> >> -- >> 2.31.1 >>
On Mon, Jun 6, 2022 at 4:22 PM Zhu, Lingshan <lingshan.zhu@intel.com> wrote: > > > > On 6/2/2022 3:40 PM, Jason Wang wrote: > > On Thu, Jun 2, 2022 at 10:48 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote: > >> This commit fixes spars warnings: cast to restricted __le16 > >> in function vdpa_dev_net_config_fill() > >> > >> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> > >> --- > >> drivers/vdpa/vdpa.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c > >> index 50a11ece603e..2719ce9962fc 100644 > >> --- a/drivers/vdpa/vdpa.c > >> +++ b/drivers/vdpa/vdpa.c > >> @@ -837,11 +837,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms > >> config.mac)) > >> return -EMSGSIZE; > >> > >> - val_u16 = le16_to_cpu(config.status); > >> + val_u16 = le16_to_cpu((__force __le16)config.status); > > Can we use virtio accessors like virtio16_to_cpu()? > I will work out a vdpa16_to_cpu() I meant __virtio16_to_cpu(true, xxx) actually here. Thanks > > Thanks, > Zhu Lingshan > > > > Thanks > > > >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) > >> return -EMSGSIZE; > >> > >> - val_u16 = le16_to_cpu(config.mtu); > >> + val_u16 = le16_to_cpu((__force __le16)config.mtu); > >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) > >> return -EMSGSIZE; > >> > >> -- > >> 2.31.1 > >> >
On 6/7/2022 2:15 PM, Jason Wang wrote: > On Mon, Jun 6, 2022 at 4:22 PM Zhu, Lingshan <lingshan.zhu@intel.com> wrote: >> >> >> On 6/2/2022 3:40 PM, Jason Wang wrote: >>> On Thu, Jun 2, 2022 at 10:48 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote: >>>> This commit fixes spars warnings: cast to restricted __le16 >>>> in function vdpa_dev_net_config_fill() >>>> >>>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> >>>> --- >>>> drivers/vdpa/vdpa.c | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c >>>> index 50a11ece603e..2719ce9962fc 100644 >>>> --- a/drivers/vdpa/vdpa.c >>>> +++ b/drivers/vdpa/vdpa.c >>>> @@ -837,11 +837,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms >>>> config.mac)) >>>> return -EMSGSIZE; >>>> >>>> - val_u16 = le16_to_cpu(config.status); >>>> + val_u16 = le16_to_cpu((__force __le16)config.status); >>> Can we use virtio accessors like virtio16_to_cpu()? >> I will work out a vdpa16_to_cpu() > I meant __virtio16_to_cpu(true, xxx) actually here. sure, this can work! > > Thanks > >> Thanks, >> Zhu Lingshan >>> Thanks >>> >>>> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) >>>> return -EMSGSIZE; >>>> >>>> - val_u16 = le16_to_cpu(config.mtu); >>>> + val_u16 = le16_to_cpu((__force __le16)config.mtu); >>>> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) >>>> return -EMSGSIZE; >>>> >>>> -- >>>> 2.31.1 >>>>
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index 50a11ece603e..2719ce9962fc 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -837,11 +837,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac)) return -EMSGSIZE; - val_u16 = le16_to_cpu(config.status); + val_u16 = le16_to_cpu((__force __le16)config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE; - val_u16 = le16_to_cpu(config.mtu); + val_u16 = le16_to_cpu((__force __le16)config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;
This commit fixes spars warnings: cast to restricted __le16 in function vdpa_dev_net_config_fill() Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> --- drivers/vdpa/vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)