virtio_net.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef _LINUX_VIRTIO_NET_H
  2. #define _LINUX_VIRTIO_NET_H
  3. #include <linux/virtio_config.h>
  4. /* The ID for virtio_net */
  5. #define VIRTIO_ID_NET 1
  6. /* The bitmap of config for virtio net */
  7. #define VIRTIO_CONFIG_NET_F 0x40
  8. #define VIRTIO_NET_F_NO_CSUM 0
  9. #define VIRTIO_NET_F_TSO4 1
  10. #define VIRTIO_NET_F_UFO 2
  11. #define VIRTIO_NET_F_TSO4_ECN 3
  12. #define VIRTIO_NET_F_TSO6 4
  13. /* The config defining mac address. */
  14. #define VIRTIO_CONFIG_NET_MAC_F 0x41
  15. /* This is the first element of the scatter-gather list. If you don't
  16. * specify GSO or CSUM features, you can simply ignore the header. */
  17. struct virtio_net_hdr
  18. {
  19. #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
  20. __u8 flags;
  21. #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
  22. #define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
  23. /* FIXME: Do we need this? If they said they can handle ECN, do they care? */
  24. #define VIRTIO_NET_HDR_GSO_TCPV4_ECN 2 // GSO frame, IPv4 TCP w/ ECN
  25. #define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
  26. #define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
  27. __u8 gso_type;
  28. __u16 gso_size;
  29. __u16 csum_start;
  30. __u16 csum_offset;
  31. };
  32. #endif /* _LINUX_VIRTIO_NET_H */