This file lists what is known to be missing or wrong in p4sim, and what is planned. Most items were found while reviewing the PRs of November 2026. Each item says what the problem is, what we propose, and where it stands. A PR that resolves an item removes it from this file.
Branches: main holds P4sim 2.0 and later. main-deprecated keeps the 1.x
line (bridge ports only, the old timing model) and gets no more changes.
- Today. The backlog builds up in the TM queues between the ingress and the
egress (
egress_buffer, or the VOQs), where scheduling and AQM belong. After the egress, each port has a transfer buffer (TransferBufferSizeframes): a plain FIFO that stands for the hardware port queue. A port takes packets from the TM while it is idle or its transfer buffer has room; the buffer never drops, and its frames are not overtaken. The default, 0, keeps the earlier behaviour: a port takes the next packet only when it is idle. (#22's per-port ns-3QueueDiscafter the egress was removed before 2.0: as the port took one packet at a time, it never held more than one.) - Literature check (November 2026), Tofino and Tofino 2. We have not
measured this on hardware; these are published sources.
- The backlog of an oversubscribed port sits in the TM's shared buffer between the ingress and the egress pipelines; all admission control and drop thresholds are in the TM (Tofino Native Architecture application note §2, §5.7; Bosshart et al., SIGCOMM 2013, §4; Arista 7170 white paper).
- The TM scheduler dequeues per port at the port's speed, and the path after it (egress parser buffer, egress pipeline, deparser, egress buffer, MAC) is flow-controlled by credits: only a few packets are in flight after the dequeue, and the egress parser never drops. The sizes of these buffers are not public.
enq_qdepthanddeq_qdepthare TM queue depths (in 80-byte cells on Tofino, 176-byte cells on Tofino 2); packets already dequeued are not counted. Whether the dequeued packet itself counts is not documented (BurstRadar, APSys 2018, assumes it does; Intel's open-source tofino-model and BMv2 do not).- So this design matches the hardware.
- Still open.
- The default size of the transfer buffer: no public value; a rough estimate is one or two full-size frames at 100 Gbps. It is 0 for now.
- The transfer buffer does not work with
EnableVoqFabricyet: the VOQ traffic manager hands each port one frame at a time itself. - The queue depth: the dequeued packet does not count in
deq_qdepth(as in BMv2), and neither do the frames in the transfer buffer.
- Today. Every hop is store and forward: a device gets a frame only when its last bit has arrived, so each hop adds one serialisation time (120 ns for a 1500-byte frame at 100 Gbps).
- Question. Tofino can also forward cut-through, starting on a frame before it has fully arrived (it is store and forward by default). Whether to model that is open; it changes the latency, not the throughput.
- PSA and PNA.
- PNA has no Thrift service of its own (BMv2's
pna_nichas one, for the time commands ofpna_nic_CLI); itsFlowTablePathruns inbm_CLI. - PSA and PNA give no digest records: BMv2's
psa_switchandpna_nicdo not pass digests on either.
- PNA has no Thrift service of its own (BMv2's
- The pipeline core (
P4SwitchArch3) ignoresmcast_grp, clones, resubmit and recirculation, without a warning: a v1model program that floods (L2 learning, for example) sends nothing. Proposal: give it the packet replication engine of v1model (theMcSimplePreLAGcomponent, so that themc_*commands ofsimple_switch_CLIwork) and an egress pass per copy; meanwhile, log a warning when a packet asks for one of them. PipelineDelayfollow-ups (#59).- No separate egress delay (decided November 2026): one delay before the TM is enough. With the same total and a port that takes its packets early enough to keep the line busy, a second delay after the TM would send the same frames in the same order at the same times (by analysis, not measured). Only the timestamps that the P4 program sees and the timing of egress clones would differ.
- A model per stage (Tofino's ingress and egress share a fixed number of match-action stages; register accesses may add time). BMv2's JSON has no stage allocation, so p4sim cannot see the stages.
- The default is 0. No published figure covers the whole pipeline; the attribute's help text gives a measured one for scale.
- Runtime CLI during the simulation. The Thrift server of a switch runs in
its own thread, so a CLI that runs during the simulation changes the switch
without synchronisation with it. The CLIs are for before and after the
simulation,
P4Controllerfor changes during it. (A CLI that connects after its switch was destroyed gets an error: the services of a switch stop before it is destroyed.) - Smaller gaps, to do when a test or user needs them:
- a configurable drop port (all switches of a simulation would share it);
- a mirroring session with both a port and a multicast group;
- the other PRE commands of
simple_switch_CLIin the STF harness (mc_node_update,mc_node_dissociate,mc_mgrp_destroy, ...).
- The branches
ns-3.39andns-3.49are based on P4sim 1.x (main at #35).mainnow builds with ns-3.39 to ns-3.49, sons-3.49is no longer needed. - BMv2.
- Upstream fix for BMv2's bundled spdlog (
registry.h), which GCC rejects from C++20 on; until then, P4sim builds with a fixed copy of these headers (CMakeLists.txt,patches/bmv2-spdlog-cxx20.patch). - Build BMv2 with optimisation (-O2).
- Find BMv2 with CMake imported targets instead of the fixed
/usr/local/lib. - Upstream fix for
psa_switch_CLI(1.15.8):mirroring_deletecallsmirroring_mapping_delete, which thepsa_switchservice does not have; and the CLI does not importInvalidMirroringOperation, so any failed mirroring command raises aNameError. Both end the CLI. - Upstream fix for BMI (1.15.8):
bmi_port_destroy_mgr()joins the port manager's thread even when the manager was never started, which crashes with glibc 2.43 (Ubuntu 26.04). P4sim is not affected: its switches have a device manager without ports instead of BMI.
- Upstream fix for BMv2's bundled spdlog (
P4Controller's meter functions.SetMeterRates(),GetMeterRates()andResetMeterRates()each have an overload for a table entry (bm::entry_handle_t) and one for a meter array (size_t): anintargument does not compile, and the type of the variable picks the overload. Proposal: name the meter-array onesMeterSetRates(), ... asP4RuntimeApidoes.