Miguel Di Ciurcio Filho <miguel.fi...@gmail.com> writes: > --- > hw/qdev-properties.c | 39 ------ > hw/qdev.c | 2 - > hw/qdev.h | 5 - > hw/xen_devconfig.c | 8 +- > hw/xen_nic.c | 1 - > net.c | 323 +++++-------------------------------------------- > net.h | 10 -- > net/slirp.c | 54 +++------ > net/slirp.h | 3 +- > net/tap.c | 9 +- > net/tap.h | 2 +- > net/vde.c | 8 +- > net/vde.h | 2 +- > qemu-common.h | 1 - > qemu-monitor.hx | 8 +- > 15 files changed, 69 insertions(+), 406 deletions(-) > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > index 7e3e99e..72ad229 100644 > --- a/hw/qdev-properties.c > +++ b/hw/qdev-properties.c > @@ -408,40 +408,6 @@ PropertyInfo qdev_prop_netdev = { > .print = print_netdev, > }; > > -/* --- vlan --- */ > - > -static int parse_vlan(DeviceState *dev, Property *prop, const char *str) > -{ > - VLANState **ptr = qdev_get_prop_ptr(dev, prop); > - int id; > - > - if (sscanf(str, "%d", &id) != 1) > - return -EINVAL; > - *ptr = qemu_find_vlan(id, 1); > - if (*ptr == NULL) > - return -ENOENT; > - return 0; > -} > - > -static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t > len) > -{ > - VLANState **ptr = qdev_get_prop_ptr(dev, prop); > - > - if (*ptr) { > - return snprintf(dest, len, "%d", (*ptr)->id); > - } else { > - return snprintf(dest, len, "<null>"); > - } > -} > - > -PropertyInfo qdev_prop_vlan = { > - .name = "vlan", > - .type = PROP_TYPE_VLAN, > - .size = sizeof(VLANClientState*), > - .parse = parse_vlan, > - .print = print_vlan, > -}; > - > /* --- pointer --- */ > > /* Not a proper property, just for dirty hacks. TODO Remove it! */ > @@ -695,11 +661,6 @@ void qdev_prop_set_netdev(DeviceState *dev, const char > *name, VLANClientState *v > qdev_prop_set(dev, name, &value, PROP_TYPE_NETDEV); > } > > -void qdev_prop_set_vlan(DeviceState *dev, const char *name, VLANState *value) > -{ > - qdev_prop_set(dev, name, &value, PROP_TYPE_VLAN); > -} > - > void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t > *value) > { > qdev_prop_set(dev, name, value, PROP_TYPE_MACADDR); > diff --git a/hw/qdev.c b/hw/qdev.c > index e99c73f..c139952 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -412,8 +412,6 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, > qemu_irq pin) > void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) > { > qdev_prop_set_macaddr(dev, "mac", nd->macaddr); > - if (nd->vlan) > - qdev_prop_set_vlan(dev, "vlan", nd->vlan); > if (nd->netdev) > qdev_prop_set_netdev(dev, "netdev", nd->netdev); > if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && > diff --git a/hw/qdev.h b/hw/qdev.h > index 3e22eec..f775d7c 100644 > --- a/hw/qdev.h > +++ b/hw/qdev.h > @@ -90,7 +90,6 @@ enum PropertyType { > PROP_TYPE_CHR, > PROP_TYPE_STRING, > PROP_TYPE_NETDEV, > - PROP_TYPE_VLAN, > PROP_TYPE_PTR, > PROP_TYPE_BIT, > }; > @@ -204,7 +203,6 @@ extern PropertyInfo qdev_prop_ptr; > extern PropertyInfo qdev_prop_macaddr; > extern PropertyInfo qdev_prop_drive; > extern PropertyInfo qdev_prop_netdev; > -extern PropertyInfo qdev_prop_vlan; > extern PropertyInfo qdev_prop_pci_devfn; > > #define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ > @@ -254,8 +252,6 @@ extern PropertyInfo qdev_prop_pci_devfn; > DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) > #define DEFINE_PROP_NETDEV(_n, _s, _f) \ > DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, VLANClientState*) > -#define DEFINE_PROP_VLAN(_n, _s, _f) \ > - DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, VLANState*) > #define DEFINE_PROP_DRIVE(_n, _s, _f) \ > DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockDriverState *) > #define DEFINE_PROP_MACADDR(_n, _s, _f) \ > @@ -277,7 +273,6 @@ void qdev_prop_set_uint64(DeviceState *dev, const char > *name, uint64_t value); > void qdev_prop_set_string(DeviceState *dev, const char *name, char *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_vlan(DeviceState *dev, const char *name, VLANState > *value); > 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_macaddr(DeviceState *dev, const char *name, uint8_t > *value); > diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c > index ea8f8c4..f395d01 100644 > --- a/hw/xen_devconfig.c > +++ b/hw/xen_devconfig.c > @@ -126,15 +126,15 @@ int xen_config_dev_nic(NICInfo *nic) > snprintf(mac, sizeof(mac), "%02x:%02x:%02x:%02x:%02x:%02x", > nic->macaddr[0], nic->macaddr[1], nic->macaddr[2], > nic->macaddr[3], nic->macaddr[4], nic->macaddr[5]); > - xen_be_printf(NULL, 1, "config nic %d: mac=\"%s\"\n", nic->vlan->id, > mac); > - xen_config_dev_dirs("vif", "qnic", nic->vlan->id, fe, be, sizeof(fe)); > + xen_be_printf(NULL, 1, "config nic: mac=\"%s\"\n", mac); > + xen_config_dev_dirs("vif", "qnic", 0, fe, be, sizeof(fe)); > > /* frontend */ > - xenstore_write_int(fe, "handle", nic->vlan->id); > + xenstore_write_int(fe, "handle", 0); > xenstore_write_str(fe, "mac", mac); > > /* backend */ > - xenstore_write_int(be, "handle", nic->vlan->id); > + xenstore_write_int(be, "handle", 0); > xenstore_write_str(be, "mac", mac); > > /* common stuff */ > diff --git a/hw/xen_nic.c b/hw/xen_nic.c > index 08055b8..bd18191 100644 > --- a/hw/xen_nic.c > +++ b/hw/xen_nic.c > @@ -312,7 +312,6 @@ static int net_init(struct XenDevice *xendev) > if (net_parse_macaddr(netdev->conf.macaddr.a, netdev->mac) < 0) > return -1; > > - netdev->conf.vlan = qemu_find_vlan(netdev->xendev.dev, 1); > netdev->conf.peer = NULL; > > netdev->nic = qemu_new_nic(&net_xen_info, &netdev->conf,
Looks like xen_devconfig.c and xen_nic.c haven't been updated for netdev, and therefore won't work without VLANs. Should that matter, somebody who cares will fix it. > diff --git a/net.c b/net.c > index 2c1c50f..9024a00 100644 > --- a/net.c > +++ b/net.c > @@ -35,7 +35,6 @@ > #include "qemu_socket.h" > #include "hw/qdev.h" > > -static QTAILQ_HEAD(, VLANState) vlans; > static QTAILQ_HEAD(, VLANClientState) non_vlan_clients; > > int default_net = 1; > @@ -188,17 +187,13 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr) > > static char *assign_name(VLANClientState *vc1, const char *model) > { > - VLANState *vlan; > char buf[256]; > int id = 0; > + VLANClientState *vc; > > - QTAILQ_FOREACH(vlan, &vlans, next) { > - VLANClientState *vc; > - > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - if (vc != vc1 && strcmp(vc->model, model) == 0) { > - id++; > - } > + QTAILQ_FOREACH(vc, &non_vlan_clients, next) { > + if (vc != vc1 && strcmp(vc->model, model) == 0) { > + id++; > } > } > No. The current code conjures up names for VLANs only. You remove VLANs, so that goes away. But here you *add* it for non-VLAN clients. Even if that's useful (which I doubt), it needs to be a separate patch. > @@ -219,7 +214,6 @@ static ssize_t qemu_deliver_packet_iov(VLANClientState > *sender, > void *opaque); > > VLANClientState *qemu_new_net_client(NetClientInfo *info, > - VLANState *vlan, > VLANClientState *peer, > const char *model, > const char *name) > @@ -238,23 +232,17 @@ VLANClientState *qemu_new_net_client(NetClientInfo > *info, > vc->name = assign_name(vc, model); > } > > - if (vlan) { > - assert(!peer); > - vc->vlan = vlan; > - QTAILQ_INSERT_TAIL(&vc->vlan->clients, vc, next); > - } else { > - if (peer) { > - assert(!peer->peer); > - vc->peer = peer; > - peer->peer = vc; > - } > - QTAILQ_INSERT_TAIL(&non_vlan_clients, vc, next); > - > - vc->send_queue = qemu_new_net_queue(qemu_deliver_packet, > - qemu_deliver_packet_iov, > - vc); > + if (peer) { > + assert(!peer->peer); > + vc->peer = peer; > + peer->peer = vc; > } > > + QTAILQ_INSERT_TAIL(&non_vlan_clients, vc, next); > + > + vc->send_queue = qemu_new_net_queue(qemu_deliver_packet, > + qemu_deliver_packet_iov, > + vc); > return vc; > } > > @@ -270,7 +258,7 @@ NICState *qemu_new_nic(NetClientInfo *info, > assert(info->type == NET_CLIENT_TYPE_NIC); > assert(info->size >= sizeof(NICState)); > > - nc = qemu_new_net_client(info, conf->vlan, conf->peer, model, name); > + nc = qemu_new_net_client(info, conf->peer, model, name); > > nic = DO_UPCAST(NICState, nc, nc); > nic->conf = conf; > @@ -281,16 +269,12 @@ NICState *qemu_new_nic(NetClientInfo *info, > > void qemu_del_vlan_client(VLANClientState *vc) > { > - if (vc->vlan) { > - QTAILQ_REMOVE(&vc->vlan->clients, vc, next); > - } else { > - if (vc->send_queue) { > - qemu_del_net_queue(vc->send_queue); > - } > - QTAILQ_REMOVE(&non_vlan_clients, vc, next); > - if (vc->peer) { > - vc->peer->peer = NULL; > - } > + if (vc->send_queue) { > + qemu_del_net_queue(vc->send_queue); > + } > + QTAILQ_REMOVE(&non_vlan_clients, vc, next); > + if (vc->peer) { > + vc->peer->peer = NULL; > } > > if (vc->info->cleanup) { > @@ -302,57 +286,19 @@ void qemu_del_vlan_client(VLANClientState *vc) > qemu_free(vc); > } > > -VLANClientState * > -qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id, > - const char *client_str) > -{ > - VLANState *vlan; > - VLANClientState *vc; > - > - vlan = qemu_find_vlan(vlan_id, 0); > - if (!vlan) { > - monitor_printf(mon, "unknown VLAN %d\n", vlan_id); > - return NULL; > - } > - > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - if (!strcmp(vc->name, client_str)) { > - break; > - } > - } > - if (!vc) { > - monitor_printf(mon, "can't find device %s on VLAN %d\n", > - client_str, vlan_id); > - } > - > - return vc; > -} > - > void qemu_foreach_nic(qemu_nic_foreach func, void *opaque) > { > VLANClientState *nc; > - VLANState *vlan; > > QTAILQ_FOREACH(nc, &non_vlan_clients, next) { > if (nc->info->type == NET_CLIENT_TYPE_NIC) { > func(DO_UPCAST(NICState, nc, nc), opaque); > } > } > - > - QTAILQ_FOREACH(vlan, &vlans, next) { > - QTAILQ_FOREACH(nc, &vlan->clients, next) { > - if (nc->info->type == NET_CLIENT_TYPE_NIC) { > - func(DO_UPCAST(NICState, nc, nc), opaque); > - } > - } > - } > } > > int qemu_can_send_packet(VLANClientState *sender) > { > - VLANState *vlan = sender->vlan; > - VLANClientState *vc; > - > if (sender->peer) { > if (sender->peer->receive_disabled) { > return 0; > @@ -364,20 +310,6 @@ int qemu_can_send_packet(VLANClientState *sender) > } > } > > - if (!sender->vlan) { > - return 1; > - } > - > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - if (vc == sender) { > - continue; > - } > - > - /* no can_receive() handler, they can always receive */ > - if (!vc->info->can_receive || vc->info->can_receive(vc)) { > - return 1; > - } > - } > return 0; > } > Doesn't this change the return value for a NIC not connected to a backend from 1 to 0? > @@ -411,63 +343,15 @@ static ssize_t qemu_deliver_packet(VLANClientState > *sender, > return ret; > } > > -static ssize_t qemu_vlan_deliver_packet(VLANClientState *sender, > - unsigned flags, > - const uint8_t *buf, > - size_t size, > - void *opaque) > -{ > - VLANState *vlan = opaque; > - VLANClientState *vc; > - ssize_t ret = -1; > - > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - ssize_t len; > - > - if (vc == sender) { > - continue; > - } > - > - if (vc->link_down) { > - ret = size; > - continue; > - } > - > - if (vc->receive_disabled) { > - ret = 0; > - continue; > - } > - > - if (flags & QEMU_NET_PACKET_FLAG_RAW && vc->info->receive_raw) { > - len = vc->info->receive_raw(vc, buf, size); > - } else { > - len = vc->info->receive(vc, buf, size); > - } > - > - if (len == 0) { > - vc->receive_disabled = 1; > - } > - > - ret = (ret >= 0) ? ret : len; > - > - } > - > - return ret; > -} > - > void qemu_purge_queued_packets(VLANClientState *vc) > { > NetQueue *queue; > > - if (!vc->peer && !vc->vlan) { > + if (!vc->peer) { > return; > } > > - if (vc->peer) { > - queue = vc->peer->send_queue; > - } else { > - queue = vc->vlan->send_queue; > - } > + queue = vc->peer->send_queue; > > qemu_net_queue_purge(queue, vc); > } > @@ -478,11 +362,7 @@ void qemu_flush_queued_packets(VLANClientState *vc) > > vc->receive_disabled = 0; > > - if (vc->vlan) { > - queue = vc->vlan->send_queue; > - } else { > - queue = vc->send_queue; > - } > + queue = vc->send_queue; > > qemu_net_queue_flush(queue); > } > @@ -499,14 +379,12 @@ static ssize_t > qemu_send_packet_async_with_flags(VLANClientState *sender, > hex_dump(stdout, buf, size); > #endif > > - if (sender->link_down || (!sender->peer && !sender->vlan)) { > + if (sender->link_down || !sender->peer) { > return size; > } > > if (sender->peer) { > queue = sender->peer->send_queue; > - } else { > - queue = sender->vlan->send_queue; > } > > return qemu_net_queue_send(queue, sender, flags, buf, size, sent_cb); > @@ -578,56 +456,18 @@ static ssize_t qemu_deliver_packet_iov(VLANClientState > *sender, > } > } > > -static ssize_t qemu_vlan_deliver_packet_iov(VLANClientState *sender, > - unsigned flags, > - const struct iovec *iov, > - int iovcnt, > - void *opaque) > -{ > - VLANState *vlan = opaque; > - VLANClientState *vc; > - ssize_t ret = -1; > - > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - ssize_t len; > - > - if (vc == sender) { > - continue; > - } > - > - if (vc->link_down) { > - ret = calc_iov_length(iov, iovcnt); > - continue; > - } > - > - assert(!(flags & QEMU_NET_PACKET_FLAG_RAW)); > - > - if (vc->info->receive_iov) { > - len = vc->info->receive_iov(vc, iov, iovcnt); > - } else { > - len = vc_sendv_compat(vc, iov, iovcnt); > - } > - > - ret = (ret >= 0) ? ret : len; > - } > - > - return ret; > -} > - > ssize_t qemu_sendv_packet_async(VLANClientState *sender, > const struct iovec *iov, int iovcnt, > NetPacketSent *sent_cb) > { > NetQueue *queue; > > - if (sender->link_down || (!sender->peer && !sender->vlan)) { > + if (sender->link_down || !sender->peer) { > return calc_iov_length(iov, iovcnt); > } > > if (sender->peer) { > queue = sender->peer->send_queue; > - } else { > - queue = sender->vlan->send_queue; > } > > return qemu_net_queue_send_iov(queue, sender, > @@ -641,34 +481,6 @@ qemu_sendv_packet(VLANClientState *vc, const struct > iovec *iov, int iovcnt) > return qemu_sendv_packet_async(vc, iov, iovcnt, NULL); > } > > -/* find or alloc a new VLAN */ > -VLANState *qemu_find_vlan(int id, int allocate) > -{ > - VLANState *vlan; > - > - QTAILQ_FOREACH(vlan, &vlans, next) { > - if (vlan->id == id) { > - return vlan; > - } > - } > - > - if (!allocate) { > - return NULL; > - } > - > - vlan = qemu_mallocz(sizeof(VLANState)); > - vlan->id = id; > - QTAILQ_INIT(&vlan->clients); > - > - vlan->send_queue = qemu_new_net_queue(qemu_vlan_deliver_packet, > - qemu_vlan_deliver_packet_iov, > - vlan); > - > - QTAILQ_INSERT_TAIL(&vlans, vlan, next); > - > - return vlan; > -} > - > VLANClientState *qemu_find_netdev(const char *id) > { > VLANClientState *vc; > @@ -754,8 +566,7 @@ int net_handle_fd_param(Monitor *mon, const char *param) > > static int net_init_nic(QemuOpts *opts, > Monitor *mon, > - const char *name, > - VLANState *vlan) > + const char *name) > { > int idx; > NICInfo *nd; > @@ -777,10 +588,8 @@ static int net_init_nic(QemuOpts *opts, > error_report("netdev '%s' not found", netdev); > return -1; > } > - } else { > - assert(vlan); > - nd->vlan = vlan; > } > + > if (name) { > nd->name = qemu_strdup(name); > } > @@ -824,10 +633,6 @@ static int net_init_nic(QemuOpts *opts, > .type = QEMU_OPT_STRING, \ > .help = "net client type (nic, tap etc.)", \ > }, { \ > - .name = "vlan", \ > - .type = QEMU_OPT_NUMBER, \ > - .help = "vlan number", \ > - }, { \ > .name = "name", \ > .type = QEMU_OPT_STRING, \ > .help = "identifier for monitor commands", \ > @@ -835,8 +640,7 @@ static int net_init_nic(QemuOpts *opts, > > typedef int (*net_client_init_func)(QemuOpts *opts, > Monitor *mon, > - const char *name, > - VLANState *vlan); > + const char *name); > > /* magic number, but compiler will warn if too small */ > #define NET_MAX_DESC 20 > @@ -1013,7 +817,6 @@ static const struct { > }, > #endif > }, > - { /* end of list */ } > }; > > int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev) Unwanted patch hunk. > @@ -1034,18 +837,14 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int > is_netdev) > strcmp(type, "user") != 0 && > #endif > #ifdef CONFIG_VDE > - strcmp(type, "vde") != 0 && > + strcmp(type, "vde") != 0 > #endif > - strcmp(type, "socket") != 0) { > + ) { This belongs to the socket & dump removal patch. > qerror_report(QERR_INVALID_PARAMETER_VALUE, "type", > "a netdev backend type"); > return -1; > } > > - if (qemu_opt_get(opts, "vlan")) { > - qerror_report(QERR_INVALID_PARAMETER, "vlan"); > - return -1; > - } > if (qemu_opt_get(opts, "name")) { > qerror_report(QERR_INVALID_PARAMETER, "name"); > return -1; > @@ -1063,23 +862,15 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int > is_netdev) > > for (i = 0; net_client_types[i].type != NULL; i++) { > if (!strcmp(net_client_types[i].type, type)) { > - VLANState *vlan = NULL; > int ret; > > if (qemu_opts_validate(opts, &net_client_types[i].desc[0]) == > -1) { > return -1; > } > > - /* Do not add to a vlan if it's a -netdev or a nic with a > - * netdev= parameter. */ > - if (!(is_netdev || > - (strcmp(type, "nic") == 0 && qemu_opt_get(opts, > "netdev")))) { > - vlan = qemu_find_vlan(qemu_opt_get_number(opts, "vlan", 0), > 1); > - } > - > ret = 0; > if (net_client_types[i].init) { > - ret = net_client_types[i].init(opts, mon, name, vlan); > + ret = net_client_types[i].init(opts, mon, name); > if (ret < 0) { > /* TODO push error reporting into init() methods */ > qerror_report(QERR_DEVICE_INIT_FAILED, type); > @@ -1130,17 +921,10 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, > QObject **ret_data) > > void do_info_network(Monitor *mon) > { > - VLANState *vlan; > VLANClientState *vc; > > - QTAILQ_FOREACH(vlan, &vlans, next) { > - monitor_printf(mon, "VLAN %d devices:\n", vlan->id); > + monitor_printf(mon, "Network devices:\n"); > > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - monitor_printf(mon, " %s: %s\n", vc->name, vc->info_str); > - } > - } > - monitor_printf(mon, "Devices not on any VLAN:\n"); > QTAILQ_FOREACH(vc, &non_vlan_clients, next) { > monitor_printf(mon, " %s: %s", vc->name, vc->info_str); > if (vc->peer) { > @@ -1152,20 +936,11 @@ void do_info_network(Monitor *mon) > > int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data) > { > - VLANState *vlan; > VLANClientState *vc = NULL; > const char *name = qdict_get_str(qdict, "name"); > int up = qdict_get_bool(qdict, "up"); > > - QTAILQ_FOREACH(vlan, &vlans, next) { > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - if (strcmp(vc->name, name) == 0) { > - goto done; > - } > - } > - } > vc = qemu_find_netdev(name); > -done: > > if (!vc) { > qerror_report(QERR_DEVICE_NOT_FOUND, name); > @@ -1182,15 +957,8 @@ done: > > void net_cleanup(void) > { > - VLANState *vlan; > VLANClientState *vc, *next_vc; > > - QTAILQ_FOREACH(vlan, &vlans, next) { > - QTAILQ_FOREACH_SAFE(vc, &vlan->clients, next, next_vc) { > - qemu_del_vlan_client(vc); > - } > - } > - > QTAILQ_FOREACH_SAFE(vc, &non_vlan_clients, next, next_vc) { > qemu_del_vlan_client(vc); > } > @@ -1198,32 +966,8 @@ void net_cleanup(void) > > void net_check_clients(void) > { > - VLANState *vlan; > VLANClientState *vc; > - int has_nic = 0, has_host_dev = 0; > - > - QTAILQ_FOREACH(vlan, &vlans, next) { > - QTAILQ_FOREACH(vc, &vlan->clients, next) { > - switch (vc->info->type) { > - case NET_CLIENT_TYPE_NIC: > - has_nic = 1; > - break; > - case NET_CLIENT_TYPE_SLIRP: > - case NET_CLIENT_TYPE_TAP: > - case NET_CLIENT_TYPE_SOCKET: > - case NET_CLIENT_TYPE_VDE: > - has_host_dev = 1; > - break; > - default: ; > - } > - } > - if (has_host_dev && !has_nic) > - fprintf(stderr, "Warning: vlan %d with no nics\n", vlan->id); > - if (has_nic && !has_host_dev) > - fprintf(stderr, > - "Warning: vlan %d is not connected to host network\n", > - vlan->id); > - } > + > QTAILQ_FOREACH(vc, &non_vlan_clients, next) { > if (!vc->peer) { > fprintf(stderr, "Warning: %s %s has no peer\n", > @@ -1255,7 +999,6 @@ int net_init_clients(void) > #endif > } > > - QTAILQ_INIT(&vlans); > QTAILQ_INIT(&non_vlan_clients); > > if (qemu_opts_foreach(&qemu_netdev_opts, net_init_netdev, NULL, 1) == -1) > diff --git a/net.h b/net.h > index b3c5ca3..ec26ae9 100644 > --- a/net.h > +++ b/net.h > @@ -15,13 +15,11 @@ struct MACAddr { > > typedef struct NICConf { > MACAddr macaddr; > - VLANState *vlan; > VLANClientState *peer; > } NICConf; > > #define DEFINE_NIC_PROPERTIES(_state, _conf) \ > DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ > - DEFINE_PROP_VLAN("vlan", _state, _conf.vlan), \ > DEFINE_PROP_NETDEV("netdev", _state, _conf.peer) > > /* VLANs support */ > @@ -31,9 +29,7 @@ typedef enum { > NET_CLIENT_TYPE_NIC, > NET_CLIENT_TYPE_SLIRP, > NET_CLIENT_TYPE_TAP, > - NET_CLIENT_TYPE_SOCKET, > NET_CLIENT_TYPE_VDE, > - NET_CLIENT_TYPE_DUMP > } net_client_type; > > typedef void (NetPoll)(VLANClientState *, bool enable); This belongs to the socket & dump removal patch. > @@ -59,7 +55,6 @@ struct VLANClientState { > NetClientInfo *info; > int link_down; > QTAILQ_ENTRY(VLANClientState) next; > - struct VLANState *vlan; > VLANClientState *peer; > NetQueue *send_queue; > char *model; > @@ -81,10 +76,8 @@ struct VLANState { > NetQueue *send_queue; > }; > > -VLANState *qemu_find_vlan(int id, int allocate); > VLANClientState *qemu_find_netdev(const char *id); > VLANClientState *qemu_new_net_client(NetClientInfo *info, > - VLANState *vlan, > VLANClientState *peer, > const char *model, > const char *name); > @@ -94,8 +87,6 @@ NICState *qemu_new_nic(NetClientInfo *info, > const char *name, > void *opaque); > void qemu_del_vlan_client(VLANClientState *vc); > -VLANClientState *qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id, > - const char *client_str); > typedef void (*qemu_nic_foreach)(NICState *nic, void *opaque); > void qemu_foreach_nic(qemu_nic_foreach func, void *opaque); > int qemu_can_send_packet(VLANClientState *vc); > @@ -128,7 +119,6 @@ struct NICInfo { > char *model; > char *name; > char *devaddr; > - VLANState *vlan; > VLANClientState *netdev; > int used; > int nvectors; > diff --git a/net/slirp.c b/net/slirp.c > index b41c60a..46b64e1 100644 > --- a/net/slirp.c > +++ b/net/slirp.c > @@ -135,7 +135,7 @@ static NetClientInfo net_slirp_info = { > .cleanup = net_slirp_cleanup, > }; > > -static int net_slirp_init(VLANState *vlan, const char *model, > +static int net_slirp_init(const char *model, > const char *name, int restricted, > const char *vnetwork, const char *vhost, > const char *vhostname, const char *tftp_export, > @@ -238,7 +238,7 @@ static int net_slirp_init(VLANState *vlan, const char > *model, > } > #endif > > - nc = qemu_new_net_client(&net_slirp_info, vlan, NULL, model, name); > + nc = qemu_new_net_client(&net_slirp_info, NULL, model, name); > > snprintf(nc->info_str, sizeof(nc->info_str), > "net=%s, restricted=%c", inet_ntoa(net), restricted ? 'y' : > 'n'); > @@ -277,28 +277,14 @@ error: > return -1; > } > > -static SlirpState *slirp_lookup(Monitor *mon, const char *vlan, > - const char *stack) > +static SlirpState *slirp_lookup(Monitor *mon, const char *stack) > { > > - if (vlan) { > - VLANClientState *nc; > - nc = qemu_find_vlan_client_by_name(mon, strtol(vlan, NULL, 0), > stack); > - if (!nc) { > - return NULL; > - } > - if (strcmp(nc->model, "user")) { > - monitor_printf(mon, "invalid device specified\n"); > - return NULL; > - } > - return DO_UPCAST(SlirpState, nc, nc); > - } else { > - if (QTAILQ_EMPTY(&slirp_stacks)) { > - monitor_printf(mon, "user mode network stack not in use\n"); > - return NULL; > - } > - return QTAILQ_FIRST(&slirp_stacks); > + if (QTAILQ_EMPTY(&slirp_stacks)) { > + monitor_printf(mon, "user mode network stack not in use\n"); > + return NULL; > } > + return QTAILQ_FIRST(&slirp_stacks); > } Parameter stack is not used anymore. > > void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict) > @@ -312,13 +298,12 @@ void net_slirp_hostfwd_remove(Monitor *mon, const QDict > *qdict) > int err; > const char *arg1 = qdict_get_str(qdict, "arg1"); > const char *arg2 = qdict_get_try_str(qdict, "arg2"); > - const char *arg3 = qdict_get_try_str(qdict, "arg3"); > > - if (arg2) { > - s = slirp_lookup(mon, arg1, arg2); > - src_str = arg3; > + if (arg1) { > + s = slirp_lookup(mon, arg1); > + src_str = arg2; > } else { > - s = slirp_lookup(mon, NULL, NULL); > + s = slirp_lookup(mon, NULL); > src_str = arg1; > } > if (!s) { Because of that, the optional name argument is now useless, too. > @@ -430,13 +415,12 @@ void net_slirp_hostfwd_add(Monitor *mon, const QDict > *qdict) > SlirpState *s; > const char *arg1 = qdict_get_str(qdict, "arg1"); > const char *arg2 = qdict_get_try_str(qdict, "arg2"); > - const char *arg3 = qdict_get_try_str(qdict, "arg3"); > > - if (arg2) { > - s = slirp_lookup(mon, arg1, arg2); > - redir_str = arg3; > + if (arg1) { > + s = slirp_lookup(mon, arg1); > + redir_str = arg2; > } else { > - s = slirp_lookup(mon, NULL, NULL); > + s = slirp_lookup(mon, NULL); > redir_str = arg1; > } > if (s) { Same here. > @@ -647,9 +631,6 @@ void do_info_usernet(Monitor *mon) > SlirpState *s; > > QTAILQ_FOREACH(s, &slirp_stacks, entry) { > - monitor_printf(mon, "VLAN %d (%s):\n", > - s->nc.vlan ? s->nc.vlan->id : -1, > - s->nc.name); > slirp_connection_info(s->slirp, mon); > } > } > @@ -678,8 +659,7 @@ static int net_init_slirp_configs(const char *name, const > char *value, void *opa > > int net_init_slirp(QemuOpts *opts, > Monitor *mon, > - const char *name, > - VLANState *vlan) > + const char *name) > { > struct slirp_config_str *config; > const char *vhost; > @@ -728,7 +708,7 @@ int net_init_slirp(QemuOpts *opts, > > qemu_opt_foreach(opts, net_init_slirp_configs, NULL, 0); > > - ret = net_slirp_init(vlan, "user", name, restricted, vnet, vhost, > + ret = net_slirp_init("user", name, restricted, vnet, vhost, > vhostname, tftp_export, bootfile, vdhcp_start, > vnamesrv, smb_export, vsmbsrv); > > diff --git a/net/slirp.h b/net/slirp.h > index c17de8e..520fc70 100644 > --- a/net/slirp.h > +++ b/net/slirp.h > @@ -32,8 +32,7 @@ > > int net_init_slirp(QemuOpts *opts, > Monitor *mon, > - const char *name, > - VLANState *vlan); > + const char *name); > > void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict); > void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict); > diff --git a/net/tap.c b/net/tap.c > index 0147dab..65bbf39 100644 > --- a/net/tap.c > +++ b/net/tap.c > @@ -296,8 +296,7 @@ static NetClientInfo net_tap_info = { > .cleanup = tap_cleanup, > }; > > -static TAPState *net_tap_fd_init(VLANState *vlan, > - const char *model, > +static TAPState *net_tap_fd_init(const char *model, > const char *name, > int fd, > int vnet_hdr) > @@ -305,7 +304,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, > VLANClientState *nc; > TAPState *s; > > - nc = qemu_new_net_client(&net_tap_info, vlan, NULL, model, name); > + nc = qemu_new_net_client(&net_tap_info, NULL, model, name); > > s = DO_UPCAST(TAPState, nc, nc); > > @@ -399,7 +398,7 @@ static int net_tap_init(QemuOpts *opts, int *vnet_hdr) > return fd; > } > > -int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState > *vlan) > +int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name) > { > TAPState *s; > int fd, vnet_hdr = 0; > @@ -436,7 +435,7 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char > *name, VLANState *vlan > } > } > > - s = net_tap_fd_init(vlan, "tap", name, fd, vnet_hdr); > + s = net_tap_fd_init("tap", name, fd, vnet_hdr); > if (!s) { > close(fd); > return -1; > diff --git a/net/tap.h b/net/tap.h > index b8cec83..48b0cec 100644 > --- a/net/tap.h > +++ b/net/tap.h > @@ -32,7 +32,7 @@ > #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" > #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" > > -int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState > *vlan); > +int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name); > > int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int > vnet_hdr_required); > > diff --git a/net/vde.c b/net/vde.c > index 0b46fa6..c8b06ac 100644 > --- a/net/vde.c > +++ b/net/vde.c > @@ -76,7 +76,7 @@ static NetClientInfo net_vde_info = { > .cleanup = vde_cleanup, > }; > > -static int net_vde_init(VLANState *vlan, const char *model, > +static int net_vde_init(const char *model, > const char *name, const char *sock, > int port, const char *group, int mode) > { > @@ -97,7 +97,7 @@ static int net_vde_init(VLANState *vlan, const char *model, > return -1; > } > > - nc = qemu_new_net_client(&net_vde_info, vlan, NULL, model, name); > + nc = qemu_new_net_client(&net_vde_info, NULL, model, name); > > snprintf(nc->info_str, sizeof(nc->info_str), "sock=%s,fd=%d", > sock, vde_datafd(vde)); > @@ -111,7 +111,7 @@ static int net_vde_init(VLANState *vlan, const char > *model, > return 0; > } > > -int net_init_vde(QemuOpts *opts, Monitor *mon, const char *name, VLANState > *vlan) > +int net_init_vde(QemuOpts *opts, Monitor *mon, const char *name) > { > const char *sock; > const char *group; > @@ -123,7 +123,7 @@ int net_init_vde(QemuOpts *opts, Monitor *mon, const char > *name, VLANState *vlan > port = qemu_opt_get_number(opts, "port", 0); > mode = qemu_opt_get_number(opts, "mode", 0700); > > - if (net_vde_init(vlan, "vde", name, sock, port, group, mode) == -1) { > + if (net_vde_init("vde", name, sock, port, group, mode) == -1) { > return -1; > } > > diff --git a/net/vde.h b/net/vde.h > index 3e6ca3e..b2f8dca 100644 > --- a/net/vde.h > +++ b/net/vde.h > @@ -29,7 +29,7 @@ > > #ifdef CONFIG_VDE > > -int net_init_vde(QemuOpts *opts, Monitor *mon, const char *name, VLANState > *vlan); > +int net_init_vde(QemuOpts *opts, Monitor *mon, const char *name); > > #endif /* CONFIG_VDE */ > > diff --git a/qemu-common.h b/qemu-common.h > index 3fb2f0b..34dc90e 100644 > --- a/qemu-common.h > +++ b/qemu-common.h > @@ -210,7 +210,6 @@ typedef struct TextConsole TextConsole; > typedef TextConsole QEMUConsole; > typedef struct CharDriverState CharDriverState; > typedef struct MACAddr MACAddr; > -typedef struct VLANState VLANState; > typedef struct VLANClientState VLANClientState; > typedef struct i2c_bus i2c_bus; > typedef struct i2c_slave i2c_slave; > diff --git a/qemu-monitor.hx b/qemu-monitor.hx > index 275f3bc..e2c2a75 100644 > --- a/qemu-monitor.hx > +++ b/qemu-monitor.hx > @@ -1224,8 +1224,8 @@ EQMP > #ifdef CONFIG_SLIRP > { > .name = "hostfwd_add", > - .args_type = "arg1:s,arg2:s?,arg3:s?", > - .params = "[vlan_id name] > [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport", > + .args_type = "arg1:s,arg2:s?", > + .params = "[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport", > .help = "redirect TCP or UDP connections from host to guest > (requires -net user)", > .mhandler.cmd = net_slirp_hostfwd_add, > }, params is inconsistent with args_type and net_slirp_hostfwd_add(). > @@ -1239,8 +1239,8 @@ ETEXI > #ifdef CONFIG_SLIRP > { > .name = "hostfwd_remove", > - .args_type = "arg1:s,arg2:s?,arg3:s?", > - .params = "[vlan_id name] [tcp|udp]:[hostaddr]:hostport", > + .args_type = "arg1:s,arg2:s?", > + .params = "[tcp|udp]:[hostaddr]:hostport", > .help = "remove host-to-guest TCP or UDP redirection", > .mhandler.cmd = net_slirp_hostfwd_remove, > }, Same here.