features.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. package virtio
  2. // Feature contains feature bits that describe a virtio device or driver.
  3. type Feature uint64
  4. // Device-independent feature bits.
  5. //
  6. // Source: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-6600006
  7. const (
  8. // FeatureIndirectDescriptors indicates that the driver can use descriptors
  9. // with an additional layer of indirection.
  10. FeatureIndirectDescriptors Feature = 1 << 28
  11. // FeatureVersion1 indicates compliance with version 1.0 of the virtio
  12. // specification.
  13. FeatureVersion1 Feature = 1 << 32
  14. )
  15. // Feature bits for networking devices.
  16. //
  17. // Source: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-2200003
  18. const (
  19. // FeatureNetDeviceCsum indicates that the device can handle packets with
  20. // partial checksum (checksum offload).
  21. FeatureNetDeviceCsum Feature = 1 << 0
  22. // FeatureNetDriverCsum indicates that the driver can handle packets with
  23. // partial checksum.
  24. FeatureNetDriverCsum Feature = 1 << 1
  25. // FeatureNetCtrlDriverOffloads indicates support for dynamic offload state
  26. // reconfiguration.
  27. FeatureNetCtrlDriverOffloads Feature = 1 << 2
  28. // FeatureNetMTU indicates that the device reports a maximum MTU value.
  29. FeatureNetMTU Feature = 1 << 3
  30. // FeatureNetMAC indicates that the device provides a MAC address.
  31. FeatureNetMAC Feature = 1 << 5
  32. // FeatureNetDriverTSO4 indicates that the driver supports the TCP
  33. // segmentation offload for received IPv4 packets.
  34. FeatureNetDriverTSO4 Feature = 1 << 7
  35. // FeatureNetDriverTSO6 indicates that the driver supports the TCP
  36. // segmentation offload for received IPv6 packets.
  37. FeatureNetDriverTSO6 Feature = 1 << 8
  38. // FeatureNetDriverECN indicates that the driver supports the TCP
  39. // segmentation offload with ECN for received packets.
  40. FeatureNetDriverECN Feature = 1 << 9
  41. // FeatureNetDriverUFO indicates that the driver supports the UDP
  42. // fragmentation offload for received packets.
  43. FeatureNetDriverUFO Feature = 1 << 10
  44. // FeatureNetDeviceTSO4 indicates that the device supports the TCP
  45. // segmentation offload for received IPv4 packets.
  46. FeatureNetDeviceTSO4 Feature = 1 << 11
  47. // FeatureNetDeviceTSO6 indicates that the device supports the TCP
  48. // segmentation offload for received IPv6 packets.
  49. FeatureNetDeviceTSO6 Feature = 1 << 12
  50. // FeatureNetDeviceECN indicates that the device supports the TCP
  51. // segmentation offload with ECN for received packets.
  52. FeatureNetDeviceECN Feature = 1 << 13
  53. // FeatureNetDeviceUFO indicates that the device supports the UDP
  54. // fragmentation offload for received packets.
  55. FeatureNetDeviceUFO Feature = 1 << 14
  56. // FeatureNetMergeRXBuffers indicates that the driver can handle merged
  57. // receive buffers.
  58. // When this feature is negotiated, devices may merge multiple descriptor
  59. // chains together to transport large received packets. [NetHdr.NumBuffers]
  60. // will then contain the number of merged descriptor chains.
  61. FeatureNetMergeRXBuffers Feature = 1 << 15
  62. // FeatureNetStatus indicates that the device configuration status field is
  63. // available.
  64. FeatureNetStatus Feature = 1 << 16
  65. // FeatureNetCtrlVQ indicates that a control channel virtqueue is
  66. // available.
  67. FeatureNetCtrlVQ Feature = 1 << 17
  68. // FeatureNetCtrlRX indicates support for RX mode control (e.g. promiscuous
  69. // or all-multicast) for packet receive filtering.
  70. FeatureNetCtrlRX Feature = 1 << 18
  71. // FeatureNetCtrlVLAN indicates support for VLAN filtering through the
  72. // control channel.
  73. FeatureNetCtrlVLAN Feature = 1 << 19
  74. // FeatureNetDriverAnnounce indicates that the driver can send gratuitous
  75. // packets.
  76. FeatureNetDriverAnnounce Feature = 1 << 21
  77. // FeatureNetMQ indicates that the device supports multiqueue with automatic
  78. // receive steering.
  79. FeatureNetMQ Feature = 1 << 22
  80. // FeatureNetCtrlMACAddr indicates that the MAC address can be set through
  81. // the control channel.
  82. FeatureNetCtrlMACAddr Feature = 1 << 23
  83. // FeatureNetDeviceUSO indicates that the device supports the UDP
  84. // segmentation offload for received packets.
  85. FeatureNetDeviceUSO Feature = 1 << 56
  86. // FeatureNetHashReport indicates that the device can report a per-packet
  87. // hash value and type.
  88. FeatureNetHashReport Feature = 1 << 57
  89. // FeatureNetDriverHdrLen indicates that the driver can provide the exact
  90. // header length value (see [NetHdr.HdrLen]).
  91. // Devices may benefit from knowing the exact header length.
  92. FeatureNetDriverHdrLen Feature = 1 << 59
  93. // FeatureNetRSS indicates that the device supports RSS (receive-side
  94. // scaling) with configurable hash parameters.
  95. FeatureNetRSS Feature = 1 << 60
  96. // FeatureNetRSCExt indicates that the device can process duplicated ACKs
  97. // and report the number of coalesced segments and duplicated ACKs.
  98. FeatureNetRSCExt Feature = 1 << 61
  99. // FeatureNetStandby indicates that the device may act as a standby for a
  100. // primary device with the same MAC address.
  101. FeatureNetStandby Feature = 1 << 62
  102. // FeatureNetSpeedDuplex indicates that the device can report link speed and
  103. // duplex mode.
  104. FeatureNetSpeedDuplex Feature = 1 << 63
  105. )