[P4-dev] How to set a valid match field using P4Runtime?

Antonin Bas antonin at barefootnetworks.com
Tue Oct 17 10:50:17 EDT 2017


I replied here: https://github.com/p4lang/p4c/issues/970

On Tue, Oct 17, 2017 at 2:44 AM, <ding.rui at zte.com.cn> wrote:

> Hi, everyone, I want to ask question.
>
> A p4 program segment is shown as follows, after using the p4c compiler to
> generate the P4Info results,
>
> I want to set an entry, but the "vlan_tag_[0]" field is translated into
> "vlan_tag_[0].$valid{2}quot;, why is it
>
> translated into this? When apps set entry, how can the apps know the
> specific field name?
>
> vlan_tag_[0] : valid;      ---->   vlan_tag_[0].$valid$  match_type = EXACT
>
> vlan_tag_[0].vid : exact; ---->  vlan_tag_[0].vid        match_type =
> EXACT
>
> vlan_tag_[1] : valid;       ----> vlan_tag_[1].$valid$   match_type =
> EXACT
>
> vlan_tag_[1].vid : exact; ---->  vlan_tag_[1].vid         match_type =
> EXACT
>
>
> P4 program:
>
> table port_vlan_to_bd_mapping {
>
>     reads {
>
>         ingress_metadata.port_lag_index : exact;
>
>         vlan_tag_[0] : valid;
>
>         vlan_tag_[0].vid : exact;
>
>         vlan_tag_[1] : valid;
>
>         vlan_tag_[1].vid : exact;
>
>     }
>
>     action_profile: bd_action_profile;
>
>     size : PORT_VLAN_TABLE_SIZE;
>
> }
>
> P4Info results:
>
> tables {
>
>   preamble {
>
>     id: 33565429
>
>     name: "port_vlan_to_bd_mapping"
>
>     alias: "port_vlan_to_bd_mapping"
>
>   }
>
>   match_fields {
>
>     id: 1
>
>     name: "ingress_metadata.port_lag_index"
>
>     bitwidth: 10
>
>     match_type: EXACT
>
>   }
>
>   match_fields {
>
>     id: 2
>
>     name: "vlan_tag_[0].$valid{2}quot;
>
>     bitwidth: 1
>
>     match_type: EXACT
>
>   }
>
>   match_fields {
>
>     id: 3
>
>     name: "vlan_tag_[0].vid"
>
>     bitwidth: 12
>
>     match_type: EXACT
>
>   }
>
>   match_fields {
>
>     id: 4
>
>     name: "vlan_tag_[1].$valid{2}quot;
>
>     bitwidth: 1
>
>     match_type: EXACT
>
>   }
>
>   match_fields {
>
>     id: 5
>
>     name: "vlan_tag_[1].vid"
>
>     bitwidth: 12
>
>     match_type: EXACT
>
>   }
>
>   action_refs {
>
>     id: 16824627
>
>   }
>
>   action_refs {
>
>     id: 16792080
>
>   }
>
>   action_refs {
>
>     id: 16800567
>
>     annotations: "@defaultonly()"
>
>   }
>
>   implementation_id: 285264432
>
>   size: 32768
>
> }
>
>
>
>
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171017/35d9b3cb/attachment-0002.html>


More information about the P4-dev mailing list