netvsc.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. .. SPDX-License-Identifier: GPL-2.0
  2. ======================
  3. Hyper-V network driver
  4. ======================
  5. Compatibility
  6. =============
  7. This driver is compatible with Windows Server 2012 R2, 2016 and
  8. Windows 10.
  9. Features
  10. ========
  11. Checksum offload
  12. ----------------
  13. The netvsc driver supports checksum offload as long as the
  14. Hyper-V host version does. Windows Server 2016 and Azure
  15. support checksum offload for TCP and UDP for both IPv4 and
  16. IPv6. Windows Server 2012 only supports checksum offload for TCP.
  17. Receive Side Scaling
  18. --------------------
  19. Hyper-V supports receive side scaling. For TCP & UDP, packets can
  20. be distributed among available queues based on IP address and port
  21. number.
  22. For TCP & UDP, we can switch hash level between L3 and L4 by ethtool
  23. command. TCP/UDP over IPv4 and v6 can be set differently. The default
  24. hash level is L4. We currently only allow switching TX hash level
  25. from within the guests.
  26. On Azure, fragmented UDP packets have high loss rate with L4
  27. hashing. Using L3 hashing is recommended in this case.
  28. For example, for UDP over IPv4 on eth0:
  29. To include UDP port numbers in hashing::
  30. ethtool -N eth0 rx-flow-hash udp4 sdfn
  31. To exclude UDP port numbers in hashing::
  32. ethtool -N eth0 rx-flow-hash udp4 sd
  33. To show UDP hash level::
  34. ethtool -n eth0 rx-flow-hash udp4
  35. Generic Receive Offload, aka GRO
  36. --------------------------------
  37. The driver supports GRO and it is enabled by default. GRO coalesces
  38. like packets and significantly reduces CPU usage under heavy Rx
  39. load.
  40. Large Receive Offload (LRO), or Receive Side Coalescing (RSC)
  41. -------------------------------------------------------------
  42. The driver supports LRO/RSC in the vSwitch feature. It reduces the per packet
  43. processing overhead by coalescing multiple TCP segments when possible. The
  44. feature is enabled by default on VMs running on Windows Server 2019 and
  45. later. It may be changed by ethtool command::
  46. ethtool -K eth0 lro on
  47. ethtool -K eth0 lro off
  48. SR-IOV support
  49. --------------
  50. Hyper-V supports SR-IOV as a hardware acceleration option. If SR-IOV
  51. is enabled in both the vSwitch and the guest configuration, then the
  52. Virtual Function (VF) device is passed to the guest as a PCI
  53. device. In this case, both a synthetic (netvsc) and VF device are
  54. visible in the guest OS and both NIC's have the same MAC address.
  55. The VF is enslaved by netvsc device. The netvsc driver will transparently
  56. switch the data path to the VF when it is available and up.
  57. Network state (addresses, firewall, etc) should be applied only to the
  58. netvsc device; the slave device should not be accessed directly in
  59. most cases. The exceptions are if some special queue discipline or
  60. flow direction is desired, these should be applied directly to the
  61. VF slave device.
  62. Receive Buffer
  63. --------------
  64. Packets are received into a receive area which is created when device
  65. is probed. The receive area is broken into MTU sized chunks and each may
  66. contain one or more packets. The number of receive sections may be changed
  67. via ethtool Rx ring parameters.
  68. There is a similar send buffer which is used to aggregate packets
  69. for sending. The send area is broken into chunks, typically of 6144
  70. bytes, each of section may contain one or more packets. Small
  71. packets are usually transmitted via copy to the send buffer. However,
  72. if the buffer is temporarily exhausted, or the packet to be transmitted is
  73. an LSO packet, the driver will provide the host with pointers to the data
  74. from the SKB. This attempts to achieve a balance between the overhead of
  75. data copy and the impact of remapping VM memory to be accessible by the
  76. host.
  77. XDP support
  78. -----------
  79. XDP (eXpress Data Path) is a feature that runs eBPF bytecode at the early
  80. stage when packets arrive at a NIC card. The goal is to increase performance
  81. for packet processing, reducing the overhead of SKB allocation and other
  82. upper network layers.
  83. hv_netvsc supports XDP in native mode, and transparently sets the XDP
  84. program on the associated VF NIC as well.
  85. Setting / unsetting XDP program on synthetic NIC (netvsc) propagates to
  86. VF NIC automatically. Setting / unsetting XDP program on VF NIC directly
  87. is not recommended, also not propagated to synthetic NIC, and may be
  88. overwritten by setting of synthetic NIC.
  89. XDP program cannot run with LRO (RSC) enabled, so you need to disable LRO
  90. before running XDP::
  91. ethtool -K eth0 lro off
  92. XDP_REDIRECT action is not yet supported.