Переглянути джерело

net: reorganize headers

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>
Paolo Bonzini 13 роки тому
батько
коміт
1422e32db5
99 змінених файлів з 170 додано та 156 видалено
  1. 1 1
      hmp.c
  2. 1 1
      hw/axis_dev88.c
  3. 1 1
      hw/cadence_gem.c
  4. 1 1
      hw/dp8393x.c
  5. 1 1
      hw/e1000.c
  6. 1 1
      hw/eepro100.c
  7. 1 1
      hw/etraxfs.h
  8. 1 1
      hw/etraxfs_eth.c
  9. 1 1
      hw/exynos4_boards.c
  10. 1 1
      hw/gumstix.c
  11. 1 1
      hw/highbank.c
  12. 1 1
      hw/integratorcp.c
  13. 1 1
      hw/kzm.c
  14. 1 1
      hw/lan9118.c
  15. 1 1
      hw/lance.c
  16. 1 1
      hw/mainstone.c
  17. 1 1
      hw/mcf5208.c
  18. 1 1
      hw/mcf_fec.c
  19. 1 1
      hw/milkymist-hw.h
  20. 1 1
      hw/milkymist-minimac2.c
  21. 1 1
      hw/mips_fulong2e.c
  22. 1 1
      hw/mips_jazz.c
  23. 1 1
      hw/mips_malta.c
  24. 1 1
      hw/mips_mipssim.c
  25. 1 1
      hw/mips_r4k.c
  26. 1 1
      hw/mipsnet.c
  27. 1 1
      hw/musicpal.c
  28. 1 1
      hw/ne2000-isa.c
  29. 1 1
      hw/ne2000.c
  30. 1 1
      hw/opencores_eth.c
  31. 1 1
      hw/openrisc_sim.c
  32. 1 1
      hw/pc.h
  33. 1 1
      hw/pc_piix.c
  34. 1 1
      hw/pci/pci-hotplug.c
  35. 1 1
      hw/pci/pci.c
  36. 1 1
      hw/pcnet-pci.c
  37. 1 1
      hw/pcnet.c
  38. 1 1
      hw/petalogix_ml605_mmu.c
  39. 1 1
      hw/petalogix_s3adsp1800_mmu.c
  40. 1 1
      hw/ppc/e500.c
  41. 1 1
      hw/ppc440_bamboo.c
  42. 1 1
      hw/ppc_newworld.c
  43. 1 1
      hw/ppc_oldworld.c
  44. 1 1
      hw/ppc_prep.c
  45. 1 1
      hw/qdev-properties.c
  46. 1 1
      hw/qdev.c
  47. 1 1
      hw/r2d.c
  48. 1 1
      hw/realview.c
  49. 1 1
      hw/rtl8139.c
  50. 1 1
      hw/s390-virtio.c
  51. 1 1
      hw/smc91c111.c
  52. 1 1
      hw/spapr.c
  53. 1 1
      hw/spapr_llan.c
  54. 1 1
      hw/stellaris.c
  55. 1 1
      hw/stellaris_enet.c
  56. 1 1
      hw/sun4m.c
  57. 1 1
      hw/sun4u.c
  58. 1 1
      hw/usb/dev-network.c
  59. 1 1
      hw/versatilepb.c
  60. 1 1
      hw/vexpress.c
  61. 1 1
      hw/vhost_net.c
  62. 1 1
      hw/vhost_net.h
  63. 1 1
      hw/virtio-net.c
  64. 0 27
      hw/virtio-net.h
  65. 1 1
      hw/virtio.h
  66. 1 1
      hw/xen_backend.h
  67. 1 1
      hw/xen_nic.c
  68. 1 1
      hw/xgmac.c
  69. 1 1
      hw/xilinx.h
  70. 1 1
      hw/xilinx_axienet.c
  71. 1 1
      hw/xilinx_ethlite.c
  72. 1 1
      hw/xilinx_zynq.c
  73. 1 1
      hw/xtensa_lx60.c
  74. 0 0
      include/net/checksum.h
  75. 3 0
      include/net/net.h
  76. 0 0
      include/net/queue.h
  77. 0 0
      include/net/slirp.h
  78. 67 0
      include/net/tap.h
  79. 1 1
      monitor.c
  80. 1 1
      net/clients.h
  81. 1 1
      net/hub.c
  82. 0 2
      net/hub.h
  83. 2 2
      net/net.c
  84. 1 1
      net/queue.c
  85. 1 1
      net/slirp.c
  86. 1 1
      net/socket.c
  87. 1 1
      net/tap-aix.c
  88. 1 1
      net/tap-bsd.c
  89. 1 1
      net/tap-haiku.c
  90. 2 1
      net/tap-linux.c
  91. 2 18
      net/tap-linux.h
  92. 1 1
      net/tap-solaris.c
  93. 2 2
      net/tap-win32.c
  94. 3 3
      net/tap.c
  95. 3 15
      net/tap_int.h
  96. 1 1
      net/util.c
  97. 1 1
      net/vde.c
  98. 1 1
      savevm.c
  99. 1 1
      vl.c

+ 1 - 1
hmp.c

@@ -14,7 +14,7 @@
  */
 
 #include "hmp.h"
-#include "net.h"
+#include "net/net.h"
 #include "qemu-char.h"
 #include "qemu-option.h"
 #include "qemu-timer.h"

+ 1 - 1
hw/axis_dev88.c

@@ -23,7 +23,7 @@
  */
 
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "flash.h"
 #include "boards.h"
 #include "etraxfs.h"

+ 1 - 1
hw/cadence_gem.c

@@ -25,7 +25,7 @@
 #include <zlib.h> /* For crc32 */
 
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "net/checksum.h"
 
 #ifdef CADENCE_GEM_ERR_DEBUG

+ 1 - 1
hw/dp8393x.c

@@ -19,7 +19,7 @@
 
 #include "hw.h"
 #include "qemu-timer.h"
-#include "net.h"
+#include "net/net.h"
 #include "mips.h"
 
 //#define DEBUG_SONIC

+ 1 - 1
hw/e1000.c

@@ -27,7 +27,7 @@
 
 #include "hw.h"
 #include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
 #include "net/checksum.h"
 #include "loader.h"
 #include "sysemu.h"

+ 1 - 1
hw/eepro100.c

@@ -43,7 +43,7 @@
 #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"

+ 1 - 1
hw/etraxfs.h

@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 
-#include "net.h"
+#include "net/net.h"
 #include "etraxfs_dma.h"
 
 qemu_irq *cris_pic_init_cpu(CPUCRISState *env);

+ 1 - 1
hw/etraxfs_eth.c

@@ -24,7 +24,7 @@
 
 #include <stdio.h>
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "etraxfs.h"
 
 #define D(x)

+ 1 - 1
hw/exynos4_boards.c

@@ -23,7 +23,7 @@
 
 #include "sysemu.h"
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "arm-misc.h"
 #include "exec-memory.h"
 #include "exynos4210.h"

+ 1 - 1
hw/gumstix.c

@@ -36,7 +36,7 @@
 
 #include "hw.h"
 #include "pxa.h"
-#include "net.h"
+#include "net/net.h"
 #include "flash.h"
 #include "devices.h"
 #include "boards.h"

+ 1 - 1
hw/highbank.c

@@ -21,7 +21,7 @@
 #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"

+ 1 - 1
hw/integratorcp.c

@@ -11,7 +11,7 @@
 #include "devices.h"
 #include "boards.h"
 #include "arm-misc.h"
-#include "net.h"
+#include "net/net.h"
 #include "exec-memory.h"
 #include "sysemu.h"
 

+ 1 - 1
hw/kzm.c

@@ -18,7 +18,7 @@
 #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"

+ 1 - 1
hw/lan9118.c

@@ -11,7 +11,7 @@
  */
 
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "devices.h"
 #include "sysemu.h"
 #include "ptimer.h"

+ 1 - 1
hw/lance.c

@@ -36,7 +36,7 @@
  */
 
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "qemu-timer.h"
 #include "qemu_socket.h"
 #include "sun4m.h"

+ 1 - 1
hw/mainstone.c

@@ -14,7 +14,7 @@
 #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"

+ 1 - 1
hw/mcf5208.c

@@ -10,7 +10,7 @@
 #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"

+ 1 - 1
hw/mcf_fec.c

@@ -6,7 +6,7 @@
  * 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>

+ 1 - 1
hw/milkymist-hw.h

@@ -3,7 +3,7 @@
 
 #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)

+ 1 - 1
hw/milkymist-minimac2.c

@@ -25,7 +25,7 @@
 #include "hw.h"
 #include "sysbus.h"
 #include "trace.h"
-#include "net.h"
+#include "net/net.h"
 #include "qemu-error.h"
 #include "qdev-addr.h"
 

+ 1 - 1
hw/mips_fulong2e.c

@@ -22,7 +22,7 @@
 #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"

+ 1 - 1
hw/mips_jazz.c

@@ -32,7 +32,7 @@
 #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"

+ 1 - 1
hw/mips_malta.c

@@ -26,7 +26,7 @@
 #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"

+ 1 - 1
hw/mips_mipssim.c

@@ -29,7 +29,7 @@
 #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"

+ 1 - 1
hw/mips_r4k.c

@@ -13,7 +13,7 @@
 #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"

+ 1 - 1
hw/mipsnet.c

@@ -1,5 +1,5 @@
 #include "hw.h"
-#include "net.h"
+#include "net/net.h"
 #include "trace.h"
 #include "sysbus.h"
 

+ 1 - 1
hw/musicpal.c

@@ -12,7 +12,7 @@
 #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"

+ 1 - 1
hw/ne2000-isa.c

@@ -25,7 +25,7 @@
 #include "pc.h"
 #include "isa.h"
 #include "qdev.h"
-#include "net.h"
+#include "net/net.h"
 #include "ne2000.h"
 #include "exec-memory.h"
 

+ 1 - 1
hw/ne2000.c

@@ -23,7 +23,7 @@
  */
 #include "hw.h"
 #include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
 #include "ne2000.h"
 #include "loader.h"
 #include "sysemu.h"

+ 1 - 1
hw/opencores_eth.c

@@ -33,7 +33,7 @@
 
 #include "hw.h"
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "sysemu.h"
 #include "trace.h"
 

+ 1 - 1
hw/openrisc_sim.c

@@ -22,7 +22,7 @@
 #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"

+ 1 - 1
hw/pc.h

@@ -6,7 +6,7 @@
 #include "ioport.h"
 #include "isa.h"
 #include "fdc.h"
-#include "net.h"
+#include "net/net.h"
 #include "memory.h"
 #include "ioapic.h"
 

+ 1 - 1
hw/pc_piix.c

@@ -30,7 +30,7 @@
 #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"

+ 1 - 1
hw/pci/pci-hotplug.c

@@ -25,7 +25,7 @@
 #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"

+ 1 - 1
hw/pci/pci.c

@@ -26,7 +26,7 @@
 #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"

+ 1 - 1
hw/pcnet-pci.c

@@ -28,7 +28,7 @@
  */
 
 #include "pci/pci.h"
-#include "net.h"
+#include "net/net.h"
 #include "loader.h"
 #include "qemu-timer.h"
 #include "dma.h"

+ 1 - 1
hw/pcnet.c

@@ -36,7 +36,7 @@
  */
 
 #include "qdev.h"
-#include "net.h"
+#include "net/net.h"
 #include "qemu-timer.h"
 #include "qemu_socket.h"
 #include "sysemu.h"

+ 1 - 1
hw/petalogix_ml605_mmu.c

@@ -27,7 +27,7 @@
 
 #include "sysbus.h"
 #include "hw.h"
-#include "net.h"
+#include "net/net.h"
 #include "flash.h"
 #include "sysemu.h"
 #include "devices.h"

+ 1 - 1
hw/petalogix_s3adsp1800_mmu.c

@@ -25,7 +25,7 @@
 
 #include "sysbus.h"
 #include "hw.h"
-#include "net.h"
+#include "net/net.h"
 #include "flash.h"
 #include "sysemu.h"
 #include "devices.h"

+ 1 - 1
hw/ppc/e500.c

@@ -18,7 +18,7 @@
 #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"

+ 1 - 1
hw/ppc440_bamboo.c

@@ -13,7 +13,7 @@
 
 #include "config.h"
 #include "qemu-common.h"
-#include "net.h"
+#include "net/net.h"
 #include "hw.h"
 #include "pci/pci.h"
 #include "boards.h"

+ 1 - 1
hw/ppc_newworld.c

@@ -53,7 +53,7 @@
 #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"

+ 1 - 1
hw/ppc_oldworld.c

@@ -30,7 +30,7 @@
 #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"

+ 1 - 1
hw/ppc_prep.c

@@ -26,7 +26,7 @@
 #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"

+ 1 - 1
hw/qdev-properties.c

@@ -1,4 +1,4 @@
-#include "net.h"
+#include "net/net.h"
 #include "qdev.h"
 #include "qerror.h"
 #include "blockdev.h"

+ 1 - 1
hw/qdev.c

@@ -25,7 +25,7 @@
    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"

+ 1 - 1
hw/r2d.c

@@ -30,7 +30,7 @@
 #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"

+ 1 - 1
hw/realview.c

@@ -12,7 +12,7 @@
 #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"

+ 1 - 1
hw/rtl8139.c

@@ -55,7 +55,7 @@
 #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"

+ 1 - 1
hw/s390-virtio.c

@@ -21,7 +21,7 @@
 #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"

+ 1 - 1
hw/smc91c111.c

@@ -8,7 +8,7 @@
  */
 
 #include "sysbus.h"
-#include "net.h"
+#include "net/net.h"
 #include "devices.h"
 /* For crc32 */
 #include <zlib.h>

+ 1 - 1
hw/spapr.c

@@ -27,7 +27,7 @@
 #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"

+ 1 - 1
hw/spapr_llan.c

@@ -25,7 +25,7 @@
  *
  */
 #include "hw.h"
-#include "net.h"
+#include "net/net.h"
 #include "hw/qdev.h"
 #include "hw/spapr.h"
 #include "hw/spapr_vio.h"

+ 1 - 1
hw/stellaris.c

@@ -13,7 +13,7 @@
 #include "devices.h"
 #include "qemu-timer.h"
 #include "i2c.h"
-#include "net.h"
+#include "net/net.h"
 #include "boards.h"
 #include "exec-memory.h"
 

+ 1 - 1
hw/stellaris_enet.c

@@ -7,7 +7,7 @@
  * 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

+ 1 - 1
hw/sun4m.c

@@ -28,7 +28,7 @@
 #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"

+ 1 - 1
hw/sun4u.c

@@ -28,7 +28,7 @@
 #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"

+ 1 - 1
hw/usb/dev-network.c

@@ -26,7 +26,7 @@
 #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"

+ 1 - 1
hw/versatilepb.c

@@ -10,7 +10,7 @@
 #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"

+ 1 - 1
hw/vexpress.c

@@ -25,7 +25,7 @@
 #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"

+ 1 - 1
hw/vhost_net.c

@@ -13,7 +13,7 @@
  * 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"

+ 1 - 1
hw/vhost_net.h

@@ -1,7 +1,7 @@
 #ifndef VHOST_NET_H
 #define VHOST_NET_H
 
-#include "net.h"
+#include "net/net.h"
 
 struct vhost_net;
 typedef struct vhost_net VHostNetState;

+ 1 - 1
hw/virtio-net.c

@@ -13,7 +13,7 @@
 
 #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"

+ 0 - 27
hw/virtio-net.h

@@ -73,33 +73,6 @@ struct virtio_net_config
     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
  *

+ 1 - 1
hw/virtio.h

@@ -15,7 +15,7 @@
 #define _QEMU_VIRTIO_H
 
 #include "hw.h"
-#include "net.h"
+#include "net/net.h"
 #include "qdev.h"
 #include "sysemu.h"
 #include "event_notifier.h"

+ 1 - 1
hw/xen_backend.h

@@ -3,7 +3,7 @@
 
 #include "xen_common.h"
 #include "sysemu.h"
-#include "net.h"
+#include "net/net.h"
 
 /* ------------------------------------------------------------- */
 

+ 1 - 1
hw/xen_nic.c

@@ -36,7 +36,7 @@
 #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"

+ 1 - 1
hw/xgmac.c

@@ -27,7 +27,7 @@
 #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

+ 1 - 1
hw/xilinx.h

@@ -1,6 +1,6 @@
 #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)

+ 1 - 1
hw/xilinx_axienet.c

@@ -24,7 +24,7 @@
 
 #include "sysbus.h"
 #include "qemu-log.h"
-#include "net.h"
+#include "net/net.h"
 #include "net/checksum.h"
 
 #include "stream.h"

+ 1 - 1
hw/xilinx_ethlite.c

@@ -24,7 +24,7 @@
 
 #include "sysbus.h"
 #include "hw.h"
-#include "net.h"
+#include "net/net.h"
 
 #define D(x)
 #define R_TX_BUF0     0

+ 1 - 1
hw/xilinx_zynq.c

@@ -17,7 +17,7 @@
 
 #include "sysbus.h"
 #include "arm-misc.h"
-#include "net.h"
+#include "net/net.h"
 #include "exec-memory.h"
 #include "sysemu.h"
 #include "boards.h"

+ 1 - 1
hw/xtensa_lx60.c

@@ -32,7 +32,7 @@
 #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"

+ 0 - 0
net/checksum.h → include/net/checksum.h


+ 3 - 0
net.h → include/net/net.h

@@ -147,6 +147,9 @@ 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"

+ 0 - 0
net/queue.h → include/net/queue.h


+ 0 - 0
net/slirp.h → include/net/slirp.h


+ 67 - 0
include/net/tap.h

@@ -0,0 +1,67 @@
+/*
+ * 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 */

+ 1 - 1
monitor.c

@@ -31,7 +31,7 @@
 #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"

+ 1 - 1
net/clients.h

@@ -24,7 +24,7 @@
 #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,

+ 1 - 1
net/hub.c

@@ -13,7 +13,7 @@
  */
 
 #include "monitor.h"
-#include "net.h"
+#include "net/net.h"
 #include "clients.h"
 #include "hub.h"
 #include "iov.h"

+ 0 - 2
net/hub.h

@@ -20,8 +20,6 @@
 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 */

+ 2 - 2
net/net.c

@@ -23,10 +23,10 @@
  */
 #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"

+ 1 - 1
net/queue.c

@@ -23,7 +23,7 @@
 
 #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

+ 1 - 1
net/slirp.c

@@ -29,7 +29,7 @@
 #include <pwd.h>
 #include <sys/wait.h>
 #endif
-#include "net.h"
+#include "net/net.h"
 #include "clients.h"
 #include "hub.h"
 #include "monitor.h"

+ 1 - 1
net/socket.c

@@ -23,7 +23,7 @@
  */
 #include "config-host.h"
 
-#include "net.h"
+#include "net/net.h"
 #include "clients.h"
 #include "monitor.h"
 #include "qemu-common.h"

+ 1 - 1
net/tap-aix.c

@@ -22,7 +22,7 @@
  * 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)

+ 1 - 1
net/tap-bsd.c

@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 
-#include "net/tap.h"
+#include "tap_int.h"
 #include "qemu-common.h"
 #include "sysemu.h"
 #include "qemu-error.h"

+ 1 - 1
net/tap-haiku.c

@@ -22,7 +22,7 @@
  * 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)

+ 2 - 1
net/tap-linux.c

@@ -23,8 +23,9 @@
  * 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>

+ 2 - 18
net/tap-linux.h

@@ -13,8 +13,8 @@
  *  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__
@@ -44,20 +44,4 @@
 #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 */

+ 1 - 1
net/tap-solaris.c

@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 
-#include "net/tap.h"
+#include "tap_int.h"
 #include "sysemu.h"
 
 #include <sys/stat.h>

+ 2 - 2
net/tap-win32.c

@@ -26,11 +26,11 @@
  *  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>

+ 3 - 3
net/tap.c

@@ -23,7 +23,7 @@
  * THE SOFTWARE.
  */
 
-#include "tap.h"
+#include "tap_int.h"
 
 #include "config-host.h"
 
@@ -33,14 +33,14 @@
 #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"
 

+ 3 - 15
net/tap.h → net/tap_int.h

@@ -23,8 +23,8 @@
  * THE SOFTWARE.
  */
 
-#ifndef QEMU_NET_TAP_H
-#define QEMU_NET_TAP_H
+#ifndef QEMU_TAP_H
+#define QEMU_TAP_H
 
 #include "qemu-common.h"
 #include "qapi-types.h"
@@ -36,13 +36,6 @@ 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);
@@ -50,9 +43,4 @@ 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 */
+#endif /* QEMU_TAP_H */

+ 1 - 1
net/util.c

@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 
-#include "net/util.h"
+#include "util.h"
 #include <errno.h>
 #include <stdlib.h>
 

+ 1 - 1
net/vde.c

@@ -25,7 +25,7 @@
 
 #include <libvdeplug.h>
 
-#include "net.h"
+#include "net/net.h"
 #include "clients.h"
 #include "qemu-common.h"
 #include "qemu-option.h"

+ 1 - 1
savevm.c

@@ -72,7 +72,7 @@
 #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"

+ 1 - 1
vl.c

@@ -127,7 +127,7 @@ int main(int argc, char **argv)
 #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"