Failed to send packet_in message

Hello there,

I wrote a p4 program based on p4guide/flowcache that involves recirculation, packet_out and match-action table operations. It can pass the p4test and p4c without any problems. It works fine with the following part:

@controller_header("packet_in")
header packet_in_header_h {
    PortIdToController_t input_port;
    PuntReason_t         punt_reason;
    ControllerOpcode_t   opcode;
}

But once I add a new field of bit-string (e.g. bit<(64*8)>) into the packet_in_header, the controller python program will not receive the packet_in message. Is there any length limit in this area?

@controller_header("packet_in")
header packet_in_header_h {
    PortIdToController_t ingress_port;
    PuntReason_t         punt_reason;
    ControllerOpcode_t   opcode;
    bit<(64 * 8)> payload;
}

32*8 and 40*8 would works, but 64*8 failed.

Thanks!

Quick response for now, without having dug into the details myself.

Your results suggest that you are definitely hitting a length limit, but I do not know what the precise limit is. There is always a finite limit to everything – it is the ones you do not exceed that you never think to ask about :-). And this is one I have never exceeded in my work before.

If you are interested in experimenting further, I would suggest trying to use two fields for the payload, e.g. payload0 and payload1, and see whether the limit seems to be the single-field limit of size, or the total size across all fields in the packet_in_header_h definition.

1 Like

Thank you for your time, Andy.
After refactoring the major part of the code, I cannot reproduce the issue. it seems the constraint does not exist anymore. It was a coincidence caused by a semantic error.