virtio_net.h 1.2 KB

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