# How do I access the data of ingress in egress？

**URL:** <https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758>\
**Category:** Getting Started with P4\
**Created:** [April 23, 2023, 10:44am UTC](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758 "2023-04-23T10:44:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PinesL](https://avatars.discourse-cdn.com/v4/letter/p/54ee81/32.png) [@PinesL](https://forum.p4.org/u/PinesL)\
**Post date:** [April 23, 2023, 10:44am UTC](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758/1 "2023-04-23T10:44:33Z")

</div>

I calculate a data in ingress and I want to obtain this data in egree. Is there any way?

---

<div class="post-metadata">

**Author:** ![SteffenLindner](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/steffenlindner/32/99_2.png) [@SteffenLindner](https://forum.p4.org/u/SteffenLindner)\
**Post date:** [April 23, 2023, 12:27pm UTC](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758/2 "2023-04-23T12:27:10Z")

</div>

You can write it to metadata or a transient header.

---

<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:** [April 23, 2023, 3:17pm UTC](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758/3 "2023-04-23T15:17:23Z")

</div>

The implementation of the v1model architecture in the behavioral-model simple\_switch / simple\_switch\_grpc process enables the feature that any assignments made to user-defined metadata fields in ingress are preserved with the packet and readable (and assignable) in egress processing.

There are other P4 architectures, e.g. Tofino’s Native Architecture (TNA) where making a field calculated in ingress to be readable in egress, requires copying the field into a “bridge” metadata header that is prepended to the packet during ingress processing, and parsed in the egress parser.

So there are variations here that may require different approaches, but if you are asking about the v1model architecture implementation in open source, it is quite easy to achieve.

---

<div class="post-metadata">

**Author:** ![PinesL](https://avatars.discourse-cdn.com/v4/letter/p/54ee81/32.png) [@PinesL](https://forum.p4.org/u/PinesL)\
**Post date:** [April 24, 2023, 1:19am UTC](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758/4 "2023-04-24T01:19:14Z")

</div>

Thank you for your advice. I am studying P4 in TNA，‘bridge’ is exactly what I want.
