app/testpmd: add commands for conntrack
[dpdk.git] / doc / guides / testpmd_app_ug / testpmd_funcs.rst
index 5785e94..c0cbc40 100644 (file)
@@ -24,10 +24,10 @@ If you type a partial command and hit ``<TAB>`` you get a list of the available
 
    testpmd> show port <TAB>
 
-       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X
-       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all
-       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X
-       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all
+       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
+       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
+       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
+       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
        ...
 
 
@@ -159,7 +159,7 @@ show port
 
 Display information for a given port or all ports::
 
-   testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc) (port_id|all)
+   testpmd> show port (info|summary|stats|xstats|fdir|dcb_tc|cap) (port_id|all)
 
 The available information categories are:
 
@@ -173,8 +173,6 @@ The available information categories are:
 
 * ``fdir``: Flow Director information and statistics.
 
-* ``stat_qmap``: Queue statistics mapping.
-
 * ``dcb_tc``: DCB information such as TC mapping.
 
 For example:
@@ -244,7 +242,7 @@ clear port
 
 Clear the port statistics and forward engine statistics for a given port or for all ports::
 
-   testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)
+   testpmd> clear port (info|stats|xstats|fdir) (port_id|all)
 
 For example::
 
@@ -3335,7 +3333,11 @@ following sections.
 
 - Dump internal representation information of all flows in hardware::
 
-   flow dump {port_id} {output_file}
+   flow dump {port_id} all {output_file}
+
+  for one flow::
+
+   flow dump {port_id} rule {rule_id} {output_file}
 
 - List and destroy aged flow rules::
 
@@ -3763,7 +3765,8 @@ This section lists supported pattern items and their attributes, if any.
 - ``gtp_psc``: match GTP PDU extension header with type 0x85.
 
   - ``pdu_type {unsigned}``: PDU type.
-  - ``qfi {unsigned}``: QoS flow identifier.
+
+  - ``qfi {unsigned}``: PPP, RQI and QoS flow identifier.
 
 - ``pppoes``, ``pppoed``: match PPPoE header.
 
@@ -3786,6 +3789,15 @@ This section lists supported pattern items and their attributes, if any.
   - ``s_field {unsigned}``: S field.
   - ``seid {unsigned}``: session endpoint identifier.
 
+- ``integrity``: match packet integrity.
+
+   - ``level {unsigned}``: Packet encapsulation level the item should
+     apply to. See rte_flow_action_rss for details.
+   - ``value {unsigned}``: A bitmask that specify what packet elements
+     must be matched for integrity.
+
+- ``conntrack``: match conntrack state.
+
 Actions list
 ^^^^^^^^^^^^
 
@@ -4052,10 +4064,10 @@ This section lists supported actions and their attributes, if any.
 
   - ``dscp_value {unsigned}``: The new DSCP value to be set
 
-- ``shared``: Use shared action created via
-  ``flow shared_action {port_id} create``
+- ``indirect``: Use indirect action created via
+  ``flow indirect_action {port_id} create``
 
-  - ``shared_action_id {unsigned}``: Shared action ID to use
+  - ``indirect_action_id {unsigned}``: Indirect action ID to use
 
 Destroying flow rules
 ~~~~~~~~~~~~~~~~~~~~~
@@ -4346,113 +4358,117 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow
    testpmd> flow aged 0
    Port 0 total aged flows: 0
 
-Creating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} create`` creates shared action with optional
-shared action ID. It is bound to ``rte_flow_shared_action_create()``::
+Creating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
 
-   flow shared_action {port_id} create [action_id {shared_action_id}]
+   flow indirect_action {port_id} create [action_id {indirect_action_id}]
       [ingress] [egress] [transfer] action {action} / end
 
 If successful, it will show::
 
-   Shared action #[...] created
+   Indirect action #[...] created
 
-Otherwise, it will complain either that shared action already exists or that
+Otherwise, it will complain either that indirect action already exists or that
 some error occurred::
 
-   Shared action #[...] is already assigned, delete it first
+   Indirect action #[...] is already assigned, delete it first
 
 ::
 
    Caught error type [...] ([...]): [...]
 
-Create shared rss action with id 100 to queues 1 and 2 on port 0::
+Create indirect rss action with id 100 to queues 1 and 2 on port 0::
 
-   testpmd> flow shared_action 0 create action_id 100 \
+   testpmd> flow indirect_action 0 create action_id 100 \
       ingress action rss queues 1 2 end / end
 
-Create shared rss action with id assigned by testpmd to queues 1 and 2 on
+Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
 port 0::
 
-       testpmd> flow shared_action 0 create action_id \
+       testpmd> flow indirect_action 0 create action_id \
                ingress action rss queues 0 1 end / end
 
-Updating shared actions
-~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` updates configuration of the shared
-action from its shared action ID (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_update()``::
+Updating indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``flow indirect_action {port_id} update`` updates configuration of the indirect
+action from its indirect action ID (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_update()``::
 
-   flow shared_action {port_id} update {shared_action_id}
+   flow indirect_action {port_id} update {indirect_action_id}
       action {action} / end
 
 If successful, it will show::
 
-   Shared action #[...] updated
+   Indirect action #[...] updated
 
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
 error occurred::
 
-   Failed to find shared action #[...] on port [...]
+   Failed to find indirect action #[...] on port [...]
 
 ::
 
    Caught error type [...] ([...]): [...]
 
-Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
+Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
 (in create example above rss queues were 1 and 2)::
 
-   testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
+   testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
 
-Destroying shared actions
-~~~~~~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} update`` destroys one or more shared actions
-from their shared action IDs (as returned by
-``flow shared_action {port_id} create``). It is bound to
-``rte_flow_shared_action_destroy()``::
+Destroying indirect actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   flow shared_action {port_id} destroy action_id {shared_action_id} [...]
+``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
+from their indirect action IDs (as returned by
+``flow indirect_action {port_id} create``). It is bound to
+``rte_flow_action_handle_destroy()``::
+
+   flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
 
 If successful, it will show::
 
-   Shared action #[...] destroyed
+   Indirect action #[...] destroyed
 
-It does not report anything for shared action IDs that do not exist.
-The usual error message is shown when a shared action cannot be destroyed::
+It does not report anything for indirect action IDs that do not exist.
+The usual error message is shown when a indirect action cannot be destroyed::
 
    Caught error type [...] ([...]): [...]
 
-Destroy shared actions having id 100 & 101::
+Destroy indirect actions having id 100 & 101::
 
-   testpmd> flow shared_action 0 destroy action_id 100 action_id 101
+   testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
 
-Query shared actions
-~~~~~~~~~~~~~~~~~~~~
-``flow shared_action {port_id} query`` queries the shared action from its
-shared action ID (as returned by ``flow shared_action {port_id} create``).
-It is bound to ``rte_flow_shared_action_query()``::
+Query indirect actions
+~~~~~~~~~~~~~~~~~~~~~~
 
-  flow shared_action {port_id} query {shared_action_id}
+``flow indirect_action {port_id} query`` queries the indirect action from its
+indirect action ID (as returned by ``flow indirect_action {port_id} create``).
+It is bound to ``rte_flow_action_handle_query()``::
 
-Currently only rss shared action supported. If successful, it will show::
+  flow indirect_action {port_id} query {indirect_action_id}
 
-   Shared RSS action:
+Currently only rss indirect action supported. If successful, it will show::
+
+   Indirect RSS action:
       refs:[...]
 
-Otherwise, it will complain either that shared action not found or that some
+Otherwise, it will complain either that indirect action not found or that some
 error occurred::
 
-   Failed to find shared action #[...] on port [...]
+   Failed to find indirect action #[...] on port [...]
 
 ::
 
    Caught error type [...] ([...]): [...]
 
-Query shared action having id 100::
+Query indirect action having id 100::
 
-   testpmd> flow shared_action 0 query 100
+   testpmd> flow indirect_action 0 query 100
 
 Sample QinQ flow rules
 ~~~~~~~~~~~~~~~~~~~~~~
@@ -4920,6 +4936,60 @@ NVGRE encapsulation header and sent to port id 0.
  testpmd> flow create 0 ingress transfer pattern eth / end actions
         sample ratio 1 index 0  / port_id id 2 / end
 
+Sample integrity rules
+~~~~~~~~~~~~~~~~~~~~~~
+
+Integrity rules can be created by the following commands:
+
+Integrity rule that forwards valid TCP packets to group 1.
+TCP packet integrity is matched with the ``l4_ok`` bit 3.
+
+::
+
+ testpmd> flow create 0 ingress
+            pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end
+            actions jump group 1 / end
+
+Integrity rule that forwards invalid packets to application.
+General packet integrity is matched with the ``packet_ok`` bit 0.
+
+::
+
+ testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end
+
+Sample conntrack rules
+~~~~~~~~~~~~~~~~~~~~~~
+
+Conntrack rules can be set by the following commands
+
+Need to construct the connection context with provided information.
+In the first table, create a flow rule by using conntrack action and jump to
+the next table. In the next table, create a rule to check the state.
+
+::
+
+ testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0
+        last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510
+        last_seq 2632987379 last_ack 2532480967 last_end 2632987379
+        last_index 0x8
+ testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0
+        sent_end 2632987379 reply_end 2633016339 max_win 28960
+        max_ack 2632987379
+ testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0
+        sent_end 2532480967 reply_end 2532546247 max_win 65280
+        max_ack 2532480967
+ testpmd> flow indirect_action 0 create ingress action conntrack / end
+ testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end
+ testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end
+
+Construct the conntrack again with only "is_orig" set to 0 (other fields are
+ignored), then use "update" interface to update the direction. Create flow
+rules like above for the peer port.
+
+::
+
+ testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end
+
 BPF Functions
 --------------