1 ; SPDX-License-Identifier: BSD-3-Clause
2 ; Copyright(c) 2022 Intel Corporation
4 ; This simple example illustrates how to perform packet mirroring. The "mirror" instruction is used
5 ; to flag the current packet for mirroring, which means that at TX time, before the current packet
6 ; is sent out, it will first be cloned (using either the fast or the slow/deep cloning method) and
7 ; the clone packet sent out on the output port specified by the mirror session.
9 ; In this example, the UDP packets with destination port 5000 are mirrored to the output port
10 ; specified by the mirror session 0, while the rest of the packets are not mirrored. Therefore, for
11 ; every UDP input packet with this specific destination port there will be two output packets (the
12 ; current packet and its clone packet), while for every other input packet there will be a single
28 bit<16> identification
44 header ethernet instanceof ethernet_h
45 header ipv4 instanceof ipv4_h
46 header udp instanceof udp_h
54 bit<32> mirror_session
57 metadata instanceof metadata_t
69 // Mark for mirroring all packets with UDP destination port of 5000.
71 MIRROR_UDP_DST_PORT_5000 : jmpneq EMIT h.udp.dst_port 5000
73 mov m.mirror_session 0
74 mirror m.mirror_slot m.mirror_session
76 EMIT : emit h.ethernet