+
+Filter Functions
+----------------
+
+This section details the available filter functions that are available.
+
+ethertype_filter
+~~~~~~~~~~~~~~~~~~~~
+
+Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue.
+
+ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) ethertype (ether_type) (drop|fwd) queue (queue_id)
+
+The available information parameters are:
+
+* port_id: the port which the Ethertype filter assigned on.
+
+* mac_addr: compare destination mac address.
+
+* mac_ignr: ignore destination mac address match.
+
+* mac_address: destination mac address to match.
+
+* ether_type: the EtherType value want to match,
+ for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid.
+
+* queue_id : The receive queue associated with this EtherType filter. It is meaningless when deleting or dropping.
+
+Example, to add/remove an ethertype filter rule:
+
+.. code-block:: console
+
+ testpmd> ethertype_filter 0 add mac_ignr ethertype 0x0806 fwd queue 3
+ testpmd> ethertype_filter 0 del mac_ignr ethertype 0x0806 fwd queue 3
+
+2tuple_filter
+~~~~~~~~~~~~~~~~~
+
+Add or delete a 2-tuple filter,
+which identify packets by specific protocol and destination TCP/UDP port
+and forwards packets into one of the receive queues.
+
+2tuple_filter (port_id) (add|del) dst_port (dst_port_value) protocol (protocol_value)
+mask (mask_value) tcp_flags (tcp_flags_value) priority (prio_value) queue (queue_id)
+
+The available information parameters are:
+
+* port_id: the port which the 2-tuple filter assigned on.
+
+* dst_port_value: destination port in L4.
+
+* protocol_value: IP L4 protocol.
+
+* mask_value: participates in the match or not by bit for field above, 1b means participate.
+
+* tcp_flags_value: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP).
+
+* prio_value: priority of this filter.
+
+* queue_id: The receive queue associated with this 2-tuple filter.
+
+Example, to add/remove an 2tuple filter rule:
+
+.. code-block:: console
+
+ testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 tcp_flags 0x02 priority 3 queue 3
+ testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 tcp_flags 0x02 priority 3 queue 3
+
+5tuple_filter
+~~~~~~~~~~~~~~~~~
+
+Add or delete a 5-tuple filter,
+which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port)
+and routes packets into one of the receive queues.
+
+5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip (src_address) dst_port (dst_port_value) src_port (src_port_value)
+protocol (protocol_value) mask (mask_value) tcp_flags (tcp_flags_value) priority (prio_value) queue (queue_id)
+
+The available information parameters are:
+
+* port_id: the port which the 5-tuple filter assigned on.
+
+* dst_address: destination IP address.
+
+* src_address: source IP address.
+
+* dst_port_value: TCP/UDP destination port.
+
+* src_port_value: TCP/UDP source port.
+
+* protocol_value: L4 protocol.
+
+* mask_value: participates in the match or not by bit for field above, 1b means participate
+
+* tcp_flags_value: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP).
+
+* prio_value: the priority of this filter.
+
+* queue_id: The receive queue associated with this 5-tuple filter.
+
+Example, to add/remove an 5tuple filter rule:
+
+.. code-block:: console
+
+ testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 64 src_port 32 protocol 0x06 mask 0x1F flags 0x0 priority 3 queue 3
+ testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 64 src_port 32 protocol 0x06 mask 0x1F flags 0x0 priority 3 queue 3
+
+syn_filter
+~~~~~~~~~~~~~~
+
+By SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue.
+
+syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
+
+The available information parameters are:
+
+* port_id: the port which the SYN filter assigned on.
+
+* high: this SYN filter has higher priority than other filters.
+
+* low: this SYN filter has lower priority than other filters.
+
+* queue_id: The receive queue associated with this SYN filter
+
+Example:
+
+.. code-block:: console
+
+ testpmd> syn_filter 0 add priority high queue 3
+
+flex_filter
+~~~~~~~~~~~
+
+With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet
+and routes packets into one of the receive queues.
+
+flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value)
+mask (mask_value) priority (prio_value) queue (queue_id)
+
+The available information parameters are:
+
+* port_id: the port which the Flex filter is assigned on.
+
+* len_value: filter length in bytes, no greater than 128.
+
+* bytes_value: a string in hexadecimal, means the value the flex filter needs to match.
+
+* mask_value: a string in hexadecimal, bit 1 means corresponding byte participates in the match.
+
+* prio_value: the priority of this filter.
+
+* queue_id: the receive queue associated with this Flex filter.
+
+Example:
+
+.. code-block:: console
+
+ testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000
+ mask 000C priority 3 queue 3
+
+ testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000
+ mask 000C priority 3 queue 3
+
+flow_director_filter
+~~~~~~~~~~~~~~~~~~~~
+
+The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
+
+Two types of filtering are supported which are referred to as Perfect Match and Signature filters, the match mode
+is set by the --pkt-filter-mode command-line parameter:
+
+* Perfect match filters.
+ The hardware checks a match between the masked fields of the received packets and the programmed filters.
+
+* Signature filters.
+ The hardware checks a match between a hash-based signature of the masked fields of the received packet.
+
+The Flow Director filters can match the different fields for different type of packet: flow type, specific input set
+per flow type and the flexible payload. The Flow Director can also mask out parts of all of these fields so that filters
+are only applied to certain fields or parts of the fields.
+
+Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information.
+
+# Commands to add flow director filters of different flow types.
+
+flow_director_filter (port_id) (add|del|update) flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)
+src (src_ip_address) dst (dst_ip_address) vlan (vlan_value) flexbytes (flexbytes_value)
+(drop|fwd) queue (queue_id) fd_id (fd_id_value)
+
+flow_director_filter (port_id) (add|del|update) flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp)
+src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) vlan (vlan_value)
+flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
+
+flow_director_filter (port_id) (add|del|update) flow (ipv4-sctp|ipv6-sctp)
+src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) tag (verification_tag)
+vlan (vlan_value) flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
+
+flow_director_filter (port_id) (add|del|update) flow l2_payload
+ether (ethertype) flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
+
+For example, to add an ipv4-udp flow type filter:
+
+.. code-block:: console
+
+ testpmd> flow_director_filter 0 add flow ipv4-udp src 2.2.2.3 32 dst 2.2.2.5 33 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1
+
+For example, add an ipv4-other flow type filter:
+
+.. code-block:: console
+
+ testpmd> flow_director_filter 0 add flow ipv4-other src 2.2.2.3 dst 2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1
+
+flush_flow_director
+~~~~~~~~~~~~~~~~~~~
+
+flush all flow director filters on a device:
+
+flush_flow_director (port_id)
+
+Example, to flush all flow director filter on port 0:
+
+.. code-block:: console
+
+ testpmd> flush_flow_director 0
+
+flow_director_mask
+~~~~~~~~~~~~~~~~~~
+
+set flow director's masks on match input set
+
+flow_director_mask (port_id) vlan (vlan_value) src_mask (ipv4_src) (ipv6_src) (src_port) dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
+
+Example, to set flow director mask on port 0:
+
+.. code-block:: console
+
+ testpmd> flow_director_mask 0 vlan 0xefff src_mask 255.255.255.255 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF dst_mask 255.255.255.255 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
+
+
+flow_director_flex_mask
+~~~~~~~~~~~~~~~~~~~~~~~
+
+set masks of flow director's flexible payload based on certain flow type:
+
+flow_director_flex_mask (port_id) flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|
+ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all) (mask)
+
+Example, to set flow director's flex mask for all flow type on port 0:
+
+.. code-block:: console
+
+ testpmd> flow_director_flex_mask 0 flow all (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
+
+
+flow_director_flex_payload
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Configure flexible payload selection.
+
+flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
+
+For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload.
+
+.. code-block:: console
+
+ testpmd> flow_director_flex_payload 0 l4 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
+
+get_sym_hash_ena_per_port
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Get symmetric hash enable configuration per port.
+
+get_sym_hash_ena_per_port (port_id)
+
+For example, to get symmetric hash enable configuration of port 1.
+
+.. code-block:: console
+
+ testpmd> get_sym_hash_ena_per_port 1
+
+set_sym_hash_ena_per_port
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set symmetric hash enable configuration per port to enable or disable.
+
+set_sym_hash_ena_per_port (port_id) (enable|disable)
+
+For example, to set symmetric hash enable configuration of port 1 to enable.
+
+.. code-block:: console
+
+ testpmd> set_sym_hash_ena_per_port 1 enable
+
+get_hash_global_config
+~~~~~~~~~~~~~~~~~~~~~~
+
+Get the global configurations of hash filters.
+
+get_hash_global_config (port_id)
+
+For example, to get the global configurations of hash filters of port 1.
+
+.. code-block:: console
+
+ testpmd> get_hash_global_config 1
+
+set_hash_global_config
+~~~~~~~~~~~~~~~~~~~~~~
+
+Set the global configurations of hash filters.
+
+set_hash_global_config (port_id) (toeplitz|simple_xor|default)
+(ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload)
+(enable|disable)
+
+For example, to enable simple_xor for flow type of ipv6 on port 2.
+
+.. code-block:: console
+
+ testpmd> set_hash_global_config 2 simple_xor ipv6 enable