Move public headers to include/net, and leave private headers in net/.
Put the virtio headers in include/net/tap.h, removing the multiple copies
that existed. Leave include/net/tap.h as the interface for NICs, and
net/tap_int.h as the interface for OS-specific parts of the tap backend.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
*/
#include "hmp.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-char.h"
#include "qemu-option.h"
#include "qemu-timer.h"
*/
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "flash.h"
#include "boards.h"
#include "etraxfs.h"
#include <zlib.h> /* For crc32 */
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "net/checksum.h"
#ifdef CADENCE_GEM_ERR_DEBUG
#include "hw.h"
#include "qemu-timer.h"
-#include "net.h"
+#include "net/net.h"
#include "mips.h"
//#define DEBUG_SONIC
#include "hw.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "net/checksum.h"
#include "loader.h"
#include "sysemu.h"
#include <stddef.h> /* offsetof */
#include "hw.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "eeprom93xx.h"
#include "sysemu.h"
#include "dma.h"
* THE SOFTWARE.
*/
-#include "net.h"
+#include "net/net.h"
#include "etraxfs_dma.h"
qemu_irq *cris_pic_init_cpu(CPUCRISState *env);
#include <stdio.h>
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "etraxfs.h"
#define D(x)
#include "sysemu.h"
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "arm-misc.h"
#include "exec-memory.h"
#include "exynos4210.h"
#include "hw.h"
#include "pxa.h"
-#include "net.h"
+#include "net/net.h"
#include "flash.h"
#include "devices.h"
#include "boards.h"
#include "arm-misc.h"
#include "devices.h"
#include "loader.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "sysbus.h"
#include "devices.h"
#include "boards.h"
#include "arm-misc.h"
-#include "net.h"
+#include "net/net.h"
#include "exec-memory.h"
#include "sysemu.h"
#include "hw.h"
#include "arm-misc.h"
#include "devices.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "serial.h"
*/
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "devices.h"
#include "sysemu.h"
#include "ptimer.h"
*/
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-timer.h"
#include "qemu_socket.h"
#include "sun4m.h"
#include "hw.h"
#include "pxa.h"
#include "arm-misc.h"
-#include "net.h"
+#include "net/net.h"
#include "devices.h"
#include "boards.h"
#include "flash.h"
#include "qemu-timer.h"
#include "ptimer.h"
#include "sysemu.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "loader.h"
#include "elf.h"
* This code is licensed under the GPL
*/
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "mcf.h"
/* For crc32 */
#include <zlib.h>
#include "qdev.h"
#include "qdev-addr.h"
-#include "net.h"
+#include "net/net.h"
static inline DeviceState *milkymist_uart_create(hwaddr base,
qemu_irq irq)
#include "hw.h"
#include "sysbus.h"
#include "trace.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-error.h"
#include "qdev-addr.h"
#include "pc.h"
#include "serial.h"
#include "fdc.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "smbus.h"
#include "block.h"
#include "sysemu.h"
#include "arch_init.h"
#include "boards.h"
-#include "net.h"
+#include "net/net.h"
#include "esp.h"
#include "mips-bios.h"
#include "loader.h"
#include "pc.h"
#include "serial.h"
#include "fdc.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "smbus.h"
#include "block.h"
#include "mips_cpudevs.h"
#include "serial.h"
#include "isa.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "mips-bios.h"
#include "pc.h"
#include "serial.h"
#include "isa.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "flash.h"
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "trace.h"
#include "sysbus.h"
#include "sysbus.h"
#include "arm-misc.h"
#include "devices.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "serial.h"
#include "pc.h"
#include "isa.h"
#include "qdev.h"
-#include "net.h"
+#include "net/net.h"
#include "ne2000.h"
#include "exec-memory.h"
*/
#include "hw.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "ne2000.h"
#include "loader.h"
#include "sysemu.h"
#include "hw.h"
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "trace.h"
#include "boards.h"
#include "elf.h"
#include "serial.h"
-#include "net.h"
+#include "net/net.h"
#include "loader.h"
#include "exec-memory.h"
#include "sysemu.h"
#include "ioport.h"
#include "isa.h"
#include "fdc.h"
-#include "net.h"
+#include "net/net.h"
#include "memory.h"
#include "ioapic.h"
#include "pci/pci.h"
#include "pci/pci_ids.h"
#include "usb.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "ide.h"
#include "kvm.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "hw/pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "hw/pc.h"
#include "monitor.h"
#include "hw/scsi.h"
#include "hw/pci/pci_bridge.h"
#include "hw/pci/pci_bus.h"
#include "monitor.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "hw/loader.h"
#include "range.h"
*/
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "loader.h"
#include "qemu-timer.h"
#include "dma.h"
*/
#include "qdev.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-timer.h"
#include "qemu_socket.h"
#include "sysemu.h"
#include "sysbus.h"
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "flash.h"
#include "sysemu.h"
#include "devices.h"
#include "sysbus.h"
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "flash.h"
#include "sysemu.h"
#include "devices.h"
#include "qemu-common.h"
#include "e500.h"
#include "e500-ccsr.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-config.h"
#include "hw/hw.h"
#include "hw/serial.h"
#include "config.h"
#include "qemu-common.h"
-#include "net.h"
+#include "net/net.h"
#include "hw.h"
#include "pci/pci.h"
#include "boards.h"
#include "mac_dbdma.h"
#include "nvram.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "fw_cfg.h"
#include "mac_dbdma.h"
#include "nvram.h"
#include "sysemu.h"
-#include "net.h"
+#include "net/net.h"
#include "isa.h"
#include "pci/pci.h"
#include "boards.h"
#include "pc.h"
#include "serial.h"
#include "fdc.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "isa.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "qdev.h"
#include "qerror.h"
#include "blockdev.h"
inherit from a particular bus (e.g. PCI or I2C) rather than
this API directly. */
-#include "net.h"
+#include "net/net.h"
#include "qdev.h"
#include "sysemu.h"
#include "error.h"
#include "sysemu.h"
#include "boards.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "sh7750_regs.h"
#include "ide.h"
#include "loader.h"
#include "primecell.h"
#include "devices.h"
#include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "i2c.h"
#include "pci/pci.h"
#include "dma.h"
#include "qemu-timer.h"
-#include "net.h"
+#include "net/net.h"
#include "loader.h"
#include "sysemu.h"
#include "iov.h"
#include "block.h"
#include "blockdev.h"
#include "sysemu.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "monitor.h"
#include "loader.h"
*/
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include "devices.h"
/* For crc32 */
#include <zlib.h>
#include "sysemu.h"
#include "hw.h"
#include "elf.h"
-#include "net.h"
+#include "net/net.h"
#include "blockdev.h"
#include "cpus.h"
#include "kvm.h"
*
*/
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "hw/qdev.h"
#include "hw/spapr.h"
#include "hw/spapr_vio.h"
#include "devices.h"
#include "qemu-timer.h"
#include "i2c.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "exec-memory.h"
* This code is licensed under the GPL.
*/
#include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
#include <zlib.h>
//#define DEBUG_STELLARIS_ENET 1
#include "sparc32_dma.h"
#include "fdc.h"
#include "sysemu.h"
-#include "net.h"
+#include "net/net.h"
#include "boards.h"
#include "firmware_abi.h"
#include "esp.h"
#include "serial.h"
#include "nvram.h"
#include "fdc.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-timer.h"
#include "sysemu.h"
#include "boards.h"
#include "qemu-common.h"
#include "hw/usb.h"
#include "hw/usb/desc.h"
-#include "net.h"
+#include "net/net.h"
#include "qemu-queue.h"
#include "qemu-config.h"
#include "sysemu.h"
#include "sysbus.h"
#include "arm-misc.h"
#include "devices.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "pci/pci.h"
#include "i2c.h"
#include "arm-misc.h"
#include "primecell.h"
#include "devices.h"
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "boards.h"
#include "exec-memory.h"
* GNU GPL, version 2 or (at your option) any later version.
*/
-#include "net.h"
+#include "net/net.h"
#include "net/tap.h"
#include "virtio-net.h"
#ifndef VHOST_NET_H
#define VHOST_NET_H
-#include "net.h"
+#include "net/net.h"
struct vhost_net;
typedef struct vhost_net VHostNetState;
#include "iov.h"
#include "virtio.h"
-#include "net.h"
+#include "net/net.h"
#include "net/checksum.h"
#include "net/tap.h"
#include "qemu-error.h"
uint16_t status;
} QEMU_PACKED;
-/* This is the first element of the scatter-gather list. If you don't
- * specify GSO or CSUM features, you can simply ignore the header. */
-struct virtio_net_hdr
-{
-#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
-#define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid
- uint8_t flags;
-#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
-#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
-#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
-#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
-#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
- uint8_t gso_type;
- uint16_t hdr_len;
- uint16_t gso_size;
- uint16_t csum_start;
- uint16_t csum_offset;
-};
-
-/* This is the version of the header to use when the MRG_RXBUF
- * feature has been negotiated. */
-struct virtio_net_hdr_mrg_rxbuf
-{
- struct virtio_net_hdr hdr;
- uint16_t num_buffers; /* Number of merged rx buffers */
-};
-
/*
* Control virtqueue data structures
*
#define _QEMU_VIRTIO_H
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "qdev.h"
#include "sysemu.h"
#include "event_notifier.h"
#include "xen_common.h"
#include "sysemu.h"
-#include "net.h"
+#include "net/net.h"
/* ------------------------------------------------------------- */
#include <sys/wait.h>
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#include "net/checksum.h"
#include "net/util.h"
#include "xen_backend.h"
#include "sysbus.h"
#include "qemu-char.h"
#include "qemu-log.h"
-#include "net.h"
+#include "net/net.h"
#include "net/checksum.h"
#ifdef DEBUG_XGMAC
#include "stream.h"
#include "qemu-common.h"
-#include "net.h"
+#include "net/net.h"
static inline DeviceState *
xilinx_intc_create(hwaddr base, qemu_irq irq, int kind_of_intr)
#include "sysbus.h"
#include "qemu-log.h"
-#include "net.h"
+#include "net/net.h"
#include "net/checksum.h"
#include "stream.h"
#include "sysbus.h"
#include "hw.h"
-#include "net.h"
+#include "net/net.h"
#define D(x)
#define R_TX_BUF0 0
#include "sysbus.h"
#include "arm-misc.h"
-#include "net.h"
+#include "net/net.h"
#include "exec-memory.h"
#include "sysemu.h"
#include "boards.h"
#include "memory.h"
#include "exec-memory.h"
#include "serial.h"
-#include "net.h"
+#include "net/net.h"
#include "sysbus.h"
#include "flash.h"
#include "blockdev.h"
--- /dev/null
+/*
+ * IP checksumming functions.
+ * (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef QEMU_NET_CHECKSUM_H
+#define QEMU_NET_CHECKSUM_H
+
+#include <stdint.h>
+
+uint32_t net_checksum_add(int len, uint8_t *buf);
+uint16_t net_checksum_finish(uint32_t sum);
+uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
+ uint8_t *addrs, uint8_t *buf);
+void net_checksum_calculate(uint8_t *data, int length);
+
+#endif /* QEMU_NET_CHECKSUM_H */
--- /dev/null
+#ifndef QEMU_NET_H
+#define QEMU_NET_H
+
+#include "qemu-queue.h"
+#include "qemu-common.h"
+#include "qdict.h"
+#include "qemu-option.h"
+#include "net/queue.h"
+#include "vmstate.h"
+#include "qapi-types.h"
+
+struct MACAddr {
+ uint8_t a[6];
+};
+
+/* qdev nic properties */
+
+typedef struct NICConf {
+ MACAddr macaddr;
+ NetClientState *peer;
+ int32_t bootindex;
+} NICConf;
+
+#define DEFINE_NIC_PROPERTIES(_state, _conf) \
+ DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \
+ DEFINE_PROP_VLAN("vlan", _state, _conf.peer), \
+ DEFINE_PROP_NETDEV("netdev", _state, _conf.peer), \
+ DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1)
+
+/* Net clients */
+
+typedef void (NetPoll)(NetClientState *, bool enable);
+typedef int (NetCanReceive)(NetClientState *);
+typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
+typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
+typedef void (NetCleanup) (NetClientState *);
+typedef void (LinkStatusChanged)(NetClientState *);
+
+typedef struct NetClientInfo {
+ NetClientOptionsKind type;
+ size_t size;
+ NetReceive *receive;
+ NetReceive *receive_raw;
+ NetReceiveIOV *receive_iov;
+ NetCanReceive *can_receive;
+ NetCleanup *cleanup;
+ LinkStatusChanged *link_status_changed;
+ NetPoll *poll;
+} NetClientInfo;
+
+struct NetClientState {
+ NetClientInfo *info;
+ int link_down;
+ QTAILQ_ENTRY(NetClientState) next;
+ NetClientState *peer;
+ NetQueue *send_queue;
+ char *model;
+ char *name;
+ char info_str[256];
+ unsigned receive_disabled : 1;
+};
+
+typedef struct NICState {
+ NetClientState nc;
+ NICConf *conf;
+ void *opaque;
+ bool peer_deleted;
+} NICState;
+
+NetClientState *qemu_find_netdev(const char *id);
+NetClientState *qemu_new_net_client(NetClientInfo *info,
+ NetClientState *peer,
+ const char *model,
+ const char *name);
+NICState *qemu_new_nic(NetClientInfo *info,
+ NICConf *conf,
+ const char *model,
+ const char *name,
+ void *opaque);
+void qemu_del_net_client(NetClientState *nc);
+NetClientState *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(NetClientState *nc);
+ssize_t qemu_sendv_packet(NetClientState *nc, const struct iovec *iov,
+ int iovcnt);
+ssize_t qemu_sendv_packet_async(NetClientState *nc, const struct iovec *iov,
+ int iovcnt, NetPacketSent *sent_cb);
+void qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size);
+ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size);
+ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf,
+ int size, NetPacketSent *sent_cb);
+void qemu_purge_queued_packets(NetClientState *nc);
+void qemu_flush_queued_packets(NetClientState *nc);
+void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6]);
+void qemu_macaddr_default_if_unset(MACAddr *macaddr);
+int qemu_show_nic_models(const char *arg, const char *const *models);
+void qemu_check_nic_model(NICInfo *nd, const char *model);
+int qemu_find_nic_model(NICInfo *nd, const char * const *models,
+ const char *default_model);
+
+ssize_t qemu_deliver_packet(NetClientState *sender,
+ unsigned flags,
+ const uint8_t *data,
+ size_t size,
+ void *opaque);
+ssize_t qemu_deliver_packet_iov(NetClientState *sender,
+ unsigned flags,
+ const struct iovec *iov,
+ int iovcnt,
+ void *opaque);
+
+void print_net_client(Monitor *mon, NetClientState *nc);
+void do_info_network(Monitor *mon);
+
+/* NIC info */
+
+#define MAX_NICS 8
+
+struct NICInfo {
+ MACAddr macaddr;
+ char *model;
+ char *name;
+ char *devaddr;
+ NetClientState *netdev;
+ int used; /* is this slot in nd_table[] being used? */
+ int instantiated; /* does this NICInfo correspond to an instantiated NIC? */
+ int nvectors;
+};
+
+extern int nb_nics;
+extern NICInfo nd_table[MAX_NICS];
+extern int default_net;
+
+/* from net.c */
+extern const char *legacy_tftp_prefix;
+extern const char *legacy_bootp_filename;
+
+int net_client_init(QemuOpts *opts, int is_netdev, Error **errp);
+int net_client_parse(QemuOptsList *opts_list, const char *str);
+int net_init_clients(void);
+void net_check_clients(void);
+void net_cleanup(void);
+void net_host_device_add(Monitor *mon, const QDict *qdict);
+void net_host_device_remove(Monitor *mon, const QDict *qdict);
+void netdev_add(QemuOpts *opts, Error **errp);
+int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret);
+
+int net_hub_id_for_client(NetClientState *nc, int *id);
+NetClientState *net_hub_port_find(int hub_id);
+
+#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
+#define DEFAULT_BRIDGE_INTERFACE "br0"
+
+void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
+
+#define POLYNOMIAL 0x04c11db6
+unsigned compute_mcast_idx(const uint8_t *ep);
+
+#define vmstate_offset_macaddr(_state, _field) \
+ vmstate_offset_array(_state, _field.a, uint8_t, \
+ sizeof(typeof_field(_state, _field)))
+
+#define VMSTATE_MACADDR(_field, _state) { \
+ .name = (stringify(_field)), \
+ .size = sizeof(MACAddr), \
+ .info = &vmstate_info_buffer, \
+ .flags = VMS_BUFFER, \
+ .offset = vmstate_offset_macaddr(_state, _field), \
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef QEMU_NET_QUEUE_H
+#define QEMU_NET_QUEUE_H
+
+#include "qemu-common.h"
+
+typedef struct NetPacket NetPacket;
+typedef struct NetQueue NetQueue;
+
+typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret);
+
+#define QEMU_NET_PACKET_FLAG_NONE 0
+#define QEMU_NET_PACKET_FLAG_RAW (1<<0)
+
+NetQueue *qemu_new_net_queue(void *opaque);
+
+void qemu_del_net_queue(NetQueue *queue);
+
+ssize_t qemu_net_queue_send(NetQueue *queue,
+ NetClientState *sender,
+ unsigned flags,
+ const uint8_t *data,
+ size_t size,
+ NetPacketSent *sent_cb);
+
+ssize_t qemu_net_queue_send_iov(NetQueue *queue,
+ NetClientState *sender,
+ unsigned flags,
+ const struct iovec *iov,
+ int iovcnt,
+ NetPacketSent *sent_cb);
+
+void qemu_net_queue_purge(NetQueue *queue, NetClientState *from);
+bool qemu_net_queue_flush(NetQueue *queue);
+
+#endif /* QEMU_NET_QUEUE_H */
--- /dev/null
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef QEMU_NET_SLIRP_H
+#define QEMU_NET_SLIRP_H
+
+#include "qemu-common.h"
+#include "qdict.h"
+#include "qemu-option.h"
+#include "qapi-types.h"
+
+#ifdef CONFIG_SLIRP
+
+void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
+void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
+
+int net_slirp_redir(const char *redir_str);
+
+int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret);
+
+int net_slirp_smb(const char *exported_dir);
+
+void do_info_usernet(Monitor *mon);
+
+#endif
+
+#endif /* QEMU_NET_SLIRP_H */
--- /dev/null
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef QEMU_NET_TAP_H
+#define QEMU_NET_TAP_H
+
+#include "qemu-common.h"
+#include "qapi-types.h"
+
+int tap_has_ufo(NetClientState *nc);
+int tap_has_vnet_hdr(NetClientState *nc);
+int tap_has_vnet_hdr_len(NetClientState *nc, int len);
+void tap_using_vnet_hdr(NetClientState *nc, int using_vnet_hdr);
+void tap_set_offload(NetClientState *nc, int csum, int tso4, int tso6, int ecn, int ufo);
+void tap_set_vnet_hdr_len(NetClientState *nc, int len);
+
+int tap_get_fd(NetClientState *nc);
+
+struct vhost_net;
+struct vhost_net *tap_get_vhost_net(NetClientState *nc);
+
+struct virtio_net_hdr
+{
+#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
+#define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid
+ uint8_t flags;
+#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
+#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
+#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
+#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
+#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
+ uint8_t gso_type;
+ uint16_t hdr_len;
+ uint16_t gso_size;
+ uint16_t csum_start;
+ uint16_t csum_offset;
+};
+
+struct virtio_net_hdr_mrg_rxbuf
+{
+ struct virtio_net_hdr hdr;
+ uint16_t num_buffers; /* Number of merged rx buffers */
+};
+
+#endif /* QEMU_NET_TAP_H */
#include "hw/watchdog.h"
#include "hw/loader.h"
#include "gdbstub.h"
-#include "net.h"
+#include "net/net.h"
#include "net/slirp.h"
#include "qemu-char.h"
#include "ui/qemu-spice.h"
+++ /dev/null
-#ifndef QEMU_NET_H
-#define QEMU_NET_H
-
-#include "qemu-queue.h"
-#include "qemu-common.h"
-#include "qdict.h"
-#include "qemu-option.h"
-#include "net/queue.h"
-#include "vmstate.h"
-#include "qapi-types.h"
-
-struct MACAddr {
- uint8_t a[6];
-};
-
-/* qdev nic properties */
-
-typedef struct NICConf {
- MACAddr macaddr;
- NetClientState *peer;
- int32_t bootindex;
-} NICConf;
-
-#define DEFINE_NIC_PROPERTIES(_state, _conf) \
- DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \
- DEFINE_PROP_VLAN("vlan", _state, _conf.peer), \
- DEFINE_PROP_NETDEV("netdev", _state, _conf.peer), \
- DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1)
-
-/* Net clients */
-
-typedef void (NetPoll)(NetClientState *, bool enable);
-typedef int (NetCanReceive)(NetClientState *);
-typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
-typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
-typedef void (NetCleanup) (NetClientState *);
-typedef void (LinkStatusChanged)(NetClientState *);
-
-typedef struct NetClientInfo {
- NetClientOptionsKind type;
- size_t size;
- NetReceive *receive;
- NetReceive *receive_raw;
- NetReceiveIOV *receive_iov;
- NetCanReceive *can_receive;
- NetCleanup *cleanup;
- LinkStatusChanged *link_status_changed;
- NetPoll *poll;
-} NetClientInfo;
-
-struct NetClientState {
- NetClientInfo *info;
- int link_down;
- QTAILQ_ENTRY(NetClientState) next;
- NetClientState *peer;
- NetQueue *send_queue;
- char *model;
- char *name;
- char info_str[256];
- unsigned receive_disabled : 1;
-};
-
-typedef struct NICState {
- NetClientState nc;
- NICConf *conf;
- void *opaque;
- bool peer_deleted;
-} NICState;
-
-NetClientState *qemu_find_netdev(const char *id);
-NetClientState *qemu_new_net_client(NetClientInfo *info,
- NetClientState *peer,
- const char *model,
- const char *name);
-NICState *qemu_new_nic(NetClientInfo *info,
- NICConf *conf,
- const char *model,
- const char *name,
- void *opaque);
-void qemu_del_net_client(NetClientState *nc);
-NetClientState *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(NetClientState *nc);
-ssize_t qemu_sendv_packet(NetClientState *nc, const struct iovec *iov,
- int iovcnt);
-ssize_t qemu_sendv_packet_async(NetClientState *nc, const struct iovec *iov,
- int iovcnt, NetPacketSent *sent_cb);
-void qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size);
-ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size);
-ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf,
- int size, NetPacketSent *sent_cb);
-void qemu_purge_queued_packets(NetClientState *nc);
-void qemu_flush_queued_packets(NetClientState *nc);
-void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6]);
-void qemu_macaddr_default_if_unset(MACAddr *macaddr);
-int qemu_show_nic_models(const char *arg, const char *const *models);
-void qemu_check_nic_model(NICInfo *nd, const char *model);
-int qemu_find_nic_model(NICInfo *nd, const char * const *models,
- const char *default_model);
-
-ssize_t qemu_deliver_packet(NetClientState *sender,
- unsigned flags,
- const uint8_t *data,
- size_t size,
- void *opaque);
-ssize_t qemu_deliver_packet_iov(NetClientState *sender,
- unsigned flags,
- const struct iovec *iov,
- int iovcnt,
- void *opaque);
-
-void print_net_client(Monitor *mon, NetClientState *nc);
-void do_info_network(Monitor *mon);
-
-/* NIC info */
-
-#define MAX_NICS 8
-
-struct NICInfo {
- MACAddr macaddr;
- char *model;
- char *name;
- char *devaddr;
- NetClientState *netdev;
- int used; /* is this slot in nd_table[] being used? */
- int instantiated; /* does this NICInfo correspond to an instantiated NIC? */
- int nvectors;
-};
-
-extern int nb_nics;
-extern NICInfo nd_table[MAX_NICS];
-extern int default_net;
-
-/* from net.c */
-extern const char *legacy_tftp_prefix;
-extern const char *legacy_bootp_filename;
-
-int net_client_init(QemuOpts *opts, int is_netdev, Error **errp);
-int net_client_parse(QemuOptsList *opts_list, const char *str);
-int net_init_clients(void);
-void net_check_clients(void);
-void net_cleanup(void);
-void net_host_device_add(Monitor *mon, const QDict *qdict);
-void net_host_device_remove(Monitor *mon, const QDict *qdict);
-void netdev_add(QemuOpts *opts, Error **errp);
-int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret);
-
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
-#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
-#define DEFAULT_BRIDGE_INTERFACE "br0"
-
-void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
-
-#define POLYNOMIAL 0x04c11db6
-unsigned compute_mcast_idx(const uint8_t *ep);
-
-#define vmstate_offset_macaddr(_state, _field) \
- vmstate_offset_array(_state, _field.a, uint8_t, \
- sizeof(typeof_field(_state, _field)))
-
-#define VMSTATE_MACADDR(_field, _state) { \
- .name = (stringify(_field)), \
- .size = sizeof(MACAddr), \
- .info = &vmstate_info_buffer, \
- .flags = VMS_BUFFER, \
- .offset = vmstate_offset_macaddr(_state, _field), \
-}
-
-#endif
+++ /dev/null
-/*
- * IP checksumming functions.
- * (c) 2008 Gerd Hoffmann <kraxel@redhat.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef QEMU_NET_CHECKSUM_H
-#define QEMU_NET_CHECKSUM_H
-
-#include <stdint.h>
-
-uint32_t net_checksum_add(int len, uint8_t *buf);
-uint16_t net_checksum_finish(uint32_t sum);
-uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
- uint8_t *addrs, uint8_t *buf);
-void net_checksum_calculate(uint8_t *data, int length);
-
-#endif /* QEMU_NET_CHECKSUM_H */
#ifndef QEMU_NET_CLIENTS_H
#define QEMU_NET_CLIENTS_H
-#include "net.h"
+#include "net/net.h"
#include "qapi-types.h"
int net_init_dump(const NetClientOptions *opts, const char *name,
*/
#include "monitor.h"
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "hub.h"
#include "iov.h"
NetClientState *net_hub_add_port(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);
-int net_hub_id_for_client(NetClientState *nc, int *id);
void net_hub_check_clients(void);
-NetClientState *net_hub_port_find(int hub_id);
#endif /* NET_HUB_H */
*/
#include "config-host.h"
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "hub.h"
-#include "slirp.h"
+#include "net/slirp.h"
#include "util.h"
#include "monitor.h"
#include "net/queue.h"
#include "qemu-queue.h"
-#include "net.h"
+#include "net/net.h"
/* The delivery handler may only return zero if it will call
* qemu_net_queue_flush() when it determines that it is once again able
+++ /dev/null
-/*
- * Copyright (c) 2003-2008 Fabrice Bellard
- * Copyright (c) 2009 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef QEMU_NET_QUEUE_H
-#define QEMU_NET_QUEUE_H
-
-#include "qemu-common.h"
-
-typedef struct NetPacket NetPacket;
-typedef struct NetQueue NetQueue;
-
-typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret);
-
-#define QEMU_NET_PACKET_FLAG_NONE 0
-#define QEMU_NET_PACKET_FLAG_RAW (1<<0)
-
-NetQueue *qemu_new_net_queue(void *opaque);
-
-void qemu_del_net_queue(NetQueue *queue);
-
-ssize_t qemu_net_queue_send(NetQueue *queue,
- NetClientState *sender,
- unsigned flags,
- const uint8_t *data,
- size_t size,
- NetPacketSent *sent_cb);
-
-ssize_t qemu_net_queue_send_iov(NetQueue *queue,
- NetClientState *sender,
- unsigned flags,
- const struct iovec *iov,
- int iovcnt,
- NetPacketSent *sent_cb);
-
-void qemu_net_queue_purge(NetQueue *queue, NetClientState *from);
-bool qemu_net_queue_flush(NetQueue *queue);
-
-#endif /* QEMU_NET_QUEUE_H */
#include <pwd.h>
#include <sys/wait.h>
#endif
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "hub.h"
#include "monitor.h"
+++ /dev/null
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef QEMU_NET_SLIRP_H
-#define QEMU_NET_SLIRP_H
-
-#include "qemu-common.h"
-#include "qdict.h"
-#include "qemu-option.h"
-#include "qapi-types.h"
-
-#ifdef CONFIG_SLIRP
-
-void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict);
-void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict);
-
-int net_slirp_redir(const char *redir_str);
-
-int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret);
-
-int net_slirp_smb(const char *exported_dir);
-
-void do_info_usernet(Monitor *mon);
-
-#endif
-
-#endif /* QEMU_NET_SLIRP_H */
*/
#include "config-host.h"
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "monitor.h"
#include "qemu-common.h"
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include <stdio.h>
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include "qemu-common.h"
#include "sysemu.h"
#include "qemu-error.h"
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include <stdio.h>
int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required)
* THE SOFTWARE.
*/
+#include "tap_int.h"
+#include "tap-linux.h"
#include "net/tap.h"
-#include "net/tap-linux.h"
#include <net/if.h>
#include <sys/ioctl.h>
* GNU General Public License for more details.
*/
-#ifndef QEMU_TAP_H
-#define QEMU_TAP_H
+#ifndef QEMU_TAP_LINUX_H
+#define QEMU_TAP_LINUX_H
#include <stdint.h>
#ifdef __linux__
#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
#define TUN_F_UFO 0x10 /* I can handle UFO packets */
-struct virtio_net_hdr
-{
- uint8_t flags;
- uint8_t gso_type;
- uint16_t hdr_len;
- uint16_t gso_size;
- uint16_t csum_start;
- uint16_t csum_offset;
-};
-
-struct virtio_net_hdr_mrg_rxbuf
-{
- struct virtio_net_hdr hdr;
- uint16_t num_buffers; /* Number of merged rx buffers */
-};
-
#endif /* QEMU_TAP_H */
* THE SOFTWARE.
*/
-#include "net/tap.h"
+#include "tap_int.h"
#include "sysemu.h"
#include <sys/stat.h>
* distribution); if not, see <http://www.gnu.org/licenses/>.
*/
-#include "tap.h"
+#include "tap_int.h"
#include "qemu-common.h"
#include "clients.h" /* net_init_tap */
-#include "net.h"
+#include "net/net.h"
#include "sysemu.h"
#include "qemu-error.h"
#include <stdio.h>
* THE SOFTWARE.
*/
-#include "tap.h"
+#include "tap_int.h"
#include "config-host.h"
#include <sys/socket.h>
#include <net/if.h>
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "monitor.h"
#include "sysemu.h"
#include "qemu-common.h"
#include "qemu-error.h"
-#include "net/tap-linux.h"
+#include "net/tap.h"
#include "hw/vhost_net.h"
+++ /dev/null
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- * Copyright (c) 2009 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef QEMU_NET_TAP_H
-#define QEMU_NET_TAP_H
-
-#include "qemu-common.h"
-#include "qapi-types.h"
-
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
-
-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);
-
-int tap_has_ufo(NetClientState *nc);
-int tap_has_vnet_hdr(NetClientState *nc);
-int tap_has_vnet_hdr_len(NetClientState *nc, int len);
-void tap_using_vnet_hdr(NetClientState *nc, int using_vnet_hdr);
-void tap_set_offload(NetClientState *nc, int csum, int tso4, int tso6, int ecn, int ufo);
-void tap_set_vnet_hdr_len(NetClientState *nc, int len);
-
-int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
-int tap_probe_vnet_hdr(int fd);
-int tap_probe_vnet_hdr_len(int fd, int len);
-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_vnet_hdr_len(int fd, int len);
-
-int tap_get_fd(NetClientState *nc);
-
-struct vhost_net;
-struct vhost_net *tap_get_vhost_net(NetClientState *nc);
-
-#endif /* QEMU_NET_TAP_H */
--- /dev/null
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef QEMU_TAP_H
+#define QEMU_TAP_H
+
+#include "qemu-common.h"
+#include "qapi-types.h"
+
+#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
+#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+
+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);
+
+int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
+int tap_probe_vnet_hdr(int fd);
+int tap_probe_vnet_hdr_len(int fd, int len);
+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_vnet_hdr_len(int fd, int len);
+
+#endif /* QEMU_TAP_H */
* THE SOFTWARE.
*/
-#include "net/util.h"
+#include "util.h"
#include <errno.h>
#include <stdlib.h>
#include <libvdeplug.h>
-#include "net.h"
+#include "net/net.h"
#include "clients.h"
#include "qemu-common.h"
#include "qemu-option.h"
#include "qemu-common.h"
#include "hw/hw.h"
#include "hw/qdev.h"
-#include "net.h"
+#include "net/net.h"
#include "monitor.h"
#include "sysemu.h"
#include "qemu-timer.h"
#include "hw/qdev.h"
#include "hw/loader.h"
#include "bt-host.h"
-#include "net.h"
+#include "net/net.h"
#include "net/slirp.h"
#include "monitor.h"
#include "console.h"