Skip to content

Commit

Permalink
ethdev: add flow item for comparison
Browse files Browse the repository at this point in the history
The new item type is added for the case user wants to match traffic
based on packet field compare result with other fields or immediate
value.

e.g. take advantage the compare item user will be able to accumulate
a IPv4/TCP packet's TCP data_offset and IPv4 IHL field to a tag
register, then compare the tag register with IPv4 header total length
to understand the packet has payload or not.

The supported operations can be as below:
 - RTE_FLOW_ITEM_COMPARE_EQ (equal)
 - RTE_FLOW_ITEM_COMPARE_NE (not equal)
 - RTE_FLOW_ITEM_COMPARE_LT (less than)
 - RTE_FLOW_ITEM_COMPARE_LE (less than or equal)
 - RTE_FLOW_ITEM_COMPARE_GT (great than)
 - RTE_FLOW_ITEM_COMPARE_GE (great than or equal)

A sample for create the comparison flow:
flow pattern_template 0 create ingress pattern_template_id 1 template \
	compare op mask le a_type mask tag a_tag_index mask 1 b_type \
	mask tag b_tag_index mask 2 width mask 0xffffffff / end
flow actions_template 0 create ingress actions_template_id 1 template \
	count / drop / end mask count / drop  / end
flow template_table 0 create table_id 1 group 2 priority 1  ingress \
	rules_number 1 pattern_template 1 actions_template 1
flow queue 0 create 0 template_table 1 pattern_template 0 \
	actions_template 0 postpone no pattern compare op is le \
	a_type is tag a_tag_index is 1 b_type is tag b_tag_index is 2 \
	width is 32 / end actions count / drop / end

Signed-off-by: Suanming Mou <[email protected]>
Acked-by: Ori Kam <[email protected]>
Acked-by: Andrew Rybchenko <[email protected]>
Acked-by: Ferruh Yigit <[email protected]>
  • Loading branch information
smou-mlnx authored and ferruhy committed Feb 6, 2024
1 parent f8d14aa commit 58143b7
Show file tree
Hide file tree
Showing 7 changed files with 467 additions and 2 deletions.
Loading

0 comments on commit 58143b7

Please sign in to comment.