X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=doc%2Fguides%2Ftestpmd_app_ug%2Ftestpmd_funcs.rst;h=33857acf5408dea23022a08adb352268c71267db;hb=fc5bffb8b5ba17c110b8c3c35c6090e3345ad000;hp=715e209fd2d441b79fb456ef32f95dd59da7e646;hpb=4b61b8774be951c7caeaba2edde27c42f2f4c58a;p=dpdk.git diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 715e209fd2..33857acf54 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1524,6 +1524,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow control +~~~~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~ @@ -2436,6 +2443,15 @@ hash of input [IP] packets received on port:: ipv6-udp-ex ) +port cleanup txq mbufs +~~~~~~~~~~~~~~~~~~~~~~ + +To cleanup txq mbufs currently cached by driver:: + + testpmd> port cleanup (port_id) txq (queue_id) (free_cnt) + +If the value of ``free_cnt`` is 0, driver should free all cached mbufs. + Device Functions ---------------- @@ -2765,13 +2781,37 @@ Delete meter profile from the ethernet device:: testpmd> del port meter profile (port_id) (profile_id) +create port policy +~~~~~~~~~~~~~~~~~~ + +Create new policy object for the ethernet device:: + + testpmd> add port meter policy (port_id) (policy_id) g_actions \ + {action} y_actions {action} r_actions {action} + +where: + +* ``policy_id``: policy ID. +* ``action``: action lists for green/yellow/red colors. + +delete port policy +~~~~~~~~~~~~~~~~~~ + +Delete policy object for the ethernet device:: + + testpmd> del port meter policy (port_id) (policy_id) + +where: + +* ``policy_id``: policy ID. + create port meter ~~~~~~~~~~~~~~~~~ Create new meter object for the ethernet device:: testpmd> create port meter (port_id) (mtr_id) (profile_id) \ - (meter_enable) (g_action) (y_action) (r_action) (stats_mask) (shared) \ + (policy_id) (meter_enable) (stats_mask) (shared) \ (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\ (dscp_tbl_entry63)] @@ -2779,11 +2819,9 @@ where: * ``mtr_id``: meter object ID. * ``profile_id``: ID for the meter profile. +* ``policy_id``: ID for the policy. * ``meter_enable``: When this parameter has a non-zero value, the meter object gets enabled at the time of creation, otherwise remains disabled. -* ``g_action``: Policer action for the packet with green color. -* ``y_action``: Policer action for the packet with yellow color. -* ``r_action``: Policer action for the packet with red color. * ``stats_mask``: Mask of statistics counter types to be enabled for the meter object. * ``shared``: When this parameter has a non-zero value, the meter object is @@ -2831,24 +2869,6 @@ Set meter dscp table for the ethernet device:: 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 ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3789,6 +3809,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 ^^^^^^^^^^^^ @@ -4060,6 +4089,10 @@ This section lists supported actions and their attributes, if any. - ``indirect_action_id {unsigned}``: Indirect action ID to use +- ``color``: Color the packet to reflect the meter color result + + - ``type {value}``: Set color type with specified value(green/yellow/red) + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ @@ -4927,6 +4960,80 @@ 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 + +Sample meter with policy rules +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Meter with policy rules can be created by the following commands: + +Need to create policy first and actions are set for green/yellow/red colors. +Create meter with policy id. Create flow with meter id. + +Example for policy with meter color action. The purpose is to color the packet +to reflect the meter color result. +The meter policy action list: ``green -> green, yellow -> yellow, red -> red``. + +:: + + testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0 + testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end + r_actions color type red / end + testpmd> create port meter 0 1 13 1 yes 0xffff 0 0 + testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end + BPF Functions --------------