Commit bf5363ef authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'stefanha/net' into staging

# By Jason Wang (2) and others
# Via Stefan Hajnoczi
* stefanha/net:
  qmp: netdev_add is like -netdev, not -net, fix documentation
  doc: document -netdev hubport
  net: reduce the unnecessary memory allocation of multiqueue
  tap: set IFF_ONE_QUEUE per default
  tap: forbid creating multiqueue tap when hub is used
  net: fix unbounded NetQueue
  net: fix qemu_flush_queued_packets() in presence of a hub
parents 806f352d af347aa5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1169,7 +1169,7 @@ ETEXI
    {
        .name       = "netdev_add",
        .args_type  = "netdev:O",
        .params     = "[user|tap|socket],id=str[,prop=value][,...]",
        .params     = "[user|tap|socket|hubport],id=str[,prop=value][,...]",
        .help       = "add host network device",
        .mhandler.cmd = hmp_netdev_add,
    },
+4 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ typedef struct VirtIONet
    VirtIODevice vdev;
    uint8_t mac[ETH_ALEN];
    uint16_t status;
    VirtIONetQueue vqs[MAX_QUEUE_NUM];
    VirtIONetQueue *vqs;
    VirtQueue *ctrl_vq;
    NICState *nic;
    uint32_t tx_timeout;
@@ -1326,8 +1326,9 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
    n->vdev.set_status = virtio_net_set_status;
    n->vdev.guest_notifier_mask = virtio_net_guest_notifier_mask;
    n->vdev.guest_notifier_pending = virtio_net_guest_notifier_pending;
    n->max_queues = MAX(conf->queues, 1);
    n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues);
    n->vqs[0].rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);
    n->max_queues = conf->queues;
    n->curr_queues = 1;
    n->vqs[0].n = n;
    n->tx_timeout = net->txtimer;
@@ -1412,6 +1413,7 @@ void virtio_net_exit(VirtIODevice *vdev)
        }
    }

    g_free(n->vqs);
    qemu_del_nic(n->nic);
    virtio_cleanup(&n->vdev);
}
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ struct NetClientState {
};

typedef struct NICState {
    NetClientState ncs[MAX_QUEUE_NUM];
    NetClientState *ncs;
    NICConf *conf;
    void *opaque;
    bool peer_deleted;
+14 −0
Original line number Diff line number Diff line
@@ -338,3 +338,17 @@ void net_hub_check_clients(void)
        }
    }
}

bool net_hub_flush(NetClientState *nc)
{
    NetHubPort *port;
    NetHubPort *source_port = DO_UPCAST(NetHubPort, nc, nc);
    int ret = 0;

    QLIST_FOREACH(port, &source_port->hub->ports, next) {
        if (port != source_port) {
            ret += qemu_net_queue_flush(port->nc.send_queue);
        }
    }
    return ret ? true : false;
}
+1 −0
Original line number Diff line number Diff line
@@ -21,5 +21,6 @@ NetClientState *net_hub_add_port(int hub_id, const char *name);
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
void net_hub_info(Monitor *mon);
void net_hub_check_clients(void);
bool net_hub_flush(NetClientState *nc);

#endif /* NET_HUB_H */
Loading