From: Antonio Fischetti <antonio.fischetti@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] doc: add a further ACL example
Date: Mon, 11 Jan 2016 17:44:54 +0000 [thread overview]
Message-ID: <1452534294-29241-1-git-send-email-antonio.fischetti@intel.com> (raw)
Add a further ACL example where the elements of the search key
are not entirely fitting into the 4 consecutive bytes of all
input fields.
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
.../prog_guide/packet_classif_access_ctrl.rst | 68 ++++++++++++++++++++++
1 file changed, 68 insertions(+)
mode change 100644 => 100755 doc/guides/prog_guide/packet_classif_access_ctrl.rst
diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst
old mode 100644
new mode 100755
index a9a5815..5fd3d34
--- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst
+++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst
@@ -246,6 +246,74 @@ A typical example of such an IPv6 2-tuple rule is a follows:
Any IPv6 packets with protocol ID 6 (TCP), and source address inside the range
[2001:db8:1234:0000:0000:0000:0000:0000 - 2001:db8:1234:ffff:ffff:ffff:ffff:ffff] matches the above rule.
+In the following example the last element of the search key is 8-bit long.
+So it is a case where the 4 consecutive bytes of an input field are not fully occupied.
+The structure for the classification is:
+
+.. code-block:: c
+
+ struct acl_key {
+ uint8_t ip_proto;
+ uint32_t ip_src;
+ uint32_t ip_dst;
+ uint8_t tos; /*< This is partially using a 32-bit input element */
+ };
+
+The following array of field definitions can be used:
+
+.. code-block:: c
+
+ struct rte_acl_field_def ipv4_defs[4] = {
+ /* first input field - always one byte long. */
+ {
+ .type = RTE_ACL_FIELD_TYPE_BITMASK,
+ .size = sizeof (uint8_t),
+ .field_index = 0,
+ .input_index = 0,
+ .offset = offsetof (struct acl_key, ip_proto),
+ },
+
+ /* next input field (IPv4 source address) - 4 consecutive bytes. */
+ {
+ .type = RTE_ACL_FIELD_TYPE_MASK,
+ .size = sizeof (uint32_t),
+ .field_index = 1,
+ .input_index = 1,
+ .offset = offsetof (struct acl_key, ip_src),
+ },
+
+ /* next input field (IPv4 destination address) - 4 consecutive bytes. */
+ {
+ .type = RTE_ACL_FIELD_TYPE_MASK,
+ .size = sizeof (uint32_t),
+ .field_index = 2,
+ .input_index = 2,
+ .offset = offsetof (struct acl_key, ip_dst),
+ },
+
+ /*
+ * Next element of search key (Type of Service) is indeed 1 byte long.
+ * Anyway we need to allocate all the 4 consecutive bytes for it.
+ */
+ {
+ .type = RTE_ACL_FIELD_TYPE_BITMASK,
+ .size = sizeof (uint32_t), /* All the 4 consecutive bytes are allocated */
+ .field_index = 3,
+ .input_index = 3,
+ .offset = offsetof (struct acl_key, tos),
+ },
+ };
+
+A typical example of such an IPv4 4-tuple rule is as follows:
+
+::
+
+ source addr/mask destination addr/mask tos/mask protocol/mask
+ 192.168.1.0/24 192.168.2.31/32 1/0xff 6/0xff
+
+Any IPv4 packets with protocol ID 6 (TCP), source address 192.168.1.[0-255], destination address 192.168.2.31,
+ToS 1 matches the above rule.
+
When creating a set of rules, for each rule, additional information must be supplied also:
* **priority**: A weight to measure the priority of the rules (higher is better).
--
1.9.3
next reply other threads:[~2016-01-11 17:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 17:44 Antonio Fischetti [this message]
2016-01-12 11:04 ` Mcnamara, John
2016-02-09 11:03 ` Thomas Monjalon
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452534294-29241-1-git-send-email-antonio.fischetti@intel.com \
--to=antonio.fischetti@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).