Add local vhost loopback example for single-machine development - #57
Closed
sarsanaee wants to merge 1 commit into
Closed
Add local vhost loopback example for single-machine development#57sarsanaee wants to merge 1 commit into
sarsanaee wants to merge 1 commit into
Conversation
Machnet previously required a physical DPDK NIC (and typically a pair of cloud VMs) to try anything end-to-end. This adds a self-contained local test that runs the full datapath on one Linux machine using DPDK virtual devices: a net_vhost port and a virtio_user port wired back-to-back over a unix socket, driven by the existing hello_world app. - examples/local_vhost_test.sh: starts the daemon on the vhost pair and verifies a hello_world message crosses the loop; heavily commented so it doubles as local-development documentation. - examples/local_vhost_config.json: two-interface config for the loop. - machnet_config: new optional per-interface "vdev" key, passed to DPDK as --vdev (plus --no-pci when no physical ports are configured). vdev arguments are sorted so DPDK port ids -- and thus the net_vhost MAC, which is derived from the port id -- are deterministic. - pmd.cc: fall back to a basic ethernet configuration with a warning, instead of LOG(FATAL), when a port lacks TX checksum offloads; virtual devices have none, and nothing on a local loop verifies checksums. - README.md / src/apps/machnet/README.md: document the new field and the local workflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFQ6Rh1j4r3i9QURDaUyXm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a self-contained way to develop and test Machnet locally on one Linux machine — no physical NIC, second VM, or cloud setup — by running the stack on a pair of DPDK virtual devices (
net_vhost+virtio_user) wired back-to-back over a unix socket.examples/local_vhost_test.sh— one-command local experiment: starts the Machnet daemon on the vhost pair, then runs the existinghello_worldserver (10.66.0.1) and client (10.66.0.2) and asserts the message crosses the loop (ARP, handshake, data transfer). Heavily commented so it doubles as local-dev documentation.examples/local_vhost_config.json— the two-interface config for the loop.machnet_config— new optional per-interface"vdev"key, passed to DPDK as--vdev(plus--no-pciwhen no physical ports are configured). vdev args are sorted so DPDK port ids — and hence thenet_vhostMAC, which is derived from the port id (56:48:4f:53:54:<port id>) — are deterministic across runs.pmd.cc— ports lacking TX checksum offloads now fall back to a basic ethernet configuration with a loud warning instead ofLOG(FATAL). Virtual devices have no checksum offloads; nothing on a local loop verifies checksums, so this is safe for the intended use and keeps the fatal-by-default spirit via the warning.vdevfield docs.Testing
bash -non the script and JSON validation pass.sudo examples/local_vhost_test.shbefore undrafting. Known risk to verify: thenet_vhostPMD MAC assumption (56:48:4f:53:54:00for port 0) — the script's comments explain how to reconcile against the[PMDPORT]log lines if it differs.🤖 Generated with Claude Code
https://claude.ai/code/session_01EFQ6Rh1j4r3i9QURDaUyXm