[P4-dev] Sending metadata to the controller

hemant at mnkcg.com hemant at mnkcg.com
Mon Feb 11 22:21:12 EST 2019

Thanks for the clarification, Nate.


To help, here is a URL from Andy’s P4 Guide that also has several clone examples, etc.




To find the digest related notes, use this:


https://github.com/jafingerhut/p4-guide/search?q=digest <https://github.com/jafingerhut/p4-guide/search?q=digest&unscoped_q=digest> &unscoped_q=digest






From: Nate Foster <jnfoster at cs.cornell.edu> 
Sent: Monday, February 11, 2019 10:13 PM
To: hemant at mnkcg.com
Cc: fhgdsfkjgirgtegosfgsjfhsgbvnsyfgasg at web.de; p4-dev <p4-dev at lists.p4.org>
Subject: Re: [P4-dev] Sending metadata to the controller


Hemant, I doubt PSA will be helpful here -- the original post mentioned using the P4_16 runtime tutorial from last June, which is based on V1Model.


Instead, I would look at Andy Fingerhut's excellent P4 Guide https://github.com/jafingerhut/p4-guide/ which contains several V1Model examples that use digests.




On Mon, Feb 11, 2019 at 10:02 PM <hemant at mnkcg.com <mailto:hemant at mnkcg.com> > wrote:

See if you can use the PSA Digest message:  https://p4.org/p4-spec/docs/PSA-v1.1.0.html#sec-packet-digest


It will help distinguish different messages.  I am not sure if the controller always replies on receiving a Digest message because then this solution won’t work for you.  Also, the PSA document says Digest is used to send messages from the data plane to the control plane.  I am not sure if the control plane can be a P4Runtime controller.


If you have p4c downloaded, see this Digest related P4 test program.  






From: P4-dev <p4-dev-bounces at lists.p4.org <mailto:p4-dev-bounces at lists.p4.org> > On Behalf Of fhgdsfkjgirgtegosfgsjfhsgbvnsyfgasg at web.de <mailto:fhgdsfkjgirgtegosfgsjfhsgbvnsyfgasg at web.de> 
Sent: Monday, February 11, 2019 9:42 PM
To: p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org> 
Subject: [P4-dev] Sending metadata to the controller




I am using the code of the P4_16 runtime tutorial 2018-06-01 and now I want to send metadata of all processed packets from the P4 switch to the controller. It seems that I cannot create new packets at the switch, so I was thinking to clone existing packets and send the cloned packets to the controller. I have cloned the packets using clone3() but now I am stuck. Also I do not want the controller to reply with any additional packets when receiving metadata. If possible, I would put ethernet, ipv4 & udp header on the cloned packets while keeping the original header structure (ethernet, ipv4, tcp/udp, tunneling) for the original packets, but how can I distinguish cloned packets from original packets at the deparser stage? As far as I know, the metadata contains an instance_type to determine it, but metadata is not accessible anymore after the egress pipeline.
If this was too fancy, what would be the best way to do it in P4 & P4 runtime?


Kind regards

P4-dev mailing list
P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20190211/5a57953b/attachment-0001.html>

More information about the P4-dev mailing list