virtio-net.c (8437f7be3b1c49631e435c652707f2cee477149d) virtio-net.c (7e0e736ecdfeac6d3517513d3a702304e4f6cf59)
1/*
2 * Virtio Network Device
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 1574 unchanged lines hidden (view full) ---

1583 VirtIODevice *vdev = VIRTIO_DEVICE(dev);
1584 VirtIONet *n = VIRTIO_NET(dev);
1585 NetClientState *nc;
1586 int i;
1587
1588 virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size);
1589
1590 n->max_queues = MAX(n->nic_conf.peers.queues, 1);
1/*
2 * Virtio Network Device
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 1574 unchanged lines hidden (view full) ---

1583 VirtIODevice *vdev = VIRTIO_DEVICE(dev);
1584 VirtIONet *n = VIRTIO_NET(dev);
1585 NetClientState *nc;
1586 int i;
1587
1588 virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size);
1589
1590 n->max_queues = MAX(n->nic_conf.peers.queues, 1);
1591 if (n->max_queues * 2 + 1 > VIRTIO_PCI_QUEUE_MAX) {
1592 error_setg(errp, "Invalid number of queues (= %" PRIu32 "), "
1593 "must be a postive integer less than %d.",
1594 n->max_queues, (VIRTIO_PCI_QUEUE_MAX - 1) / 2);
1595 virtio_cleanup(vdev);
1596 return;
1597 }
1591 n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues);
1592 n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx);
1593 n->curr_queues = 1;
1594 n->vqs[0].n = n;
1595 n->tx_timeout = n->net_conf.txtimer;
1596
1597 if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer")
1598 && strcmp(n->net_conf.tx, "bh")) {

--- 162 unchanged lines hidden ---
1598 n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues);
1599 n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx);
1600 n->curr_queues = 1;
1601 n->vqs[0].n = n;
1602 n->tx_timeout = n->net_conf.txtimer;
1603
1604 if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer")
1605 && strcmp(n->net_conf.tx, "bh")) {

--- 162 unchanged lines hidden ---