All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro
@ 2017-03-08  7:58 Wei Zhao
  2017-03-08  7:58 ` [PATCH v2 2/2] net/ixgbe: add mac type check for all filters Wei Zhao
  2017-03-08 10:43 ` [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Zhao @ 2017-03-08  7:58 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Wei Zhao, Wenzhuo Lu

move ixgbe 2 mac type check macro to ixgbe_ethdev.h in
order to be used by filter parser functions in file
ixgbe_flow.c.

Fixes: 6c52c126f27a ("ixgbe: move to drivers/net/")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 12 ------------
 drivers/net/ixgbe/ixgbe_ethdev.h | 12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2e497a8..e57a427 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5951,13 +5951,6 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
 	hw->mac.ops.set_rar(hw, 0, (void *)addr, 0, 0);
 }
 
-#define MAC_TYPE_FILTER_SUP(type)    do {\
-	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
-		(type) != ixgbe_mac_X550 && (type) != ixgbe_mac_X550EM_x &&\
-		(type) != ixgbe_mac_X550EM_a)\
-		return -ENOTSUP;\
-} while (0)
-
 int
 ixgbe_syn_filter_set(struct rte_eth_dev *dev,
 			struct rte_eth_syn_filter *filter,
@@ -6225,11 +6218,6 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
-#define MAC_TYPE_FILTER_SUP_EXT(type)    do {\
-	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540)\
-		return -ENOTSUP;\
-} while (0)
-
 static inline struct ixgbe_5tuple_filter *
 ixgbe_5tuple_filter_lookup(struct ixgbe_5tuple_filter_list *filter_list,
 			struct ixgbe_5tuple_filter_info *key)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c13b10e..058ad87 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -139,6 +139,18 @@
 #define IXGBE_MAX_FDIR_FILTER_NUM       (1024 * 32)
 #define IXGBE_MAX_L2_TN_FILTER_NUM      128
 
+#define MAC_TYPE_FILTER_SUP_EXT(type)    do {\
+	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540)\
+		return -ENOTSUP;\
+} while (0)
+
+#define MAC_TYPE_FILTER_SUP(type)    do {\
+	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
+		(type) != ixgbe_mac_X550 && (type) != ixgbe_mac_X550EM_x &&\
+		(type) != ixgbe_mac_X550EM_a)\
+		return -ENOTSUP;\
+} while (0)
+
 /*
  * Information about the fdir mode.
  */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] net/ixgbe: add mac type check for all filters
  2017-03-08  7:58 [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro Wei Zhao
@ 2017-03-08  7:58 ` Wei Zhao
  2017-03-08 10:43 ` [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Wei Zhao @ 2017-03-08  7:58 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Wei Zhao, Wenzhuo Lu

All kinds of filter need to hardware mac type check
to make sure the hardware support that type of fliter.
If not, it may cause serious issue.

v2:
 delete useless function declaration

Fixes: 11777435c727 ("net/ixgbe: parse flow director filter")
Fixes: 672be56d76a2 ("net/ixgbe: parse n-tuple filter")
Fixes: eb3539fc8550 ("net/ixgbe: parse ethertype filter")
Fixes: 429f6ebb42cc ("net/ixgbe: parse TCP SYN filter")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

---
 drivers/net/ixgbe/ixgbe_flow.c | 76 ++++++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 48a06a6..e2ba9c2 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -420,13 +420,17 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
 
 /* a specific function for ixgbe because the flags is specific */
 static int
-ixgbe_parse_ntuple_filter(const struct rte_flow_attr *attr,
+ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev,
+			  const struct rte_flow_attr *attr,
 			  const struct rte_flow_item pattern[],
 			  const struct rte_flow_action actions[],
 			  struct rte_eth_ntuple_filter *filter,
 			  struct rte_flow_error *error)
 {
 	int ret;
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	MAC_TYPE_FILTER_SUP_EXT(hw->mac.type);
 
 	ret = cons_parse_ntuple_filter(attr, pattern, actions, filter, error);
 
@@ -668,13 +672,17 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr,
 }
 
 static int
-ixgbe_parse_ethertype_filter(const struct rte_flow_attr *attr,
+ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev,
+				 const struct rte_flow_attr *attr,
 			     const struct rte_flow_item pattern[],
 			     const struct rte_flow_action actions[],
 			     struct rte_eth_ethertype_filter *filter,
 			     struct rte_flow_error *error)
 {
 	int ret;
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	MAC_TYPE_FILTER_SUP(hw->mac.type);
 
 	ret = cons_parse_ethertype_filter(attr, pattern,
 					actions, filter, error);
@@ -963,13 +971,17 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr,
 }
 
 static int
-ixgbe_parse_syn_filter(const struct rte_flow_attr *attr,
+ixgbe_parse_syn_filter(struct rte_eth_dev *dev,
+				 const struct rte_flow_attr *attr,
 			     const struct rte_flow_item pattern[],
 			     const struct rte_flow_action actions[],
 			     struct rte_eth_syn_filter *filter,
 			     struct rte_flow_error *error)
 {
 	int ret;
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	MAC_TYPE_FILTER_SUP(hw->mac.type);
 
 	ret = cons_parse_syn_filter(attr, pattern,
 					actions, filter, error);
@@ -1152,7 +1164,7 @@ cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,
 }
 
 static int
-ixgbe_validate_l2_tn_filter(struct rte_eth_dev *dev,
+ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
 			const struct rte_flow_attr *attr,
 			const struct rte_flow_item pattern[],
 			const struct rte_flow_action actions[],
@@ -2306,46 +2318,37 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
 }
 
 static int
-ixgbe_parse_fdir_filter(const struct rte_flow_attr *attr,
+ixgbe_parse_fdir_filter(struct rte_eth_dev *dev,
+			const struct rte_flow_attr *attr,
 			const struct rte_flow_item pattern[],
 			const struct rte_flow_action actions[],
 			struct ixgbe_fdir_rule *rule,
 			struct rte_flow_error *error)
 {
 	int ret;
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+
+	if (hw->mac.type != ixgbe_mac_82599EB &&
+		hw->mac.type != ixgbe_mac_X540 &&
+		hw->mac.type != ixgbe_mac_X550 &&
+		hw->mac.type != ixgbe_mac_X550EM_x &&
+		hw->mac.type != ixgbe_mac_X550EM_a)
+		return -ENOTSUP;
 
 	ret = ixgbe_parse_fdir_filter_normal(attr, pattern,
 					actions, rule, error);
 
 	if (!ret)
-		return 0;
+		goto step_next;
 
 	ret = ixgbe_parse_fdir_filter_tunnel(attr, pattern,
 					actions, rule, error);
 
-	return ret;
-}
-
-static int
-ixgbe_validate_fdir_filter(struct rte_eth_dev *dev,
-			const struct rte_flow_attr *attr,
-			const struct rte_flow_item pattern[],
-			const struct rte_flow_action actions[],
-			struct ixgbe_fdir_rule *rule,
-			struct rte_flow_error *error)
-{
-	int ret = 0;
-
-	enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
-
-	ixgbe_parse_fdir_filter(attr, pattern, actions,
-				rule, error);
-
-
+step_next:
 	if (fdir_mode == RTE_FDIR_MODE_NONE ||
 	    fdir_mode != rule->mode)
 		return -ENOTSUP;
-
 	return ret;
 }
 
@@ -2449,7 +2452,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 				ixgbe_flow_mem_ptr, entries);
 
 	memset(&ntuple_filter, 0, sizeof(struct rte_eth_ntuple_filter));
-	ret = ixgbe_parse_ntuple_filter(attr, pattern,
+	ret = ixgbe_parse_ntuple_filter(dev, attr, pattern,
 			actions, &ntuple_filter, error);
 	if (!ret) {
 		ret = ixgbe_add_del_ntuple_filter(dev, &ntuple_filter, TRUE);
@@ -2469,7 +2472,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 	}
 
 	memset(&ethertype_filter, 0, sizeof(struct rte_eth_ethertype_filter));
-	ret = ixgbe_parse_ethertype_filter(attr, pattern,
+	ret = ixgbe_parse_ethertype_filter(dev, attr, pattern,
 				actions, &ethertype_filter, error);
 	if (!ret) {
 		ret = ixgbe_add_del_ethertype_filter(dev,
@@ -2491,7 +2494,8 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 	}
 
 	memset(&syn_filter, 0, sizeof(struct rte_eth_syn_filter));
-	ret = cons_parse_syn_filter(attr, pattern, actions, &syn_filter, error);
+	ret = ixgbe_parse_syn_filter(dev, attr, pattern,
+				actions, &syn_filter, error);
 	if (!ret) {
 		ret = ixgbe_syn_filter_set(dev, &syn_filter, TRUE);
 		if (!ret) {
@@ -2511,7 +2515,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 	}
 
 	memset(&fdir_rule, 0, sizeof(struct ixgbe_fdir_rule));
-	ret = ixgbe_parse_fdir_filter(attr, pattern,
+	ret = ixgbe_parse_fdir_filter(dev, attr, pattern,
 				actions, &fdir_rule, error);
 	if (!ret) {
 		/* A mask cannot be deleted. */
@@ -2564,7 +2568,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 	}
 
 	memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
-	ret = cons_parse_l2_tn_filter(attr, pattern,
+	ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern,
 					actions, &l2_tn_filter, error);
 	if (!ret) {
 		ret = ixgbe_dev_l2_tunnel_filter_add(dev, &l2_tn_filter, FALSE);
@@ -2610,31 +2614,31 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,
 	int ret;
 
 	memset(&ntuple_filter, 0, sizeof(struct rte_eth_ntuple_filter));
-	ret = ixgbe_parse_ntuple_filter(attr, pattern,
+	ret = ixgbe_parse_ntuple_filter(dev, attr, pattern,
 				actions, &ntuple_filter, error);
 	if (!ret)
 		return 0;
 
 	memset(&ethertype_filter, 0, sizeof(struct rte_eth_ethertype_filter));
-	ret = ixgbe_parse_ethertype_filter(attr, pattern,
+	ret = ixgbe_parse_ethertype_filter(dev, attr, pattern,
 				actions, &ethertype_filter, error);
 	if (!ret)
 		return 0;
 
 	memset(&syn_filter, 0, sizeof(struct rte_eth_syn_filter));
-	ret = ixgbe_parse_syn_filter(attr, pattern,
+	ret = ixgbe_parse_syn_filter(dev, attr, pattern,
 				actions, &syn_filter, error);
 	if (!ret)
 		return 0;
 
 	memset(&fdir_rule, 0, sizeof(struct ixgbe_fdir_rule));
-	ret = ixgbe_validate_fdir_filter(dev, attr, pattern,
+	ret = ixgbe_parse_fdir_filter(dev, attr, pattern,
 				actions, &fdir_rule, error);
 	if (!ret)
 		return 0;
 
 	memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
-	ret = ixgbe_validate_l2_tn_filter(dev, attr, pattern,
+	ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern,
 				actions, &l2_tn_filter, error);
 
 	return ret;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro
  2017-03-08  7:58 [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro Wei Zhao
  2017-03-08  7:58 ` [PATCH v2 2/2] net/ixgbe: add mac type check for all filters Wei Zhao
@ 2017-03-08 10:43 ` Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2017-03-08 10:43 UTC (permalink / raw)
  To: Wei Zhao, dev; +Cc: Wenzhuo Lu

On 3/8/2017 7:58 AM, Wei Zhao wrote:
> move ixgbe 2 mac type check macro to ixgbe_ethdev.h in
> order to be used by filter parser functions in file
> ixgbe_flow.c.
> 
> Fixes: 6c52c126f27a ("ixgbe: move to drivers/net/")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro
@ 2017-03-08  7:54 Wei Zhao
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Zhao @ 2017-03-08  7:54 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Wei Zhao, Wenzhuo Lu

move ixgbe 2 mac type check macro to ixgbe_ethdev.h in
order to be used by filter parser functions in file
ixgbe_flow.c.

Fixes: 6c52c126f27a ("ixgbe: move to drivers/net/")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 12 ------------
 drivers/net/ixgbe/ixgbe_ethdev.h | 12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2e497a8..e57a427 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5951,13 +5951,6 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
 	hw->mac.ops.set_rar(hw, 0, (void *)addr, 0, 0);
 }
 
-#define MAC_TYPE_FILTER_SUP(type)    do {\
-	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
-		(type) != ixgbe_mac_X550 && (type) != ixgbe_mac_X550EM_x &&\
-		(type) != ixgbe_mac_X550EM_a)\
-		return -ENOTSUP;\
-} while (0)
-
 int
 ixgbe_syn_filter_set(struct rte_eth_dev *dev,
 			struct rte_eth_syn_filter *filter,
@@ -6225,11 +6218,6 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
-#define MAC_TYPE_FILTER_SUP_EXT(type)    do {\
-	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540)\
-		return -ENOTSUP;\
-} while (0)
-
 static inline struct ixgbe_5tuple_filter *
 ixgbe_5tuple_filter_lookup(struct ixgbe_5tuple_filter_list *filter_list,
 			struct ixgbe_5tuple_filter_info *key)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c13b10e..058ad87 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -139,6 +139,18 @@
 #define IXGBE_MAX_FDIR_FILTER_NUM       (1024 * 32)
 #define IXGBE_MAX_L2_TN_FILTER_NUM      128
 
+#define MAC_TYPE_FILTER_SUP_EXT(type)    do {\
+	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540)\
+		return -ENOTSUP;\
+} while (0)
+
+#define MAC_TYPE_FILTER_SUP(type)    do {\
+	if ((type) != ixgbe_mac_82599EB && (type) != ixgbe_mac_X540 &&\
+		(type) != ixgbe_mac_X550 && (type) != ixgbe_mac_X550EM_x &&\
+		(type) != ixgbe_mac_X550EM_a)\
+		return -ENOTSUP;\
+} while (0)
+
 /*
  * Information about the fdir mode.
  */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-08 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08  7:58 [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro Wei Zhao
2017-03-08  7:58 ` [PATCH v2 2/2] net/ixgbe: add mac type check for all filters Wei Zhao
2017-03-08 10:43 ` [PATCH v2 1/2] net/ixgbe: move ixgbe 2 mac type check macro Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2017-03-08  7:54 Wei Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.