<div dir="ltr">Hi!<div>I have a big number of IPv4 5-tuple rules, every rule corresponds to some action. I need to find all matched rules and perform all tied actions.</div><div>The search time greatly affects overall system performance, so I can't just scan all rules. ACL is based on multi-bit tries and provides great performance, so I'm looking for nearly the same performance with the ability to find all matches within a single request. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 24 нояб. 2021 г. в 18:20, Dmitry Kozlyuk <<a href="mailto:dmitry.kozliuk@gmail.com">dmitry.kozliuk@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2021-11-24 11:06 (UTC+0100), Steffen Weise:<br>
> > Hi folks!<br>
> ><br>
> > I'm using DPDK's ACL library to classify incoming packets by IPv4 5 tuple<br>
> > match (src address, dst address, src port, dst port, protocol). Right now<br>
> > it is possible to find only the best match based on the rule's priority.<br>
> > Is there any way (maybe a custom patch for the ACL library exists?) to<br>
> > find all matches in a single request? Decreased performance and even some<br>
> > false-positive matches are acceptable.<br>
> > It could be a big number of matches so using categories is not an option.<br>
> ><br>
> > Thanks,<br>
> > Dmitriy Stepanov<br>
> >  <br>
> <br>
> Hi,<br>
> <br>
> I have the very same question. Such a mechanism would help me in my<br>
> applications. Currently I go for lookup on multiple separate tables.<br>
> <br>
> Cheers,<br>
> Steffen Weise<br>
<br>
Hi,<br>
<br>
I wonder what is the original problem you're solving.<br>
<br>
A set of IPv4 5-tuple rules can be viewed as a set of regular expressions:<br>
<br>
ACL:    src <a href="http://1.1.1.0/24" rel="noreferrer" target="_blank">1.1.1.0/24</a> dst <a href="http://2.2.2.2/32" rel="noreferrer" target="_blank">2.2.2.2/32</a> sport any dport 0x0035 proto tcp<br>
Regex:  ^\x01\x01\x01.\x02\x02\x02\x02..\x00\x35\x06$<br>
<br>
Here, "." stands for "any byte".<br>
For masks/ranges not aligned on 8 bits regex ranges can be used, e.g.:<br>
<br>
ACL:    sport 100-200<br>
        # this one is easy, just one byte varies<br>
Regex:  \x00[\x64-\xC8]<br>
<br>
ACL:    sport 200-300<br>
        # this one is hard, needs an algorithm to transform<br>
        # 200-300 => 200-255,256-300 => 0xC8-0xFF,0x0100-0x012C<br>
Regex:  (?:\x00[\xC8-xFF]|\x01[\x00-\x2C])<br>
<br>
ACL:    src <a href="http://192.0.2.64/26" rel="noreferrer" target="_blank">192.0.2.64/26</a><br>
        # this one is easy, there are also hard examples like above<br>
Regex:  \xC0\x00\x02[\x40-\x7F]<br>
<br>
IIUC, you need all matching expressions for every packet,<br>
which is represented as a 4+4+2+2+1 byte "string".<br>
This is exactly what Hyperscan library does, for example:<br>
<a href="http://intel.github.io/hyperscan/dev-reference/runtime.html" rel="noreferrer" target="_blank">http://intel.github.io/hyperscan/dev-reference/runtime.html</a><br>
<br>
There is now regexdev in DPDK,<br>
take a look at it, maybe it will suit your needs and HW.<br>
</blockquote></div>