aboutsummaryrefslogtreecommitdiff
path: root/hw/xen_nic.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-01-30 19:12:22 +0800
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-01 11:02:55 -0600
commitb356f76de31e343121cdab3a01b39182edce9519 (patch)
tree917613c9d0047ba2b4b67a5a4e6146c62b2a62d7 /hw/xen_nic.c
parent28a65891a0deb10b222890b9eb916ca32cb977bb (diff)
net: introduce qemu_get_queue()
To support multiqueue, the patch introduce a helper qemu_get_queue() which is used to get the NetClientState of a device. The following patches would refactor this helper to support multiqueue. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/xen_nic.c')
-rw-r--r--hw/xen_nic.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/xen_nic.c b/hw/xen_nic.c
index dc12110dba..d5b39eadd3 100644
--- a/hw/xen_nic.c
+++ b/hw/xen_nic.c
@@ -185,9 +185,11 @@ static void net_tx_packets(struct XenNetDev *netdev)
}
memcpy(tmpbuf, page + txreq.offset, txreq.size);
net_checksum_calculate(tmpbuf, txreq.size);
- qemu_send_packet(&netdev->nic->nc, tmpbuf, txreq.size);
+ qemu_send_packet(qemu_get_queue(netdev->nic), tmpbuf,
+ txreq.size);
} else {
- qemu_send_packet(&netdev->nic->nc, page + txreq.offset, txreq.size);
+ qemu_send_packet(qemu_get_queue(netdev->nic),
+ page + txreq.offset, txreq.size);
}
xc_gnttab_munmap(netdev->xendev.gnttabdev, page, 1);
net_tx_response(netdev, &txreq, NETIF_RSP_OKAY);
@@ -329,7 +331,8 @@ static int net_init(struct XenDevice *xendev)
netdev->nic = qemu_new_nic(&net_xen_info, &netdev->conf,
"xen", NULL, netdev);
- snprintf(netdev->nic->nc.info_str, sizeof(netdev->nic->nc.info_str),
+ snprintf(qemu_get_queue(netdev->nic)->info_str,
+ sizeof(qemu_get_queue(netdev->nic)->info_str),
"nic: xenbus vif macaddr=%s", netdev->mac);
/* fill info */
@@ -405,7 +408,7 @@ static void net_disconnect(struct XenDevice *xendev)
netdev->rxs = NULL;
}
if (netdev->nic) {
- qemu_del_net_client(&netdev->nic->nc);
+ qemu_del_net_client(qemu_get_queue(netdev->nic));
netdev->nic = NULL;
}
}
@@ -414,7 +417,7 @@ static void net_event(struct XenDevice *xendev)
{
struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev);
net_tx_packets(netdev);
- qemu_flush_queued_packets(&netdev->nic->nc);
+ qemu_flush_queued_packets(qemu_get_queue(netdev->nic));
}
static int net_free(struct XenDevice *xendev)