DPDK usage discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Steffen Weise <stweise.linux@gmail.com>,
	Дмитрий Степанов <stepanov.dmit@gmail.com>
Cc: users@dpdk.org
Subject: Re: Find all matches with DPDK ACL
Date: Wed, 24 Nov 2021 18:19:58 +0300
Message-ID: <20211124181958.212f1179@sovereign> (raw)
In-Reply-To: <CAOBD2Betu-U9hznd3oA0y-Av7dPp2RsvVOrsWUC5Qiqo7j8Jcg@mail.gmail.com>

2021-11-24 11:06 (UTC+0100), Steffen Weise:
> > Hi folks!
> >
> > I'm using DPDK's ACL library to classify incoming packets by IPv4 5 tuple
> > match (src address, dst address, src port, dst port, protocol). Right now
> > it is possible to find only the best match based on the rule's priority.
> > Is there any way (maybe a custom patch for the ACL library exists?) to
> > find all matches in a single request? Decreased performance and even some
> > false-positive matches are acceptable.
> > It could be a big number of matches so using categories is not an option.
> >
> > Thanks,
> > Dmitriy Stepanov
> >  
> Hi,
> I have the very same question. Such a mechanism would help me in my
> applications. Currently I go for lookup on multiple separate tables.
> Cheers,
> Steffen Weise


I wonder what is the original problem you're solving.

A set of IPv4 5-tuple rules can be viewed as a set of regular expressions:

ACL:	src dst sport any dport 0x0035 proto tcp
Regex:	^\x01\x01\x01.\x02\x02\x02\x02..\x00\x35\x06$

Here, "." stands for "any byte".
For masks/ranges not aligned on 8 bits regex ranges can be used, e.g.:

ACL:	sport 100-200
	# this one is easy, just one byte varies
Regex:  \x00[\x64-\xC8]

ACL:	sport 200-300
	# this one is hard, needs an algorithm to transform
	# 200-300 => 200-255,256-300 => 0xC8-0xFF,0x0100-0x012C
Regex:	(?:\x00[\xC8-xFF]|\x01[\x00-\x2C])

ACL:	src
	# this one is easy, there are also hard examples like above
Regex:  \xC0\x00\x02[\x40-\x7F]

IIUC, you need all matching expressions for every packet,
which is represented as a 4+4+2+2+1 byte "string".
This is exactly what Hyperscan library does, for example:

There is now regexdev in DPDK,
take a look at it, maybe it will suit your needs and HW.

  reply	other threads:[~2021-11-24 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 16:55 Дмитрий Степанов
2021-11-24 10:06 ` Steffen Weise
2021-11-24 15:19   ` Dmitry Kozlyuk [this message]
2021-11-26 13:53     ` Дмитрий Степанов
2021-11-26 14:12       ` Dmitry Kozlyuk
2021-11-26 14:56         ` Дмитрий Степанов
2021-11-26 23:56           ` Dmitry Kozlyuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124181958.212f1179@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=stepanov.dmit@gmail.com \
    --cc=stweise.linux@gmail.com \
    --cc=users@dpdk.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK usage discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ http://inbox.dpdk.org/users \
	public-inbox-index users

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git