[P4-dev] Error updating direct register

Antonin Bas antonin at barefootnetworks.com
Tue May 9 12:44:08 EDT 2017


Direct registers are indeed not supported in bmv2. I'll edit the README and
add an error message in the p4c-bm compiler.

On Tue, May 9, 2017 at 5:55 AM, <niemand at darkenwood.net> wrote:

> I'm having some issues implementing a direct register using bmv2. My
> understanding is that with direct access there is a cell of the register
> for each entry in the table. However when I try to update the register with
> the register_write action I get this error, crashing the switch.
>
> [14:28:13.147] [bmv2] [D] [thread 5684] [1.0] [cxt 0] Action entry is
> update_flow -
> lt-simple_switch: ../../include/bm/bm_sim/stateful.h:111: bm::Register&
> bm::RegisterArray::operator[](size_t): Assertion `idx < size()' failed.
>
> This looks like the index is out of range. I'm using 0 but according to
> the spec with a direct access register the index should be ignored since
> the matching table entry should determine which cell to use. Any idea what
> I'm doing wrong here? I haven't been able to find any examples of direct
> access registers being used, and I'm starting to wonder if they are
> implemented in bmv2. Thanks.
>
>
> register timestamp {
>     width : 48;
>     direct: flow;
> }
>
> action add_flow() {
>         modify_field(standard_metadata.egress_spec, 1);
>         // Packet received by control plane program and new entry
>         // created with Source/Destination MAC and update_flow action
> }
>
> action update_flow() {
>     register_write(timestamp, 0, intrinsic_metadata.ingress_glo
> bal_timestamp);
>     drop();
> }
>
> table flow {
>         reads {
>                 ether_hdr.src : exact;
>                 ether_hdr.dst : exact;
>         }
>         actions {
>                 update_flow;
>                 add_flow; // Default
>         }
> }
>
>
> _______________________________________________
> 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/20170509/ca0b4d67/attachment-0002.html>


More information about the P4-dev mailing list