aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-01-30 19:12:23 +0800
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-01 11:03:00 -0600
commitcc1f0f45425d0cca41ad421623f92bebc93a21a9 (patch)
tree8015fb30e1da7eab59fbbf236f790500a47cbea0 /hw/usb
parentb356f76de31e343121cdab3a01b39182edce9519 (diff)
net: introduce qemu_get_nic()
To support multiqueue, this patch introduces a helper qemu_get_nic() to get NICState from a NetClientState. 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')
-rw-r--r--hw/usb/dev-network.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index a131f9c851..abc6eac591 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -1261,7 +1261,7 @@ static void usb_net_handle_data(USBDevice *dev, USBPacket *p)
static ssize_t usbnet_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
- USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
+ USBNetState *s = qemu_get_nic_opaque(nc);
uint8_t *in_buf = s->in_buf;
size_t total_size = size;
@@ -1308,7 +1308,7 @@ static ssize_t usbnet_receive(NetClientState *nc, const uint8_t *buf, size_t siz
static int usbnet_can_receive(NetClientState *nc)
{
- USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
+ USBNetState *s = qemu_get_nic_opaque(nc);
if (is_rndis(s) && s->rndis_state != RNDIS_DATA_INITIALIZED) {
return 1;
@@ -1319,7 +1319,7 @@ static int usbnet_can_receive(NetClientState *nc)
static void usbnet_cleanup(NetClientState *nc)
{
- USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
+ USBNetState *s = qemu_get_nic_opaque(nc);
s->nic = NULL;
}