[P4-dev] Check equality of two header fields

David Hancock dhancock at cs.utah.edu
Tue Jun 28 16:47:11 EDT 2016


Javier and I are both suggesting the use of a matchless table; when you 
run this program on your switch you should make sure to set the table's 
default action through the control channel.  If you don't, some 
implementations will do a no_op while others might drop the packet.

--David

On 06/28/2016 02:41 PM, David Hancock wrote:
> action a_setflag() {
>   modify_field(meta.flag, 1);
> }
>
> table t_setflag {
>   actions {
>     a_setflag;
>   }
> }
>
> table subsequent_table {
>   reads {
>     meta.flag : exact;
>   }
>   actions {
>     ...
>   }
> }
>
> control ingress {
>   ...
>   if A == B {
>     apply(t_setflag);
>   }
>   apply(subsequent_table);
>   ...
> }
>
> On 06/28/2016 02:30 PM, Ashutosh Agrawal (ashu) wrote:
>>
>> Let’s say I’ve a packet header with srcAddr and DstAddr fields. I 
>> want to check if src and dst addresses are same and set a metadata 
>> flag. I can then use this flag as a key field for a subsequent table. 
>> AFAIK, this A==B check can only be done in Control Flow but I can’t 
>> modify the metadata there. Any ideas?
>>
>>
>>
>> _______________________________________________
>> P4-dev mailing list
>> P4-dev at lists.p4.org
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20160628/498f97f7/attachment-0002.html>


More information about the P4-dev mailing list