diff options
author | Jason Wang <jasowang@redhat.com> | 2013-01-30 19:12:22 +0800 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-01 11:02:55 -0600 |
commit | b356f76de31e343121cdab3a01b39182edce9519 (patch) | |
tree | 917613c9d0047ba2b4b67a5a4e6146c62b2a62d7 /hw/usb/dev-network.c | |
parent | 28a65891a0deb10b222890b9eb916ca32cb977bb (diff) | |
download | qemu-b356f76de31e343121cdab3a01b39182edce9519.zip qemu-b356f76de31e343121cdab3a01b39182edce9519.tar.gz qemu-b356f76de31e343121cdab3a01b39182edce9519.tar.bz2 |
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/usb/dev-network.c')
-rw-r--r-- | hw/usb/dev-network.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 9dede4c..a131f9c 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1012,7 +1012,7 @@ static int rndis_keepalive_response(USBNetState *s, static void usb_net_reset_in_buf(USBNetState *s) { s->in_ptr = s->in_len = 0; - qemu_flush_queued_packets(&s->nic->nc); + qemu_flush_queued_packets(qemu_get_queue(s->nic)); } static int rndis_parse(USBNetState *s, uint8_t *data, int length) @@ -1196,7 +1196,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p) if (!is_rndis(s)) { if (p->iov.size < 64) { - qemu_send_packet(&s->nic->nc, s->out_buf, s->out_ptr); + qemu_send_packet(qemu_get_queue(s->nic), s->out_buf, s->out_ptr); s->out_ptr = 0; } return; @@ -1209,7 +1209,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p) uint32_t offs = 8 + le32_to_cpu(msg->DataOffset); uint32_t size = le32_to_cpu(msg->DataLength); if (offs + size <= len) - qemu_send_packet(&s->nic->nc, s->out_buf + offs, size); + qemu_send_packet(qemu_get_queue(s->nic), s->out_buf + offs, size); } s->out_ptr -= len; memmove(s->out_buf, &s->out_buf[len], s->out_ptr); @@ -1330,7 +1330,7 @@ static void usb_net_handle_destroy(USBDevice *dev) /* TODO: remove the nd_table[] entry */ rndis_clear_responsequeue(s); - qemu_del_net_client(&s->nic->nc); + qemu_del_net_client(qemu_get_queue(s->nic)); } static NetClientInfo net_usbnet_info = { @@ -1361,7 +1361,7 @@ static int usb_net_initfn(USBDevice *dev) qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_usbnet_info, &s->conf, object_get_typename(OBJECT(s)), s->dev.qdev.id, s); - qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); + qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); snprintf(s->usbstring_mac, sizeof(s->usbstring_mac), "%02x%02x%02x%02x%02x%02x", 0x40, |