Skip to content

Commit 8e183a3

Browse files
authored
More details on fields egress spec and egress port (#1247)
1 parent c37ec2d commit 8e183a3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/simple_switch.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,22 @@ Here are the fields:
9090
ingress. If your P4 program assigns a value of DROP_PORT to `egress_spec`, it
9191
will still behave according to the "after-ingress pseudocode", even if you
9292
never call `mark_to_drop` (P4_16) or `drop` (P4_14).
93+
Note that if you never assign a value to this field, nor drop the
94+
packet, during ingress processing, its default initial value is 0,
95+
and the packet will be unicast to output port 0.
9396
- `egress_port` (sm14, v1m) - Only intended to be accessed during
94-
egress processing, read only. The output port this packet is
95-
destined to.
97+
egress processing, read only. While you can read its value during
98+
ingress processing, you should think of its value as uninitialized
99+
garbage during ingress. This field is assigned a predictable value
100+
just before the packet begins egress processing, equal to the output
101+
port that this packet is destined to (if it is not dropped during
102+
egress processing). There is no compile-time error or warning if
103+
you do assign to this field, but if you wish your P4 code to be
104+
easier to port to other programmable switches, do not ever assign it
105+
a value. See [Appendix D.2 "No output port change during egress" of
106+
the PNA
107+
specification](https://staging.p4.org/p4-spec/docs/psa-working-draft-html-version.html#appendix-rationale-egress-cannot-change-output-port)
108+
for some explanation of why.
96109
- `egress_instance` (sm14) - Renamed `egress_rid` in simple_switch.
97110
See `egress_rid` below.
98111
- `instance_type` (sm14, v1m) - Contains a value that can be read by

0 commit comments

Comments
 (0)