mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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:
parent
b356f76de3
commit
cc1f0f4542
28 changed files with 92 additions and 78 deletions
|
@ -167,7 +167,7 @@ static const MemoryRegionOps eth_ops = {
|
|||
|
||||
static int eth_can_rx(NetClientState *nc)
|
||||
{
|
||||
struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
|
||||
struct xlx_ethlite *s = qemu_get_nic_opaque(nc);
|
||||
unsigned int rxbase = s->rxbuf * (0x800 / 4);
|
||||
|
||||
return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S);
|
||||
|
@ -175,7 +175,7 @@ static int eth_can_rx(NetClientState *nc)
|
|||
|
||||
static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
|
||||
{
|
||||
struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
|
||||
struct xlx_ethlite *s = qemu_get_nic_opaque(nc);
|
||||
unsigned int rxbase = s->rxbuf * (0x800 / 4);
|
||||
|
||||
/* DA filter. */
|
||||
|
@ -201,7 +201,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
|
|||
|
||||
static void eth_cleanup(NetClientState *nc)
|
||||
{
|
||||
struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
|
||||
struct xlx_ethlite *s = qemu_get_nic_opaque(nc);
|
||||
|
||||
s->nic = NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue