[P4-dev] VL field bitwidth needs to be a multiple of 8

Regis Martins regisftm at gmail.com
Wed Jul 19 18:18:55 EDT 2017


Hello people!

I'm trying to create a variable length field on my ipv4 header, as
following:

...

header_type ipv4_t {
    fields {
        version     : 4;
        ihl         : 4;
        diffserv    : 8;
        totalLen    : 16;
        id          : 16;
        flags       : 3;
        fragOffset  : 13;
        ttl         : 8;
        protocol    : 8;
        hdrChecksum : 16;
        srcAddr     : 32;
        dstAddr     : 32;
        options_ipv4: *;
    }
    length          : (ihl << 2);
    max_length      : 60;
}


...


The compilation works fine, however the fist packet_in (it is a ping),
abends the bmv2 with the following message:

[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Parser 'parser':
start
[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Parser state 'start'
has no switch, going to default next state
[19:05:52.601] [bmv2] [T] [thread 6991] [33.0] [cxt 0] Bytes parsed: 0
[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Extracting header
'eth'
[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Parser state
'parse_eth': key is 0800
[19:05:52.601] [bmv2] [T] [thread 6991] [33.0] [cxt 0] Bytes parsed: 14
[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Extracting header
'tmp_hdr'
[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Parser set: setting
field 'scalars.tmp' from expression, new value is 4
*[19:05:52.601] [bmv2] [D] [thread 6991] [33.0] [cxt 0] Extracting
variable-sized header 'tmp_hdr_0'*
*simple_switch: parser.cpp:288: virtual void
bm::ParserOpExtractVL::operator()(bm::Packet*, const char*, size_t*) const:
Assertion `nbits % 8 == 0 && "VL field bitwidth needs to be a multiple of
8"' failed.*

Any clue about what is happening?

Please, let me know if there you need further information...

Regards,

*Regis Martins*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170719/42dbfca8/attachment-0002.html>


More information about the P4-dev mailing list