testpmd> show port <TAB>
- info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
- info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
- stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
- stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap 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
...
Display information for a given port or all ports::
- testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)
+ testpmd> show port (info|summary|stats|xstats|fdir|dcb_tc|cap) (port_id|all)
The available information categories are:
* ``fdir``: Flow Director information and statistics.
-* ``stat_qmap``: Queue statistics mapping.
-
* ``dcb_tc``: DCB information such as TC mapping.
-* ``cap``: Supported offload capabilities.
-
For example:
.. code-block:: console
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::
testpmd> set port (port_id) fec_mode auto|off|rs|baser
+Config Sample actions list
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Configure the sample actions list to be used when sampling a packet by
+rte_flow_action_sample::
+
+ set sample_actions {index} {action} [/ {action} [...]] / end
+
+There are multiple global buffers for ``sample_actions``, this command will set
+one internal buffer index by ``{index}``.
+
+In order to use different sample actions list, ``index`` must be specified
+during the flow rule creation::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
+ sample ratio 2 index 2 / end
+
+Otherwise the default index ``0`` is used.
Port Functions
--------------
Add meter profile (srTCM rfc2697) to the ethernet device::
testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
- (cir) (cbs) (ebs)
+ (cir) (cbs) (ebs) (packet_mode)
where:
* ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
add port meter profile (trTCM rfc2968)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Add meter profile (srTCM rfc2698) to the ethernet device::
testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
- (cir) (pir) (cbs) (pbs)
+ (cir) (pir) (cbs) (pbs) (packet_mode)
where:
* ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
add port meter profile (trTCM rfc4115)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Add meter profile (trTCM rfc4115) to the ethernet device::
testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
- (cir) (eir) (cbs) (ebs)
+ (cir) (eir) (cbs) (ebs) (packet_mode)
where:
* ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
delete port meter profile
~~~~~~~~~~~~~~~~~~~~~~~~~
testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
(dscp_tbl_entry1)...(dscp_tbl_entry63)]
-set port meter policer action
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set meter policer action for the ethernet device::
-
- testpmd> set port meter policer action (port_id) (mtr_id) (action_mask) \
- (action0) [(action1) (action1)]
-
-where:
-
-* ``action_mask``: Bit mask indicating which policer actions need to be
- updated. One or more policer actions can be updated in a single function
- invocation. To update the policer action associated with color C, bit
- (1 << C) needs to be set in *action_mask* and element at position C
- in the *actions* array needs to be valid.
-* ``actionx``: Policer action for the color x,
- RTE_MTR_GREEN <= x < RTE_MTR_COLORS
-
set port meter stats mask
~~~~~~~~~~~~~~~~~~~~~~~~~
- 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::
- ``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.
- ``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
^^^^^^^^^^^^
- ``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
~~~~~~~~~~~~~~~~~~~~~
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 shared_action {port_id} create [action_id {shared_action_id}]
+``flow indirect_action {port_id} create`` creates indirect action with optional
+indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
+
+ 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 shared_action {port_id} update {shared_action_id}
+``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 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 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 shared_action {port_id} destroy action_id {shared_action_id} [...]
+ 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 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()``::
- flow shared_action {port_id} query {shared_action_id}
+ flow indirect_action {port_id} query {indirect_action_id}
-Currently only rss shared action supported. If successful, it will show::
+Currently only rss indirect action supported. If successful, it will show::
- Shared RSS action:
+ 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
~~~~~~~~~~~~~~~~~~~~~~
testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
seid is 1 / end actions queue index 3 / end
+Sample Sampling/Mirroring rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sample/Mirroring rules can be set by the following commands
+
+NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
+and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
+
+::
+
+ testpmd> set sample_actions 0 mark id 0x1234 / queue index 0 / end
+ testpmd> flow create 0 ingress group 1 pattern eth / end actions
+ sample ratio 2 index 0 / queue index 1 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets with encapsulation header are sent to port id 0, and also
+mirrored the packets and sent to port id 2.
+
+::
+
+ testpmd> set sample_actions 0 port_id id 2 / end
+ testpmd> flow create 1 ingress transfer pattern eth / end actions
+ sample ratio 1 index 0 / raw_encap / port_id id 0 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set sample_actions 0 raw_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+ sample ratio 1 index 0 / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+VXLAN encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
+ ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 vxlan_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+ sample ratio 1 index 0 / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+NVGRE encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
+ eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 nvgre_encap / port_id id 0 / end
+ 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
--------------