Skip to content

RFC: vswitch design #636

@JDuchniewicz

Description

@JDuchniewicz
Author(s) @JDuchniewicz, @alexandermbrown
Date of last update 13 Feb 2026

Original PR with description and design: #177

Overview

The vswitch models a physical Ethernet switch where we have the ability to send and receive packets to all PDs connected to the vswitch. vswitch has to connect to at least one virtualiser TX/RX pair (further connected to a Device) and one or more clients - each consisting of a set of sDDF network queues (TX/RX active & free).

Each pair of TX/RX queues comprises a port, similar to Ethernet ports. Whether a given port can talk to another one is established by the routing table. How we set it up is one of the open questions of the design.

Filtering

Each port has an allow-list that specify which other ports on the vswitch it can access. The allow-list construction is done statically during the system file creation. We could allow for dynamic modification of that allowlist during runtime via a PPC.

Copying

Right now we are copying every packet that is being forwarded to avoid the problem of all free buffers accumulating on one client. When connecting the clients we don't need a copier component on the RX path anymore because the vswitch will handle that.

An open question is whether we can avoid the copy on the TX path, as it is being done in the systems without the vswitch on the TX path (from the client's perspective).

Example System

Image (Image courtesy of @alexandermbrown)

Open questions

Carrying over some questions from the original PR:

  • Who should be doing the multiplexing: vswitch or the virtualiser? Currently virtualiser performs the multiplexing between all connected PDs and allows for broadcasting the packets to all of them. This means overlapping responsibilities between vswitch and the RX virtualiser.
    In the original PR there is also the idea of merging components but I think that's beyond scope

Some of my own:

  • Can VSwitch have more virtualiser pairs connected? Does it even make sense?
  • Do we want to allow for vswitch daisy-chaining? In such case we must resort to dynamic routing as we will have multiple MAC addresses corresponding to one port
  • Can we avoid copying? Seems like we could get away with not copying on TX path from the virtualiser but that would require a good way of handling the buffers.

Option 1: Static routing table

In this option we have just a single virtualiser connected and multiple clients where none of them can be a vswitch
(they actually could but we would need to recursively find all the MACs that present themselves behind this port, then we have also the issue of having a virtualiser behind a vswitch connected to a vswitch).

We construct a MAC to client's port mapping during sdf creation. When the vswitch is operational and it receives a packet, it routes it to a known client using the static MAC to client mapping. If the destination MAC is unknown it means it has to be routed to the outside via the virtualiser port (to the device and to the outside world).

Option 2: Dynamic routing table

This is the design from the original PR. The routing table is constructed dynamically as the vswitch receives packets. The MAC to client mappings are then created and reused, but this still has to search through all existing mappings to see if we don't have a mapping to this MAC already which is slow. This has the advantage that we can have many various devices connected, possibly daisy-chained vswitches. But we have to trade-off some time during packet processing for the table creation and updating.

The original PR did not foresee vswitch behind a vswitch as there is still a one-to-one MAC and port number mapping (unless I am understanding the code wrongly).

Related branches

sddf
meta.py virtio_vswitch example
sdf changes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions