[P4-dev] ingress_port with simple_router

Andy Fingerhut andy.fingerhut at gmail.com
Sat May 27 18:19:28 EDT 2017


If you use the --log-console option to the simple_switch command, you
should see extra debug information such as the names of tables, and the
names of search key fields and their values, every time a table is applied
(plus other useful trace info).

Note that if a packet arrives that has no 802.1Q header, the vlan_tag.vid
field value is undefined, and thus is not easy to predict what its actual
binary value will be, and unlikely to match any entries in your table
unless you insert all possible entries.

One way to handle this with an exact match table is, before apply'ing the
table, check whether the vlan_tag header is valid.  If it is, assign the
vid value to some similarly named field in metadata, e.g. my_meta.vid.  If
vlan_tag is not valid, assign some default valid to my_meta.vid, e.g.
0xfff.  Then the value of my_meta.vid will be predictable.  You may also
want to add the valid bit of the vlan_tag header to your table's search
key, to distinguish the packets that have an 802.1Q header from those that
do not.

Andy

On Fri, May 26, 2017 at 6:56 PM, Aldo Febro <af12abw at gmail.com> wrote:

> Hi All,
>
> I think I'm missing something simple here that I kept getting "table miss"
> when I try to match with 2 conditions i.e. ingress_port and VLAN ID.
>
> I'm using simple_router and I'm trying drop packets that are coming from
> ingress_port 5 with VLAN ID 10.
>
> To populate the table, I used the following command:
> "table_add port_vlan_check _drop 5 10 =>"
>
>
> P4 code:
> table port_vlan_check {
>  reads {
> standard_metadata.ingress_port : exact;
> vlan_tag.vid : exact;
> }
> actions {
> _drop;
> _nop;
>  }
>  size 16384;
> }
>
>
> Is there special syntax required for ingress_port  when used in command
> line?
>
> How do I debug the value used during the "reads" in match-action table?
>
> Thank you,
> Aldo
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170527/fbf12b27/attachment-0002.html>


More information about the P4-dev mailing list