[P4-dev] 2 questions

Garegin Grigoryan grigorg at clarkson.edu
Wed Jun 14 10:44:14 EDT 2017


Thank you all,

Mihai, I'm using a VM with Stanford-17 workshop tutorials for compiling p4
programs.
I edited the p4apprunner.py script: I added --p4-14 line to the line 118

   *rv* = run_command('p4c-bm2-ss --p4-14 %s' % ' '.join(compiler_args))

However, I see no effect from this flag when I run ./run.sh from
"excersises/ipv4_forward" folder. Does p4-14 flag work with p4c-bm2-ss
compiler?

On Mon, Jun 12, 2017 at 3:08 PM, Han Wang <hanwang at barefootnetworks.com>
wrote:

> Hi Garegin,
>
> I tried the P4-16 program in p4c repo that uses clone with STF.
>
> The steps are:
>
> 1. Create a STF test, save it to p4c/testdata/p4_16_samples/clone-bmv2.stf
> For example,
> packet 0 00000000 00000000 ABCD0000 ABCD0000
> expect 0 00000000 00000000 ABCD0000 ABCD0000
>
> 2. In p4c/build,
> ```
> make bmv2/testdata/p4_16_samples/clone-bmv2.p4.test
> ./bmv2/testdata/p4_16_samples/clone-bmv2.p4.test
> ```
>
> It does not seems to crash BMV2, but I was expecting to receive two copies
> of the incoming packet. (But only received one).
>
> Han
>
> On Jun 12, 2017, at 11:22 AM, Mihai Budiu <mbudiu at vmware.com> wrote:
>
> The p4c reference compiler implementation should support P4-14 programs
> when invoked with the --p4-14 command-line option.
>
> In principle cloning should work, but the compiler does not have any tests
> involving cloning.
>
> At some point switch.p4 used to pass all PTF tests when compiled with the
> reference compiler implementation; I don’t know if there are any PTF tests
> for cloning.
>
> Mihai
>
> *From:* P4-dev [mailto:p4-dev-bounces at lists.p4.org
> <p4-dev-bounces at lists.p4.org>] *On Behalf Of *Antonin Bas
> *Sent:* Monday, June 12, 2017 11:19 AM
> *To:* Garegin Grigoryan <grigorg at clarkson.edu>
> *Cc:* p4-dev <p4-dev at lists.p4.org>
> *Subject:* Re: [P4-dev] 2 questions
>
> Hi,
>
> The example that Nate sent is written in P4_14, so no it will not compile
> with a P4_16 compiler.
> v1model does include a clone primitive (https://github.com/p4lang/p4c
> /blob/master/p4include/v1model.p4#L138
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_p4lang_p4c_blob_master_p4include_v1model.p4-23L138&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=IB1q5JrWWBI2SxQDaVB7gvfwtvzhiZZHo7FnvoMhLCg&s=eaVyPblrHeobmSMP6KlJsa6zvvRdIcd10B3_8OYYb2E&e=>),
> but I do not know how well it works. I found an example P4_16 program in
> the p4c repo (https://github.com/p4lang/p4c/blob/master/testdata/p4_16_
> samples/clone-bmv2.p4#L30
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_p4lang_p4c_blob_master_testdata_p4-5F16-5Fsamples_clone-2Dbmv2.p4-23L30&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=IB1q5JrWWBI2SxQDaVB7gvfwtvzhiZZHo7FnvoMhLCg&s=JSwuJ9gL9r_aRsm176Yc_OXcIaQrLlDD0n7_c-W5Q6A&e=>)
> that uses clone, but based on the comment in the file ("this causes a crash
> in bmv2"), it is unlikely that it works... Support in the p4c bmv2 backend
> may be incomplete, but more importantly I am not sure v1model is sufficient
> to replicate the P4_14 cloning abilities. You may have to wait for the new
> Portable Switch Architecture (PSA), which is meant to provide more complete
> packet forwarding abstractions, and is supposed to be a more natural
> architecture for P4_16 programs (than v1model).
>
> Thanks,
>
> Antonin
>
>
> On Mon, Jun 12, 2017 at 9:34 AM, Garegin Grigoryan <grigorg at clarkson.edu>
> wrote:
>
> 1) Is this example is compatible with P4_16?
>
> It gives me an error (“could not find declaration for “
> clone_ingress_pkt_to_egress”")
>
> Sincerely,
> Garegin Grigoryan
> grigorg at clarkson.edu
>
>
> On Jun 8, 2017, at 2:42 AM, Nate Foster <jnfoster at cs.cornell.edu> wrote:
>
> 1) You can see an example of packet cloning here:
> https://github.com/p4lang/switch/blob/21d750ce6015c54978ee9a
> 3519838340698876c7/p4src/sflow.p4#L69
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_p4lang_switch_blob_21d750ce6015c54978ee9a3519838340698876c7_p4src_sflow.p4-23L69&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=IB1q5JrWWBI2SxQDaVB7gvfwtvzhiZZHo7FnvoMhLCg&s=rnMk-XouTSjHvNQRZS0KZrXpJQKzP0zh-W4tWVhIWyc&e=>
> https://github.com/p4lang/switch/blob/135599947d53d7dc2f830b
> 12f4e169f430d78af0/p4src/acl.p4
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_p4lang_switch_blob_135599947d53d7dc2f830b12f4e169f430d78af0_p4src_acl.p4&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=IB1q5JrWWBI2SxQDaVB7gvfwtvzhiZZHo7FnvoMhLCg&s=Ia8JfBTyfUombK6iRZkXVY2Jk6fvyOMQyR9HpDdhRcY&e=>
>
> 2) See the P4 tutorial slides, starting around page 91, for a description
> of the "PD" API.
> https://github.com/p4lang/tutorials/blob/master/SIGCOMM_2016
> /p4-tutorial-slides.pdf
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_p4lang_tutorials_blob_master_SIGCOMM-5F2016_p4-2Dtutorial-2Dslides.pdf&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=IB1q5JrWWBI2SxQDaVB7gvfwtvzhiZZHo7FnvoMhLCg&s=8n9c5P1YJNBdz__123dH-WMuqE7JUGLt9_3ieJ9R0Xw&e=>
>
>
> -N
>
> On Sun, Jun 4, 2017 at 1:08 PM, Garegin Grigoryan <grigorg at clarkson.edu>
> wrote:
>
> Thank you!
>
> 1) Could you give a code example (or a reference) for P4_16 standard
> regarding packet cloning?
> 2) What kind of control plane API for bmv2 model is available?
>
>
> On Fri, Jun 2, 2017 at 2:21 PM, Nate Foster <jnfoster at cs.cornell.edu>
> wrote:
>
> 1) Is it possible to clone packets at the data plane and forward a cloned
> packet through the pipeline to the egress and then output it?
>
>
> Yes, although the details of how cloning works are architecture specific.
>
>
> 2) How can I print the contents of a table and registers in P4?
>
>
> You need to write a program against the control-plane API for your P4
> program to do this.
>
> -N
>
>
>
>
> --
> Sincerely,
> Garegin Grigoryan
>
>
>
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.p4.org_mailman_listinfo_p4-2Ddev-5Flists.p4.org&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=IB1q5JrWWBI2SxQDaVB7gvfwtvzhiZZHo7FnvoMhLCg&s=mZNhPvTrwpZSd0A0toyAk7jvxKpbh0-2tVd4h8BArT8&e=>
>
>
>
>
> --
> Antonin
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
>
>


-- 
Sincerely,
Garegin Grigoryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170614/141867fc/attachment-0002.html>


More information about the P4-dev mailing list