[P4-discuss] standard_metadata.egress_spec and egress Control Programm

Antonin Bas antonin at barefootnetworks.com
Fri Oct 14 12:41:29 EDT 2016


As per the p4spec, standard_metadata.egress_spec needs to be by definition
set in the ingress control flow. This metadata field is a way for the P4
programmer to express the intended egress, so it makes sense that this
field cannot be set in the egress control flow. When the egress control
flow is executed you already know which physical port the packet is
committed to, and you can access this information in
standard_metadata.egress_port, which is a read-only field.
If you are not familiar with the P4 abstract switch model, I encourage you
to read the spec: http://p4.org/wp-content/uploads/2015/04/p4-latest.pdf

On Thu, Oct 13, 2016 at 10:58 PM, Thambi Sreedharan <thambisree at gmail.com>
wrote:

> Hi
>
> The behavioral-model/targets/simple_switch (commit
> ff0cdf4f2c9abc27ee46d33f5cd6b742aacce28c) is used for testing.
> We  set the standard_metadata.egress_spec (for the exit port) in egress
> pipeline, but all the pkts goes to Port 0.
> If we move the table_action to ingress pipeline then the pkt exit to
> correct egress port.
>
> Please let me know how I can set egress_spec in Egress pipe line and it
> goes to correct egress port.
>
> Thanks
> Thambi
>
> The table_action :
>
> action set_egress_port(egressPort) {
>
>     modify_field(standard_metadata.egress_spec, egressPort);
>
> }
>
>
>
> table egMap2Port {
>
>     reads {
>
>         egress_metadata.portMap : exact;
>
>     }
>
>
>     actions {
>
>                 set_egress_port;
>
>                 eg_drop;
>
>         }
>
>
>         size: EGMAP2PORT_SIZE;
>
>
> }
>
> _______________________________________________
> P4-discuss mailing list
> P4-discuss at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-discuss_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20161014/f8e50e22/attachment-0002.html>


More information about the P4-discuss mailing list