[P4-dev] Don't care for exact match key

Kentaro Ebisawa ebiken.g at gmail.com
Sun Feb 17 05:59:55 EST 2019


Thank you Vladimir, Andy, for quick response.

I was seeking for a way to decrease number of tables, but looks like I 
should follow the example Vladimir has shown.

--
Kentaro Ebisawa <ebiken.g at gmail.com>

------ Original Message ------
From: "Vladimir Gurevich" <vladimir.gurevich at barefootnetworks.com>
To: "Kentaro Ebisawa" <ebiken.g at gmail.com>
Cc: "p4-dev" <p4-dev at lists.p4.org>
Sent: 2019/02/17 16:26:03
Subject: Re: [P4-dev] Don't care for exact match key

>Hello Kentaro,
>
>Generally speaking, if you want to have an ability to specify "don't 
>care" you have to use ternary match.
>
>In your particular case, given that IPv4 and IPv6 headers are mutually 
>exclusive (unless you designed a new protocol where they aren't), using 
>ternary match seems like a big waste. I would suggest having two 
>separate exact match tables, one for IPv4 and another one for IPv6 and 
>use an if statement to choose between them like so:
>
>table test_table_ipv4 {
>      key = {
>          hdr.ipv4.dstAddr: exact;
>      }
>...
>
>table test_table_ipv6 {
>      key = {
>          hdr.ipv6.dstAddr: exact;
>      }
>...
>
>if (hdr.ipv4.isValid()) {
>     test_table_ipv4.apply();
>} else if (hdr.ipv6.isValid()) {
>     test_table_ipv6.apply();
>} else {
>     . . .
>}
>
>Happy hacking,
>Vladimir
>
>Vladimir Gurevich
>Barefoot Networks
>Director, Customer Training and Education
>Email: vgurevich at barefootnetworks.com
>Phone: (408) 833-4505
>
>
>
>
>On Sat, Feb 16, 2019 at 11:10 PM Kentaro Ebisawa <ebiken.g at gmail.com> 
>wrote:
>>Hi,
>>
>>Are there a way to set "don't care" for exact match key?
>>Or do I have to use lpm or ternary to ignore some of the match keys in
>>the table.
>>
>>For example, I want to have a table which has 2 exact match keys and 
>>set
>>below kind of entries.
>>* Exact match IPv4 dst address and don't care IPv6 dst address
>>* Exact match IPv6 dst address and don't care IPv4 dst address
>>
>>table test_table {
>>      key = {
>>          hdr.ipv4.dstAddr: exact;
>>          hdr.ipv6.dstAddr: exact;
>>      }
>>...
>>
>>--
>>Kentaro Ebisawa <ebiken.g at gmail.com>
>>
>>
>>_______________________________________________
>>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/20190217/1aff03c3/attachment-0001.html>


More information about the P4-dev mailing list