doc: describe ACL classification methods
[dpdk.git] / doc / guides / prog_guide / packet_classif_access_ctrl.rst
index 72f4510..d2adbff 100644 (file)
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+    Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
     All rights reserved.
 
     Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,18 @@ The library API provides the following basic operations:
 Overview
 --------
 
+Rule definition
+~~~~~~~~~~~~~~~
+
 The current implementation allows the user for each AC context to specify its own rule (set of fields)
 over which packet classification will be performed.
+Though there are few restrictions on the rule fields layout:
+
+*  First field in the rule definition has to be one byte long.
+*  All subsequent fields has to be grouped into sets of 4 consecutive bytes.
+
+This is done mainly for performance reasons - search function processes the first input byte as part of the flow setup and then the inner loop of the search function is unrolled to process four input bytes at a time.
+
 To define each field inside an AC rule, the following structure is used:
 
 .. code-block:: c
@@ -85,10 +95,7 @@ To define each field inside an AC rule, the following structure is used:
     A zero-based value that represents the position of the field inside the rule; 0 to N-1 for N fields.
 
 *   input_index
-    For performance reasons, the inner loop of the search function is unrolled to process four input bytes at a time.
-    This requires the input to be grouped into sets of 4 consecutive bytes.
-    The loop processes the first input byte as part of the setup and then
-    subsequent bytes must be in groups of 4 consecutive bytes.
+    As mentioned above, all input fields, except the very first one, must be in groups of 4 consecutive bytes.
     The input index specifies to which input group that field belongs to.
 
 *   offset
@@ -262,6 +269,22 @@ When creating a set of rules, for each rule, additional information must be supp
     When adding new rules into an ACL context, all fields must be in host byte order (LSB).
     When the search is performed for an input tuple, all fields in that tuple must be in network byte order (MSB).
 
+Classification methods
+~~~~~~~~~~~~~~~~~~~~~~
+
+After rte_acl_build() over given ACL context has finished successfully, it can be used to perform classification - search for a ACL rule with highest priority over the input data.
+There are several implementations of classify algorithm:
+
+*   **RTE_ACL_CLASSIFY_SCALAR**: generic implementation, doesn't require any specific HW support.
+
+*   **RTE_ACL_CLASSIFY_SSE**: vector implementation, can process up to 8 flows in parallel. Requires SSE 4.1 support.
+
+*   **RTE_ACL_CLASSIFY_AVX2**: vector implementation, can process up to 16 flows in parallel. Requires AVX2 support.
+
+It is purely a runtime decision which method to choose, there is no build-time difference.
+All implementations operates over the same internal RT structures and use similar principles. The main difference is that vector implementations can manually exploit IA SIMD instructions and process several input data flows in parallel.
+At startup ACL library determines the highest available classify method for the given platform and sets it as default one. Though the user has an ability to override the default classifier function for a given ACL context or perform particular search using non-default classify method. In that case it is user responsibility to make sure that given platform supports selected classify implementation.
+
 Application Programming Interface (API) Usage
 ---------------------------------------------