Commit f57fb884 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'stefanha/net' into staging

* stefanha/net:
  net: add the support for -netdev socket, listen
  net: fix the coding style
  hub: add the support for hub own flow control
  net: determine if packets can be sent before net queue deliver packets
  net: cleanup deliver/deliver_iov func pointers
  net: Make "info network" output more readable info
  net: Rename qemu_del_vlan_client() to qemu_del_net_client()
  net: Rename vc local variables to nc
  net: Rename VLANClientState to NetClientState
  net: Rename non_vlan_clients to net_clients
  net: Remove VLANState
  net: Remove vlan code from net.c
  net: Convert qdev_prop_vlan to peer with hub
  net: Drop vlan argument to qemu_new_net_client()
  hub: Check that hubs are configured correctly
  net: Look up 'vlan' net clients using hubs
  net: Use hubs for the vlan feature
  net: Add a hub net client
  net: Add interface to bridge when SIOCBRADDIF isn't available
parents 3d0b7b52 011de2b5
......@@ -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;
......@@ -602,7 +602,7 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)
* gem_receive:
* 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];
target_phys_addr_t packet_desc_addr, last_desc_addr;
......@@ -1146,7 +1146,7 @@ static const MemoryRegionOps gem_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
static void gem_cleanup(VLANClientState *nc)
static void gem_cleanup(NetClientState *nc)
{
GemState *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -1154,7 +1154,7 @@ static void gem_cleanup(VLANClientState *nc)
s->nic = NULL;
}
static void gem_set_link(VLANClientState *nc)
static void gem_set_link(NetClientState *nc)
{
DB_PRINT("\n");
phy_update_link(DO_UPCAST(NICState, nc, nc)->opaque);
......
......@@ -673,7 +673,7 @@ static const MemoryRegionOps dp8393x_ops = {
.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;
......@@ -722,7 +722,7 @@ static int receive_filter(dp8393xState *s, const uint8_t * buf, int size)
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;
uint16_t data[10];
......@@ -858,7 +858,7 @@ static void nic_reset(void *opaque)
dp8393x_update_irq(s);
}
static void nic_cleanup(VLANClientState *nc)
static void nic_cleanup(NetClientState *nc)
{
dp8393xState *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -899,7 +899,6 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift,
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */
s->conf.macaddr = nd->macaddr;
s->conf.vlan = nd->vlan;
s->conf.peer = nd->netdev;
s->nic = qemu_new_nic(&net_dp83932_info, &s->conf, nd->model, nd->name, s);
......
......@@ -720,7 +720,7 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
}
static void
e1000_set_link_status(VLANClientState *nc)
e1000_set_link_status(NetClientState *nc)
{
E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
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
e1000_can_receive(VLANClientState *nc)
e1000_can_receive(NetClientState *nc)
{
E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -770,7 +770,7 @@ static uint64_t rx_desc_base(E1000State *s)
}
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;
struct e1000_rx_desc desc;
......@@ -1185,7 +1185,7 @@ e1000_mmio_setup(E1000State *d)
}
static void
e1000_cleanup(VLANClientState *nc)
e1000_cleanup(NetClientState *nc)
{
E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -1201,7 +1201,7 @@ pci_e1000_uninit(PCIDevice *dev)
qemu_free_timer(d->autoneg_timer);
memory_region_destroy(&d->mmio);
memory_region_destroy(&d->io);
qemu_del_vlan_client(&d->nic->nc);
qemu_del_net_client(&d->nic->nc);
}
static NetClientInfo net_e1000_info = {
......
......@@ -1616,7 +1616,7 @@ static const MemoryRegionOps eepro100_ops = {
.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;
TRACE(RXTX, logout("%p\n", s));
......@@ -1626,7 +1626,7 @@ static int nic_can_receive(VLANClientState *nc)
#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:
* - 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;
......@@ -1847,7 +1847,7 @@ static void pci_nic_uninit(PCIDevice *pci_dev)
memory_region_destroy(&s->flash_bar);
vmstate_unregister(&pci_dev->qdev, s->vmstate, s);
eeprom93xx_free(&pci_dev->qdev, s->eeprom);
qemu_del_vlan_client(&s->nic->nc);
qemu_del_net_client(&s->nic->nc);
}
static NetClientInfo net_eepro100_info = {
......
......@@ -507,12 +507,12 @@ static int eth_match_groupaddr(struct fs_eth *eth, const unsigned char *sa)
return match;
}
static int eth_can_receive(VLANClientState *nc)
static int eth_can_receive(NetClientState *nc)
{
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 };
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;
}
static void eth_set_link(VLANClientState *nc)
static void eth_set_link(NetClientState *nc)
{
struct fs_eth *eth = DO_UPCAST(NICState, nc, nc)->opaque;
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;
......
......@@ -81,7 +81,7 @@ static void lan9215_init(uint32_t base, qemu_irq irq)
SysBusDevice *s;
/* This should be a 9215 but the 9118 is close enough */
if (nd_table[0].vlan) {
if (nd_table[0].used) {
qemu_check_nic_model(&nd_table[0], "lan9118");
dev = qdev_create(NULL, "lan9118");
qdev_set_nic_properties(dev, &nd_table[0]);
......
......@@ -284,7 +284,7 @@ static void highbank_init(ram_addr_t ram_size,
sysbus_create_simple("sysbus-ahci", 0xffe08000, pic[83]);
if (nd_table[0].vlan) {
if (nd_table[0].used) {
qemu_check_nic_model(&nd_table[0], "xgmac");
dev = qdev_create(NULL, "xgmac");
qdev_set_nic_properties(dev, &nd_table[0]);
......
......@@ -493,7 +493,7 @@ static void integratorcp_init(ram_addr_t ram_size,
sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
if (nd_table[0].vlan)
if (nd_table[0].used)
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
sysbus_create_simple("pl110", 0xc0000000, pic[22]);
......
......@@ -121,7 +121,7 @@ static void kzm_init(ram_addr_t ram_size,
imx_timerp_create(0x53f98000, qdev_get_gpio_in(dev, 27), ccm);
imx_timerg_create(0x53f90000, qdev_get_gpio_in(dev, 29), ccm);
if (nd_table[0].vlan) {
if (nd_table[0].used) {
lan9118_init(&nd_table[0], 0xb6000000, qdev_get_gpio_in(dev, 52));
}
......
......@@ -384,7 +384,7 @@ static void phy_update_link(lan9118_state *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);
}
......@@ -456,7 +456,7 @@ static void lan9118_reset(DeviceState *d)
lan9118_reload_eeprom(s);
}
static int lan9118_can_receive(VLANClientState *nc)
static int lan9118_can_receive(NetClientState *nc)
{
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)
{
lan9118_state *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -1304,7 +1304,7 @@ static const MemoryRegionOps lan9118_16bit_mem_ops = {
.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;
......
......@@ -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;
......
......@@ -236,7 +236,7 @@ static void mcf5208evb_init(ram_addr_t ram_size,
fprintf(stderr, "Too many NICs\n");
exit(1);
}
if (nd_table[0].vlan)
if (nd_table[0].used)
mcf_fec_init(address_space_mem, &nd_table[0],
0xfc030000, pic + 36);
......
......@@ -351,13 +351,13 @@ static void mcf_fec_write(void *opaque, target_phys_addr_t addr,
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;
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_bd bd;
......@@ -439,7 +439,7 @@ static const MemoryRegionOps mcf_fec_ops = {
.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;
......@@ -472,7 +472,6 @@ void mcf_fec_init(MemoryRegion *sysmem, NICInfo *nd,
memory_region_add_subregion(sysmem, base, &s->iomem);
s->conf.macaddr = nd->macaddr;
s->conf.vlan = nd->vlan;
s->conf.peer = nd->netdev;
s->nic = qemu_new_nic(&net_mcf_fec_info, &s->conf, nd->model, nd->name, s);
......
......@@ -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;
......@@ -408,7 +408,7 @@ static const MemoryRegionOps minimac2_ops = {
.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;
......@@ -422,7 +422,7 @@ static int minimac2_can_rx(VLANClientState *nc)
return 0;
}
static void minimac2_cleanup(VLANClientState *nc)
static void minimac2_cleanup(NetClientState *nc)
{
MilkymistMinimac2State *s = DO_UPCAST(NICState, nc, nc)->opaque;
......
......@@ -217,7 +217,7 @@ mips_mipssim_init (ram_addr_t ram_size,
if (serial_hds[0])
serial_init(0x3f8, env->irq[4], 115200, serial_hds[0]);
if (nd_table[0].vlan)
if (nd_table[0].used)
/* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */
mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
}
......
......@@ -283,7 +283,7 @@ void mips_r4k_init (ram_addr_t ram_size,
isa_vga_init(isa_bus);
if (nd_table[0].vlan)
if (nd_table[0].used)
isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]);
ide_drive_get(hd, MAX_IDE_BUS);
......
......@@ -62,7 +62,7 @@ static int mipsnet_buffer_full(MIPSnetState *s)
return 0;
}
static int mipsnet_can_receive(VLANClientState *nc)
static int mipsnet_can_receive(NetClientState *nc)
{
MIPSnetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -71,7 +71,7 @@ static int mipsnet_can_receive(VLANClientState *nc)
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;
......@@ -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;
......
......@@ -182,12 +182,12 @@ static void eth_rx_desc_get(uint32_t addr, mv88w8618_rx_desc *desc)
le32_to_cpus(&desc->next);
}
static int eth_can_receive(VLANClientState *nc)
static int eth_can_receive(NetClientState *nc)
{
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;
uint32_t desc_addr;
......@@ -366,7 +366,7 @@ static const MemoryRegionOps mv88w8618_eth_ops = {
.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;
......
......@@ -36,7 +36,7 @@ typedef struct ISANE2000State {
NE2000State ne2000;
} ISANE2000State;
static void isa_ne2000_cleanup(VLANClientState *nc)
static void isa_ne2000_cleanup(NetClientState *nc)
{
NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
......
......@@ -165,7 +165,7 @@ static int ne2000_buffer_full(NE2000State *s)
return 0;
}
int ne2000_can_receive(VLANClientState *nc)
int ne2000_can_receive(NetClientState *nc)
{
NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -176,7 +176,7 @@ int ne2000_can_receive(VLANClientState *nc)
#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;
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);
}
static void ne2000_cleanup(VLANClientState *nc)
static void ne2000_cleanup(NetClientState *nc)
{
NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
......@@ -750,7 +750,7 @@ static void pci_ne2000_exit(PCIDevice *pci_dev)
NE2000State *s = &d->ne2000;
memory_region_destroy(&s->io);
qemu_del_vlan_client(&s->nic->nc);
qemu_del_net_client(&s->nic->nc);
}
static Property ne2000_properties[] = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment