devices: virtio-net: implement MRG_RXBUF feature

Add a new process_mrg_rx flow to enable MRG_RXBUF feature.
In order to support this feature, following steps are
necessary.

1. Copy socket buffer to crosvm's pending buffer in advance,
so that we can know how much space this buffer required.
2. Queue need to support look around available ring
to try to pop several descriptors whose total length bigger than required.
3. Split the pending buffer in crosvm progress and write to each descriptor.
4. Queue need to support add all descriptors into used one time to avoid
unexpected error.

By the way, because we read socket packet to pending buffer
from tap in advance, if this packet has not sent to driver
due to vq is exhausted, we should keep it and use it firstly in next handle
process instead of re-reading from tap.

Furthermore, due to extra copy, the performance for rx big frame TCP will
descresed little, but rx UDP performance will increase significantly.

BUG=b/413511264
TEST=presubmit
Change-Id: Iaca233c714471d1ad52d29bb3eee75817ad3959a
Signed-off-by: Junnan Wu <junnan01.wu@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6490829
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
5 files changed
tree: 9c6c595e3458087b911612369cf7b4e066997ab2
  1. .cargo/
  2. .config/
  3. .devcontainer/
  4. .github/
  5. .vscode/
  6. aarch64/
  7. aarch64_sys_reg/
  8. acpi_tables/
  9. android_audio/
  10. arch/
  11. argh_helpers/
  12. audio_streams_conformance_test/
  13. audio_util/
  14. base/
  15. base_tokio/
  16. bit_field/
  17. broker_ipc/
  18. common/
  19. cros_async/
  20. cros_fdt/
  21. cros_tracing/
  22. cros_tracing_types/
  23. crosvm_cli/
  24. crosvm_control/
  25. crosvm_plugin/
  26. devices/
  27. disk/
  28. docs/
  29. e2e_tests/
  30. ext2/
  31. fuse/
  32. fuzz/
  33. gpu_display/
  34. hypervisor/
  35. infra/
  36. io_uring/
  37. jail/
  38. kernel_cmdline/
  39. kernel_loader/
  40. kvm/
  41. kvm_sys/
  42. libcras_stub/
  43. linux_input_sys/
  44. logo/
  45. media/
  46. metrics/
  47. metrics_events/
  48. net_sys/
  49. net_util/
  50. perfetto/
  51. power_monitor/
  52. prebuilts/
  53. proto_build_tools/
  54. protos/
  55. resources/
  56. riscv64/
  57. rutabaga_gfx/
  58. sandbox/
  59. serde_keyvalue/
  60. snapshot/
  61. src/
  62. swap/
  63. system_api/
  64. tests/
  65. third_party/
  66. tools/
  67. tube_transporter/
  68. usb_sys/
  69. usb_util/
  70. vendor/
  71. vfio_sys/
  72. vhost/
  73. virtio_sys/
  74. vm_control/
  75. vm_memory/
  76. win_audio/
  77. win_util/
  78. x86_64/
  79. .dockerignore
  80. .envrc
  81. .gitattributes
  82. .gitignore
  83. .gitmodules
  84. .rustfmt.toml
  85. ARCHITECTURE.md
  86. Cargo.lock
  87. Cargo.toml
  88. CONTRIBUTING.md
  89. DIR_METADATA
  90. LICENSE
  91. mypy.ini
  92. OWNERS
  93. OWNERS_COUNCIL
  94. PRESUBMIT.cfg
  95. pyproject.toml
  96. README.chromeos.md
  97. README.md
  98. rust-toolchain
README.md

crosvm - The ChromeOS Virtual Machine Monitor

crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the ChromeOS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.

crosvm is currently used to run Linux/Android guests on ChromeOS devices.

Logo