[dpdk-dev,RFC,1/2] rte_flow: add attribute for signature match

Message ID 1494791406-3594-2-git-send-email-qi.z.zhang@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang May 14, 2017, 7:50 p.m. UTC
  Add new attribute "sig_match" to rte_flow_attr.
This attribute indicate if current flow take "perfect match"
or "signature match".
With perfect match (by default), if a packet does not match pattern,
actions will not be taken. (this is identical with current behavior )
With signature match, if a packet does not match pattern, it still
has the possibility to trigger the actions, this happens when device
think the signature of the pattern is matched.
Signature match is expected to have better performance than perfect
match, but the cost is accuracy.
When a flow rule with this attribute set, identical behavior can ONLY
be guaranteed if packet matches the pattern, since different device
may have different implementation of signature calculation algorithm.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 app/test-pmd/cmdline_flow.c | 11 +++++++++++
 lib/librte_ether/rte_flow.h |  3 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 0fd69f9..512f817 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -95,6 +95,7 @@  enum index {
 	PRIORITY,
 	INGRESS,
 	EGRESS,
+	SIG_MATCH,
 
 	/* Validate/create pattern. */
 	PATTERN,
@@ -397,6 +398,7 @@  static const enum index next_vc_attr[] = {
 	PRIORITY,
 	INGRESS,
 	EGRESS,
+	SIG_MATCH,
 	PATTERN,
 	ZERO,
 };
@@ -896,6 +898,12 @@  static const struct token token_list[] = {
 		.next = NEXT(next_vc_attr),
 		.call = parse_vc,
 	},
+	[SIG_MATCH] = {
+		.name = "sig_match",
+		.help = "affect rule to match",
+		.next = NEXT(next_vc_attr),
+		.call = parse_vc,
+	},
 	/* Validate/create pattern. */
 	[PATTERN] = {
 		.name = "pattern",
@@ -1728,6 +1736,9 @@  parse_vc(struct context *ctx, const struct token *token,
 	case EGRESS:
 		out->args.vc.attr.egress = 1;
 		return len;
+	case SIG_MATCH:
+		out->args.vc.attr.sig_match = 1;
+		return len;
 	case PATTERN:
 		out->args.vc.pattern =
 			(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index c47edbc..8ba3c36 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -95,7 +95,8 @@  struct rte_flow_attr {
 	uint32_t priority; /**< Priority level within group. */
 	uint32_t ingress:1; /**< Rule applies to ingress traffic. */
 	uint32_t egress:1; /**< Rule applies to egress traffic. */
-	uint32_t reserved:30; /**< Reserved, must be zero. */
+	uint32_t sig_match:1; /**< only use hash signagure to match. */
+	uint32_t reserved:29; /**< Reserved, must be zero. */
 };
 
 /**