[P4-dev] storing field_list_calculation into a metadata field

Salvatore Signorello salvatore.signorello at uni.lu
Wed Aug 19 14:52:00 EDT 2015


Hi Swaroop,

your suggestion should do the job, I just need to set the 'size' 
argument (the 4th one) to zero, so that (base+hash_value) equals 0 (see 
action description on page 38 of the spec.)

/modify_field_with_hash_based_offset(salvatores_metadata.hashfield, 0, 
output_value, 0);

/Btw, I think that the action above has been introduced with a different 
aim in mind, that is, to generate random indexes for actions selection 
in ECMP-like cases (I'm having a déjà-vu, because someone else has 
probably pointed out such thing in a previous discussion).
/
/That's solved, I still don't understand why the field_list_calculation 
was omitted from the accepted type for the modify_field option. I'm sure 
that the dev-fellows will shed some light on this soon.

Thanks,
Salvatore

On 08/19/2015 07:11 PM, Swaroop Thool wrote:
>
> Hi Salvatore,
>
> Referred to given field_list_calculation. Will this work for you? I am 
> not yet sure
>
> /modify_field_with_hash_based_offset(salvatores_metadata.hashfield, 0, 
> output_value, 1000);/  //where 1000 is range of hash value
>
>
> Best,
> Swaroop
> ------------------------------------------------------------------------
> Date: Wed, 19 Aug 2015 15:14:07 +0200
> From: salvatore.signorello at uni.lu
> To: ljw at barefootnetworks.com; p4-dev at p4.org
> Subject: Re: [P4-dev] storing field_list_calculation into a metadata field
>
> Hi lj,
>
> thanks, more inline
>
> Best,
> Salvo
>
> On 08/19/2015 01:26 PM, LJ Wobker wrote:
>
>     Per section 2.4 & 3 of the spec, you should be able to use
>
>     *field_list_calculation* */output_value/*
>
>     *//*
>
>     *//* to obtain a hash value from your set of fields.  The output
>     of this (output_value) can then be referenced in action primitives…
>
>     field_list /something/ {
>
>         ipv4.source;
>
>         ipv4.dest;
>
>         tcp.source;
>
>         tcp.dest;
>
>     }
>
>     field_list_calculation *output_value* {
>
>         input {
>
>     /something/;
>
>         }
>
>         algorithm : crc32;
>
>         output_width : 32;
>
>     }
>
>     modify_field (salvatores_metadata.hashfield, *output_value*)
>
>     // “salvatores_metadata.hashfield” is a 32b field defined in the
>     metadata header somewhere…
>
>     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…
>
> that's exactly what I've tried and it hasn't worked. This produces a 
> semantic error for a type mismatch, that is,
>
> 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
>
> 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.
>
>
>     --lj
>
>     -----Original Message-----
>     From: P4-dev [mailto:p4-dev-bounces at p4.org
>     <mailto:p4-dev-bounces at p4.org>] On Behalf Of Salvatore Signorello
>     Sent: Wednesday, August 19, 2015 12:07 PM
>     To: p4-dev at p4.org <mailto:p4-dev at p4.org>
>     Subject: [P4-dev] storing field_list_calculation into a metadata field
>
>     Hi all,
>
>     is there any way to store the hash of a fields list (so a field list
>
>     calculation) into a metadata field for further matching into a table?
>
>     The signature of the primitive action "modify_field" does not
>     accept a
>
>     field list as src parameter. Could please someone point out if
>     there was
>
>     any specific rationale for not allowing such thing?
>
>     Note: I still refer to the old specification (ver 1.0.2).
>
>     Best,
>
>     Salvatore
>
>     -- 
>
>     Salvatore Signorello
>
>     PhD student @ SecanLab
>
>     Interdisciplinary Centre for Security, Reliability and Trust
>
>     SnT, University of Luxembourg
>
>     http://wwwen.uni.lu/snt/people/salvatore_signorello
>
>     _______________________________________________
>
>     P4-dev mailing list
>
>     P4-dev at p4.org <mailto:P4-dev at p4.org>
>
>     Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
>
>     Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/
>
>
> -- 
> Salvatore Signorello
> PhD student @ SecanLab
>
> Interdisciplinary Centre for Security, Reliability and Trust
> SnT, University of Luxembourg
> http://wwwen.uni.lu/snt/people/salvatore_signorello
>
> _______________________________________________ P4-dev mailing list 
> P4-dev at p4.org Listinfo - 
> http://mail.p4.org/mailman/listinfo/p4-dev_p4.org Archives - 
> http://mail.p4.org/pipermail/p4-dev_p4.org/

-- 
Salvatore Signorello
PhD student @ SecanLab

Interdisciplinary Centre for Security, Reliability and Trust
SnT, University of Luxembourg
http://wwwen.uni.lu/snt/people/salvatore_signorello

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150819/8fee7713/attachment-0001.html>


More information about the P4-dev mailing list