[P4-dev] generate_digest vs copy_to_cpu

hemant at mnkcg.com hemant at mnkcg.com
Wed Aug 29 18:47:04 EDT 2018



Sorry, I can say which is better practice for using port vs. digest.  Maybe
others can chime in for what they have used in implementations.


Regarding Thrift API, someone else may be able to help.  I have not used
Thrift myself, except, when it's used internally in p4c and associated






From: ec <richard.mayers92 at gmail.com> 
Sent: Wednesday, August 29, 2018 6:34 PM
To: hemant at mnkcg.com
Cc: p4-dev at lists.p4.org
Subject: Re: [P4-dev] generate_digest vs copy_to_cpu


Thanks for the reply Hemant,


I know that digest is to send something small, and that sending to cpu sends
the entire packet (still you can make it small by truncating).


I was asking more about, if there is any big difference, if one is a better
practice than the other in the general case. 


Furthermore, where can I find documentation for the thrift API ?


Kind regards,


On 29 Aug 2018, at 16:34, hemant at mnkcg.com <mailto:hemant at mnkcg.com>  wrote:


Hi Richard,


Please see documentation on digest in the PSA specification:

Just section 7.14.  The digest is used to send abbreviated data to the


In the P4-16 specification (
https://p4.org/p4-spec/docs/P4-16-v1.1.0-draft.html) , there is also an
example to send a packet to a specific port.  Search for "to_cpu" in the doc
and see the example.





-----Original Message-----
From: P4-dev <p4-dev-bounces at lists.p4.org
<mailto:p4-dev-bounces at lists.p4.org> > On Behalf Of ecm
Sent: Tuesday, August 28, 2018 7:40 PM
To: p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org> 
Subject: [P4-dev] generate_digest vs copy_to_cpu


Hi all,


I want to know which are the differences between using digests or normal
switch_ports when writing some sort of control plane. At the moment the
easiest way I found is to simply send a norma packet to a special port where
you have a process listening and then if needed update the switch using the
CLI, thrift, etc..


When reading the spec, I saw that there was a primitive (not an extern in
simple_switch) called digest. I never used it due to lack of documentation,
examples, etc. However, today I wanted to give it a try, and after checking
the l2 learning example + several mailing list posts + some github issues I
managed to do something.


Putting the P4Runtime aside, and considering only digest, and copy_to_cpu (
is there more ways of having dp-cp communication ???), I would like to know
what is the best way to do DP-CP things, or when is one more useful than the
other ? Because for example using digests seems quite cumbersome, since you
have to acknowledge every packet you receive.


PD: is there any good documentation of how to use the thrift API? The best I
found at the moment is the the runtime_CLI.py


Thanks in advance,




P4-dev mailing list

 <mailto:P4-dev at lists.p4.org> 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/20180829/c0b1c849/attachment-0001.html>

More information about the P4-dev mailing list