net: Rename VLANClientState to NetClientState
The vlan feature is no longer part of net core. Rename VLANClientState to NetClientState because net clients are not explicitly associated with a vlan at all, instead they have a peer net client to which they are connected. This patch is a mechanical search-and-replace except for a few whitespace fixups where changing VLANClientState to NetClientState misaligned whitespace. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
		
							parent
							
								
									94878994dc
								
							
						
					
					
						commit
						4e68f7a081
					
				| 
						 | 
					@ -405,7 +405,7 @@ static void phy_update_link(GemState *s)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int gem_can_receive(VLANClientState *nc)
 | 
					static int gem_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GemState *s;
 | 
					    GemState *s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -602,7 +602,7 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)
 | 
				
			||||||
 * gem_receive:
 | 
					 * gem_receive:
 | 
				
			||||||
 * Fit a packet handed to us by QEMU into the receive descriptor ring.
 | 
					 * Fit a packet handed to us by QEMU into the receive descriptor ring.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static ssize_t gem_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    unsigned    desc[2];
 | 
					    unsigned    desc[2];
 | 
				
			||||||
    target_phys_addr_t packet_desc_addr, last_desc_addr;
 | 
					    target_phys_addr_t packet_desc_addr, last_desc_addr;
 | 
				
			||||||
| 
						 | 
					@ -1146,7 +1146,7 @@ static const MemoryRegionOps gem_ops = {
 | 
				
			||||||
    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
					    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void gem_cleanup(VLANClientState *nc)
 | 
					static void gem_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GemState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    GemState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1154,7 +1154,7 @@ static void gem_cleanup(VLANClientState *nc)
 | 
				
			||||||
    s->nic = NULL;
 | 
					    s->nic = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void gem_set_link(VLANClientState *nc)
 | 
					static void gem_set_link(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DB_PRINT("\n");
 | 
					    DB_PRINT("\n");
 | 
				
			||||||
    phy_update_link(DO_UPCAST(NICState, nc, nc)->opaque);
 | 
					    phy_update_link(DO_UPCAST(NICState, nc, nc)->opaque);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -673,7 +673,7 @@ static const MemoryRegionOps dp8393x_ops = {
 | 
				
			||||||
    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nic_can_receive(VLANClientState *nc)
 | 
					static int nic_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -722,7 +722,7 @@ static int receive_filter(dp8393xState *s, const uint8_t * buf, int size)
 | 
				
			||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t nic_receive(VLANClientState *nc, const uint8_t * buf, size_t size)
 | 
					static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    uint16_t data[10];
 | 
					    uint16_t data[10];
 | 
				
			||||||
| 
						 | 
					@ -858,7 +858,7 @@ static void nic_reset(void *opaque)
 | 
				
			||||||
    dp8393x_update_irq(s);
 | 
					    dp8393x_update_irq(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void nic_cleanup(VLANClientState *nc)
 | 
					static void nic_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -720,7 +720,7 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
e1000_set_link_status(VLANClientState *nc)
 | 
					e1000_set_link_status(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    uint32_t old_status = s->mac_reg[STATUS];
 | 
					    uint32_t old_status = s->mac_reg[STATUS];
 | 
				
			||||||
| 
						 | 
					@ -754,7 +754,7 @@ static bool e1000_has_rxbufs(E1000State *s, size_t total_size)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
e1000_can_receive(VLANClientState *nc)
 | 
					e1000_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -770,7 +770,7 @@ static uint64_t rx_desc_base(E1000State *s)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t
 | 
					static ssize_t
 | 
				
			||||||
e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    struct e1000_rx_desc desc;
 | 
					    struct e1000_rx_desc desc;
 | 
				
			||||||
| 
						 | 
					@ -1185,7 +1185,7 @@ e1000_mmio_setup(E1000State *d)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
e1000_cleanup(VLANClientState *nc)
 | 
					e1000_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1616,7 +1616,7 @@ static const MemoryRegionOps eepro100_ops = {
 | 
				
			||||||
    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
					    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nic_can_receive(VLANClientState *nc)
 | 
					static int nic_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    TRACE(RXTX, logout("%p\n", s));
 | 
					    TRACE(RXTX, logout("%p\n", s));
 | 
				
			||||||
| 
						 | 
					@ -1626,7 +1626,7 @@ static int nic_can_receive(VLANClientState *nc)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t nic_receive(VLANClientState *nc, const uint8_t * buf, size_t size)
 | 
					static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* TODO:
 | 
					    /* TODO:
 | 
				
			||||||
     * - Magic packets should set bit 30 in power management driver register.
 | 
					     * - Magic packets should set bit 30 in power management driver register.
 | 
				
			||||||
| 
						 | 
					@ -1831,7 +1831,7 @@ static const VMStateDescription vmstate_eepro100 = {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void nic_cleanup(VLANClientState *nc)
 | 
					static void nic_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    EEPRO100State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -507,12 +507,12 @@ static int eth_match_groupaddr(struct fs_eth *eth, const unsigned char *sa)
 | 
				
			||||||
	return match;
 | 
						return match;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int eth_can_receive(VLANClientState *nc)
 | 
					static int eth_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t eth_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t eth_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 | 
						unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 | 
				
			||||||
	struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
						struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
| 
						 | 
					@ -549,7 +549,7 @@ static int eth_tx_push(void *opaque, unsigned char *buf, int len, bool eop)
 | 
				
			||||||
	return len;
 | 
						return len;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eth_set_link(VLANClientState *nc)
 | 
					static void eth_set_link(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
						struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
	D(printf("%s %d\n", __func__, nc->link_down));
 | 
						D(printf("%s %d\n", __func__, nc->link_down));
 | 
				
			||||||
| 
						 | 
					@ -566,7 +566,7 @@ static const MemoryRegionOps eth_ops = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eth_cleanup(VLANClientState *nc)
 | 
					static void eth_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
						struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -384,7 +384,7 @@ static void phy_update_link(lan9118_state *s)
 | 
				
			||||||
    phy_update_irq(s);
 | 
					    phy_update_irq(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void lan9118_set_link(VLANClientState *nc)
 | 
					static void lan9118_set_link(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    phy_update_link(DO_UPCAST(NICState, nc, nc)->opaque);
 | 
					    phy_update_link(DO_UPCAST(NICState, nc, nc)->opaque);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -456,7 +456,7 @@ static void lan9118_reset(DeviceState *d)
 | 
				
			||||||
    lan9118_reload_eeprom(s);
 | 
					    lan9118_reload_eeprom(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int lan9118_can_receive(VLANClientState *nc)
 | 
					static int lan9118_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -509,7 +509,7 @@ static int lan9118_filter(lan9118_state *s, const uint8_t *addr)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t lan9118_receive(VLANClientState *nc, const uint8_t *buf,
 | 
					static ssize_t lan9118_receive(NetClientState *nc, const uint8_t *buf,
 | 
				
			||||||
                               size_t size)
 | 
					                               size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    lan9118_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    lan9118_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
| 
						 | 
					@ -1304,7 +1304,7 @@ static const MemoryRegionOps lan9118_16bit_mem_ops = {
 | 
				
			||||||
    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void lan9118_cleanup(VLANClientState *nc)
 | 
					static void lan9118_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    lan9118_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    lan9118_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,7 @@ static const MemoryRegionOps lance_mem_ops = {
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void lance_cleanup(VLANClientState *nc)
 | 
					static void lance_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -351,13 +351,13 @@ static void mcf_fec_write(void *opaque, target_phys_addr_t addr,
 | 
				
			||||||
    mcf_fec_update(s);
 | 
					    mcf_fec_update(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int mcf_fec_can_receive(VLANClientState *nc)
 | 
					static int mcf_fec_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    mcf_fec_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    mcf_fec_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    return s->rx_enabled;
 | 
					    return s->rx_enabled;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t mcf_fec_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t mcf_fec_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    mcf_fec_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    mcf_fec_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    mcf_fec_bd bd;
 | 
					    mcf_fec_bd bd;
 | 
				
			||||||
| 
						 | 
					@ -439,7 +439,7 @@ static const MemoryRegionOps mcf_fec_ops = {
 | 
				
			||||||
    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void mcf_fec_cleanup(VLANClientState *nc)
 | 
					static void mcf_fec_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    mcf_fec_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    mcf_fec_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,7 @@ static void update_rx_interrupt(MilkymistMinimac2State *s)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t minimac2_rx(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t minimac2_rx(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -408,7 +408,7 @@ static const MemoryRegionOps minimac2_ops = {
 | 
				
			||||||
    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int minimac2_can_rx(VLANClientState *nc)
 | 
					static int minimac2_can_rx(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -422,7 +422,7 @@ static int minimac2_can_rx(VLANClientState *nc)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void minimac2_cleanup(VLANClientState *nc)
 | 
					static void minimac2_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ static int mipsnet_buffer_full(MIPSnetState *s)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int mipsnet_can_receive(VLANClientState *nc)
 | 
					static int mipsnet_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ static int mipsnet_can_receive(VLANClientState *nc)
 | 
				
			||||||
    return !mipsnet_buffer_full(s);
 | 
					    return !mipsnet_buffer_full(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t mipsnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t mipsnet_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,7 +209,7 @@ static const VMStateDescription vmstate_mipsnet = {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void mipsnet_cleanup(VLANClientState *nc)
 | 
					static void mipsnet_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,12 +182,12 @@ static void eth_rx_desc_get(uint32_t addr, mv88w8618_rx_desc *desc)
 | 
				
			||||||
    le32_to_cpus(&desc->next);
 | 
					    le32_to_cpus(&desc->next);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int eth_can_receive(VLANClientState *nc)
 | 
					static int eth_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t eth_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t eth_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    mv88w8618_eth_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    mv88w8618_eth_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    uint32_t desc_addr;
 | 
					    uint32_t desc_addr;
 | 
				
			||||||
| 
						 | 
					@ -366,7 +366,7 @@ static const MemoryRegionOps mv88w8618_eth_ops = {
 | 
				
			||||||
    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eth_cleanup(VLANClientState *nc)
 | 
					static void eth_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    mv88w8618_eth_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    mv88w8618_eth_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ typedef struct ISANE2000State {
 | 
				
			||||||
    NE2000State ne2000;
 | 
					    NE2000State ne2000;
 | 
				
			||||||
} ISANE2000State;
 | 
					} ISANE2000State;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void isa_ne2000_cleanup(VLANClientState *nc)
 | 
					static void isa_ne2000_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,7 +165,7 @@ static int ne2000_buffer_full(NE2000State *s)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ne2000_can_receive(VLANClientState *nc)
 | 
					int ne2000_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -176,7 +176,7 @@ int ne2000_can_receive(VLANClientState *nc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MIN_BUF_SIZE 60
 | 
					#define MIN_BUF_SIZE 60
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t ne2000_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
 | 
					ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    int size = size_;
 | 
					    int size = size_;
 | 
				
			||||||
| 
						 | 
					@ -703,7 +703,7 @@ void ne2000_setup_io(NE2000State *s, unsigned size)
 | 
				
			||||||
    memory_region_init_io(&s->io, &ne2000_ops, s, "ne2000", size);
 | 
					    memory_region_init_io(&s->io, &ne2000_ops, s, "ne2000", size);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ne2000_cleanup(VLANClientState *nc)
 | 
					static void ne2000_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,5 +31,5 @@ typedef struct NE2000State {
 | 
				
			||||||
void ne2000_setup_io(NE2000State *s, unsigned size);
 | 
					void ne2000_setup_io(NE2000State *s, unsigned size);
 | 
				
			||||||
extern const VMStateDescription vmstate_ne2000;
 | 
					extern const VMStateDescription vmstate_ne2000;
 | 
				
			||||||
void ne2000_reset(NE2000State *s);
 | 
					void ne2000_reset(NE2000State *s);
 | 
				
			||||||
int ne2000_can_receive(VLANClientState *vc);
 | 
					int ne2000_can_receive(NetClientState *vc);
 | 
				
			||||||
ssize_t ne2000_receive(VLANClientState *vc, const uint8_t *buf, size_t size_);
 | 
					ssize_t ne2000_receive(NetClientState *vc, const uint8_t *buf, size_t size_);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -311,7 +311,7 @@ static void open_eth_int_source_write(OpenEthState *s,
 | 
				
			||||||
            s->regs[INT_SOURCE] & s->regs[INT_MASK]);
 | 
					            s->regs[INT_SOURCE] & s->regs[INT_MASK]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void open_eth_set_link_status(VLANClientState *nc)
 | 
					static void open_eth_set_link_status(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenEthState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    OpenEthState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -342,7 +342,7 @@ static void open_eth_reset(void *opaque)
 | 
				
			||||||
    open_eth_set_link_status(&s->nic->nc);
 | 
					    open_eth_set_link_status(&s->nic->nc);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int open_eth_can_receive(VLANClientState *nc)
 | 
					static int open_eth_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenEthState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    OpenEthState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -351,7 +351,7 @@ static int open_eth_can_receive(VLANClientState *nc)
 | 
				
			||||||
        (rx_desc(s)->len_flags & RXD_E);
 | 
					        (rx_desc(s)->len_flags & RXD_E);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t open_eth_receive(VLANClientState *nc,
 | 
					static ssize_t open_eth_receive(NetClientState *nc,
 | 
				
			||||||
        const uint8_t *buf, size_t size)
 | 
					        const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OpenEthState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    OpenEthState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
| 
						 | 
					@ -462,7 +462,7 @@ static ssize_t open_eth_receive(VLANClientState *nc,
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void open_eth_cleanup(VLANClientState *nc)
 | 
					static void open_eth_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -264,7 +264,7 @@ static void pci_physical_memory_read(void *dma_opaque, target_phys_addr_t addr,
 | 
				
			||||||
    pci_dma_read(dma_opaque, addr, buf, len);
 | 
					    pci_dma_read(dma_opaque, addr, buf, len);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void pci_pcnet_cleanup(VLANClientState *nc)
 | 
					static void pci_pcnet_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1004,7 +1004,7 @@ static int pcnet_tdte_poll(PCNetState *s)
 | 
				
			||||||
    return !!(CSR_CXST(s) & 0x8000);
 | 
					    return !!(CSR_CXST(s) & 0x8000);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pcnet_can_receive(VLANClientState *nc)
 | 
					int pcnet_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    PCNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    if (CSR_STOP(s) || CSR_SPND(s))
 | 
					    if (CSR_STOP(s) || CSR_SPND(s))
 | 
				
			||||||
| 
						 | 
					@ -1015,7 +1015,7 @@ int pcnet_can_receive(VLANClientState *nc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MIN_BUF_SIZE 60
 | 
					#define MIN_BUF_SIZE 60
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
 | 
					ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    PCNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    int is_padr = 0, is_bcast = 0, is_ladr = 0;
 | 
					    int is_padr = 0, is_bcast = 0, is_ladr = 0;
 | 
				
			||||||
| 
						 | 
					@ -1197,7 +1197,7 @@ ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
 | 
				
			||||||
    return size_;
 | 
					    return size_;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pcnet_set_link_status(VLANClientState *nc)
 | 
					void pcnet_set_link_status(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,9 +57,9 @@ uint32_t pcnet_ioport_readw(void *opaque, uint32_t addr);
 | 
				
			||||||
void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val);
 | 
					void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val);
 | 
				
			||||||
uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
 | 
					uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
 | 
				
			||||||
uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
 | 
					uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
 | 
				
			||||||
int pcnet_can_receive(VLANClientState *nc);
 | 
					int pcnet_can_receive(NetClientState *nc);
 | 
				
			||||||
ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_);
 | 
					ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_);
 | 
				
			||||||
void pcnet_set_link_status(VLANClientState *nc);
 | 
					void pcnet_set_link_status(NetClientState *nc);
 | 
				
			||||||
void pcnet_common_cleanup(PCNetState *d);
 | 
					void pcnet_common_cleanup(PCNetState *d);
 | 
				
			||||||
int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
 | 
					int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
 | 
				
			||||||
extern const VMStateDescription vmstate_pcnet;
 | 
					extern const VMStateDescription vmstate_pcnet;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -584,7 +584,7 @@ PropertyInfo qdev_prop_chr = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int parse_netdev(DeviceState *dev, const char *str, void **ptr)
 | 
					static int parse_netdev(DeviceState *dev, const char *str, void **ptr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *netdev = qemu_find_netdev(str);
 | 
					    NetClientState *netdev = qemu_find_netdev(str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (netdev == NULL) {
 | 
					    if (netdev == NULL) {
 | 
				
			||||||
        return -ENOENT;
 | 
					        return -ENOENT;
 | 
				
			||||||
| 
						 | 
					@ -598,7 +598,7 @@ static int parse_netdev(DeviceState *dev, const char *str, void **ptr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *print_netdev(void *ptr)
 | 
					static const char *print_netdev(void *ptr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *netdev = ptr;
 | 
					    NetClientState *netdev = ptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return netdev->name ? netdev->name : "";
 | 
					    return netdev->name ? netdev->name : "";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -625,7 +625,7 @@ PropertyInfo qdev_prop_netdev = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len)
 | 
					static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState **ptr = qdev_get_prop_ptr(dev, prop);
 | 
					    NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (*ptr) {
 | 
					    if (*ptr) {
 | 
				
			||||||
        int id;
 | 
					        int id;
 | 
				
			||||||
| 
						 | 
					@ -642,7 +642,7 @@ static void get_vlan(Object *obj, Visitor *v, void *opaque,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DeviceState *dev = DEVICE(obj);
 | 
					    DeviceState *dev = DEVICE(obj);
 | 
				
			||||||
    Property *prop = opaque;
 | 
					    Property *prop = opaque;
 | 
				
			||||||
    VLANClientState **ptr = qdev_get_prop_ptr(dev, prop);
 | 
					    NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
 | 
				
			||||||
    int32_t id = -1;
 | 
					    int32_t id = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (*ptr) {
 | 
					    if (*ptr) {
 | 
				
			||||||
| 
						 | 
					@ -660,10 +660,10 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DeviceState *dev = DEVICE(obj);
 | 
					    DeviceState *dev = DEVICE(obj);
 | 
				
			||||||
    Property *prop = opaque;
 | 
					    Property *prop = opaque;
 | 
				
			||||||
    VLANClientState **ptr = qdev_get_prop_ptr(dev, prop);
 | 
					    NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
 | 
				
			||||||
    Error *local_err = NULL;
 | 
					    Error *local_err = NULL;
 | 
				
			||||||
    int32_t id;
 | 
					    int32_t id;
 | 
				
			||||||
    VLANClientState *hubport;
 | 
					    NetClientState *hubport;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (dev->state != DEV_STATE_CREATED) {
 | 
					    if (dev->state != DEV_STATE_CREATED) {
 | 
				
			||||||
        error_set(errp, QERR_PERMISSION_DENIED);
 | 
					        error_set(errp, QERR_PERMISSION_DENIED);
 | 
				
			||||||
| 
						 | 
					@ -1186,7 +1186,7 @@ void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *valu
 | 
				
			||||||
    assert_no_error(errp);
 | 
					    assert_no_error(errp);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qdev_prop_set_netdev(DeviceState *dev, const char *name, VLANClientState *value)
 | 
					void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientState *value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Error *errp = NULL;
 | 
					    Error *errp = NULL;
 | 
				
			||||||
    assert(!value || value->name);
 | 
					    assert(!value || value->name);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -289,9 +289,9 @@ extern PropertyInfo qdev_prop_pci_host_devaddr;
 | 
				
			||||||
#define DEFINE_PROP_STRING(_n, _s, _f)             \
 | 
					#define DEFINE_PROP_STRING(_n, _s, _f)             \
 | 
				
			||||||
    DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
 | 
					    DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
 | 
				
			||||||
#define DEFINE_PROP_NETDEV(_n, _s, _f)             \
 | 
					#define DEFINE_PROP_NETDEV(_n, _s, _f)             \
 | 
				
			||||||
    DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, VLANClientState*)
 | 
					    DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NetClientState*)
 | 
				
			||||||
#define DEFINE_PROP_VLAN(_n, _s, _f)             \
 | 
					#define DEFINE_PROP_VLAN(_n, _s, _f)             \
 | 
				
			||||||
    DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, VLANClientState*)
 | 
					    DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, NetClientState*)
 | 
				
			||||||
#define DEFINE_PROP_DRIVE(_n, _s, _f) \
 | 
					#define DEFINE_PROP_DRIVE(_n, _s, _f) \
 | 
				
			||||||
    DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockDriverState *)
 | 
					    DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockDriverState *)
 | 
				
			||||||
#define DEFINE_PROP_MACADDR(_n, _s, _f)         \
 | 
					#define DEFINE_PROP_MACADDR(_n, _s, _f)         \
 | 
				
			||||||
| 
						 | 
					@ -320,7 +320,7 @@ void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value);
 | 
				
			||||||
void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
 | 
					void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
 | 
				
			||||||
void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value);
 | 
					void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value);
 | 
				
			||||||
void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value);
 | 
					void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value);
 | 
				
			||||||
void qdev_prop_set_netdev(DeviceState *dev, const char *name, VLANClientState *value);
 | 
					void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientState *value);
 | 
				
			||||||
int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *value) QEMU_WARN_UNUSED_RESULT;
 | 
					int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *value) QEMU_WARN_UNUSED_RESULT;
 | 
				
			||||||
void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name, BlockDriverState *value);
 | 
					void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name, BlockDriverState *value);
 | 
				
			||||||
void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value);
 | 
					void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -788,7 +788,7 @@ static bool rtl8139_cp_rx_valid(RTL8139State *s)
 | 
				
			||||||
    return !(s->RxRingAddrLO == 0 && s->RxRingAddrHI == 0);
 | 
					    return !(s->RxRingAddrLO == 0 && s->RxRingAddrHI == 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int rtl8139_can_receive(VLANClientState *nc)
 | 
					static int rtl8139_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    int avail;
 | 
					    int avail;
 | 
				
			||||||
| 
						 | 
					@ -810,7 +810,7 @@ static int rtl8139_can_receive(VLANClientState *nc)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt)
 | 
					static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    /* size is the length of the buffer passed to the driver */
 | 
					    /* size is the length of the buffer passed to the driver */
 | 
				
			||||||
| 
						 | 
					@ -1187,7 +1187,7 @@ static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_
 | 
				
			||||||
    return size_;
 | 
					    return size_;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t rtl8139_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t rtl8139_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return rtl8139_do_receive(nc, buf, size, 1);
 | 
					    return rtl8139_do_receive(nc, buf, size, 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -3431,7 +3431,7 @@ static void rtl8139_timer(void *opaque)
 | 
				
			||||||
    rtl8139_set_next_tctr_time(s, qemu_get_clock_ns(vm_clock));
 | 
					    rtl8139_set_next_tctr_time(s, qemu_get_clock_ns(vm_clock));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void rtl8139_cleanup(VLANClientState *nc)
 | 
					static void rtl8139_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -628,7 +628,7 @@ static uint32_t smc91c111_readl(void *opaque, target_phys_addr_t offset)
 | 
				
			||||||
    return val;
 | 
					    return val;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int smc91c111_can_receive(VLANClientState *nc)
 | 
					static int smc91c111_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    smc91c111_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    smc91c111_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -639,7 +639,7 @@ static int smc91c111_can_receive(VLANClientState *nc)
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t smc91c111_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t smc91c111_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    smc91c111_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    smc91c111_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    int status;
 | 
					    int status;
 | 
				
			||||||
| 
						 | 
					@ -728,7 +728,7 @@ static const MemoryRegionOps smc91c111_mem_ops = {
 | 
				
			||||||
    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void smc91c111_cleanup(VLANClientState *nc)
 | 
					static void smc91c111_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    smc91c111_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    smc91c111_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,14 +83,14 @@ typedef struct VIOsPAPRVLANDevice {
 | 
				
			||||||
    target_ulong rxq_ptr;
 | 
					    target_ulong rxq_ptr;
 | 
				
			||||||
} VIOsPAPRVLANDevice;
 | 
					} VIOsPAPRVLANDevice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int spapr_vlan_can_receive(VLANClientState *nc)
 | 
					static int spapr_vlan_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VIOsPAPRVLANDevice *dev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VIOsPAPRVLANDevice *dev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (dev->isopen && dev->rx_bufs > 0);
 | 
					    return (dev->isopen && dev->rx_bufs > 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t spapr_vlan_receive(VLANClientState *nc, const uint8_t *buf,
 | 
					static ssize_t spapr_vlan_receive(NetClientState *nc, const uint8_t *buf,
 | 
				
			||||||
                                  size_t size)
 | 
					                                  size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VIOsPAPRDevice *sdev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VIOsPAPRDevice *sdev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ static void stellaris_enet_update(stellaris_enet_state *s)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* TODO: Implement MAC address filtering.  */
 | 
					/* TODO: Implement MAC address filtering.  */
 | 
				
			||||||
static ssize_t stellaris_enet_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    stellaris_enet_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    stellaris_enet_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    int n;
 | 
					    int n;
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ static ssize_t stellaris_enet_receive(VLANClientState *nc, const uint8_t *buf, s
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int stellaris_enet_can_receive(VLANClientState *nc)
 | 
					static int stellaris_enet_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    stellaris_enet_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    stellaris_enet_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -381,7 +381,7 @@ static int stellaris_enet_load(QEMUFile *f, void *opaque, int version_id)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void stellaris_enet_cleanup(VLANClientState *nc)
 | 
					static void stellaris_enet_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    stellaris_enet_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    stellaris_enet_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1247,7 +1247,7 @@ static int usb_net_handle_data(USBDevice *dev, USBPacket *p)
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t usbnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t usbnet_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    struct rndis_packet_msg_type *msg;
 | 
					    struct rndis_packet_msg_type *msg;
 | 
				
			||||||
| 
						 | 
					@ -1285,7 +1285,7 @@ static ssize_t usbnet_receive(VLANClientState *nc, const uint8_t *buf, size_t si
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int usbnet_can_receive(VLANClientState *nc)
 | 
					static int usbnet_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1296,7 +1296,7 @@ static int usbnet_can_receive(VLANClientState *nc)
 | 
				
			||||||
    return !s->in_len;
 | 
					    return !s->in_len;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void usbnet_cleanup(VLANClientState *nc)
 | 
					static void usbnet_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@ struct vhost_net {
 | 
				
			||||||
    struct vhost_dev dev;
 | 
					    struct vhost_dev dev;
 | 
				
			||||||
    struct vhost_virtqueue vqs[2];
 | 
					    struct vhost_virtqueue vqs[2];
 | 
				
			||||||
    int backend;
 | 
					    int backend;
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
 | 
					unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ void vhost_net_ack_features(struct vhost_net *net, unsigned features)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int vhost_net_get_fd(VLANClientState *backend)
 | 
					static int vhost_net_get_fd(NetClientState *backend)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    switch (backend->info->type) {
 | 
					    switch (backend->info->type) {
 | 
				
			||||||
    case NET_CLIENT_OPTIONS_KIND_TAP:
 | 
					    case NET_CLIENT_OPTIONS_KIND_TAP:
 | 
				
			||||||
| 
						 | 
					@ -91,7 +91,7 @@ static int vhost_net_get_fd(VLANClientState *backend)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd,
 | 
					struct vhost_net *vhost_net_init(NetClientState *backend, int devfd,
 | 
				
			||||||
                                 bool force)
 | 
					                                 bool force)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int r;
 | 
					    int r;
 | 
				
			||||||
| 
						 | 
					@ -214,7 +214,7 @@ void vhost_net_cleanup(struct vhost_net *net)
 | 
				
			||||||
    g_free(net);
 | 
					    g_free(net);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd,
 | 
					struct vhost_net *vhost_net_init(NetClientState *backend, int devfd,
 | 
				
			||||||
                                 bool force)
 | 
					                                 bool force)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    error_report("vhost-net support is not compiled in");
 | 
					    error_report("vhost-net support is not compiled in");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
struct vhost_net;
 | 
					struct vhost_net;
 | 
				
			||||||
typedef struct vhost_net VHostNetState;
 | 
					typedef struct vhost_net VHostNetState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VHostNetState *vhost_net_init(VLANClientState *backend, int devfd, bool force);
 | 
					VHostNetState *vhost_net_init(NetClientState *backend, int devfd, bool force);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool vhost_net_query(VHostNetState *net, VirtIODevice *dev);
 | 
					bool vhost_net_query(VHostNetState *net, VirtIODevice *dev);
 | 
				
			||||||
int vhost_net_start(VHostNetState *net, VirtIODevice *dev);
 | 
					int vhost_net_start(VHostNetState *net, VirtIODevice *dev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -163,7 +163,7 @@ static void virtio_net_set_status(struct VirtIODevice *vdev, uint8_t status)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void virtio_net_set_link_status(VLANClientState *nc)
 | 
					static void virtio_net_set_link_status(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    uint16_t old_status = n->status;
 | 
					    uint16_t old_status = n->status;
 | 
				
			||||||
| 
						 | 
					@ -453,7 +453,7 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
 | 
				
			||||||
    qemu_notify_event();
 | 
					    qemu_notify_event();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int virtio_net_can_receive(VLANClientState *nc)
 | 
					static int virtio_net_can_receive(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    if (!n->vdev.vm_running) {
 | 
					    if (!n->vdev.vm_running) {
 | 
				
			||||||
| 
						 | 
					@ -593,7 +593,7 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t virtio_net_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL;
 | 
					    struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL;
 | 
				
			||||||
| 
						 | 
					@ -690,7 +690,7 @@ static ssize_t virtio_net_receive(VLANClientState *nc, const uint8_t *buf, size_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int32_t virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq);
 | 
					static int32_t virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void virtio_net_tx_complete(VLANClientState *nc, ssize_t len)
 | 
					static void virtio_net_tx_complete(NetClientState *nc, ssize_t len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -980,7 +980,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void virtio_net_cleanup(VLANClientState *nc)
 | 
					static void virtio_net_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -233,7 +233,7 @@ static void net_rx_response(struct XenNetDev *netdev,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NET_IP_ALIGN 2
 | 
					#define NET_IP_ALIGN 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_rx_ok(VLANClientState *nc)
 | 
					static int net_rx_ok(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XenNetDev *netdev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XenNetDev *netdev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    RING_IDX rc, rp;
 | 
					    RING_IDX rc, rp;
 | 
				
			||||||
| 
						 | 
					@ -254,7 +254,7 @@ static int net_rx_ok(VLANClientState *nc)
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t net_rx_packet(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XenNetDev *netdev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XenNetDev *netdev = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    netif_rx_request_t rxreq;
 | 
					    netif_rx_request_t rxreq;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -308,7 +308,7 @@ static const MemoryRegionOps enet_mem_ops = {
 | 
				
			||||||
    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
					    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int eth_can_rx(VLANClientState *nc)
 | 
					static int eth_can_rx(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XgmacState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XgmacState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -316,7 +316,7 @@ static int eth_can_rx(VLANClientState *nc)
 | 
				
			||||||
    return s->regs[DMA_CONTROL] & DMA_CONTROL_SR;
 | 
					    return s->regs[DMA_CONTROL] & DMA_CONTROL_SR;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t eth_rx(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XgmacState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XgmacState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    static const unsigned char sa_bcast[6] = {0xff, 0xff, 0xff,
 | 
					    static const unsigned char sa_bcast[6] = {0xff, 0xff, 0xff,
 | 
				
			||||||
| 
						 | 
					@ -364,7 +364,7 @@ out:
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eth_cleanup(VLANClientState *nc)
 | 
					static void eth_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XgmacState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XgmacState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    s->nic = NULL;
 | 
					    s->nic = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -612,7 +612,7 @@ static const MemoryRegionOps enet_ops = {
 | 
				
			||||||
    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
					    .endianness = DEVICE_LITTLE_ENDIAN,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int eth_can_rx(VLANClientState *nc)
 | 
					static int eth_can_rx(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XilinxAXIEnet *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XilinxAXIEnet *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -635,7 +635,7 @@ static int enet_match_addr(const uint8_t *buf, uint32_t f0, uint32_t f1)
 | 
				
			||||||
    return match;
 | 
					    return match;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t eth_rx(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct XilinxAXIEnet *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XilinxAXIEnet *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    static const unsigned char sa_bcast[6] = {0xff, 0xff, 0xff,
 | 
					    static const unsigned char sa_bcast[6] = {0xff, 0xff, 0xff,
 | 
				
			||||||
| 
						 | 
					@ -780,7 +780,7 @@ static ssize_t eth_rx(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eth_cleanup(VLANClientState *nc)
 | 
					static void eth_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* FIXME.  */
 | 
					    /* FIXME.  */
 | 
				
			||||||
    struct XilinxAXIEnet *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct XilinxAXIEnet *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,7 +160,7 @@ static const MemoryRegionOps eth_ops = {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int eth_can_rx(VLANClientState *nc)
 | 
					static int eth_can_rx(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    int r;
 | 
					    int r;
 | 
				
			||||||
| 
						 | 
					@ -168,7 +168,7 @@ static int eth_can_rx(VLANClientState *nc)
 | 
				
			||||||
    return r;
 | 
					    return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t eth_rx(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					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 = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
    unsigned int rxbase = s->rxbuf * (0x800 / 4);
 | 
					    unsigned int rxbase = s->rxbuf * (0x800 / 4);
 | 
				
			||||||
| 
						 | 
					@ -194,7 +194,7 @@ static ssize_t eth_rx(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void eth_cleanup(VLANClientState *nc)
 | 
					static void eth_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
					    struct xlx_ethlite *s = DO_UPCAST(NICState, nc, nc)->opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										87
									
								
								net.c
								
								
								
								
							
							
						
						
									
										87
									
								
								net.c
								
								
								
								
							| 
						 | 
					@ -47,7 +47,7 @@
 | 
				
			||||||
# define CONFIG_NET_BRIDGE
 | 
					# define CONFIG_NET_BRIDGE
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static QTAILQ_HEAD(, VLANClientState) net_clients;
 | 
					static QTAILQ_HEAD(, NetClientState) net_clients;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int default_net = 1;
 | 
					int default_net = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ int parse_host_port(struct sockaddr_in *saddr, const char *str)
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6])
 | 
					void qemu_format_nic_info_str(NetClientState *vc, uint8_t macaddr[6])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    snprintf(vc->info_str, sizeof(vc->info_str),
 | 
					    snprintf(vc->info_str, sizeof(vc->info_str),
 | 
				
			||||||
             "model=%s,macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
 | 
					             "model=%s,macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
 | 
				
			||||||
| 
						 | 
					@ -162,9 +162,9 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr)
 | 
				
			||||||
 * Only net clients created with the legacy -net option need this.  Naming is
 | 
					 * Only net clients created with the legacy -net option need this.  Naming is
 | 
				
			||||||
 * mandatory for net clients created with -netdev.
 | 
					 * mandatory for net clients created with -netdev.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static char *assign_name(VLANClientState *vc1, const char *model)
 | 
					static char *assign_name(NetClientState *vc1, const char *model)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
    char buf[256];
 | 
					    char buf[256];
 | 
				
			||||||
    int id = 0;
 | 
					    int id = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,25 +184,25 @@ static char *assign_name(VLANClientState *vc1, const char *model)
 | 
				
			||||||
    return g_strdup(buf);
 | 
					    return g_strdup(buf);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_deliver_packet(VLANClientState *sender,
 | 
					static ssize_t qemu_deliver_packet(NetClientState *sender,
 | 
				
			||||||
                                   unsigned flags,
 | 
					                                   unsigned flags,
 | 
				
			||||||
                                   const uint8_t *data,
 | 
					                                   const uint8_t *data,
 | 
				
			||||||
                                   size_t size,
 | 
					                                   size_t size,
 | 
				
			||||||
                                   void *opaque);
 | 
					                                   void *opaque);
 | 
				
			||||||
static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
 | 
					static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
 | 
				
			||||||
                                       unsigned flags,
 | 
					                                       unsigned flags,
 | 
				
			||||||
                                       const struct iovec *iov,
 | 
					                                       const struct iovec *iov,
 | 
				
			||||||
                                       int iovcnt,
 | 
					                                       int iovcnt,
 | 
				
			||||||
                                       void *opaque);
 | 
					                                       void *opaque);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VLANClientState *qemu_new_net_client(NetClientInfo *info,
 | 
					NetClientState *qemu_new_net_client(NetClientInfo *info,
 | 
				
			||||||
                                     VLANClientState *peer,
 | 
					                                    NetClientState *peer,
 | 
				
			||||||
                                     const char *model,
 | 
					                                    const char *model,
 | 
				
			||||||
                                     const char *name)
 | 
					                                    const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(info->size >= sizeof(VLANClientState));
 | 
					    assert(info->size >= sizeof(NetClientState));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vc = g_malloc0(info->size);
 | 
					    vc = g_malloc0(info->size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -234,7 +234,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
 | 
				
			||||||
                       const char *name,
 | 
					                       const char *name,
 | 
				
			||||||
                       void *opaque)
 | 
					                       void *opaque)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    NICState *nic;
 | 
					    NICState *nic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(info->type == NET_CLIENT_OPTIONS_KIND_NIC);
 | 
					    assert(info->type == NET_CLIENT_OPTIONS_KIND_NIC);
 | 
				
			||||||
| 
						 | 
					@ -249,7 +249,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
 | 
				
			||||||
    return nic;
 | 
					    return nic;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void qemu_cleanup_vlan_client(VLANClientState *vc)
 | 
					static void qemu_cleanup_vlan_client(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QTAILQ_REMOVE(&net_clients, vc, next);
 | 
					    QTAILQ_REMOVE(&net_clients, vc, next);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -258,7 +258,7 @@ static void qemu_cleanup_vlan_client(VLANClientState *vc)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void qemu_free_vlan_client(VLANClientState *vc)
 | 
					static void qemu_free_vlan_client(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (vc->send_queue) {
 | 
					    if (vc->send_queue) {
 | 
				
			||||||
        qemu_del_net_queue(vc->send_queue);
 | 
					        qemu_del_net_queue(vc->send_queue);
 | 
				
			||||||
| 
						 | 
					@ -271,7 +271,7 @@ static void qemu_free_vlan_client(VLANClientState *vc)
 | 
				
			||||||
    g_free(vc);
 | 
					    g_free(vc);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_del_vlan_client(VLANClientState *vc)
 | 
					void qemu_del_vlan_client(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* If there is a peer NIC, delete and cleanup client, but do not free. */
 | 
					    /* If there is a peer NIC, delete and cleanup client, but do not free. */
 | 
				
			||||||
    if (vc->peer && vc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
 | 
					    if (vc->peer && vc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
 | 
				
			||||||
| 
						 | 
					@ -303,7 +303,7 @@ void qemu_del_vlan_client(VLANClientState *vc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_foreach_nic(qemu_nic_foreach func, void *opaque)
 | 
					void qemu_foreach_nic(qemu_nic_foreach func, void *opaque)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QTAILQ_FOREACH(nc, &net_clients, next) {
 | 
					    QTAILQ_FOREACH(nc, &net_clients, next) {
 | 
				
			||||||
        if (nc->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
 | 
					        if (nc->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
 | 
				
			||||||
| 
						 | 
					@ -312,7 +312,7 @@ void qemu_foreach_nic(qemu_nic_foreach func, void *opaque)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int qemu_can_send_packet(VLANClientState *sender)
 | 
					int qemu_can_send_packet(NetClientState *sender)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!sender->peer) {
 | 
					    if (!sender->peer) {
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
| 
						 | 
					@ -327,13 +327,13 @@ int qemu_can_send_packet(VLANClientState *sender)
 | 
				
			||||||
    return 1;
 | 
					    return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_deliver_packet(VLANClientState *sender,
 | 
					static ssize_t qemu_deliver_packet(NetClientState *sender,
 | 
				
			||||||
                                   unsigned flags,
 | 
					                                   unsigned flags,
 | 
				
			||||||
                                   const uint8_t *data,
 | 
					                                   const uint8_t *data,
 | 
				
			||||||
                                   size_t size,
 | 
					                                   size_t size,
 | 
				
			||||||
                                   void *opaque)
 | 
					                                   void *opaque)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc = opaque;
 | 
					    NetClientState *vc = opaque;
 | 
				
			||||||
    ssize_t ret;
 | 
					    ssize_t ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (vc->link_down) {
 | 
					    if (vc->link_down) {
 | 
				
			||||||
| 
						 | 
					@ -357,7 +357,7 @@ static ssize_t qemu_deliver_packet(VLANClientState *sender,
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_purge_queued_packets(VLANClientState *vc)
 | 
					void qemu_purge_queued_packets(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!vc->peer) {
 | 
					    if (!vc->peer) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
| 
						 | 
					@ -366,14 +366,14 @@ void qemu_purge_queued_packets(VLANClientState *vc)
 | 
				
			||||||
    qemu_net_queue_purge(vc->peer->send_queue, vc);
 | 
					    qemu_net_queue_purge(vc->peer->send_queue, vc);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_flush_queued_packets(VLANClientState *vc)
 | 
					void qemu_flush_queued_packets(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    vc->receive_disabled = 0;
 | 
					    vc->receive_disabled = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_net_queue_flush(vc->send_queue);
 | 
					    qemu_net_queue_flush(vc->send_queue);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_send_packet_async_with_flags(VLANClientState *sender,
 | 
					static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender,
 | 
				
			||||||
                                                 unsigned flags,
 | 
					                                                 unsigned flags,
 | 
				
			||||||
                                                 const uint8_t *buf, int size,
 | 
					                                                 const uint8_t *buf, int size,
 | 
				
			||||||
                                                 NetPacketSent *sent_cb)
 | 
					                                                 NetPacketSent *sent_cb)
 | 
				
			||||||
| 
						 | 
					@ -394,7 +394,7 @@ static ssize_t qemu_send_packet_async_with_flags(VLANClientState *sender,
 | 
				
			||||||
    return qemu_net_queue_send(queue, sender, flags, buf, size, sent_cb);
 | 
					    return qemu_net_queue_send(queue, sender, flags, buf, size, sent_cb);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_send_packet_async(VLANClientState *sender,
 | 
					ssize_t qemu_send_packet_async(NetClientState *sender,
 | 
				
			||||||
                               const uint8_t *buf, int size,
 | 
					                               const uint8_t *buf, int size,
 | 
				
			||||||
                               NetPacketSent *sent_cb)
 | 
					                               NetPacketSent *sent_cb)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -402,18 +402,18 @@ ssize_t qemu_send_packet_async(VLANClientState *sender,
 | 
				
			||||||
                                             buf, size, sent_cb);
 | 
					                                             buf, size, sent_cb);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size)
 | 
					void qemu_send_packet(NetClientState *vc, const uint8_t *buf, int size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qemu_send_packet_async(vc, buf, size, NULL);
 | 
					    qemu_send_packet_async(vc, buf, size, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_send_packet_raw(VLANClientState *vc, const uint8_t *buf, int size)
 | 
					ssize_t qemu_send_packet_raw(NetClientState *vc, const uint8_t *buf, int size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return qemu_send_packet_async_with_flags(vc, QEMU_NET_PACKET_FLAG_RAW,
 | 
					    return qemu_send_packet_async_with_flags(vc, QEMU_NET_PACKET_FLAG_RAW,
 | 
				
			||||||
                                             buf, size, NULL);
 | 
					                                             buf, size, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t vc_sendv_compat(VLANClientState *vc, const struct iovec *iov,
 | 
					static ssize_t vc_sendv_compat(NetClientState *vc, const struct iovec *iov,
 | 
				
			||||||
                               int iovcnt)
 | 
					                               int iovcnt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint8_t buffer[4096];
 | 
					    uint8_t buffer[4096];
 | 
				
			||||||
| 
						 | 
					@ -424,13 +424,13 @@ static ssize_t vc_sendv_compat(VLANClientState *vc, const struct iovec *iov,
 | 
				
			||||||
    return vc->info->receive(vc, buffer, offset);
 | 
					    return vc->info->receive(vc, buffer, offset);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
 | 
					static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
 | 
				
			||||||
                                       unsigned flags,
 | 
					                                       unsigned flags,
 | 
				
			||||||
                                       const struct iovec *iov,
 | 
					                                       const struct iovec *iov,
 | 
				
			||||||
                                       int iovcnt,
 | 
					                                       int iovcnt,
 | 
				
			||||||
                                       void *opaque)
 | 
					                                       void *opaque)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc = opaque;
 | 
					    NetClientState *vc = opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (vc->link_down) {
 | 
					    if (vc->link_down) {
 | 
				
			||||||
        return iov_size(iov, iovcnt);
 | 
					        return iov_size(iov, iovcnt);
 | 
				
			||||||
| 
						 | 
					@ -443,7 +443,7 @@ static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_sendv_packet_async(VLANClientState *sender,
 | 
					ssize_t qemu_sendv_packet_async(NetClientState *sender,
 | 
				
			||||||
                                const struct iovec *iov, int iovcnt,
 | 
					                                const struct iovec *iov, int iovcnt,
 | 
				
			||||||
                                NetPacketSent *sent_cb)
 | 
					                                NetPacketSent *sent_cb)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -461,14 +461,14 @@ ssize_t qemu_sendv_packet_async(VLANClientState *sender,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t
 | 
					ssize_t
 | 
				
			||||||
qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov, int iovcnt)
 | 
					qemu_sendv_packet(NetClientState *vc, const struct iovec *iov, int iovcnt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return qemu_sendv_packet_async(vc, iov, iovcnt, NULL);
 | 
					    return qemu_sendv_packet_async(vc, iov, iovcnt, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VLANClientState *qemu_find_netdev(const char *id)
 | 
					NetClientState *qemu_find_netdev(const char *id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QTAILQ_FOREACH(vc, &net_clients, next) {
 | 
					    QTAILQ_FOREACH(vc, &net_clients, next) {
 | 
				
			||||||
        if (vc->info->type == NET_CLIENT_OPTIONS_KIND_NIC)
 | 
					        if (vc->info->type == NET_CLIENT_OPTIONS_KIND_NIC)
 | 
				
			||||||
| 
						 | 
					@ -553,7 +553,7 @@ int net_handle_fd_param(Monitor *mon, const char *param)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_init_nic(const NetClientOptions *opts, const char *name,
 | 
					static int net_init_nic(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                        VLANClientState *peer)
 | 
					                        NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int idx;
 | 
					    int idx;
 | 
				
			||||||
    NICInfo *nd;
 | 
					    NICInfo *nd;
 | 
				
			||||||
| 
						 | 
					@ -619,7 +619,7 @@ static int net_init_nic(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
 | 
					static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
 | 
				
			||||||
    const NetClientOptions *opts,
 | 
					    const NetClientOptions *opts,
 | 
				
			||||||
    const char *name,
 | 
					    const char *name,
 | 
				
			||||||
    VLANClientState *peer) = {
 | 
					    NetClientState *peer) = {
 | 
				
			||||||
        [NET_CLIENT_OPTIONS_KIND_NIC]       = net_init_nic,
 | 
					        [NET_CLIENT_OPTIONS_KIND_NIC]       = net_init_nic,
 | 
				
			||||||
#ifdef CONFIG_SLIRP
 | 
					#ifdef CONFIG_SLIRP
 | 
				
			||||||
        [NET_CLIENT_OPTIONS_KIND_USER]      = net_init_slirp,
 | 
					        [NET_CLIENT_OPTIONS_KIND_USER]      = net_init_slirp,
 | 
				
			||||||
| 
						 | 
					@ -679,7 +679,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (net_client_init_fun[opts->kind]) {
 | 
					    if (net_client_init_fun[opts->kind]) {
 | 
				
			||||||
        VLANClientState *peer = NULL;
 | 
					        NetClientState *peer = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Do not add to a vlan if it's a -netdev or a nic with a netdev=
 | 
					        /* Do not add to a vlan if it's a -netdev or a nic with a netdev=
 | 
				
			||||||
         * parameter. */
 | 
					         * parameter. */
 | 
				
			||||||
| 
						 | 
					@ -791,7 +791,7 @@ void net_host_device_add(Monitor *mon, const QDict *qdict)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void net_host_device_remove(Monitor *mon, const QDict *qdict)
 | 
					void net_host_device_remove(Monitor *mon, const QDict *qdict)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
    int vlan_id = qdict_get_int(qdict, "vlan_id");
 | 
					    int vlan_id = qdict_get_int(qdict, "vlan_id");
 | 
				
			||||||
    const char *device = qdict_get_str(qdict, "device");
 | 
					    const char *device = qdict_get_str(qdict, "device");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -843,7 +843,7 @@ exit_err:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qmp_netdev_del(const char *id, Error **errp)
 | 
					void qmp_netdev_del(const char *id, Error **errp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vc = qemu_find_netdev(id);
 | 
					    vc = qemu_find_netdev(id);
 | 
				
			||||||
    if (!vc) {
 | 
					    if (!vc) {
 | 
				
			||||||
| 
						 | 
					@ -855,7 +855,7 @@ void qmp_netdev_del(const char *id, Error **errp)
 | 
				
			||||||
    qemu_opts_del(qemu_opts_find(qemu_find_opts_err("netdev", errp), id));
 | 
					    qemu_opts_del(qemu_opts_find(qemu_find_opts_err("netdev", errp), id));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void print_net_client(Monitor *mon, VLANClientState *vc)
 | 
					static void print_net_client(Monitor *mon, NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    monitor_printf(mon, "%s: type=%s,%s\n", vc->name,
 | 
					    monitor_printf(mon, "%s: type=%s,%s\n", vc->name,
 | 
				
			||||||
                   NetClientOptionsKind_lookup[vc->info->type], vc->info_str);
 | 
					                   NetClientOptionsKind_lookup[vc->info->type], vc->info_str);
 | 
				
			||||||
| 
						 | 
					@ -863,7 +863,7 @@ static void print_net_client(Monitor *mon, VLANClientState *vc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void do_info_network(Monitor *mon)
 | 
					void do_info_network(Monitor *mon)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc, *peer;
 | 
					    NetClientState *vc, *peer;
 | 
				
			||||||
    NetClientOptionsKind type;
 | 
					    NetClientOptionsKind type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    monitor_printf(mon, "Devices not on any VLAN:\n");
 | 
					    monitor_printf(mon, "Devices not on any VLAN:\n");
 | 
				
			||||||
| 
						 | 
					@ -884,7 +884,7 @@ void do_info_network(Monitor *mon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qmp_set_link(const char *name, bool up, Error **errp)
 | 
					void qmp_set_link(const char *name, bool up, Error **errp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc = NULL;
 | 
					    NetClientState *vc = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QTAILQ_FOREACH(vc, &net_clients, next) {
 | 
					    QTAILQ_FOREACH(vc, &net_clients, next) {
 | 
				
			||||||
        if (!strcmp(vc->name, name)) {
 | 
					        if (!strcmp(vc->name, name)) {
 | 
				
			||||||
| 
						 | 
					@ -892,7 +892,6 @@ void qmp_set_link(const char *name, bool up, Error **errp)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
done:
 | 
					done:
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!vc) {
 | 
					    if (!vc) {
 | 
				
			||||||
        error_set(errp, QERR_DEVICE_NOT_FOUND, name);
 | 
					        error_set(errp, QERR_DEVICE_NOT_FOUND, name);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
| 
						 | 
					@ -918,7 +917,7 @@ done:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void net_cleanup(void)
 | 
					void net_cleanup(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc, *next_vc;
 | 
					    NetClientState *vc, *next_vc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QTAILQ_FOREACH_SAFE(vc, &net_clients, next, next_vc) {
 | 
					    QTAILQ_FOREACH_SAFE(vc, &net_clients, next, next_vc) {
 | 
				
			||||||
        qemu_del_vlan_client(vc);
 | 
					        qemu_del_vlan_client(vc);
 | 
				
			||||||
| 
						 | 
					@ -927,7 +926,7 @@ void net_cleanup(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void net_check_clients(void)
 | 
					void net_check_clients(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *vc;
 | 
					    NetClientState *vc;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Don't warn about the default network setup that you get if
 | 
					    /* Don't warn about the default network setup that you get if
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										60
									
								
								net.h
								
								
								
								
							
							
						
						
									
										60
									
								
								net.h
								
								
								
								
							| 
						 | 
					@ -17,7 +17,7 @@ struct MACAddr {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct NICConf {
 | 
					typedef struct NICConf {
 | 
				
			||||||
    MACAddr macaddr;
 | 
					    MACAddr macaddr;
 | 
				
			||||||
    VLANClientState *peer;
 | 
					    NetClientState *peer;
 | 
				
			||||||
    int32_t bootindex;
 | 
					    int32_t bootindex;
 | 
				
			||||||
} NICConf;
 | 
					} NICConf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,14 +27,14 @@ typedef struct NICConf {
 | 
				
			||||||
    DEFINE_PROP_NETDEV("netdev", _state, _conf.peer),                   \
 | 
					    DEFINE_PROP_NETDEV("netdev", _state, _conf.peer),                   \
 | 
				
			||||||
    DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1)
 | 
					    DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VLANs support */
 | 
					/* Net clients */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef void (NetPoll)(VLANClientState *, bool enable);
 | 
					typedef void (NetPoll)(NetClientState *, bool enable);
 | 
				
			||||||
typedef int (NetCanReceive)(VLANClientState *);
 | 
					typedef int (NetCanReceive)(NetClientState *);
 | 
				
			||||||
typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t);
 | 
					typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
 | 
				
			||||||
typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int);
 | 
					typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
 | 
				
			||||||
typedef void (NetCleanup) (VLANClientState *);
 | 
					typedef void (NetCleanup) (NetClientState *);
 | 
				
			||||||
typedef void (LinkStatusChanged)(VLANClientState *);
 | 
					typedef void (LinkStatusChanged)(NetClientState *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct NetClientInfo {
 | 
					typedef struct NetClientInfo {
 | 
				
			||||||
    NetClientOptionsKind type;
 | 
					    NetClientOptionsKind type;
 | 
				
			||||||
| 
						 | 
					@ -48,11 +48,11 @@ typedef struct NetClientInfo {
 | 
				
			||||||
    NetPoll *poll;
 | 
					    NetPoll *poll;
 | 
				
			||||||
} NetClientInfo;
 | 
					} NetClientInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct VLANClientState {
 | 
					struct NetClientState {
 | 
				
			||||||
    NetClientInfo *info;
 | 
					    NetClientInfo *info;
 | 
				
			||||||
    int link_down;
 | 
					    int link_down;
 | 
				
			||||||
    QTAILQ_ENTRY(VLANClientState) next;
 | 
					    QTAILQ_ENTRY(NetClientState) next;
 | 
				
			||||||
    VLANClientState *peer;
 | 
					    NetClientState *peer;
 | 
				
			||||||
    NetQueue *send_queue;
 | 
					    NetQueue *send_queue;
 | 
				
			||||||
    char *model;
 | 
					    char *model;
 | 
				
			||||||
    char *name;
 | 
					    char *name;
 | 
				
			||||||
| 
						 | 
					@ -61,39 +61,39 @@ struct VLANClientState {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct NICState {
 | 
					typedef struct NICState {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    NICConf *conf;
 | 
					    NICConf *conf;
 | 
				
			||||||
    void *opaque;
 | 
					    void *opaque;
 | 
				
			||||||
    bool peer_deleted;
 | 
					    bool peer_deleted;
 | 
				
			||||||
} NICState;
 | 
					} NICState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VLANClientState *qemu_find_netdev(const char *id);
 | 
					NetClientState *qemu_find_netdev(const char *id);
 | 
				
			||||||
VLANClientState *qemu_new_net_client(NetClientInfo *info,
 | 
					NetClientState *qemu_new_net_client(NetClientInfo *info,
 | 
				
			||||||
                                     VLANClientState *peer,
 | 
					                                    NetClientState *peer,
 | 
				
			||||||
                                     const char *model,
 | 
					                                    const char *model,
 | 
				
			||||||
                                     const char *name);
 | 
					                                    const char *name);
 | 
				
			||||||
NICState *qemu_new_nic(NetClientInfo *info,
 | 
					NICState *qemu_new_nic(NetClientInfo *info,
 | 
				
			||||||
                       NICConf *conf,
 | 
					                       NICConf *conf,
 | 
				
			||||||
                       const char *model,
 | 
					                       const char *model,
 | 
				
			||||||
                       const char *name,
 | 
					                       const char *name,
 | 
				
			||||||
                       void *opaque);
 | 
					                       void *opaque);
 | 
				
			||||||
void qemu_del_vlan_client(VLANClientState *vc);
 | 
					void qemu_del_vlan_client(NetClientState *vc);
 | 
				
			||||||
VLANClientState *qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id,
 | 
					NetClientState *qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id,
 | 
				
			||||||
                                               const char *client_str);
 | 
					                                              const char *client_str);
 | 
				
			||||||
typedef void (*qemu_nic_foreach)(NICState *nic, void *opaque);
 | 
					typedef void (*qemu_nic_foreach)(NICState *nic, void *opaque);
 | 
				
			||||||
void qemu_foreach_nic(qemu_nic_foreach func, void *opaque);
 | 
					void qemu_foreach_nic(qemu_nic_foreach func, void *opaque);
 | 
				
			||||||
int qemu_can_send_packet(VLANClientState *vc);
 | 
					int qemu_can_send_packet(NetClientState *vc);
 | 
				
			||||||
ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
 | 
					ssize_t qemu_sendv_packet(NetClientState *vc, const struct iovec *iov,
 | 
				
			||||||
                          int iovcnt);
 | 
					                          int iovcnt);
 | 
				
			||||||
ssize_t qemu_sendv_packet_async(VLANClientState *vc, const struct iovec *iov,
 | 
					ssize_t qemu_sendv_packet_async(NetClientState *vc, const struct iovec *iov,
 | 
				
			||||||
                                int iovcnt, NetPacketSent *sent_cb);
 | 
					                                int iovcnt, NetPacketSent *sent_cb);
 | 
				
			||||||
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
 | 
					void qemu_send_packet(NetClientState *vc, const uint8_t *buf, int size);
 | 
				
			||||||
ssize_t qemu_send_packet_raw(VLANClientState *vc, const uint8_t *buf, int size);
 | 
					ssize_t qemu_send_packet_raw(NetClientState *vc, const uint8_t *buf, int size);
 | 
				
			||||||
ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf,
 | 
					ssize_t qemu_send_packet_async(NetClientState *vc, const uint8_t *buf,
 | 
				
			||||||
                               int size, NetPacketSent *sent_cb);
 | 
					                               int size, NetPacketSent *sent_cb);
 | 
				
			||||||
void qemu_purge_queued_packets(VLANClientState *vc);
 | 
					void qemu_purge_queued_packets(NetClientState *vc);
 | 
				
			||||||
void qemu_flush_queued_packets(VLANClientState *vc);
 | 
					void qemu_flush_queued_packets(NetClientState *vc);
 | 
				
			||||||
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
 | 
					void qemu_format_nic_info_str(NetClientState *vc, uint8_t macaddr[6]);
 | 
				
			||||||
void qemu_macaddr_default_if_unset(MACAddr *macaddr);
 | 
					void qemu_macaddr_default_if_unset(MACAddr *macaddr);
 | 
				
			||||||
int qemu_show_nic_models(const char *arg, const char *const *models);
 | 
					int qemu_show_nic_models(const char *arg, const char *const *models);
 | 
				
			||||||
void qemu_check_nic_model(NICInfo *nd, const char *model);
 | 
					void qemu_check_nic_model(NICInfo *nd, const char *model);
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ struct NICInfo {
 | 
				
			||||||
    char *model;
 | 
					    char *model;
 | 
				
			||||||
    char *name;
 | 
					    char *name;
 | 
				
			||||||
    char *devaddr;
 | 
					    char *devaddr;
 | 
				
			||||||
    VLANClientState *netdev;
 | 
					    NetClientState *netdev;
 | 
				
			||||||
    int used;         /* is this slot in nd_table[] being used? */
 | 
					    int used;         /* is this slot in nd_table[] being used? */
 | 
				
			||||||
    int instantiated; /* does this NICInfo correspond to an instantiated NIC? */
 | 
					    int instantiated; /* does this NICInfo correspond to an instantiated NIC? */
 | 
				
			||||||
    int nvectors;
 | 
					    int nvectors;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								net/dump.c
								
								
								
								
							
							
						
						
									
										12
									
								
								net/dump.c
								
								
								
								
							| 
						 | 
					@ -30,7 +30,7 @@
 | 
				
			||||||
#include "hub.h"
 | 
					#include "hub.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct DumpState {
 | 
					typedef struct DumpState {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    int64_t start_ts;
 | 
					    int64_t start_ts;
 | 
				
			||||||
    int fd;
 | 
					    int fd;
 | 
				
			||||||
    int pcap_caplen;
 | 
					    int pcap_caplen;
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,7 @@ struct pcap_sf_pkthdr {
 | 
				
			||||||
    uint32_t len;
 | 
					    uint32_t len;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t dump_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t dump_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DumpState *s = DO_UPCAST(DumpState, nc, nc);
 | 
					    DumpState *s = DO_UPCAST(DumpState, nc, nc);
 | 
				
			||||||
    struct pcap_sf_pkthdr hdr;
 | 
					    struct pcap_sf_pkthdr hdr;
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ static ssize_t dump_receive(VLANClientState *nc, const uint8_t *buf, size_t size
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void dump_cleanup(VLANClientState *nc)
 | 
					static void dump_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DumpState *s = DO_UPCAST(DumpState, nc, nc);
 | 
					    DumpState *s = DO_UPCAST(DumpState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,11 +100,11 @@ static NetClientInfo net_dump_info = {
 | 
				
			||||||
    .cleanup = dump_cleanup,
 | 
					    .cleanup = dump_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_dump_init(VLANClientState *peer, const char *device,
 | 
					static int net_dump_init(NetClientState *peer, const char *device,
 | 
				
			||||||
                         const char *name, const char *filename, int len)
 | 
					                         const char *name, const char *filename, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct pcap_file_hdr hdr;
 | 
					    struct pcap_file_hdr hdr;
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    DumpState *s;
 | 
					    DumpState *s;
 | 
				
			||||||
    struct tm tm;
 | 
					    struct tm tm;
 | 
				
			||||||
    int fd;
 | 
					    int fd;
 | 
				
			||||||
| 
						 | 
					@ -146,7 +146,7 @@ static int net_dump_init(VLANClientState *peer, const char *device,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_dump(const NetClientOptions *opts, const char *name,
 | 
					int net_init_dump(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                  VLANClientState *peer)
 | 
					                  NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int len;
 | 
					    int len;
 | 
				
			||||||
    const char *file;
 | 
					    const char *file;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,6 @@
 | 
				
			||||||
#include "qapi-types.h"
 | 
					#include "qapi-types.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_dump(const NetClientOptions *opts, const char *name,
 | 
					int net_init_dump(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                  VLANClientState *peer);
 | 
					                  NetClientState *peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* QEMU_NET_DUMP_H */
 | 
					#endif /* QEMU_NET_DUMP_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								net/hub.c
								
								
								
								
							
							
						
						
									
										26
									
								
								net/hub.c
								
								
								
								
							| 
						 | 
					@ -25,7 +25,7 @@
 | 
				
			||||||
typedef struct NetHub NetHub;
 | 
					typedef struct NetHub NetHub;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct NetHubPort {
 | 
					typedef struct NetHubPort {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    QLIST_ENTRY(NetHubPort) next;
 | 
					    QLIST_ENTRY(NetHubPort) next;
 | 
				
			||||||
    NetHub *hub;
 | 
					    NetHub *hub;
 | 
				
			||||||
    int id;
 | 
					    int id;
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,7 @@ static NetHub *net_hub_new(int id)
 | 
				
			||||||
    return hub;
 | 
					    return hub;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t net_hub_port_receive(VLANClientState *nc,
 | 
					static ssize_t net_hub_port_receive(NetClientState *nc,
 | 
				
			||||||
                                    const uint8_t *buf, size_t len)
 | 
					                                    const uint8_t *buf, size_t len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHubPort *port = DO_UPCAST(NetHubPort, nc, nc);
 | 
					    NetHubPort *port = DO_UPCAST(NetHubPort, nc, nc);
 | 
				
			||||||
| 
						 | 
					@ -93,7 +93,7 @@ static ssize_t net_hub_port_receive(VLANClientState *nc,
 | 
				
			||||||
    return net_hub_receive(port->hub, port, buf, len);
 | 
					    return net_hub_receive(port->hub, port, buf, len);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t net_hub_port_receive_iov(VLANClientState *nc,
 | 
					static ssize_t net_hub_port_receive_iov(NetClientState *nc,
 | 
				
			||||||
                                        const struct iovec *iov, int iovcnt)
 | 
					                                        const struct iovec *iov, int iovcnt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHubPort *port = DO_UPCAST(NetHubPort, nc, nc);
 | 
					    NetHubPort *port = DO_UPCAST(NetHubPort, nc, nc);
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ static ssize_t net_hub_port_receive_iov(VLANClientState *nc,
 | 
				
			||||||
    return net_hub_receive_iov(port->hub, port, iov, iovcnt);
 | 
					    return net_hub_receive_iov(port->hub, port, iov, iovcnt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void net_hub_port_cleanup(VLANClientState *nc)
 | 
					static void net_hub_port_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHubPort *port = DO_UPCAST(NetHubPort, nc, nc);
 | 
					    NetHubPort *port = DO_UPCAST(NetHubPort, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ static NetClientInfo net_hub_port_info = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static NetHubPort *net_hub_port_new(NetHub *hub, const char *name)
 | 
					static NetHubPort *net_hub_port_new(NetHub *hub, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    NetHubPort *port;
 | 
					    NetHubPort *port;
 | 
				
			||||||
    int id = hub->num_ports++;
 | 
					    int id = hub->num_ports++;
 | 
				
			||||||
    char default_name[128];
 | 
					    char default_name[128];
 | 
				
			||||||
| 
						 | 
					@ -145,7 +145,7 @@ static NetHubPort *net_hub_port_new(NetHub *hub, const char *name)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * If there is no existing hub with the given id then a new hub is created.
 | 
					 * If there is no existing hub with the given id then a new hub is created.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VLANClientState *net_hub_add_port(int hub_id, const char *name)
 | 
					NetClientState *net_hub_add_port(int hub_id, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHub *hub;
 | 
					    NetHub *hub;
 | 
				
			||||||
    NetHubPort *port;
 | 
					    NetHubPort *port;
 | 
				
			||||||
| 
						 | 
					@ -167,11 +167,11 @@ VLANClientState *net_hub_add_port(int hub_id, const char *name)
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Find a specific client on a hub
 | 
					 * Find a specific client on a hub
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VLANClientState *net_hub_find_client_by_name(int hub_id, const char *name)
 | 
					NetClientState *net_hub_find_client_by_name(int hub_id, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHub *hub;
 | 
					    NetHub *hub;
 | 
				
			||||||
    NetHubPort *port;
 | 
					    NetHubPort *port;
 | 
				
			||||||
    VLANClientState *peer;
 | 
					    NetClientState *peer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QLIST_FOREACH(hub, &hubs, next) {
 | 
					    QLIST_FOREACH(hub, &hubs, next) {
 | 
				
			||||||
        if (hub->id == hub_id) {
 | 
					        if (hub->id == hub_id) {
 | 
				
			||||||
| 
						 | 
					@ -190,11 +190,11 @@ VLANClientState *net_hub_find_client_by_name(int hub_id, const char *name)
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Find a available port on a hub; otherwise create one new port
 | 
					 * Find a available port on a hub; otherwise create one new port
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VLANClientState *net_hub_port_find(int hub_id)
 | 
					NetClientState *net_hub_port_find(int hub_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHub *hub;
 | 
					    NetHub *hub;
 | 
				
			||||||
    NetHubPort *port;
 | 
					    NetHubPort *port;
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QLIST_FOREACH(hub, &hubs, next) {
 | 
					    QLIST_FOREACH(hub, &hubs, next) {
 | 
				
			||||||
        if (hub->id == hub_id) {
 | 
					        if (hub->id == hub_id) {
 | 
				
			||||||
| 
						 | 
					@ -234,7 +234,7 @@ void net_hub_info(Monitor *mon)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @id              Pointer for hub id output, may be NULL
 | 
					 * @id              Pointer for hub id output, may be NULL
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int net_hub_id_for_client(VLANClientState *nc, int *id)
 | 
					int net_hub_id_for_client(NetClientState *nc, int *id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHubPort *port;
 | 
					    NetHubPort *port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -254,7 +254,7 @@ int net_hub_id_for_client(VLANClientState *nc, int *id)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_hubport(const NetClientOptions *opts, const char *name,
 | 
					int net_init_hubport(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                     VLANClientState *peer)
 | 
					                     NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const NetdevHubPortOptions *hubport;
 | 
					    const NetdevHubPortOptions *hubport;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,7 +277,7 @@ void net_hub_check_clients(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetHub *hub;
 | 
					    NetHub *hub;
 | 
				
			||||||
    NetHubPort *port;
 | 
					    NetHubPort *port;
 | 
				
			||||||
    VLANClientState *peer;
 | 
					    NetClientState *peer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QLIST_FOREACH(hub, &hubs, next) {
 | 
					    QLIST_FOREACH(hub, &hubs, next) {
 | 
				
			||||||
        int has_nic = 0, has_host_dev = 0;
 | 
					        int has_nic = 0, has_host_dev = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								net/hub.h
								
								
								
								
							
							
						
						
									
										10
									
								
								net/hub.h
								
								
								
								
							| 
						 | 
					@ -18,12 +18,12 @@
 | 
				
			||||||
#include "qemu-common.h"
 | 
					#include "qemu-common.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_hubport(const NetClientOptions *opts, const char *name,
 | 
					int net_init_hubport(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                     VLANClientState *peer);
 | 
					                     NetClientState *peer);
 | 
				
			||||||
VLANClientState *net_hub_add_port(int hub_id, const char *name);
 | 
					NetClientState *net_hub_add_port(int hub_id, const char *name);
 | 
				
			||||||
VLANClientState *net_hub_find_client_by_name(int hub_id, const char *name);
 | 
					NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
 | 
				
			||||||
void net_hub_info(Monitor *mon);
 | 
					void net_hub_info(Monitor *mon);
 | 
				
			||||||
int net_hub_id_for_client(VLANClientState *nc, int *id);
 | 
					int net_hub_id_for_client(NetClientState *nc, int *id);
 | 
				
			||||||
void net_hub_check_clients(void);
 | 
					void net_hub_check_clients(void);
 | 
				
			||||||
VLANClientState *net_hub_port_find(int hub_id);
 | 
					NetClientState *net_hub_port_find(int hub_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* NET_HUB_H */
 | 
					#endif /* NET_HUB_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								net/queue.c
								
								
								
								
							
							
						
						
									
										16
									
								
								net/queue.c
								
								
								
								
							| 
						 | 
					@ -40,7 +40,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct NetPacket {
 | 
					struct NetPacket {
 | 
				
			||||||
    QTAILQ_ENTRY(NetPacket) entry;
 | 
					    QTAILQ_ENTRY(NetPacket) entry;
 | 
				
			||||||
    VLANClientState *sender;
 | 
					    NetClientState *sender;
 | 
				
			||||||
    unsigned flags;
 | 
					    unsigned flags;
 | 
				
			||||||
    int size;
 | 
					    int size;
 | 
				
			||||||
    NetPacketSent *sent_cb;
 | 
					    NetPacketSent *sent_cb;
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,7 @@ void qemu_del_net_queue(NetQueue *queue)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_net_queue_append(NetQueue *queue,
 | 
					static ssize_t qemu_net_queue_append(NetQueue *queue,
 | 
				
			||||||
                                     VLANClientState *sender,
 | 
					                                     NetClientState *sender,
 | 
				
			||||||
                                     unsigned flags,
 | 
					                                     unsigned flags,
 | 
				
			||||||
                                     const uint8_t *buf,
 | 
					                                     const uint8_t *buf,
 | 
				
			||||||
                                     size_t size,
 | 
					                                     size_t size,
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ static ssize_t qemu_net_queue_append(NetQueue *queue,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_net_queue_append_iov(NetQueue *queue,
 | 
					static ssize_t qemu_net_queue_append_iov(NetQueue *queue,
 | 
				
			||||||
                                         VLANClientState *sender,
 | 
					                                         NetClientState *sender,
 | 
				
			||||||
                                         unsigned flags,
 | 
					                                         unsigned flags,
 | 
				
			||||||
                                         const struct iovec *iov,
 | 
					                                         const struct iovec *iov,
 | 
				
			||||||
                                         int iovcnt,
 | 
					                                         int iovcnt,
 | 
				
			||||||
| 
						 | 
					@ -143,7 +143,7 @@ static ssize_t qemu_net_queue_append_iov(NetQueue *queue,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_net_queue_deliver(NetQueue *queue,
 | 
					static ssize_t qemu_net_queue_deliver(NetQueue *queue,
 | 
				
			||||||
                                      VLANClientState *sender,
 | 
					                                      NetClientState *sender,
 | 
				
			||||||
                                      unsigned flags,
 | 
					                                      unsigned flags,
 | 
				
			||||||
                                      const uint8_t *data,
 | 
					                                      const uint8_t *data,
 | 
				
			||||||
                                      size_t size)
 | 
					                                      size_t size)
 | 
				
			||||||
| 
						 | 
					@ -158,7 +158,7 @@ static ssize_t qemu_net_queue_deliver(NetQueue *queue,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t qemu_net_queue_deliver_iov(NetQueue *queue,
 | 
					static ssize_t qemu_net_queue_deliver_iov(NetQueue *queue,
 | 
				
			||||||
                                          VLANClientState *sender,
 | 
					                                          NetClientState *sender,
 | 
				
			||||||
                                          unsigned flags,
 | 
					                                          unsigned flags,
 | 
				
			||||||
                                          const struct iovec *iov,
 | 
					                                          const struct iovec *iov,
 | 
				
			||||||
                                          int iovcnt)
 | 
					                                          int iovcnt)
 | 
				
			||||||
| 
						 | 
					@ -173,7 +173,7 @@ static ssize_t qemu_net_queue_deliver_iov(NetQueue *queue,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_net_queue_send(NetQueue *queue,
 | 
					ssize_t qemu_net_queue_send(NetQueue *queue,
 | 
				
			||||||
                            VLANClientState *sender,
 | 
					                            NetClientState *sender,
 | 
				
			||||||
                            unsigned flags,
 | 
					                            unsigned flags,
 | 
				
			||||||
                            const uint8_t *data,
 | 
					                            const uint8_t *data,
 | 
				
			||||||
                            size_t size,
 | 
					                            size_t size,
 | 
				
			||||||
| 
						 | 
					@ -197,7 +197,7 @@ ssize_t qemu_net_queue_send(NetQueue *queue,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_net_queue_send_iov(NetQueue *queue,
 | 
					ssize_t qemu_net_queue_send_iov(NetQueue *queue,
 | 
				
			||||||
                                VLANClientState *sender,
 | 
					                                NetClientState *sender,
 | 
				
			||||||
                                unsigned flags,
 | 
					                                unsigned flags,
 | 
				
			||||||
                                const struct iovec *iov,
 | 
					                                const struct iovec *iov,
 | 
				
			||||||
                                int iovcnt,
 | 
					                                int iovcnt,
 | 
				
			||||||
| 
						 | 
					@ -220,7 +220,7 @@ ssize_t qemu_net_queue_send_iov(NetQueue *queue,
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_net_queue_purge(NetQueue *queue, VLANClientState *from)
 | 
					void qemu_net_queue_purge(NetQueue *queue, NetClientState *from)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetPacket *packet, *next;
 | 
					    NetPacket *packet, *next;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								net/queue.h
								
								
								
								
							
							
						
						
									
										12
									
								
								net/queue.h
								
								
								
								
							| 
						 | 
					@ -29,15 +29,15 @@
 | 
				
			||||||
typedef struct NetPacket NetPacket;
 | 
					typedef struct NetPacket NetPacket;
 | 
				
			||||||
typedef struct NetQueue NetQueue;
 | 
					typedef struct NetQueue NetQueue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef void (NetPacketSent) (VLANClientState *sender, ssize_t ret);
 | 
					typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef ssize_t (NetPacketDeliver) (VLANClientState *sender,
 | 
					typedef ssize_t (NetPacketDeliver) (NetClientState *sender,
 | 
				
			||||||
                                    unsigned flags,
 | 
					                                    unsigned flags,
 | 
				
			||||||
                                    const uint8_t *buf,
 | 
					                                    const uint8_t *buf,
 | 
				
			||||||
                                    size_t size,
 | 
					                                    size_t size,
 | 
				
			||||||
                                    void *opaque);
 | 
					                                    void *opaque);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef ssize_t (NetPacketDeliverIOV) (VLANClientState *sender,
 | 
					typedef ssize_t (NetPacketDeliverIOV) (NetClientState *sender,
 | 
				
			||||||
                                       unsigned flags,
 | 
					                                       unsigned flags,
 | 
				
			||||||
                                       const struct iovec *iov,
 | 
					                                       const struct iovec *iov,
 | 
				
			||||||
                                       int iovcnt,
 | 
					                                       int iovcnt,
 | 
				
			||||||
| 
						 | 
					@ -52,20 +52,20 @@ NetQueue *qemu_new_net_queue(NetPacketDeliver *deliver,
 | 
				
			||||||
void qemu_del_net_queue(NetQueue *queue);
 | 
					void qemu_del_net_queue(NetQueue *queue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_net_queue_send(NetQueue *queue,
 | 
					ssize_t qemu_net_queue_send(NetQueue *queue,
 | 
				
			||||||
                            VLANClientState *sender,
 | 
					                            NetClientState *sender,
 | 
				
			||||||
                            unsigned flags,
 | 
					                            unsigned flags,
 | 
				
			||||||
                            const uint8_t *data,
 | 
					                            const uint8_t *data,
 | 
				
			||||||
                            size_t size,
 | 
					                            size_t size,
 | 
				
			||||||
                            NetPacketSent *sent_cb);
 | 
					                            NetPacketSent *sent_cb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t qemu_net_queue_send_iov(NetQueue *queue,
 | 
					ssize_t qemu_net_queue_send_iov(NetQueue *queue,
 | 
				
			||||||
                                VLANClientState *sender,
 | 
					                                NetClientState *sender,
 | 
				
			||||||
                                unsigned flags,
 | 
					                                unsigned flags,
 | 
				
			||||||
                                const struct iovec *iov,
 | 
					                                const struct iovec *iov,
 | 
				
			||||||
                                int iovcnt,
 | 
					                                int iovcnt,
 | 
				
			||||||
                                NetPacketSent *sent_cb);
 | 
					                                NetPacketSent *sent_cb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qemu_net_queue_purge(NetQueue *queue, VLANClientState *from);
 | 
					void qemu_net_queue_purge(NetQueue *queue, NetClientState *from);
 | 
				
			||||||
void qemu_net_queue_flush(NetQueue *queue);
 | 
					void qemu_net_queue_flush(NetQueue *queue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* QEMU_NET_QUEUE_H */
 | 
					#endif /* QEMU_NET_QUEUE_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								net/slirp.c
								
								
								
								
							
							
						
						
									
										14
									
								
								net/slirp.c
								
								
								
								
							| 
						 | 
					@ -68,7 +68,7 @@ struct slirp_config_str {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct SlirpState {
 | 
					typedef struct SlirpState {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    QTAILQ_ENTRY(SlirpState) entry;
 | 
					    QTAILQ_ENTRY(SlirpState) entry;
 | 
				
			||||||
    Slirp *slirp;
 | 
					    Slirp *slirp;
 | 
				
			||||||
#ifndef _WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len)
 | 
				
			||||||
    qemu_send_packet(&s->nc, pkt, pkt_len);
 | 
					    qemu_send_packet(&s->nc, pkt, pkt_len);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t net_slirp_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t net_slirp_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SlirpState *s = DO_UPCAST(SlirpState, nc, nc);
 | 
					    SlirpState *s = DO_UPCAST(SlirpState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ static ssize_t net_slirp_receive(VLANClientState *nc, const uint8_t *buf, size_t
 | 
				
			||||||
    return size;
 | 
					    return size;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void net_slirp_cleanup(VLANClientState *nc)
 | 
					static void net_slirp_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SlirpState *s = DO_UPCAST(SlirpState, nc, nc);
 | 
					    SlirpState *s = DO_UPCAST(SlirpState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,7 +136,7 @@ static NetClientInfo net_slirp_info = {
 | 
				
			||||||
    .cleanup = net_slirp_cleanup,
 | 
					    .cleanup = net_slirp_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_slirp_init(VLANClientState *peer, const char *model,
 | 
					static int net_slirp_init(NetClientState *peer, const char *model,
 | 
				
			||||||
                          const char *name, int restricted,
 | 
					                          const char *name, int restricted,
 | 
				
			||||||
                          const char *vnetwork, const char *vhost,
 | 
					                          const char *vnetwork, const char *vhost,
 | 
				
			||||||
                          const char *vhostname, const char *tftp_export,
 | 
					                          const char *vhostname, const char *tftp_export,
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ static int net_slirp_init(VLANClientState *peer, const char *model,
 | 
				
			||||||
#ifndef _WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
    struct in_addr smbsrv = { .s_addr = 0 };
 | 
					    struct in_addr smbsrv = { .s_addr = 0 };
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    SlirpState *s;
 | 
					    SlirpState *s;
 | 
				
			||||||
    char buf[20];
 | 
					    char buf[20];
 | 
				
			||||||
    uint32_t addr;
 | 
					    uint32_t addr;
 | 
				
			||||||
| 
						 | 
					@ -284,7 +284,7 @@ static SlirpState *slirp_lookup(Monitor *mon, const char *vlan,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (vlan) {
 | 
					    if (vlan) {
 | 
				
			||||||
        VLANClientState *nc;
 | 
					        NetClientState *nc;
 | 
				
			||||||
        nc = net_hub_find_client_by_name(strtol(vlan, NULL, 0), stack);
 | 
					        nc = net_hub_find_client_by_name(strtol(vlan, NULL, 0), stack);
 | 
				
			||||||
        if (!nc) {
 | 
					        if (!nc) {
 | 
				
			||||||
            return NULL;
 | 
					            return NULL;
 | 
				
			||||||
| 
						 | 
					@ -706,7 +706,7 @@ net_init_slirp_configs(const StringList *fwd, int flags)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_slirp(const NetClientOptions *opts, const char *name,
 | 
					int net_init_slirp(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                   VLANClientState *peer)
 | 
					                   NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct slirp_config_str *config;
 | 
					    struct slirp_config_str *config;
 | 
				
			||||||
    char *vnet;
 | 
					    char *vnet;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
#ifdef CONFIG_SLIRP
 | 
					#ifdef CONFIG_SLIRP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_slirp(const NetClientOptions *opts, const char *name,
 | 
					int net_init_slirp(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                   VLANClientState *peer);
 | 
					                   NetClientState *peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
 | 
					void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
 | 
				
			||||||
void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
 | 
					void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										30
									
								
								net/socket.c
								
								
								
								
							
							
						
						
									
										30
									
								
								net/socket.c
								
								
								
								
							| 
						 | 
					@ -34,7 +34,7 @@
 | 
				
			||||||
#include "qemu_socket.h"
 | 
					#include "qemu_socket.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct NetSocketState {
 | 
					typedef struct NetSocketState {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    int fd;
 | 
					    int fd;
 | 
				
			||||||
    int state; /* 0 = getting length, 1 = getting data */
 | 
					    int state; /* 0 = getting length, 1 = getting data */
 | 
				
			||||||
    unsigned int index;
 | 
					    unsigned int index;
 | 
				
			||||||
| 
						 | 
					@ -44,14 +44,14 @@ typedef struct NetSocketState {
 | 
				
			||||||
} NetSocketState;
 | 
					} NetSocketState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct NetSocketListenState {
 | 
					typedef struct NetSocketListenState {
 | 
				
			||||||
    VLANClientState *peer;
 | 
					    NetClientState *peer;
 | 
				
			||||||
    char *model;
 | 
					    char *model;
 | 
				
			||||||
    char *name;
 | 
					    char *name;
 | 
				
			||||||
    int fd;
 | 
					    int fd;
 | 
				
			||||||
} NetSocketListenState;
 | 
					} NetSocketListenState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* XXX: we consider we can send the whole packet without blocking */
 | 
					/* XXX: we consider we can send the whole packet without blocking */
 | 
				
			||||||
static ssize_t net_socket_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t net_socket_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
 | 
					    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
 | 
				
			||||||
    uint32_t len;
 | 
					    uint32_t len;
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@ static ssize_t net_socket_receive(VLANClientState *nc, const uint8_t *buf, size_
 | 
				
			||||||
    return send_all(s->fd, buf, size);
 | 
					    return send_all(s->fd, buf, size);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t net_socket_receive_dgram(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
 | 
					    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,7 +231,7 @@ fail:
 | 
				
			||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void net_socket_cleanup(VLANClientState *nc)
 | 
					static void net_socket_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
 | 
					    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
 | 
				
			||||||
    qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
 | 
					    qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
 | 
				
			||||||
| 
						 | 
					@ -245,7 +245,7 @@ static NetClientInfo net_dgram_socket_info = {
 | 
				
			||||||
    .cleanup = net_socket_cleanup,
 | 
					    .cleanup = net_socket_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static NetSocketState *net_socket_fd_init_dgram(VLANClientState *peer,
 | 
					static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
 | 
				
			||||||
                                                const char *model,
 | 
					                                                const char *model,
 | 
				
			||||||
                                                const char *name,
 | 
					                                                const char *name,
 | 
				
			||||||
                                                int fd, int is_connected)
 | 
					                                                int fd, int is_connected)
 | 
				
			||||||
| 
						 | 
					@ -253,7 +253,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANClientState *peer,
 | 
				
			||||||
    struct sockaddr_in saddr;
 | 
					    struct sockaddr_in saddr;
 | 
				
			||||||
    int newfd;
 | 
					    int newfd;
 | 
				
			||||||
    socklen_t saddr_len;
 | 
					    socklen_t saddr_len;
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    NetSocketState *s;
 | 
					    NetSocketState *s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* fd passed: multicast: "learn" dgram_dst address from bound address and save it
 | 
					    /* fd passed: multicast: "learn" dgram_dst address from bound address and save it
 | 
				
			||||||
| 
						 | 
					@ -323,12 +323,12 @@ static NetClientInfo net_socket_info = {
 | 
				
			||||||
    .cleanup = net_socket_cleanup,
 | 
					    .cleanup = net_socket_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static NetSocketState *net_socket_fd_init_stream(VLANClientState *peer,
 | 
					static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
 | 
				
			||||||
                                                 const char *model,
 | 
					                                                 const char *model,
 | 
				
			||||||
                                                 const char *name,
 | 
					                                                 const char *name,
 | 
				
			||||||
                                                 int fd, int is_connected)
 | 
					                                                 int fd, int is_connected)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    NetSocketState *s;
 | 
					    NetSocketState *s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nc = qemu_new_net_client(&net_socket_info, peer, model, name);
 | 
					    nc = qemu_new_net_client(&net_socket_info, peer, model, name);
 | 
				
			||||||
| 
						 | 
					@ -347,7 +347,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANClientState *peer,
 | 
				
			||||||
    return s;
 | 
					    return s;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static NetSocketState *net_socket_fd_init(VLANClientState *peer,
 | 
					static NetSocketState *net_socket_fd_init(NetClientState *peer,
 | 
				
			||||||
                                          const char *model, const char *name,
 | 
					                                          const char *model, const char *name,
 | 
				
			||||||
                                          int fd, int is_connected)
 | 
					                                          int fd, int is_connected)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -398,7 +398,7 @@ static void net_socket_accept(void *opaque)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_socket_listen_init(VLANClientState *peer,
 | 
					static int net_socket_listen_init(NetClientState *peer,
 | 
				
			||||||
                                  const char *model,
 | 
					                                  const char *model,
 | 
				
			||||||
                                  const char *name,
 | 
					                                  const char *name,
 | 
				
			||||||
                                  const char *host_str)
 | 
					                                  const char *host_str)
 | 
				
			||||||
| 
						 | 
					@ -446,7 +446,7 @@ static int net_socket_listen_init(VLANClientState *peer,
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_socket_connect_init(VLANClientState *peer,
 | 
					static int net_socket_connect_init(NetClientState *peer,
 | 
				
			||||||
                                   const char *model,
 | 
					                                   const char *model,
 | 
				
			||||||
                                   const char *name,
 | 
					                                   const char *name,
 | 
				
			||||||
                                   const char *host_str)
 | 
					                                   const char *host_str)
 | 
				
			||||||
| 
						 | 
					@ -496,7 +496,7 @@ static int net_socket_connect_init(VLANClientState *peer,
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_socket_mcast_init(VLANClientState *peer,
 | 
					static int net_socket_mcast_init(NetClientState *peer,
 | 
				
			||||||
                                 const char *model,
 | 
					                                 const char *model,
 | 
				
			||||||
                                 const char *name,
 | 
					                                 const char *name,
 | 
				
			||||||
                                 const char *host_str,
 | 
					                                 const char *host_str,
 | 
				
			||||||
| 
						 | 
					@ -535,7 +535,7 @@ static int net_socket_mcast_init(VLANClientState *peer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_socket_udp_init(VLANClientState *peer,
 | 
					static int net_socket_udp_init(NetClientState *peer,
 | 
				
			||||||
                                 const char *model,
 | 
					                                 const char *model,
 | 
				
			||||||
                                 const char *name,
 | 
					                                 const char *name,
 | 
				
			||||||
                                 const char *rhost,
 | 
					                                 const char *rhost,
 | 
				
			||||||
| 
						 | 
					@ -587,7 +587,7 @@ static int net_socket_udp_init(VLANClientState *peer,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_socket(const NetClientOptions *opts, const char *name,
 | 
					int net_init_socket(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                    VLANClientState *peer)
 | 
					                    NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const NetdevSocketOptions *sock;
 | 
					    const NetdevSocketOptions *sock;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,6 @@
 | 
				
			||||||
#include "qapi-types.h"
 | 
					#include "qapi-types.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_socket(const NetClientOptions *opts, const char *name,
 | 
					int net_init_socket(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                    VLANClientState *peer);
 | 
					                    NetClientState *peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* QEMU_NET_SOCKET_H */
 | 
					#endif /* QEMU_NET_SOCKET_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -630,11 +630,11 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle,
 | 
				
			||||||
/********************************************/
 | 
					/********************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 typedef struct TAPState {
 | 
					 typedef struct TAPState {
 | 
				
			||||||
     VLANClientState nc;
 | 
					     NetClientState nc;
 | 
				
			||||||
     tap_win32_overlapped_t *handle;
 | 
					     tap_win32_overlapped_t *handle;
 | 
				
			||||||
 } TAPState;
 | 
					 } TAPState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void tap_cleanup(VLANClientState *nc)
 | 
					static void tap_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -645,7 +645,7 @@ static void tap_cleanup(VLANClientState *nc)
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t tap_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -673,10 +673,10 @@ static NetClientInfo net_tap_win32_info = {
 | 
				
			||||||
    .cleanup = tap_cleanup,
 | 
					    .cleanup = tap_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tap_win32_init(VLANClientState *peer, const char *model,
 | 
					static int tap_win32_init(NetClientState *peer, const char *model,
 | 
				
			||||||
                          const char *name, const char *ifname)
 | 
					                          const char *name, const char *ifname)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    TAPState *s;
 | 
					    TAPState *s;
 | 
				
			||||||
    tap_win32_overlapped_t *handle;
 | 
					    tap_win32_overlapped_t *handle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -700,7 +700,7 @@ static int tap_win32_init(VLANClientState *peer, const char *model,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
					int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                 VLANClientState *peer)
 | 
					                 NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const NetdevTapOptions *tap;
 | 
					    const NetdevTapOptions *tap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -719,12 +719,12 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_has_ufo(VLANClientState *vc)
 | 
					int tap_has_ufo(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_has_vnet_hdr(VLANClientState *vc)
 | 
					int tap_has_vnet_hdr(NetClientState *vc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -738,16 +738,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void tap_using_vnet_hdr(VLANClientState *vc, int using_vnet_hdr)
 | 
					void tap_using_vnet_hdr(NetClientState *vc, int using_vnet_hdr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void tap_set_offload(VLANClientState *vc, int csum, int tso4,
 | 
					void tap_set_offload(NetClientState *vc, int csum, int tso4,
 | 
				
			||||||
                     int tso6, int ecn, int ufo)
 | 
					                     int tso6, int ecn, int ufo)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct vhost_net *tap_get_vhost_net(VLANClientState *nc)
 | 
					struct vhost_net *tap_get_vhost_net(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										38
									
								
								net/tap.c
								
								
								
								
							
							
						
						
									
										38
									
								
								net/tap.c
								
								
								
								
							| 
						 | 
					@ -50,7 +50,7 @@
 | 
				
			||||||
#define TAP_BUFSIZE (4096 + 65536)
 | 
					#define TAP_BUFSIZE (4096 + 65536)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct TAPState {
 | 
					typedef struct TAPState {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    int fd;
 | 
					    int fd;
 | 
				
			||||||
    char down_script[1024];
 | 
					    char down_script[1024];
 | 
				
			||||||
    char down_script_arg[128];
 | 
					    char down_script_arg[128];
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ static ssize_t tap_write_packet(TAPState *s, const struct iovec *iov, int iovcnt
 | 
				
			||||||
    return len;
 | 
					    return len;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t tap_receive_iov(VLANClientState *nc, const struct iovec *iov,
 | 
					static ssize_t tap_receive_iov(NetClientState *nc, const struct iovec *iov,
 | 
				
			||||||
                               int iovcnt)
 | 
					                               int iovcnt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
| 
						 | 
					@ -134,7 +134,7 @@ static ssize_t tap_receive_iov(VLANClientState *nc, const struct iovec *iov,
 | 
				
			||||||
    return tap_write_packet(s, iovp, iovcnt);
 | 
					    return tap_write_packet(s, iovp, iovcnt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t tap_receive_raw(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t tap_receive_raw(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
    struct iovec iov[2];
 | 
					    struct iovec iov[2];
 | 
				
			||||||
| 
						 | 
					@ -154,7 +154,7 @@ static ssize_t tap_receive_raw(VLANClientState *nc, const uint8_t *buf, size_t s
 | 
				
			||||||
    return tap_write_packet(s, iov, iovcnt);
 | 
					    return tap_write_packet(s, iov, iovcnt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t tap_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
    struct iovec iov[1];
 | 
					    struct iovec iov[1];
 | 
				
			||||||
| 
						 | 
					@ -183,7 +183,7 @@ ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void tap_send_completed(VLANClientState *nc, ssize_t len)
 | 
					static void tap_send_completed(NetClientState *nc, ssize_t len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
    tap_read_poll(s, 1);
 | 
					    tap_read_poll(s, 1);
 | 
				
			||||||
| 
						 | 
					@ -214,7 +214,7 @@ static void tap_send(void *opaque)
 | 
				
			||||||
    } while (size > 0 && qemu_can_send_packet(&s->nc));
 | 
					    } while (size > 0 && qemu_can_send_packet(&s->nc));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_has_ufo(VLANClientState *nc)
 | 
					int tap_has_ufo(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -223,7 +223,7 @@ int tap_has_ufo(VLANClientState *nc)
 | 
				
			||||||
    return s->has_ufo;
 | 
					    return s->has_ufo;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_has_vnet_hdr(VLANClientState *nc)
 | 
					int tap_has_vnet_hdr(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -232,7 +232,7 @@ int tap_has_vnet_hdr(VLANClientState *nc)
 | 
				
			||||||
    return !!s->host_vnet_hdr_len;
 | 
					    return !!s->host_vnet_hdr_len;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_has_vnet_hdr_len(VLANClientState *nc, int len)
 | 
					int tap_has_vnet_hdr_len(NetClientState *nc, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,7 +241,7 @@ int tap_has_vnet_hdr_len(VLANClientState *nc, int len)
 | 
				
			||||||
    return tap_probe_vnet_hdr_len(s->fd, len);
 | 
					    return tap_probe_vnet_hdr_len(s->fd, len);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void tap_set_vnet_hdr_len(VLANClientState *nc, int len)
 | 
					void tap_set_vnet_hdr_len(NetClientState *nc, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -253,7 +253,7 @@ void tap_set_vnet_hdr_len(VLANClientState *nc, int len)
 | 
				
			||||||
    s->host_vnet_hdr_len = len;
 | 
					    s->host_vnet_hdr_len = len;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void tap_using_vnet_hdr(VLANClientState *nc, int using_vnet_hdr)
 | 
					void tap_using_vnet_hdr(NetClientState *nc, int using_vnet_hdr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -265,7 +265,7 @@ void tap_using_vnet_hdr(VLANClientState *nc, int using_vnet_hdr)
 | 
				
			||||||
    s->using_vnet_hdr = using_vnet_hdr;
 | 
					    s->using_vnet_hdr = using_vnet_hdr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void tap_set_offload(VLANClientState *nc, int csum, int tso4,
 | 
					void tap_set_offload(NetClientState *nc, int csum, int tso4,
 | 
				
			||||||
                     int tso6, int ecn, int ufo)
 | 
					                     int tso6, int ecn, int ufo)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
| 
						 | 
					@ -276,7 +276,7 @@ void tap_set_offload(VLANClientState *nc, int csum, int tso4,
 | 
				
			||||||
    tap_fd_set_offload(s->fd, csum, tso4, tso6, ecn, ufo);
 | 
					    tap_fd_set_offload(s->fd, csum, tso4, tso6, ecn, ufo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void tap_cleanup(VLANClientState *nc)
 | 
					static void tap_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -296,14 +296,14 @@ static void tap_cleanup(VLANClientState *nc)
 | 
				
			||||||
    s->fd = -1;
 | 
					    s->fd = -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void tap_poll(VLANClientState *nc, bool enable)
 | 
					static void tap_poll(NetClientState *nc, bool enable)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
    tap_read_poll(s, enable);
 | 
					    tap_read_poll(s, enable);
 | 
				
			||||||
    tap_write_poll(s, enable);
 | 
					    tap_write_poll(s, enable);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_get_fd(VLANClientState *nc)
 | 
					int tap_get_fd(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
    assert(nc->info->type == NET_CLIENT_OPTIONS_KIND_TAP);
 | 
					    assert(nc->info->type == NET_CLIENT_OPTIONS_KIND_TAP);
 | 
				
			||||||
| 
						 | 
					@ -322,13 +322,13 @@ static NetClientInfo net_tap_info = {
 | 
				
			||||||
    .cleanup = tap_cleanup,
 | 
					    .cleanup = tap_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static TAPState *net_tap_fd_init(VLANClientState *peer,
 | 
					static TAPState *net_tap_fd_init(NetClientState *peer,
 | 
				
			||||||
                                 const char *model,
 | 
					                                 const char *model,
 | 
				
			||||||
                                 const char *name,
 | 
					                                 const char *name,
 | 
				
			||||||
                                 int fd,
 | 
					                                 int fd,
 | 
				
			||||||
                                 int vnet_hdr)
 | 
					                                 int vnet_hdr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    TAPState *s;
 | 
					    TAPState *s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nc = qemu_new_net_client(&net_tap_info, peer, model, name);
 | 
					    nc = qemu_new_net_client(&net_tap_info, peer, model, name);
 | 
				
			||||||
| 
						 | 
					@ -514,7 +514,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_bridge(const NetClientOptions *opts, const char *name,
 | 
					int net_init_bridge(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                    VLANClientState *peer)
 | 
					                    NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const NetdevBridgeOptions *bridge;
 | 
					    const NetdevBridgeOptions *bridge;
 | 
				
			||||||
    const char *helper, *br;
 | 
					    const char *helper, *br;
 | 
				
			||||||
| 
						 | 
					@ -587,7 +587,7 @@ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
					int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                 VLANClientState *peer)
 | 
					                 NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const NetdevTapOptions *tap;
 | 
					    const NetdevTapOptions *tap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -708,7 +708,7 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VHostNetState *tap_get_vhost_net(VLANClientState *nc)
 | 
					VHostNetState *tap_get_vhost_net(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
					    TAPState *s = DO_UPCAST(TAPState, nc, nc);
 | 
				
			||||||
    assert(nc->info->type == NET_CLIENT_OPTIONS_KIND_TAP);
 | 
					    assert(nc->info->type == NET_CLIENT_OPTIONS_KIND_TAP);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										20
									
								
								net/tap.h
								
								
								
								
							
							
						
						
									
										20
									
								
								net/tap.h
								
								
								
								
							| 
						 | 
					@ -33,18 +33,18 @@
 | 
				
			||||||
#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
 | 
					#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
					int net_init_tap(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                 VLANClientState *peer);
 | 
					                 NetClientState *peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required);
 | 
					int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
 | 
					ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_has_ufo(VLANClientState *vc);
 | 
					int tap_has_ufo(NetClientState *vc);
 | 
				
			||||||
int tap_has_vnet_hdr(VLANClientState *vc);
 | 
					int tap_has_vnet_hdr(NetClientState *vc);
 | 
				
			||||||
int tap_has_vnet_hdr_len(VLANClientState *vc, int len);
 | 
					int tap_has_vnet_hdr_len(NetClientState *vc, int len);
 | 
				
			||||||
void tap_using_vnet_hdr(VLANClientState *vc, int using_vnet_hdr);
 | 
					void tap_using_vnet_hdr(NetClientState *vc, int using_vnet_hdr);
 | 
				
			||||||
void tap_set_offload(VLANClientState *vc, int csum, int tso4, int tso6, int ecn, int ufo);
 | 
					void tap_set_offload(NetClientState *vc, int csum, int tso4, int tso6, int ecn, int ufo);
 | 
				
			||||||
void tap_set_vnet_hdr_len(VLANClientState *vc, int len);
 | 
					void tap_set_vnet_hdr_len(NetClientState *vc, int len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
 | 
					int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
 | 
				
			||||||
int tap_probe_vnet_hdr(int fd);
 | 
					int tap_probe_vnet_hdr(int fd);
 | 
				
			||||||
| 
						 | 
					@ -53,12 +53,12 @@ int tap_probe_has_ufo(int fd);
 | 
				
			||||||
void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
 | 
					void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
 | 
				
			||||||
void tap_fd_set_vnet_hdr_len(int fd, int len);
 | 
					void tap_fd_set_vnet_hdr_len(int fd, int len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tap_get_fd(VLANClientState *vc);
 | 
					int tap_get_fd(NetClientState *vc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct vhost_net;
 | 
					struct vhost_net;
 | 
				
			||||||
struct vhost_net *tap_get_vhost_net(VLANClientState *vc);
 | 
					struct vhost_net *tap_get_vhost_net(NetClientState *vc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_bridge(const NetClientOptions *opts, const char *name,
 | 
					int net_init_bridge(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                    VLANClientState *peer);
 | 
					                    NetClientState *peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* QEMU_NET_TAP_H */
 | 
					#endif /* QEMU_NET_TAP_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								net/vde.c
								
								
								
								
							
							
						
						
									
										12
									
								
								net/vde.c
								
								
								
								
							| 
						 | 
					@ -33,7 +33,7 @@
 | 
				
			||||||
#include "qemu-option.h"
 | 
					#include "qemu-option.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct VDEState {
 | 
					typedef struct VDEState {
 | 
				
			||||||
    VLANClientState nc;
 | 
					    NetClientState nc;
 | 
				
			||||||
    VDECONN *vde;
 | 
					    VDECONN *vde;
 | 
				
			||||||
} VDEState;
 | 
					} VDEState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@ static void vde_to_qemu(void *opaque)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ssize_t vde_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
					static ssize_t vde_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VDEState *s = DO_UPCAST(VDEState, nc, nc);
 | 
					    VDEState *s = DO_UPCAST(VDEState, nc, nc);
 | 
				
			||||||
    ssize_t ret;
 | 
					    ssize_t ret;
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@ static ssize_t vde_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void vde_cleanup(VLANClientState *nc)
 | 
					static void vde_cleanup(NetClientState *nc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VDEState *s = DO_UPCAST(VDEState, nc, nc);
 | 
					    VDEState *s = DO_UPCAST(VDEState, nc, nc);
 | 
				
			||||||
    qemu_set_fd_handler(vde_datafd(s->vde), NULL, NULL, NULL);
 | 
					    qemu_set_fd_handler(vde_datafd(s->vde), NULL, NULL, NULL);
 | 
				
			||||||
| 
						 | 
					@ -75,11 +75,11 @@ static NetClientInfo net_vde_info = {
 | 
				
			||||||
    .cleanup = vde_cleanup,
 | 
					    .cleanup = vde_cleanup,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int net_vde_init(VLANClientState *peer, const char *model,
 | 
					static int net_vde_init(NetClientState *peer, const char *model,
 | 
				
			||||||
                        const char *name, const char *sock,
 | 
					                        const char *name, const char *sock,
 | 
				
			||||||
                        int port, const char *group, int mode)
 | 
					                        int port, const char *group, int mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VLANClientState *nc;
 | 
					    NetClientState *nc;
 | 
				
			||||||
    VDEState *s;
 | 
					    VDEState *s;
 | 
				
			||||||
    VDECONN *vde;
 | 
					    VDECONN *vde;
 | 
				
			||||||
    char *init_group = (char *)group;
 | 
					    char *init_group = (char *)group;
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ static int net_vde_init(VLANClientState *peer, const char *model,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_vde(const NetClientOptions *opts, const char *name,
 | 
					int net_init_vde(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                 VLANClientState *peer)
 | 
					                 NetClientState *peer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    const NetdevVdeOptions *vde;
 | 
					    const NetdevVdeOptions *vde;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@
 | 
				
			||||||
#ifdef CONFIG_VDE
 | 
					#ifdef CONFIG_VDE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int net_init_vde(const NetClientOptions *opts, const char *name,
 | 
					int net_init_vde(const NetClientOptions *opts, const char *name,
 | 
				
			||||||
                 VLANClientState *peer);
 | 
					                 NetClientState *peer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* CONFIG_VDE */
 | 
					#endif /* CONFIG_VDE */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -234,7 +234,7 @@ typedef struct TextConsole TextConsole;
 | 
				
			||||||
typedef TextConsole QEMUConsole;
 | 
					typedef TextConsole QEMUConsole;
 | 
				
			||||||
typedef struct CharDriverState CharDriverState;
 | 
					typedef struct CharDriverState CharDriverState;
 | 
				
			||||||
typedef struct MACAddr MACAddr;
 | 
					typedef struct MACAddr MACAddr;
 | 
				
			||||||
typedef struct VLANClientState VLANClientState;
 | 
					typedef struct NetClientState NetClientState;
 | 
				
			||||||
typedef struct i2c_bus i2c_bus;
 | 
					typedef struct i2c_bus i2c_bus;
 | 
				
			||||||
typedef struct ISABus ISABus;
 | 
					typedef struct ISABus ISABus;
 | 
				
			||||||
typedef struct ISADevice ISADevice;
 | 
					typedef struct ISADevice ISADevice;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue