[P4-dev] header stack in bmv2

Roshan sedar at oasis.uclouvain.be
Mon Nov 27 17:38:57 EST 2017


Hi,

I am trying to store two state variables per switch in a header stack
and doing the following. Seems it does not work. I am trying this on
bmv2. No compilation errors. Is this the correct way to do what I am
trying to do?

header_type state_var_t{

      fields {

          field_1: 8;
          field_2: 8;
     }
}

header state_var_t state[64];

parser start {
      extract(state[2]); //for example
      set_metadata(my_meta.field_1, state[2].field_1);
      set_metadata(my_meta.field_2, state[2].field_2);
      return ingress;
}

Any help would be great.

Thanks!

Roshan.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171127/c91505f9/attachment-0002.html>


More information about the P4-dev mailing list