DPDK patches and discussions
 help / color / mirror / Atom feed
From: Beilei Xing <beilei.xing@intel.com>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 4/4] net/i40e: support ether pattern for FDIR
Date: Wed,  7 Jun 2017 16:09:56 +0800	[thread overview]
Message-ID: <1496822996-26398-5-git-send-email-beilei.xing@intel.com> (raw)
In-Reply-To: <1496822996-26398-1-git-send-email-beilei.xing@intel.com>

Previously, i40e PMD will select ethertype filter
parser when adding ether pattern rules. In fact,
FDIR also supports ether pattern.
This patch adds ether pattern support for FDIR.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_flow.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 46ee96e..0827182 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -1572,6 +1572,7 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter },
 	/* FDIR - support default flow type without flexible payload*/
+	{ pattern_ethertype, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_tcp, i40e_flow_parse_fdir_filter },
@@ -1817,10 +1818,10 @@ i40e_match_pattern(enum rte_flow_item_type *item_array,
 
 /* Find if there's parse filter function matched */
 static parse_filter_t
-i40e_find_parse_filter_func(struct rte_flow_item *pattern)
+i40e_find_parse_filter_func(struct rte_flow_item *pattern, uint32_t *idx)
 {
 	parse_filter_t parse_filter = NULL;
-	uint8_t i = 0;
+	uint8_t i = *idx;
 
 	for (; i < RTE_DIM(i40e_supported_patterns); i++) {
 		if (i40e_match_pattern(i40e_supported_patterns[i].items,
@@ -1830,6 +1831,8 @@ i40e_find_parse_filter_func(struct rte_flow_item *pattern)
 		}
 	}
 
+	*idx = ++i;
+
 	return parse_filter;
 }
 
@@ -3768,7 +3771,8 @@ i40e_flow_validate(struct rte_eth_dev *dev,
 	parse_filter_t parse_filter;
 	uint32_t item_num = 0; /* non-void item number of pattern*/
 	uint32_t i = 0;
-	int ret;
+	bool flag = false;
+	int ret = I40E_NOT_SUPPORTED;
 
 	if (!pattern) {
 		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
@@ -3810,16 +3814,21 @@ i40e_flow_validate(struct rte_eth_dev *dev,
 
 	i40e_pattern_skip_void_item(items, pattern);
 
-	/* Find if there's matched parse filter function */
-	parse_filter = i40e_find_parse_filter_func(items);
-	if (!parse_filter) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ITEM,
-				   pattern, "Unsupported pattern");
-		return -rte_errno;
-	}
-
-	ret = parse_filter(dev, attr, items, actions, error, &cons_filter);
+	i = 0;
+	do {
+		parse_filter = i40e_find_parse_filter_func(items, &i);
+		if (!parse_filter && !flag) {
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   pattern, "Unsupported pattern");
+			rte_free(items);
+			return -rte_errno;
+		}
+		if (parse_filter)
+			ret = parse_filter(dev, attr, items, actions,
+					   error, &cons_filter);
+		flag = true;
+	} while ((ret < 0) && (i < RTE_DIM(i40e_supported_patterns)));
 
 	rte_free(items);
 
-- 
2.5.5

  parent reply	other threads:[~2017-06-07  8:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  6:10 [dpdk-dev] [PATCH 0/3] net/i40e: add advanced features " Beilei Xing
2017-05-24  6:10 ` [dpdk-dev] [PATCH 1/3] net/i40e: support flexible payload parsing " Beilei Xing
2017-06-06  7:46   ` Lu, Wenzhuo
2017-06-06  7:58     ` Xing, Beilei
2017-05-24  6:10 ` [dpdk-dev] [PATCH 2/3] net/i40e: support input set selection " Beilei Xing
2017-06-06  8:04   ` Lu, Wenzhuo
2017-05-24  6:10 ` [dpdk-dev] [PATCH 3/3] net/i40e: update supported patterns " Beilei Xing
2017-06-06  8:32   ` Lu, Wenzhuo
2017-06-07  8:09 ` [dpdk-dev] [PATCH v2 0/4] net/i40e: add advanced features " Beilei Xing
2017-06-07  8:09   ` [dpdk-dev] [PATCH v2 1/4] net/i40e: support flexible payload parsing " Beilei Xing
2017-06-08  2:48     ` Lu, Wenzhuo
2017-06-08 10:02     ` Ferruh Yigit
2017-06-07  8:09   ` [dpdk-dev] [PATCH v2 2/4] net/i40e: support input set selection " Beilei Xing
2017-06-07  8:09   ` [dpdk-dev] [PATCH v2 3/4] net/i40e: update supported patterns " Beilei Xing
2017-06-07  8:09   ` Beilei Xing [this message]
2017-06-08  2:59     ` [dpdk-dev] [PATCH v2 4/4] net/i40e: support ether pattern " Lu, Wenzhuo
2017-06-09  8:21   ` [dpdk-dev] [PATCH v3 0/4] net/i40e: add advanced features " Beilei Xing
2017-06-09  8:21     ` [dpdk-dev] [PATCH v3 1/4] net/i40e: support flexible payload parsing " Beilei Xing
2017-06-09  8:21     ` [dpdk-dev] [PATCH v3 2/4] net/i40e: support input set selection " Beilei Xing
2017-06-09  8:21     ` [dpdk-dev] [PATCH v3 3/4] net/i40e: update supported patterns " Beilei Xing
2017-06-09  8:21     ` [dpdk-dev] [PATCH v3 4/4] net/i40e: support ether pattern " Beilei Xing
2017-06-09 10:59     ` [dpdk-dev] [PATCH v3 0/4] net/i40e: add advanced features " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496822996-26398-5-git-send-email-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).