<div dir="ltr">The truth is that P4 as it is does not really provide good support for trailer processing.<div>(For example, the ethernet trailer is never mentioned anywhere in the spec.)</div><div><br></div><div>If one plans to handle trailers similar to headers it would indeed make sense to have a "seek" or "skip" operation to jump over the payload. But this is a discussion for the p4-design mailing list.</div><div><div><br></div><div>Mihai</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 4, 2015 at 9:36 AM, Peter Newman <span dir="ltr"><<a href="mailto:petenewm@cisco.com" target="_blank">petenewm@cisco.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Salvatore,<br>
      <br>
      I would define a packet header that contains a single variable
      length field designed to contain all of the information you wish
      to skip. The only requirement is that at run time the length of
      this variable length field can be calculated from the fields in
      the packet that occur before it.<br>
      <br>
      I would still solve the problem this way even if the P4 spec is
      augmented with TLV processing. It only takes one parse cycle to
      skip information. I am assuming it would take N parse cycles to
      process each TLV option. I would only spend the N parse cycles if
      I needed to access the information contained in the TLV fields.<br>
      <br>
      --Peter<br>
      <br>
      On 8/4/2015 1:10 AM, Salvatore Signorello wrote:<br>
    </div>
    <blockquote type="cite">
      
      Thank you all for your feedback,<br>
      <br>
      let's think for a moment of a protocol that needs to check a
      trailer field, and so that needs to skip a considerable portion of
      the packet (e.g., the upper layer payload), what does the P4
      programmer do? Does he define dummy header for extracting the
      payload? I know that "extracting" at such a high level could mean
      many things, but imho still the language syntax is a bit
      counterintuitive if you keep such construct. <br>
      <br>
      I don't want to discuss the protocol I'm working on, because it is
      a research idea that is not running on any real device. So, I've
      quickly selected an existing protocol that could generate the same
      issue, that is, the Encapsulating Security Payload (ESP), to start
      brainstorming on.<br>
      <br>
      I will also try to write out the parsing of IPv6 extension
      headers, because I guess this is something needed even there. Have
      you already thought about those?<br>
      <br>
      Best,<br>
      Salvatore<br>
      <br>
      <br>
      <br>
      <br>
      <div>On 08/03/2015 08:22 PM, Mihai Budiu
        wrote:<br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">Today this is the only mechanism to read a
          non-constant number of bytes (i.e., which depends on header
          data).
          <div><br>
          </div>
          <div>Mihai</div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Mon, Aug 3, 2015 at 11:16 AM,
            Gordon Brebner <span dir="ltr"><<a href="mailto:Gordon.Brebner@xilinx.com" target="_blank">Gordon.Brebner@xilinx.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div link="#0563C1" vlink="#954F72" lang="EN-US">
                <div>
                  <p class="MsoNormal"><span style="color:#1f497d">I
                      think that a generic “skip n bytes” operation can
                      be done using a header with a single field of *
                      width and a length expression to compute the
                      desired n.<span>  </span> Is this correct?</span></p>
                  <p class="MsoNormal"><span style="color:#1f497d"> </span></p>
                  <p class="MsoNormal"><span style="color:#1f497d">Gordon.</span></p>
                  <p class="MsoNormal"><span style="color:#1f497d"> </span></p>
                  <p class="MsoNormal"><span style="color:#1f497d"> </span></p>
                  <div>
                    <div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
                      <p class="MsoNormal"><b><span>From:</span></b><span>
                          P4-dev [mailto:<a href="mailto:p4-dev-bounces@p4.org" target="_blank">p4-dev-bounces@p4.org</a>] <b>On
                            Behalf Of </b>LJ Wobker<br>
                          <b>Sent:</b> Monday, August 03, 2015 11:08 AM<br>
                          <b>To:</b> Salvatore Signorello; <a href="mailto:p4-dev@p4.org" target="_blank">p4-dev@p4.org</a><br>
                          <b>Subject:</b> Re: [P4-dev] move parser
                          pointer forward</span></p>
                    </div>
                  </div>
                  <p class="MsoNormal"> </p>
                  <p>That's correct - there is no explicit "skip"
                    functionality in the parser.  Think of the parse
                    tree as a continuous graph that walks through the
                    incoming bytestream in order: there are no gaps.  As
                    Mihai suggests, you can always just use a dummy
                    header field for bytes that you don't care about,
                    although I would contend that in most cases it will
                    make more sense to just parse the header with a
                    meaningful name.  </p>
                  <p> </p>
                  <p>Let us consider a contrived case such as: RTP in
                    UDP in ipv4 in ethernet.  Let's further assume
                    (again, contrived) that you know you absolutely do
                    not need to parse any of the specific fields within
                    the UDP header, but you need/want to be able to get
                    to the RTP headers underneath.</p>
                  <p> </p>
                  <p>You could easily build a parse tree/header
                    definition that treats the entire UDP header as one
                    field, instead of the component fields.  This might
                    or might not be simpler/easier/faster/cheaper for a
                    given target or compiler to handle, and it might (or
                    might not!) be more convenient for the P4
                    programmer. </p>
                  <p> </p>
                  <p>Original UDP header format from <a href="https://github.com/p4lang/p4factory/blob/master/targets/switch/p4src/includes/headers.p4" target="_blank">
p4factory/master/targets/switch/p4src/includes/headers.p4</a></p>
                  <p style="text-align:center" align="center"> </p>
                  <p class="MsoNormal"><span>header_type udp_t {</span></p>
                  <p class="MsoNormal"><span>    fields {</span></p>
                  <p class="MsoNormal"><b><span>        srcPort : 16;</span></b></p>
                  <p class="MsoNormal"><b><span>        dstPort : 16;</span></b></p>
                  <p class="MsoNormal"><b><span>        length_ : 16;</span></b></p>
                  <p class="MsoNormal"><b><span>        checksum : 16;</span></b></p>
                  <p class="MsoNormal"><span>    }</span></p>
                  <p class="MsoNormal"><span>}</span></p>
                  <p> </p>
                  <p>Modified/ simpler version as described:</p>
                  <p> </p>
                  <p class="MsoNormal"><span>header_type udp_t {</span></p>
                  <p class="MsoNormal"><span>    fields {</span></p>
                  <p class="MsoNormal"><b><span>        meaningless_blob
                        : 64;</span></b></p>
                  <p class="MsoNormal"><span>    }</span></p>
                  <p class="MsoNormal"><span>}</span></p>
                  <p> </p>
                  <p> </p>
                  <p>So that’s probably a longer answer than you really
                    needed, but I figured I’d write it out for
                    posterity.</p>
                  <p> </p>
                  <p> </p>
                  <p>--lj        </p>
                  <p> </p>
                  <p> </p>
                  <p> </p>
                  <p> </p>
                  <p> </p>
                  <p>-----Original Message-----<br>
                    From: P4-dev [mailto:<a href="mailto:p4-dev-bounces@p4.org" target="_blank">p4-dev-bounces@p4.org</a>] On
                    Behalf Of Salvatore Signorello<br>
                    Sent: Monday, August 03, 2015 10:01 AM<br>
                    To: <a href="mailto:p4-dev@p4.org" target="_blank">p4-dev@p4.org</a><br>
                    Subject: [P4-dev] move parser pointer forward</p>
                  <p> </p>
                  <p>Hi all,</p>
                  <p> </p>
                  <p>could someone confirm that the actual specification
                    doesn't provide any </p>
                  <p>construct to advance the parsing pointer except the
                    "extract" one?</p>
                  <p> </p>
                  <p>Is it possible to skip the parsing of some fields
                    without defining and </p>
                  <p>extracting a header including them?</p>
                  <p> </p>
                  <p>Best,</p>
                  <p>Salvatore</p>
                  <p> </p>
                  <p> </p>
                  <p> </p>
                  <p> </p>
                  <p> </p>
                  <p>_______________________________________________</p>
                  <p>P4-dev mailing list</p>
                  <p><a href="mailto:P4-dev@p4.org" target="_blank"><span style="color:windowtext;text-decoration:none">P4-dev@p4.org</span></a></p>
                  <p>Listinfo - <a href="http://mail.p4.org/mailman/listinfo/p4-dev_p4.org" target="_blank"> <span style="color:windowtext;text-decoration:none">http://mail.p4.org/mailman/listinfo/p4-dev_p4.org</span></a></p>
                  <p>Archives - <a href="http://mail.p4.org/pipermail/p4-dev_p4.org/" target="_blank"> <span style="color:windowtext;text-decoration:none">http://mail.p4.org/pipermail/p4-dev_p4.org/</span></a></p>
                </div>
                <br>
                <br>
                This email and any attachments are intended for the sole
                use of the named recipient(s) and contain(s)
                confidential information that may be proprietary,
                privileged or copyrighted under applicable law. If you
                are not the intended recipient, do not read, copy, or
                forward this email message or any attachments. Delete
                this email message and any attachments immediately. <br>
                <br>
              </div>
              <br>
              _______________________________________________<br>
              P4-dev mailing list<br>
              <a href="mailto:P4-dev@p4.org" target="_blank">P4-dev@p4.org</a><br>
              Listinfo - <a href="http://mail.p4.org/mailman/listinfo/p4-dev_p4.org" rel="noreferrer" target="_blank">http://mail.p4.org/mailman/listinfo/p4-dev_p4.org</a><br>
              Archives - <a href="http://mail.p4.org/pipermail/p4-dev_p4.org/" rel="noreferrer" target="_blank">http://mail.p4.org/pipermail/p4-dev_p4.org/</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
P4-dev mailing list
<a href="mailto:P4-dev@p4.org" target="_blank">P4-dev@p4.org</a>
Listinfo - <a href="http://mail.p4.org/mailman/listinfo/p4-dev_p4.org" target="_blank">http://mail.p4.org/mailman/listinfo/p4-dev_p4.org</a>
Archives - <a href="http://mail.p4.org/pipermail/p4-dev_p4.org/" target="_blank">http://mail.p4.org/pipermail/p4-dev_p4.org/</a></pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
P4-dev mailing list<br>
<a href="mailto:P4-dev@p4.org">P4-dev@p4.org</a><br>
Listinfo - <a href="http://mail.p4.org/mailman/listinfo/p4-dev_p4.org" rel="noreferrer" target="_blank">http://mail.p4.org/mailman/listinfo/p4-dev_p4.org</a><br>
Archives - <a href="http://mail.p4.org/pipermail/p4-dev_p4.org/" rel="noreferrer" target="_blank">http://mail.p4.org/pipermail/p4-dev_p4.org/</a><br></blockquote></div><br></div>