Document the txpp sample application, which measures the precision of the send-on-timestamp (Tx packet pacing) offload, and add a release note entry.
Signed-off-by: Soumyadeep Hore <[email protected]> --- MAINTAINERS | 1 + doc/guides/rel_notes/release_27_03.rst | 5 + doc/guides/sample_app_ug/index.rst | 1 + doc/guides/sample_app_ug/txpp.rst | 162 +++++++++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 doc/guides/sample_app_ug/txpp.rst diff --git a/MAINTAINERS b/MAINTAINERS index d8c4353e6a..ec99569c84 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2122,6 +2122,7 @@ F: doc/guides/sample_app_ug/skeleton.rst Tx packet pacing example M: Soumyadeep Hore <[email protected]> F: examples/txpp/ +F: doc/guides/sample_app_ug/txpp.rst VMDq examples F: examples/vmdq/ diff --git a/doc/guides/rel_notes/release_27_03.rst b/doc/guides/rel_notes/release_27_03.rst index a91813faca..561b3a535f 100644 --- a/doc/guides/rel_notes/release_27_03.rst +++ b/doc/guides/rel_notes/release_27_03.rst @@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added Tx packet pacing sample application.** + + Added the ``txpp`` sample application to measure the precision + of the send-on-timestamp (Tx packet pacing) offload. + Removed Items ------------- diff --git a/doc/guides/sample_app_ug/index.rst b/doc/guides/sample_app_ug/index.rst index 4cb3115f2b..2893aae714 100644 --- a/doc/guides/sample_app_ug/index.rst +++ b/doc/guides/sample_app_ug/index.rst @@ -50,6 +50,7 @@ Sample Applications User Guides vm_power_management ptpclient ptp_tap_relay_sw + txpp ipsec_secgw bbdev_app ntb diff --git a/doc/guides/sample_app_ug/txpp.rst b/doc/guides/sample_app_ug/txpp.rst new file mode 100644 index 0000000000..298319cb1c --- /dev/null +++ b/doc/guides/sample_app_ug/txpp.rst @@ -0,0 +1,162 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2026 Intel Corporation. + +Tx Packet Pacing Sample Application +=================================== + +The Tx Packet Pacing sample application measures the precision of the +Earliest TxTime First (ETF) offload, also known as send-on-timestamp +(``RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP``). + +Overview +-------- + +The application runs a paced generator on a Tx port and a receiver on a +separate Rx port. + +The generator gives every packet a hardware launch time that tracks the +device PHC. The PHC is read with ``rte_eth_read_clock()`` and extrapolated +with the TSC, and packets are handed to hardware in bursts, each packet only +a fixed lead time before its launch time. As a result the schedule always +tracks real time and never runs ahead of the hardware scheduling window, +which is what makes precise, non-dropping pacing possible. The scheduled +launch time and a sequence number are also written into the packet payload. +Pacing starts once the Tx link is up, so no packet is lost on the wire. + +The generator reports the packets handed to the driver after their launch +time, which cannot be paced, the bursts that had to wait for Tx ring room, +and the stalls of its own loop, during which no packet is handed over. +The first two are zero when the lead time and the Tx ring size fit the +requested interval and the lead time is longer than the longest stall. +The packets sent by the NIC are reported from the port statistics. + +The receiver enables Rx hardware timestamping +(``RTE_ETH_RX_OFFLOAD_TIMESTAMP``) and, for every packet, compares the +hardware Rx timestamp with the scheduled launch time carried in the +payload. It reports the launch error (bias and jitter), the inter-arrival +interval accuracy, sequence gaps and an error histogram. + +When both ports are on the same adapter they share a PHC and the launch +error is absolute. When they are on different adapters the bias carries a +constant PHC offset, so the jitter and the inter-arrival interval are the +meaningful precision metrics. + +Compiling the Application +------------------------- + +To compile the sample application, see :doc:`compiling`. + +The application is located in the ``txpp`` sub-directory. + +Running the Application +----------------------- + +The Tx port must support ``RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP`` and the +Rx port must support ``RTE_ETH_RX_OFFLOAD_TIMESTAMP``. At least two lcores +are required (one for the generator and one for the receiver). + +To run the example in a ``linux`` environment, with the Tx port cabled to +the Rx port: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 0-2 -a <tx_pci> -a <rx_pci> -- \ + -t 0 -r 1 -i 10000 -l 50000 -o 1000000 -n 100000 + +The application parameters are: + +* ``-t PORT``: Tx (generator) port id (default 0). + +* ``-r PORT``: Rx (receiver) port id (default 1). + +* ``-i NS``: requested inter-packet interval in nanoseconds (default 10000). + +* ``-g N``: packets per group, sent ``-i`` apart (default 1). + +* ``-p NS``: start-to-start period of the groups in nanoseconds + (default group size times interval, that is evenly spaced packets). + +* ``-l NS``: lead time a packet is given to hardware before its launch + time (default 50000). + +* ``-o NS``: initial lead of the first launch time (default 1000000). + +* ``-n COUNT``: number of packets to send, 0 means run until stopped + (default 0). + +* ``-s BYTES``: packet size (default 64). + +* ``-q DESC``: Tx ring size (default 1024). The ring must hold the packets + of one lead time, that is lead time divided by interval. + +* ``-R N``: Tx RS and free threshold (default the PMD default). + +* ``-b N``: minimum number of packets handed to the driver at once, + up to 256 (default 1). + +* ``-Q N``: number of Tx queues, packet *n* is sent on queue *n* modulo + *N*, up to 16 (default 1). + +* ``-c NS``: fixed latency subtracted from the measured error, for + example the cable and PHY delay (default 0). + +* ``-T``: Tx only, no Rx port is used. The receiver runs on another host + and identifies the frames by their EtherType (0x88B5), magic, sequence + number and scheduled launch time. + +* ``-d MAC``: destination MAC address of the frames + (default the Rx port MAC address, or broadcast with ``-T``). + +To pace packets for a receiver on another host, only one lcore is needed: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 1 -a <tx_pci> -- -T -i 10000 -n 100000 + +A longer lead time gives the hardware more time to fetch the packet and +improves the precision, small intervals then need a larger Tx ring: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 1 -a <tx_pci> -- -T -i 1024 \ + -l 500000 -q 4096 -n 1000000 + +When an extra lcore is given, the device clock is read on it, so the +generator never waits for a clock read. This is needed when reading the +clock is slow, as on a VF where every read is a request to the PF, and the +lead time must then also cover the clock read time: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 1,2 -a <vf_pci> -- -T -i 1024 \ + -l 2000000 -q 4096 -n 1000000 + +At high packet rates every Tx doorbell and every descriptor write-back +disturbs the packet being launched at that time. Handing packets over in +large bursts with a matching Tx RS threshold reduces both and improves +the precision: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 1,2 -a <tx_pci> -- -T -i 1024 \ + -l 2000000 -q 4096 -b 256 -R 256 -n 1000000 + +Short groups of closely spaced packets, as sent by media senders, +are paced with ``-g`` and ``-p``. For example groups of 8 packets +128 ns apart, starting every 8192 ns: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 1,2 -a <tx_pci> -- -T -i 128 \ + -g 8 -p 8192 -l 2000000 -q 4096 -b 256 -R 256 -n 1000000 + +A Tx queue fetches a packet only when its launch time expires, so packets +of one queue that are closer than this fetch time leave together. +Spreading them over several queues lets each one be fetched on time: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-txpp -l 1,2 -a <tx_pci> -- -T -i 128 \ + -g 8 -p 8192 -Q 8 -l 2000000 -q 4096 -b 256 -R 256 -n 1000000 + +Press ``Ctrl-C`` to stop; the measured statistics are printed on exit. -- 2.43.0

