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>
This commit is contained in:
Jason Wang 2013-01-30 19:12:23 +08:00 committed by Anthony Liguori
parent b356f76de3
commit cc1f0f4542
28 changed files with 92 additions and 78 deletions

View file

@ -167,7 +167,7 @@ static int ne2000_buffer_full(NE2000State *s)
int ne2000_can_receive(NetClientState *nc)
{
NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
NE2000State *s = qemu_get_nic_opaque(nc);
if (s->cmd & E8390_STOP)
return 1;
@ -178,7 +178,7 @@ int ne2000_can_receive(NetClientState *nc)
ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
{
NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
NE2000State *s = qemu_get_nic_opaque(nc);
int size = size_;
uint8_t *p;
unsigned int total_len, next, avail, len, index, mcast_idx;
@ -706,7 +706,7 @@ void ne2000_setup_io(NE2000State *s, unsigned size)
static void ne2000_cleanup(NetClientState *nc)
{
NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
NE2000State *s = qemu_get_nic_opaque(nc);
s->nic = NULL;
}