<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi lj,<br>
    <br>
    thanks, more inline<br>
    <br>
    Best,<br>
    Salvo<br>
    <br>
    <div class="moz-cite-prefix">On 08/19/2015 01:26 PM, LJ Wobker
      wrote:<br>
    </div>
    <blockquote
      cite="mid:24ce97f47e35c79f2d9a7fc62c02c818@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-name:"No Spacing\,codelet";
        mso-style-priority:1;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:9.0pt;
        font-family:"Lucida Console";
        color:#0070C0;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
      <div class="WordSection1">
        <p class="MsoPlainText">Per section 2.4 & 3 of the spec, you
          should be able to use</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> <b>field_list_calculation</b> <b><i>output_value</i></b></p>
        <p class="MsoPlainText"><b><i> </i></b></p>
        <p class="MsoPlainText"><b><i> </i></b> to obtain a hash value
          from your set of fields.  The output of this (output_value)
          can then be referenced in action primitives…</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoNoSpacing"> </p>
        <p class="MsoNoSpacing">field_list <i>something</i> { </p>
        <p class="MsoNoSpacing">    ipv4.source;</p>
        <p class="MsoNoSpacing">    ipv4.dest;</p>
        <p class="MsoNoSpacing">    tcp.source;</p>
        <p class="MsoNoSpacing">    tcp.dest;</p>
        <p class="MsoNoSpacing">}</p>
        <p class="MsoNoSpacing"> </p>
        <p class="MsoNoSpacing">field_list_calculation <b>output_value</b>
          {</p>
        <p class="MsoNoSpacing">    input {</p>
        <p class="MsoNoSpacing">       <i>something</i>;</p>
        <p class="MsoNoSpacing">    }</p>
        <p class="MsoNoSpacing">    algorithm : crc32;</p>
        <p class="MsoNoSpacing">    output_width : 32;</p>
        <p class="MsoNoSpacing">}</p>
        <p class="MsoNoSpacing"> </p>
        <p class="MsoNoSpacing">modify_field
          (salvatores_metadata.hashfield, <b>output_value</b>)</p>
        <p class="MsoNoSpacing">// “salvatores_metadata.hashfield” is a
          32b field defined in the metadata header somewhere…</p>
        <p class="MsoPlainText">                                                   
        </p>
        <p class="MsoPlainText">Have you tried this and found it not to
          be working?  I didn’t pull this from working code, but it
          should be pretty close… </p>
      </div>
    </blockquote>
    that's exactly what I've tried and it hasn't worked. This produces a
    semantic error for a type mismatch, that is,<br>
    <br>
    Semantic error: Error when calling primitive modify_field (countComp
    -> countComponents -> modify_field) in file myfile.p4 at line
    40: argument 1 has type field list calculation, but formal src has
    type field, integer value<br>
    <br>
    I guess that you may have a look at the primitives.json file to see
    which are the types accepted by this primitive action. Field_list is
    not included.<br>
    <br>
    <br>
    <blockquote
      cite="mid:24ce97f47e35c79f2d9a7fc62c02c818@mail.gmail.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">--lj        </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">-----Original Message-----<br>
          From: P4-dev [mailto:<a moz-do-not-send="true"
            href="mailto:p4-dev-bounces@p4.org">p4-dev-bounces@p4.org</a>]
          On Behalf Of Salvatore Signorello<br>
          Sent: Wednesday, August 19, 2015 12:07 PM<br>
          To: <a moz-do-not-send="true" href="mailto:p4-dev@p4.org">p4-dev@p4.org</a><br>
          Subject: [P4-dev] storing field_list_calculation into a
          metadata field</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">Hi all,</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">is there any way to store the hash of a
          fields list (so a field list </p>
        <p class="MsoPlainText">calculation) into a metadata field for
          further matching into a table?</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">The signature of the primitive action
          "modify_field" does not accept a </p>
        <p class="MsoPlainText">field list as src parameter. Could
          please someone point out if there was </p>
        <p class="MsoPlainText">any specific rationale for not allowing
          such thing?</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">Note: I still refer to the old
          specification (ver 1.0.2).</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">Best,</p>
        <p class="MsoPlainText">Salvatore</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">-- </p>
        <p class="MsoPlainText">Salvatore Signorello</p>
        <p class="MsoPlainText">PhD student @ SecanLab</p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">Interdisciplinary Centre for Security,
          Reliability and Trust</p>
        <p class="MsoPlainText">SnT, University of Luxembourg</p>
        <p class="MsoPlainText"><a moz-do-not-send="true"
            href="http://wwwen.uni.lu/snt/people/salvatore_signorello"><span
              style="color:windowtext;text-decoration:none">http://wwwen.uni.lu/snt/people/salvatore_signorello</span></a></p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText"> </p>
        <p class="MsoPlainText">_______________________________________________</p>
        <p class="MsoPlainText">P4-dev mailing list</p>
        <p class="MsoPlainText"><a moz-do-not-send="true"
            href="mailto:P4-dev@p4.org"><span
              style="color:windowtext;text-decoration:none">P4-dev@p4.org</span></a></p>
        <p class="MsoPlainText">Listinfo - <a moz-do-not-send="true"
            href="http://mail.p4.org/mailman/listinfo/p4-dev_p4.org"><span
              style="color:windowtext;text-decoration:none">http://mail.p4.org/mailman/listinfo/p4-dev_p4.org</span></a></p>
        <p class="MsoPlainText">Archives - <a moz-do-not-send="true"
            href="http://mail.p4.org/pipermail/p4-dev_p4.org/"><span
              style="color:windowtext;text-decoration:none">http://mail.p4.org/pipermail/p4-dev_p4.org/</span></a></p>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Salvatore Signorello
PhD student @ SecanLab

Interdisciplinary Centre for Security, Reliability and Trust
SnT, University of Luxembourg
<a class="moz-txt-link-freetext" href="http://wwwen.uni.lu/snt/people/salvatore_signorello">http://wwwen.uni.lu/snt/people/salvatore_signorello</a></pre>
  </body>
</html>