search for: virtio_has_feature

Displaying 20 results from an estimated 1755 matches for "virtio_has_feature".

2017 Jul 18
2
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
..., "Fail to set guest offload. \n"); > + return -EINVAL; > + } > + > + return 0; > +} > + > +static int virtnet_clear_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = 0; > + > + if (!vi->guest_offloads) > + return 0; > + > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads = 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > +static int virtnet_restore_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = vi->guest_offloads...
2017 Jul 18
2
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
..., "Fail to set guest offload. \n"); > + return -EINVAL; > + } > + > + return 0; > +} > + > +static int virtnet_clear_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = 0; > + > + if (!vi->guest_offloads) > + return 0; > + > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads = 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > +static int virtnet_restore_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = vi->guest_offloads...
2014 Nov 19
3
[PATCH V2 net] virtio-net: validate features during probe
...rivers/net/virtio_net.c @@ -1673,6 +1673,93 @@ static const struct attribute_group virtio_net_mrg_rx_group = { }; #endif +static int virtnet_validate_features(struct virtio_device *dev, + unsigned int *table, + int table_size, + unsigned int feature) +{ + int i; + + if (!virtio_has_feature(dev, feature)) { + for (i = 0; i < table_size; i++) { + unsigned int f = table[i]; + + if (virtio_has_feature(dev, f)) { + dev_err(&dev->dev, + "buggy hyperviser: feature 0x%x was advertised but its dependency 0x%x was not", + f, feature); + return -EINVAL; +...
2014 Nov 19
3
[PATCH V2 net] virtio-net: validate features during probe
...rivers/net/virtio_net.c @@ -1673,6 +1673,93 @@ static const struct attribute_group virtio_net_mrg_rx_group = { }; #endif +static int virtnet_validate_features(struct virtio_device *dev, + unsigned int *table, + int table_size, + unsigned int feature) +{ + int i; + + if (!virtio_has_feature(dev, feature)) { + for (i = 0; i < table_size; i++) { + unsigned int f = table[i]; + + if (virtio_has_feature(dev, f)) { + dev_err(&dev->dev, + "buggy hyperviser: feature 0x%x was advertised but its dependency 0x%x was not", + f, feature); + return -EINVAL; +...
2014 Jan 25
3
[PATCH] virtio_balloon: don't call virtio_has_feature() twice on init_vqs()
Cchange init_vqs() to avoid calling twice the virtio_has_feature() - attempting to find out if VIRTIO_BALLOON_F_STATS_VQ feature was negotiated - consequently we prevent unnecessarily running the drivers' feature_table more than needed. Signed-off-by: Leandro Dorileo <l at dorileo.org> --- drivers/virtio/virtio_balloon.c | 6 ++++-- 1 file changed, 4...
2014 Jan 25
3
[PATCH] virtio_balloon: don't call virtio_has_feature() twice on init_vqs()
Cchange init_vqs() to avoid calling twice the virtio_has_feature() - attempting to find out if VIRTIO_BALLOON_F_STATS_VQ feature was negotiated - consequently we prevent unnecessarily running the drivers' feature_table more than needed. Signed-off-by: Leandro Dorileo <l at dorileo.org> --- drivers/virtio/virtio_balloon.c | 6 ++++-- 1 file changed, 4...
2020 Mar 10
2
[PATCH v2] virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM
...>> + /* >> + * We're allowed to reuse any free pages, even if they are >> + * still to be processed by the host. >> + */ >> + err = virtio_balloon_register_shrinker(vb); >> + if (err) >> + goto out_del_balloon_wq; >> } >> + if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) { >> + vb->oom_nb.notifier_call = virtio_balloon_oom_notify; >> + vb->oom_nb.priority = VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY; >> + err = register_oom_notifier(&vb->oom_nb); >> + if (err < 0) >> + goto out_unre...
2020 Mar 10
2
[PATCH v2] virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM
...>> + /* >> + * We're allowed to reuse any free pages, even if they are >> + * still to be processed by the host. >> + */ >> + err = virtio_balloon_register_shrinker(vb); >> + if (err) >> + goto out_del_balloon_wq; >> } >> + if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) { >> + vb->oom_nb.notifier_call = virtio_balloon_oom_notify; >> + vb->oom_nb.priority = VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY; >> + err = register_oom_notifier(&vb->oom_nb); >> + if (err < 0) >> + goto out_unre...
2014 Dec 11
0
[PATCH RFC v6 04/20] virtio: add feature checking helpers
...support the VIRTIO_BLK_F_CONFIG_WCE feature. @@ -618,10 +615,10 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status) * * s->blk would erroneously be placed in writethrough mode. */ - if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) { + if (!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) { aio_context_acquire(blk_get_aio_context(s->blk)); blk_set_enable_write_cache(s->blk, - !!(features & (1 << VIRTIO_BLK_F_WCE))); + virtio_has_feature(vdev, VIRTIO_B...
2014 Dec 11
0
[PATCH RFC v6 04/20] virtio: add feature checking helpers
...support the VIRTIO_BLK_F_CONFIG_WCE feature. @@ -618,10 +615,10 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status) * * s->blk would erroneously be placed in writethrough mode. */ - if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) { + if (!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) { aio_context_acquire(blk_get_aio_context(s->blk)); blk_set_enable_write_cache(s->blk, - !!(features & (1 << VIRTIO_BLK_F_WCE))); + virtio_has_feature(vdev, VIRTIO_B...
2017 Jul 24
1
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
..., "Fail to set guest offload. \n"); > + return -EINVAL; > + } > + > + return 0; > +} > + > +static int virtnet_clear_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = 0; > + > + if (!vi->guest_offloads) > + return 0; > + > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads = 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > +static int virtnet_restore_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = vi->guest_offloads...
2017 Jul 24
1
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
..., "Fail to set guest offload. \n"); > + return -EINVAL; > + } > + > + return 0; > +} > + > +static int virtnet_clear_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = 0; > + > + if (!vi->guest_offloads) > + return 0; > + > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads = 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > +static int virtnet_restore_guest_offloads(struct virtnet_info *vi) > +{ > + u64 offloads = vi->guest_offloads...
2011 Mar 31
1
[PATCH] virtio_net: convert to hw_features
...+ b/drivers/net/virtio_net.c @@ -710,17 +710,6 @@ static int virtnet_close(struct net_device *dev) return 0; } -static int virtnet_set_tx_csum(struct net_device *dev, u32 data) -{ - struct virtnet_info *vi = netdev_priv(dev); - struct virtio_device *vdev = vi->vdev; - - if (data && !virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) - return -ENOSYS; - - return ethtool_op_set_tx_hw_csum(dev, data); -} - static void virtnet_set_rx_mode(struct net_device *dev) { struct virtnet_info *vi = netdev_priv(dev); @@ -822,10 +811,6 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) }...
2011 Mar 31
1
[PATCH] virtio_net: convert to hw_features
...+ b/drivers/net/virtio_net.c @@ -710,17 +710,6 @@ static int virtnet_close(struct net_device *dev) return 0; } -static int virtnet_set_tx_csum(struct net_device *dev, u32 data) -{ - struct virtnet_info *vi = netdev_priv(dev); - struct virtio_device *vdev = vi->vdev; - - if (data && !virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) - return -ENOSYS; - - return ethtool_op_set_tx_hw_csum(dev, data); -} - static void virtnet_set_rx_mode(struct net_device *dev) { struct virtnet_info *vi = netdev_priv(dev); @@ -822,10 +811,6 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) }...
2014 Nov 19
4
[PATCH net] virtio-net: validate features during probe
...rivers/net/virtio_net.c @@ -1673,6 +1673,95 @@ static const struct attribute_group virtio_net_mrg_rx_group = { }; #endif +static int virtnet_validate_features(struct virtio_device *dev, + unsigned int *table, + int table_size, + unsigned int feature) +{ + int i; + + if (!virtio_has_feature(dev, feature)) { + for (i = 0; i < table_size; i++) { + unsigned int f = table[i]; + + if (virtio_has_feature(dev, f)) { + dev_err(&dev->dev, + "buggy hyperviser: feature 0x%x was advertised but its dependency 0x%x was not", + f, feature); + return -EINVAL; +...
2014 Nov 19
4
[PATCH net] virtio-net: validate features during probe
...rivers/net/virtio_net.c @@ -1673,6 +1673,95 @@ static const struct attribute_group virtio_net_mrg_rx_group = { }; #endif +static int virtnet_validate_features(struct virtio_device *dev, + unsigned int *table, + int table_size, + unsigned int feature) +{ + int i; + + if (!virtio_has_feature(dev, feature)) { + for (i = 0; i < table_size; i++) { + unsigned int f = table[i]; + + if (virtio_has_feature(dev, f)) { + dev_err(&dev->dev, + "buggy hyperviser: feature 0x%x was advertised but its dependency 0x%x was not", + f, feature); + return -EINVAL; +...
2016 Dec 23
2
[PATCH net 7/9] virtio-net: forbid XDP when VIRTIO_NET_F_GUEST_UFO is support
...a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 77ae358..c1f66d8 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1684,7 +1684,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog) > int i, err; > > if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > - virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) { > + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || > + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || > + virtio_has_feature(vi->vdev, VIR...
2016 Dec 23
2
[PATCH net 7/9] virtio-net: forbid XDP when VIRTIO_NET_F_GUEST_UFO is support
...a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 77ae358..c1f66d8 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1684,7 +1684,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog) > int i, err; > > if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > - virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) { > + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || > + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || > + virtio_has_feature(vi->vdev, VIR...
2019 Oct 25
2
[PATCH v2] vhost: introduce mdev based hardware backend
...se its dedicated DMA domain for the work. > > Anyway, this could be done in the future. We can have a version first that > doesn't support ctrl_vq. > > Thanks Well no ctrl_vq implies either no offloads, or no XDP (since XDP needs to disable offloads dynamically). if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) && (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || v...
2019 Oct 25
2
[PATCH v2] vhost: introduce mdev based hardware backend
...se its dedicated DMA domain for the work. > > Anyway, this could be done in the future. We can have a version first that > doesn't support ctrl_vq. > > Thanks Well no ctrl_vq implies either no offloads, or no XDP (since XDP needs to disable offloads dynamically). if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) && (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || v...