1 ; SPDX-License-Identifier: BSD-3-Clause
2 ; Copyright(c) 2022 Intel Corporation
4 ; This simple example illustrates how to perform packet recirculation. The "recirculate" instruction
5 ; is used to mark the current packet for recirculation, which means that at TX time the packet is
6 ; reinjected into the pipeline for another full pass as opposed to being sent to the output port.
8 ; The same packet can be recirculated multiple times, with the recirculation pass ID retrieved by
9 ; the "recircid" instruction. The pass ID can be used by the program to execute different code on
10 ; the same packet in different pipeline passes. The packet meta-data is preserved between the
26 bit<16> identification
42 header ethernet instanceof ethernet_h
43 header ipv4 instanceof ipv4_h
44 header udp instanceof udp_h
54 metadata instanceof metadata_t
66 // State machine based on the recirculation pass ID.
68 // During each of the first 5 passes through the pipeline (m.pass_id is 0 .. 4), the UDP
69 // source port is incremented and the packet is marked for recirculation, while on the final
70 // iteration (m.pass_id is 5) the packet is sent out.
73 jmpgt EMIT m.pass_id 4
77 EMIT : emit h.ethernet