[P4-dev] Packet Metadata in P4Runtime PacketIn/PacketOut messages with v1model and P416

Lewis, Ben b.lewis at lancaster.ac.uk
Sat Oct 13 15:48:00 EDT 2018


Thanks Andy, I’d neglected to call setValid() and had assumed it was implicit because of the controller_metadata

It’s working now.

Ben

On 13 Oct 2018, at 15:30, Andy Fingerhut <andy.fingerhut at gmail.com<mailto:andy.fingerhut at gmail.com>> wrote:

I guess after defining that header, you are calling .setValid() on it in some conditions you have decided and written in your code, and assigning the values you want to its fields, and it is the first header that you .emit() in your deparser code?

If you are doing all of those things, what is going wrong?

Andy

On Sat, Oct 13, 2018 at 7:26 AM Lewis, Ben <b.lewis at lancaster.ac.uk<mailto:b.lewis at lancaster.ac.uk>> wrote:
Hi all,

Does anyone have any insight into getting packet metadata to the controller from bmv2 when sending the packet via the P4Runtime port?

I’m looking to be able to tell the control plane why the packet was forwarded, the ingress port and whether the packet was cloned. I know I can prepend this information to the packet but I was hoping this would be a more elegant approach.


The code below unfortunately doesn’t work
@controller_header("packet_in")
struct packet_in_t {
bit<4> reason;
bit<9> ingress_port
bit<1> isClone;
}

struct metadata {
        packet_in_t packet_in_meta;
}

Any insight is appreciated
Thanks
Ben
_______________________________________________
P4-dev mailing list
P4-dev at lists.p4.org<mailto: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/20181013/8ced1dae/attachment.html>


More information about the P4-dev mailing list