From patchwork Sun May 14 19:50:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 24282 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 8529758F6; Mon, 15 May 2017 04:56:30 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 53A2811D4 for ; Mon, 15 May 2017 04:56:26 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2017 19:56:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,342,1491289200"; d="scan'208";a="856781544" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.129.189]) by FMSMGA003.fm.intel.com with ESMTP; 14 May 2017 19:56:24 -0700 From: Qi Zhang To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, wenzhuo.lu@intel.com, beilei.xing@intel.com, Qi Zhang Date: Sun, 14 May 2017 15:50:05 -0400 Message-Id: <1494791406-3594-2-git-send-email-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494791406-3594-1-git-send-email-qi.z.zhang@intel.com> References: <1494791406-3594-1-git-send-email-qi.z.zhang@intel.com> Subject: [dpdk-dev] [RFC 1/2] rte_flow: add attribute for signature match X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- app/test-pmd/cmdline_flow.c | 11 +++++++++++ lib/librte_ether/rte_flow.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) 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. */ }; /**