aboutsummaryrefslogtreecommitdiff
path: root/hw/rtl8139.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/rtl8139.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/rtl8139.c')
-rw-r--r--hw/rtl8139.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index cfbf3f47c1..22d24ae6af 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -1259,7 +1259,7 @@ static void rtl8139_reset(DeviceState *d)
//s->BasicModeStatus |= 0x0040; /* UTP medium */
s->BasicModeStatus |= 0x0020; /* autonegotiation completed */
/* preserve link state */
- s->BasicModeStatus |= s->nic->nc.link_down ? 0 : 0x04;
+ s->BasicModeStatus |= qemu_get_queue(s->nic)->link_down ? 0 : 0x04;
s->NWayAdvert = 0x05e1; /* all modes, full duplex */
s->NWayLPAR = 0x05e1; /* all modes, full duplex */
@@ -1787,7 +1787,7 @@ static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
}
DPRINTF("+++ transmit loopback mode\n");
- rtl8139_do_receive(&s->nic->nc, buf, size, do_interrupt);
+ rtl8139_do_receive(qemu_get_queue(s->nic), buf, size, do_interrupt);
if (iov) {
g_free(buf2);
@@ -1796,9 +1796,9 @@ static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
else
{
if (iov) {
- qemu_sendv_packet(&s->nic->nc, iov, 3);
+ qemu_sendv_packet(qemu_get_queue(s->nic), iov, 3);
} else {
- qemu_send_packet(&s->nic->nc, buf, size);
+ qemu_send_packet(qemu_get_queue(s->nic), buf, size);
}
}
}
@@ -3230,7 +3230,7 @@ static int rtl8139_post_load(void *opaque, int version_id)
/* nc.link_down can't be migrated, so infer link_down according
* to link status bit in BasicModeStatus */
- s->nic->nc.link_down = (s->BasicModeStatus & 0x04) == 0;
+ qemu_get_queue(s->nic)->link_down = (s->BasicModeStatus & 0x04) == 0;
return 0;
}
@@ -3446,7 +3446,7 @@ static void pci_rtl8139_uninit(PCIDevice *dev)
}
qemu_del_timer(s->timer);
qemu_free_timer(s->timer);
- qemu_del_net_client(&s->nic->nc);
+ qemu_del_net_client(qemu_get_queue(s->nic));
}
static void rtl8139_set_link_status(NetClientState *nc)
@@ -3503,7 +3503,7 @@ static int pci_rtl8139_init(PCIDevice *dev)
s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf,
object_get_typename(OBJECT(dev)), 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);
s->cplus_txbuffer = NULL;
s->cplus_txbuffer_len = 0;