| 807 | } |
| 808 | |
| 809 | void |
| 810 | vhost_setup_virtio_net(int vid, bool enable, bool compliant_ol_flags, bool stats_enabled, |
| 811 | bool support_iommu) |
| 812 | { |
| 813 | struct virtio_net *dev = get_device(vid); |
| 814 | |
| 815 | if (dev == NULL) |
| 816 | return; |
| 817 | |
| 818 | if (enable) |
| 819 | dev->flags |= VIRTIO_DEV_BUILTIN_VIRTIO_NET; |
| 820 | else |
| 821 | dev->flags &= ~VIRTIO_DEV_BUILTIN_VIRTIO_NET; |
| 822 | if (!compliant_ol_flags) |
| 823 | dev->flags |= VIRTIO_DEV_LEGACY_OL_FLAGS; |
| 824 | else |
| 825 | dev->flags &= ~VIRTIO_DEV_LEGACY_OL_FLAGS; |
| 826 | if (stats_enabled) |
| 827 | dev->flags |= VIRTIO_DEV_STATS_ENABLED; |
| 828 | else |
| 829 | dev->flags &= ~VIRTIO_DEV_STATS_ENABLED; |
| 830 | if (support_iommu) |
| 831 | dev->flags |= VIRTIO_DEV_SUPPORT_IOMMU; |
| 832 | else |
| 833 | dev->flags &= ~VIRTIO_DEV_SUPPORT_IOMMU; |
| 834 | |
| 835 | if (vhost_user_iotlb_init(dev) < 0) |
| 836 | VHOST_LOG_CONFIG("device", ERR, "failed to init IOTLB\n"); |
| 837 | |
| 838 | } |
| 839 | |
| 840 | void |
| 841 | vhost_enable_extbuf(int vid) |
no test coverage detected