net->feature_bits = options->feature_bits;
net->save_acked_features = options->save_acked_features;
net->max_tx_queue_size = options->max_tx_queue_size;
+ net->is_vhost_user = options->is_vhost_user;
net->dev.max_queues = 1;
net->dev.vqs = net->vqs;
* because vhost user doesn't interrupt masking/unmasking
* properly.
*/
- if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+ if (net->is_vhost_user) {
dev->use_guest_notifier_mask = false;
}
}
static int peer_attach(VirtIONet *n, int index)
{
NetClientState *nc = qemu_get_subqueue(n->nic, index);
+ struct vhost_net *net;
if (!nc->peer) {
return 0;
}
- if (nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+ net = get_vhost_net(nc->peer);
+ if (net && net->is_vhost_user) {
vhost_net_set_vring_enable(nc->peer, 1);
}
static int peer_detach(VirtIONet *n, int index)
{
NetClientState *nc = qemu_get_subqueue(n->nic, index);
+ struct vhost_net *net;
if (!nc->peer) {
return 0;
}
- if (nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+ net = get_vhost_net(nc->peer);
+ if (net && net->is_vhost_user) {
vhost_net_set_vring_enable(nc->peer, 0);
}
const int *feature_bits;
int max_tx_queue_size;
SaveAcketFeatures *save_acked_features;
+ bool is_vhost_user;
NetClientState *nc;
};
unsigned int nvqs;
const int *feature_bits;
int max_tx_queue_size;
+ bool is_vhost_user;
GetAckedFeatures *get_acked_features;
SaveAcketFeatures *save_acked_features;
void *opaque;
options.get_acked_features = NULL;
options.save_acked_features = NULL;
options.max_tx_queue_size = 0;
+ options.is_vhost_user = false;
s->vhost_net = vhost_net_init(&options);
if (!s->vhost_net) {
options.max_tx_queue_size = VIRTQUEUE_MAX_SIZE;
options.get_acked_features = vhost_user_get_acked_features;
options.save_acked_features = vhost_user_save_acked_features;
+ options.is_vhost_user = true;
net = vhost_net_init(&options);
if (!net) {
options.get_acked_features = NULL;
options.save_acked_features = NULL;
options.max_tx_queue_size = VIRTQUEUE_MAX_SIZE;
+ options.is_vhost_user = false;
net = vhost_net_init(&options);
if (!net) {