DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org, beilei.xing@intel.com
Cc: wenzhuo.lu@intel.com, Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix QinQ eth pattern parsing
Date: Wed,  5 Apr 2017 15:03:57 +0100	[thread overview]
Message-ID: <1491401037-28611-1-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1491236049-6747-1-git-send-email-bernard.iremonger@intel.com>

The eth keyword only should be accepted.

Fixes: d46e85af6b5c ("net/i40e: parse QinQ pattern")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
Changes in v2:
rebased to latest dpdk-next-net
Document the i40e_flow_parse_qinq_pattern function.
Parse the eth keyword in similar way to mpls parsing function.

 drivers/net/i40e/i40e_flow.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 9f541eaff..3cf0e5a70 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -1740,6 +1740,13 @@ i40e_flow_parse_mpls_filter(struct rte_eth_dev *dev,
 	return ret;
 }
 
+/* 1. Last in item should be NULL as range is not supported.
+ * 2. Supported filter types: QINQ.
+ * 3. Mask of fields which need to be matched should be
+ *    filled with 1.
+ * 4. Mask of fields which needn't to be matched should be
+ *    filled with 0.
+ */
 static int
 i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 			      const struct rte_flow_item *pattern,
@@ -1747,8 +1754,6 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 			      struct i40e_tunnel_filter_conf *filter)
 {
 	const struct rte_flow_item *item = pattern;
-	const struct rte_flow_item_eth *eth_spec;
-	const struct rte_flow_item_eth *eth_mask;
 	const struct rte_flow_item_vlan *vlan_spec = NULL;
 	const struct rte_flow_item_vlan *vlan_mask = NULL;
 	const struct rte_flow_item_vlan *i_vlan_spec = NULL;
@@ -1770,13 +1775,11 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
 		item_type = item->type;
 		switch (item_type) {
 		case RTE_FLOW_ITEM_TYPE_ETH:
-			eth_spec = (const struct rte_flow_item_eth *)item->spec;
-			eth_mask = (const struct rte_flow_item_eth *)item->mask;
-			if (eth_spec && eth_mask) {
+			if (item->spec || item->mask) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
-						   "Invalid ether spec/mask");
+						   "Invalid ETH item");
 				return -rte_errno;
 			}
 			break;
-- 
2.11.0

  parent reply	other threads:[~2017-04-05 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 16:14 [dpdk-dev] [PATCH] net/i40e: fix " Bernard Iremonger
2017-04-04 12:39 ` Ferruh Yigit
2017-04-04 12:52   ` Iremonger, Bernard
2017-04-05  2:03     ` Xing, Beilei
2017-04-05  8:00       ` Iremonger, Bernard
2017-04-05 14:03 ` Bernard Iremonger [this message]
2017-04-06  4:54   ` [dpdk-dev] [PATCH v2] net/i40e: fix QinQ " Xing, Beilei
2017-04-07 16:21     ` 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=1491401037-28611-1-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=wenzhuo.lu@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).