[3/3] ethdev: move L2 tunnel config structure to ixgbe driver

Message ID 1603361181-21556-4-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: remove L2 tunnel config API |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Andrew Rybchenko Oct. 22, 2020, 10:06 a.m. UTC
  net/ixgbe driver is the only user of the struct rte_eth_l2_tunnel_conf.
Move it to the driver and use ixgbe_ prefix instead of rte_eth_.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++-----
 drivers/net/ixgbe/ixgbe_ethdev.h | 16 ++++++++++--
 drivers/net/ixgbe/ixgbe_flow.c   | 42 ++++++++++++++++----------------
 lib/librte_ethdev/rte_eth_ctrl.h | 11 ---------
 4 files changed, 41 insertions(+), 40 deletions(-)
  

Comments

Wang, Haiyue Oct. 23, 2020, 2:12 a.m. UTC | #1
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Thursday, October 22, 2020 18:06
> To: Guo, Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org
> Subject: [PATCH 3/3] ethdev: move L2 tunnel config structure to ixgbe driver
> 
> net/ixgbe driver is the only user of the struct rte_eth_l2_tunnel_conf.
> Move it to the driver and use ixgbe_ prefix instead of rte_eth_.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++-----
>  drivers/net/ixgbe/ixgbe_ethdev.h | 16 ++++++++++--
>  drivers/net/ixgbe/ixgbe_flow.c   | 42 ++++++++++++++++----------------
>  lib/librte_ethdev/rte_eth_ctrl.h | 11 ---------
>  4 files changed, 41 insertions(+), 40 deletions(-)

Acked-by: Haiyue Wang <haiyue.wang@intel.com>


> --
> 2.17.1
  
Guo, Jia Oct. 23, 2020, 3:10 a.m. UTC | #2
> -----Original Message-----
> From: Wang, Haiyue <haiyue.wang@intel.com>
> Sent: Friday, October 23, 2020 10:13 AM
> To: Andrew Rybchenko <arybchenko@solarflare.com>; Guo, Jia
> <jia.guo@intel.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit,
> Ferruh <ferruh.yigit@intel.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH 3/3] ethdev: move L2 tunnel config structure to ixgbe
> driver
> 
> > -----Original Message-----
> > From: Andrew Rybchenko <arybchenko@solarflare.com>
> > Sent: Thursday, October 22, 2020 18:06
> > To: Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
> > <haiyue.wang@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Yigit,
> > Ferruh <ferruh.yigit@intel.com>; Andrew Rybchenko
> > <andrew.rybchenko@oktetlabs.ru>
> > Cc: dev@dpdk.org
> > Subject: [PATCH 3/3] ethdev: move L2 tunnel config structure to ixgbe
> > driver
> >
> > net/ixgbe driver is the only user of the struct rte_eth_l2_tunnel_conf.
> > Move it to the driver and use ixgbe_ prefix instead of rte_eth_.
> >
> > Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++-----
> > drivers/net/ixgbe/ixgbe_ethdev.h | 16 ++++++++++--
> >  drivers/net/ixgbe/ixgbe_flow.c   | 42 ++++++++++++++++----------------
> >  lib/librte_ethdev/rte_eth_ctrl.h | 11 ---------
> >  4 files changed, 41 insertions(+), 40 deletions(-)
> 
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>

Please check if the apply issue is exist.
After that, please add my ack. Thanks Andrew.

> 
> 
> > --
> > 2.17.1
>
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 9c91b8cde8..23baa5e9c5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -7550,7 +7550,7 @@  ixgbe_e_tag_enable(struct ixgbe_hw *hw)
 
 static int
 ixgbe_e_tag_filter_del(struct rte_eth_dev *dev,
-		       struct rte_eth_l2_tunnel_conf *l2_tunnel)
+		       struct ixgbe_l2_tunnel_conf *l2_tunnel)
 {
 	int ret = 0;
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -7586,7 +7586,7 @@  ixgbe_e_tag_filter_del(struct rte_eth_dev *dev,
 
 static int
 ixgbe_e_tag_filter_add(struct rte_eth_dev *dev,
-		       struct rte_eth_l2_tunnel_conf *l2_tunnel)
+		       struct ixgbe_l2_tunnel_conf *l2_tunnel)
 {
 	int ret = 0;
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -7690,7 +7690,7 @@  ixgbe_remove_l2_tn_filter(struct ixgbe_l2_tn_info *l2_tn_info,
 /* Add l2 tunnel filter */
 int
 ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev,
-			       struct rte_eth_l2_tunnel_conf *l2_tunnel,
+			       struct ixgbe_l2_tunnel_conf *l2_tunnel,
 			       bool restore)
 {
 	int ret;
@@ -7747,7 +7747,7 @@  ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev,
 /* Delete l2 tunnel filter */
 int
 ixgbe_dev_l2_tunnel_filter_del(struct rte_eth_dev *dev,
-			       struct rte_eth_l2_tunnel_conf *l2_tunnel)
+			       struct ixgbe_l2_tunnel_conf *l2_tunnel)
 {
 	int ret;
 	struct ixgbe_l2_tn_info *l2_tn_info =
@@ -8169,7 +8169,7 @@  ixgbe_l2_tn_filter_restore(struct rte_eth_dev *dev)
 	struct ixgbe_l2_tn_info *l2_tn_info =
 		IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
 	struct ixgbe_l2_tn_filter *node;
-	struct rte_eth_l2_tunnel_conf l2_tn_conf;
+	struct ixgbe_l2_tunnel_conf l2_tn_conf;
 
 	TAILQ_FOREACH(node, &l2_tn_info->l2_tn_list, entries) {
 		l2_tn_conf.l2_tunnel_type = node->key.l2_tn_type;
@@ -8276,7 +8276,7 @@  ixgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev)
 	struct ixgbe_l2_tn_info *l2_tn_info =
 		IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);
 	struct ixgbe_l2_tn_filter *l2_tn_filter;
-	struct rte_eth_l2_tunnel_conf l2_tn_conf;
+	struct ixgbe_l2_tunnel_conf l2_tn_conf;
 	int ret = 0;
 
 	while ((l2_tn_filter = TAILQ_FIRST(&l2_tn_info->l2_tn_list))) {
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index a4f7d184b5..ff0ab78f5d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -678,13 +678,25 @@  int ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
 int ixgbe_syn_filter_set(struct rte_eth_dev *dev,
 			struct rte_eth_syn_filter *filter,
 			bool add);
+
+/**
+ * l2 tunnel configuration.
+ */
+struct ixgbe_l2_tunnel_conf {
+	enum rte_eth_tunnel_type l2_tunnel_type;
+	uint16_t ether_type; /* ether type in l2 header */
+	uint32_t tunnel_id; /* port tag id for e-tag */
+	uint16_t vf_id; /* VF id for tag insertion */
+	uint32_t pool; /* destination pool for tag based forwarding */
+};
+
 int
 ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev,
-			       struct rte_eth_l2_tunnel_conf *l2_tunnel,
+			       struct ixgbe_l2_tunnel_conf *l2_tunnel,
 			       bool restore);
 int
 ixgbe_dev_l2_tunnel_filter_del(struct rte_eth_dev *dev,
-			       struct rte_eth_l2_tunnel_conf *l2_tunnel);
+			       struct ixgbe_l2_tunnel_conf *l2_tunnel);
 void ixgbe_filterlist_init(void);
 void ixgbe_filterlist_flush(void);
 /*
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 6b3dea46ee..dff04c462c 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -72,7 +72,7 @@  struct ixgbe_fdir_rule_ele {
 /* l2_tunnel filter list structure */
 struct ixgbe_eth_l2_tunnel_conf_ele {
 	TAILQ_ENTRY(ixgbe_eth_l2_tunnel_conf_ele) entries;
-	struct rte_eth_l2_tunnel_conf filter_info;
+	struct ixgbe_l2_tunnel_conf filter_info;
 };
 /* rss filter list structure */
 struct ixgbe_rss_conf_ele {
@@ -1197,7 +1197,7 @@  cons_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[],
-			struct rte_eth_l2_tunnel_conf *filter,
+			struct ixgbe_l2_tunnel_conf *filter,
 			struct rte_flow_error *error)
 {
 	const struct rte_flow_item *item;
@@ -1231,7 +1231,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	/* The first not void item should be e-tag. */
 	item = next_no_void_pattern(pattern, NULL);
 	if (item->type != RTE_FLOW_ITEM_TYPE_E_TAG) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ITEM,
 			item, "Not supported by L2 tunnel filter");
@@ -1239,7 +1239,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	}
 
 	if (!item->spec || !item->mask) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
 			item, "Not supported by L2 tunnel filter");
 		return -rte_errno;
@@ -1261,7 +1261,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	    e_tag_mask->in_ecid_e ||
 	    e_tag_mask->ecid_e ||
 	    e_tag_mask->rsvd_grp_ecid_b != rte_cpu_to_be_16(0x3FFF)) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ITEM,
 			item, "Not supported by L2 tunnel filter");
@@ -1278,7 +1278,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	/* check if the next not void item is END */
 	item = next_no_void_pattern(pattern, item);
 	if (item->type != RTE_FLOW_ITEM_TYPE_END) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ITEM,
 			item, "Not supported by L2 tunnel filter");
@@ -1288,7 +1288,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	/* parse attr */
 	/* must be input direction */
 	if (!attr->ingress) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
 			attr, "Only support ingress.");
@@ -1297,7 +1297,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 
 	/* not supported */
 	if (attr->egress) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
 			attr, "Not support egress.");
@@ -1306,7 +1306,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 
 	/* not supported */
 	if (attr->transfer) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,
 			attr, "No support for transfer.");
@@ -1315,7 +1315,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 
 	/* not supported */
 	if (attr->priority) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
 			attr, "Not support priority.");
@@ -1326,7 +1326,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	act = next_no_void_action(actions, NULL);
 	if (act->type != RTE_FLOW_ACTION_TYPE_VF &&
 			act->type != RTE_FLOW_ACTION_TYPE_PF) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ACTION,
 			act, "Not supported action.");
@@ -1343,7 +1343,7 @@  cons_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	/* check if the next not void item is END */
 	act = next_no_void_action(actions, act);
 	if (act->type != RTE_FLOW_ACTION_TYPE_END) {
-		memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ACTION,
 			act, "Not supported action.");
@@ -1358,7 +1358,7 @@  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[],
-			struct rte_eth_l2_tunnel_conf *l2_tn_filter,
+			struct ixgbe_l2_tunnel_conf *l2_tn_filter,
 			struct rte_flow_error *error)
 {
 	int ret = 0;
@@ -1372,7 +1372,7 @@  ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev,
 	if (hw->mac.type != ixgbe_mac_X550 &&
 		hw->mac.type != ixgbe_mac_X550EM_x &&
 		hw->mac.type != ixgbe_mac_X550EM_a) {
-		memset(l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+		memset(l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 		rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ITEM,
 			NULL, "Not supported by L2 tunnel filter");
@@ -3023,7 +3023,7 @@  ixgbe_flow_create(struct rte_eth_dev *dev,
 	struct rte_eth_ethertype_filter ethertype_filter;
 	struct rte_eth_syn_filter syn_filter;
 	struct ixgbe_fdir_rule fdir_rule;
-	struct rte_eth_l2_tunnel_conf l2_tn_filter;
+	struct ixgbe_l2_tunnel_conf l2_tn_filter;
 	struct ixgbe_hw_fdir_info *fdir_info =
 		IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
 	struct ixgbe_rte_flow_rss_conf rss_conf;
@@ -3211,7 +3211,7 @@  ixgbe_flow_create(struct rte_eth_dev *dev,
 		goto out;
 	}
 
-	memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+	memset(&l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 	ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern,
 					actions, &l2_tn_filter, error);
 	if (!ret) {
@@ -3225,7 +3225,7 @@  ixgbe_flow_create(struct rte_eth_dev *dev,
 			}
 			rte_memcpy(&l2_tn_filter_ptr->filter_info,
 				&l2_tn_filter,
-				sizeof(struct rte_eth_l2_tunnel_conf));
+				sizeof(struct ixgbe_l2_tunnel_conf));
 			TAILQ_INSERT_TAIL(&filter_l2_tunnel_list,
 				l2_tn_filter_ptr, entries);
 			flow->rule = l2_tn_filter_ptr;
@@ -3282,7 +3282,7 @@  ixgbe_flow_validate(struct rte_eth_dev *dev,
 	struct rte_eth_ntuple_filter ntuple_filter;
 	struct rte_eth_ethertype_filter ethertype_filter;
 	struct rte_eth_syn_filter syn_filter;
-	struct rte_eth_l2_tunnel_conf l2_tn_filter;
+	struct ixgbe_l2_tunnel_conf l2_tn_filter;
 	struct ixgbe_fdir_rule fdir_rule;
 	struct ixgbe_rte_flow_rss_conf rss_conf;
 	int ret;
@@ -3311,7 +3311,7 @@  ixgbe_flow_validate(struct rte_eth_dev *dev,
 	if (!ret)
 		return 0;
 
-	memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+	memset(&l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
 	ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern,
 				actions, &l2_tn_filter, error);
 	if (!ret)
@@ -3337,7 +3337,7 @@  ixgbe_flow_destroy(struct rte_eth_dev *dev,
 	struct rte_eth_ethertype_filter ethertype_filter;
 	struct rte_eth_syn_filter syn_filter;
 	struct ixgbe_fdir_rule fdir_rule;
-	struct rte_eth_l2_tunnel_conf l2_tn_filter;
+	struct ixgbe_l2_tunnel_conf l2_tn_filter;
 	struct ixgbe_ntuple_filter_ele *ntuple_filter_ptr;
 	struct ixgbe_ethertype_filter_ele *ethertype_filter_ptr;
 	struct ixgbe_eth_syn_filter_ele *syn_filter_ptr;
@@ -3407,7 +3407,7 @@  ixgbe_flow_destroy(struct rte_eth_dev *dev,
 		l2_tn_filter_ptr = (struct ixgbe_eth_l2_tunnel_conf_ele *)
 				pmd_flow->rule;
 		rte_memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info,
-			sizeof(struct rte_eth_l2_tunnel_conf));
+			sizeof(struct ixgbe_l2_tunnel_conf));
 		ret = ixgbe_dev_l2_tunnel_filter_del(dev, &l2_tn_filter);
 		if (!ret) {
 			TAILQ_REMOVE(&filter_l2_tunnel_list,
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 012e8059ad..1cca522fa3 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -486,17 +486,6 @@  struct rte_eth_fdir_stats {
 	uint32_t best_cnt;     /**< Number of filters in best effort spaces. */
 };
 
-/**
- * l2 tunnel configuration.
- */
-struct rte_eth_l2_tunnel_conf {
-	enum rte_eth_tunnel_type l2_tunnel_type;
-	uint16_t ether_type; /* ether type in l2 header */
-	uint32_t tunnel_id; /* port tag id for e-tag */
-	uint16_t vf_id; /* VF id for tag insertion */
-	uint32_t pool; /* destination pool for tag based forwarding */
-};
-
 #ifdef __cplusplus
 }
 #endif