# Packet Clone: identify the clone and the origin

**URL:** <https://forum.p4.org/t/packet-clone-identify-the-clone-and-the-origin/1194>\
**Category:** Getting Started with P4\
**Created:** [June 6, 2024, 2:14pm UTC](https://forum.p4.org/t/packet-clone-identify-the-clone-and-the-origin/1194 "2024-06-06T14:14:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![p4newbee](https://avatars.discourse-cdn.com/v4/letter/p/7ea924/32.png) [@p4newbee](https://forum.p4.org/u/p4newbee)\
**Post date:** [June 6, 2024, 2:14pm UTC](https://forum.p4.org/t/packet-clone-identify-the-clone-and-the-origin/1194/1 "2024-06-06T14:14:29Z")

</div>

Hello there,

When I perform a packet clone in the ingress pipeline, the original packet will be sent to the CPU port, and the clone will be processed by the `l2_forward` table lookup. Is this the expected behaviour?

Many thanks!

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [June 6, 2024, 3:15pm UTC](https://forum.p4.org/t/packet-clone-identify-the-clone-and-the-origin/1194/2 "2024-06-06T15:15:56Z")

</div>

WIth the v1model architecture, the expected behavior is that the cloned packet will have 0 or more copies made of it, depending upon how the mirror session has been configured (each mirror session can be configured to do nothing, in which case no clone is created, to send 1 clone to 1 output port, or to send N clones to a multicast group), each is then queued in the traffic manager, and each then performs egress processing independently of the original, and of any other clone copies made.

If you want gory details, see here for what should happen with all kinds of packets, whether cloned or not: [behavioral-model/docs/simple\_switch.md at main · p4lang/behavioral-model · GitHub](https://github.com/p4lang/behavioral-model/blob/main/docs/simple_switch.md)

Saying more about what should happen really depends upon your P4 program, e.g. not all P4 programs have an `l2_forward` table, so without seeing the program I don’t know anything about it other than its name.

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [June 6, 2024, 3:17pm UTC](https://forum.p4.org/t/packet-clone-identify-the-clone-and-the-origin/1194/3 "2024-06-06T15:17:31Z")

</div>

Note: If you are able to share your complete P4 program, and the output of the BMv2 packet processing log for a particular packet that you describe in your original question, perhaps someone could look at it and explain the behavior.
