[04/14] ethdev: remove legacy flexible filter type support
diff mbox series

Message ID 1603030152-13451-5-git-send-email-arybchenko@solarflare.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • ethdev: remove legacy filter API
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Oct. 18, 2020, 2:09 p.m. UTC
RTE flow API should be used for filtering.

Temporarily preserve helper defines in public interface.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pmd/cmdline.c               | 195 ---------------------------
 doc/guides/rel_notes/deprecation.rst |   2 +-
 drivers/net/e1000/igb_ethdev.c       | 104 --------------
 drivers/net/qede/qede_filter.c       |   1 -
 drivers/net/sfc/sfc_ethdev.c         |   3 -
 5 files changed, 1 insertion(+), 304 deletions(-)

Comments

Wang, Haiyue Oct. 19, 2020, 6:29 a.m. UTC | #1
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Sunday, October 18, 2020 22:09
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>; Guo,
> Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Rasesh Mody <rmody@marvell.com>; Shahed
> Shaikh <shshaikh@marvell.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org
> Subject: [PATCH 04/14] ethdev: remove legacy flexible filter type support
> 
> RTE flow API should be used for filtering.
> 
> Temporarily preserve helper defines in public interface.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  app/test-pmd/cmdline.c               | 195 ---------------------------
>  doc/guides/rel_notes/deprecation.rst |   2 +-
>  drivers/net/e1000/igb_ethdev.c       | 104 --------------

For igb PMD,

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

>  drivers/net/qede/qede_filter.c       |   1 -
>  drivers/net/sfc/sfc_ethdev.c         |   3 -
>  5 files changed, 1 insertion(+), 304 deletions(-)


> 2.17.1

Patch
diff mbox series

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f0fe97fb9c..e7e85cf304 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -993,11 +993,6 @@  static void cmd_help_long_parsed(void *parsed_result,
 			"syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)"
 			"    Add/Del syn filter.\n\n"
 
-			"flex_filter (port_id) (add|del) len (len_value)"
-			" bytes (bytes_value) mask (mask_value)"
-			" priority (prio_value) queue (queue_id)\n"
-			"    Add/Del a flex filter.\n\n"
-
 			"flow_director_filter (port_id) mode IP (add|del|update)"
 			" flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
 			" src (src_ip_address) dst (dst_ip_address)"
@@ -10873,195 +10868,6 @@  cmdline_parse_inst_t cmd_5tuple_filter = {
 	},
 };
 
-/* *** ADD/REMOVE A flex FILTER *** */
-struct cmd_flex_filter_result {
-	cmdline_fixed_string_t filter;
-	cmdline_fixed_string_t ops;
-	portid_t port_id;
-	cmdline_fixed_string_t len;
-	uint8_t len_value;
-	cmdline_fixed_string_t bytes;
-	cmdline_fixed_string_t bytes_value;
-	cmdline_fixed_string_t mask;
-	cmdline_fixed_string_t mask_value;
-	cmdline_fixed_string_t priority;
-	uint8_t priority_value;
-	cmdline_fixed_string_t queue;
-	uint16_t queue_id;
-};
-
-static int xdigit2val(unsigned char c)
-{
-	int val;
-	if (isdigit(c))
-		val = c - '0';
-	else if (isupper(c))
-		val = c - 'A' + 10;
-	else
-		val = c - 'a' + 10;
-	return val;
-}
-
-static void
-cmd_flex_filter_parsed(void *parsed_result,
-			  __rte_unused struct cmdline *cl,
-			  __rte_unused void *data)
-{
-	int ret = 0;
-	struct rte_eth_flex_filter filter;
-	struct cmd_flex_filter_result *res = parsed_result;
-	char *bytes_ptr, *mask_ptr;
-	uint16_t len, i, j = 0;
-	char c;
-	int val;
-	uint8_t byte = 0;
-
-	if (res->len_value > RTE_FLEX_FILTER_MAXLEN) {
-		printf("the len exceed the max length 128\n");
-		return;
-	}
-	memset(&filter, 0, sizeof(struct rte_eth_flex_filter));
-	filter.len = res->len_value;
-	filter.priority = res->priority_value;
-	filter.queue = res->queue_id;
-	bytes_ptr = res->bytes_value;
-	mask_ptr = res->mask_value;
-
-	 /* translate bytes string to array. */
-	if (bytes_ptr[0] == '0' && ((bytes_ptr[1] == 'x') ||
-		(bytes_ptr[1] == 'X')))
-		bytes_ptr += 2;
-	len = strnlen(bytes_ptr, res->len_value * 2);
-	if (len == 0 || (len % 8 != 0)) {
-		printf("please check len and bytes input\n");
-		return;
-	}
-	for (i = 0; i < len; i++) {
-		c = bytes_ptr[i];
-		if (isxdigit(c) == 0) {
-			/* invalid characters. */
-			printf("invalid input\n");
-			return;
-		}
-		val = xdigit2val(c);
-		if (i % 2) {
-			byte |= val;
-			filter.bytes[j] = byte;
-			printf("bytes[%d]:%02x ", j, filter.bytes[j]);
-			j++;
-			byte = 0;
-		} else
-			byte |= val << 4;
-	}
-	printf("\n");
-	 /* translate mask string to uint8_t array. */
-	if (mask_ptr[0] == '0' && ((mask_ptr[1] == 'x') ||
-		(mask_ptr[1] == 'X')))
-		mask_ptr += 2;
-	len = strnlen(mask_ptr, (res->len_value + 3) / 4);
-	if (len == 0) {
-		printf("invalid input\n");
-		return;
-	}
-	j = 0;
-	byte = 0;
-	for (i = 0; i < len; i++) {
-		c = mask_ptr[i];
-		if (isxdigit(c) == 0) {
-			/* invalid characters. */
-			printf("invalid input\n");
-			return;
-		}
-		val = xdigit2val(c);
-		if (i % 2) {
-			byte |= val;
-			filter.mask[j] = byte;
-			printf("mask[%d]:%02x ", j, filter.mask[j]);
-			j++;
-			byte = 0;
-		} else
-			byte |= val << 4;
-	}
-	printf("\n");
-
-	if (!strcmp(res->ops, "add"))
-		ret = rte_eth_dev_filter_ctrl(res->port_id,
-				RTE_ETH_FILTER_FLEXIBLE,
-				RTE_ETH_FILTER_ADD,
-				&filter);
-	else
-		ret = rte_eth_dev_filter_ctrl(res->port_id,
-				RTE_ETH_FILTER_FLEXIBLE,
-				RTE_ETH_FILTER_DELETE,
-				&filter);
-
-	if (ret < 0)
-		printf("flex filter setting error: (%s)\n", strerror(-ret));
-}
-
-cmdline_parse_token_string_t cmd_flex_filter_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				filter, "flex_filter");
-cmdline_parse_token_num_t cmd_flex_filter_port_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result,
-				port_id, UINT16);
-cmdline_parse_token_string_t cmd_flex_filter_ops =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				ops, "add#del");
-cmdline_parse_token_string_t cmd_flex_filter_len =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				len, "len");
-cmdline_parse_token_num_t cmd_flex_filter_len_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result,
-				len_value, UINT8);
-cmdline_parse_token_string_t cmd_flex_filter_bytes =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				bytes, "bytes");
-cmdline_parse_token_string_t cmd_flex_filter_bytes_value =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				bytes_value, NULL);
-cmdline_parse_token_string_t cmd_flex_filter_mask =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				mask, "mask");
-cmdline_parse_token_string_t cmd_flex_filter_mask_value =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				mask_value, NULL);
-cmdline_parse_token_string_t cmd_flex_filter_priority =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				priority, "priority");
-cmdline_parse_token_num_t cmd_flex_filter_priority_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result,
-				priority_value, UINT8);
-cmdline_parse_token_string_t cmd_flex_filter_queue =
-	TOKEN_STRING_INITIALIZER(struct cmd_flex_filter_result,
-				queue, "queue");
-cmdline_parse_token_num_t cmd_flex_filter_queue_id =
-	TOKEN_NUM_INITIALIZER(struct cmd_flex_filter_result,
-				queue_id, UINT16);
-cmdline_parse_inst_t cmd_flex_filter = {
-	.f = cmd_flex_filter_parsed,
-	.data = NULL,
-	.help_str = "flex_filter <port_id> add|del len <value> bytes "
-		"<value> mask <value> priority <value> queue <queue_id>: "
-		"Add/Del a flex filter",
-	.tokens = {
-		(void *)&cmd_flex_filter_filter,
-		(void *)&cmd_flex_filter_port_id,
-		(void *)&cmd_flex_filter_ops,
-		(void *)&cmd_flex_filter_len,
-		(void *)&cmd_flex_filter_len_value,
-		(void *)&cmd_flex_filter_bytes,
-		(void *)&cmd_flex_filter_bytes_value,
-		(void *)&cmd_flex_filter_mask,
-		(void *)&cmd_flex_filter_mask_value,
-		(void *)&cmd_flex_filter_priority,
-		(void *)&cmd_flex_filter_priority_value,
-		(void *)&cmd_flex_filter_queue,
-		(void *)&cmd_flex_filter_queue_id,
-		NULL,
-	},
-};
-
 /* *** Filters Control *** */
 
 /* *** deal with flow director filter *** */
@@ -19833,7 +19639,6 @@  cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_syn_filter,
 	(cmdline_parse_inst_t *)&cmd_2tuple_filter,
 	(cmdline_parse_inst_t *)&cmd_5tuple_filter,
-	(cmdline_parse_inst_t *)&cmd_flex_filter,
 	(cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index f655fc06ac..4ed78809c0 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -108,7 +108,7 @@  Deprecation Notices
 
 * ethdev: the legacy filter API, including
   ``rte_eth_dev_filter_supported()``, ``rte_eth_dev_filter_ctrl()`` as well
-  as filter types FLEXIBLE, SYN, NTUPLE, TUNNEL, FDIR,
+  as filter types SYN, NTUPLE, TUNNEL, FDIR,
   HASH and L2_TUNNEL, is superseded by the generic flow API (rte_flow) in
   PMDs that implement the latter.
   The legacy API will be removed in DPDK 20.11.
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 8b18f1cb28..7f99b76e48 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -195,11 +195,6 @@  static int igb_add_2tuple_filter(struct rte_eth_dev *dev,
 			struct rte_eth_ntuple_filter *ntuple_filter);
 static int igb_remove_2tuple_filter(struct rte_eth_dev *dev,
 			struct rte_eth_ntuple_filter *ntuple_filter);
-static int eth_igb_get_flex_filter(struct rte_eth_dev *dev,
-			struct rte_eth_flex_filter *filter);
-static int eth_igb_flex_filter_handle(struct rte_eth_dev *dev,
-			enum rte_filter_op filter_op,
-			void *arg);
 static int igb_add_5tuple_filter_82576(struct rte_eth_dev *dev,
 			struct rte_eth_ntuple_filter *ntuple_filter);
 static int igb_remove_5tuple_filter_82576(struct rte_eth_dev *dev,
@@ -4127,102 +4122,6 @@  eth_igb_add_del_flex_filter(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
-eth_igb_get_flex_filter(struct rte_eth_dev *dev,
-			struct rte_eth_flex_filter *filter)
-{
-	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct e1000_filter_info *filter_info =
-		E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
-	struct e1000_flex_filter flex_filter, *it;
-	uint32_t wufc, queueing, wufc_en = 0;
-
-	memset(&flex_filter, 0, sizeof(struct e1000_flex_filter));
-	flex_filter.filter_info.len = filter->len;
-	flex_filter.filter_info.priority = filter->priority;
-	memcpy(flex_filter.filter_info.dwords, filter->bytes, filter->len);
-	memcpy(flex_filter.filter_info.mask, filter->mask,
-			RTE_ALIGN(filter->len, CHAR_BIT) / CHAR_BIT);
-
-	it = eth_igb_flex_filter_lookup(&filter_info->flex_list,
-				&flex_filter.filter_info);
-	if (it == NULL) {
-		PMD_DRV_LOG(ERR, "filter doesn't exist.");
-		return -ENOENT;
-	}
-
-	wufc = E1000_READ_REG(hw, E1000_WUFC);
-	wufc_en = E1000_WUFC_FLEX_HQ | (E1000_WUFC_FLX0 << it->index);
-
-	if ((wufc & wufc_en) == wufc_en) {
-		uint32_t reg_off = 0;
-		if (it->index < E1000_MAX_FHFT)
-			reg_off = E1000_FHFT(it->index);
-		else
-			reg_off = E1000_FHFT_EXT(it->index - E1000_MAX_FHFT);
-
-		queueing = E1000_READ_REG(hw,
-				reg_off + E1000_FHFT_QUEUEING_OFFSET);
-		filter->len = queueing & E1000_FHFT_QUEUEING_LEN;
-		filter->priority = (queueing & E1000_FHFT_QUEUEING_PRIO) >>
-			E1000_FHFT_QUEUEING_PRIO_SHIFT;
-		filter->queue = (queueing & E1000_FHFT_QUEUEING_QUEUE) >>
-			E1000_FHFT_QUEUEING_QUEUE_SHIFT;
-		return 0;
-	}
-	return -ENOENT;
-}
-
-static int
-eth_igb_flex_filter_handle(struct rte_eth_dev *dev,
-			enum rte_filter_op filter_op,
-			void *arg)
-{
-	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_eth_flex_filter *filter;
-	int ret = 0;
-
-	MAC_TYPE_FILTER_SUP_EXT(hw->mac.type);
-
-	if (filter_op == RTE_ETH_FILTER_NOP)
-		return ret;
-
-	if (arg == NULL) {
-		PMD_DRV_LOG(ERR, "arg shouldn't be NULL for operation %u",
-			    filter_op);
-		return -EINVAL;
-	}
-
-	filter = (struct rte_eth_flex_filter *)arg;
-	if (filter->len == 0 || filter->len > E1000_MAX_FLEX_FILTER_LEN
-	    || filter->len % sizeof(uint64_t) != 0) {
-		PMD_DRV_LOG(ERR, "filter's length is out of range");
-		return -EINVAL;
-	}
-	if (filter->priority > E1000_MAX_FLEX_FILTER_PRI) {
-		PMD_DRV_LOG(ERR, "filter's priority is out of range");
-		return -EINVAL;
-	}
-
-	switch (filter_op) {
-	case RTE_ETH_FILTER_ADD:
-		ret = eth_igb_add_del_flex_filter(dev, filter, TRUE);
-		break;
-	case RTE_ETH_FILTER_DELETE:
-		ret = eth_igb_add_del_flex_filter(dev, filter, FALSE);
-		break;
-	case RTE_ETH_FILTER_GET:
-		ret = eth_igb_get_flex_filter(dev, filter);
-		break;
-	default:
-		PMD_DRV_LOG(ERR, "unsupported operation %u", filter_op);
-		ret = -EINVAL;
-		break;
-	}
-
-	return ret;
-}
-
 /* translate elements in struct rte_eth_ntuple_filter to struct e1000_5tuple_filter_info*/
 static inline int
 ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
@@ -4852,9 +4751,6 @@  eth_igb_filter_ctrl(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_SYN:
 		ret = eth_igb_syn_filter_handle(dev, filter_op, arg);
 		break;
-	case RTE_ETH_FILTER_FLEXIBLE:
-		ret = eth_igb_flex_filter_handle(dev, filter_op, arg);
-		break;
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
 			return -EINVAL;
diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c
index 4d31db09fd..28dc9d2234 100644
--- a/drivers/net/qede/qede_filter.c
+++ b/drivers/net/qede/qede_filter.c
@@ -1561,7 +1561,6 @@  int qede_dev_filter_ctrl(struct rte_eth_dev *eth_dev,
 
 		*(const void **)arg = &qede_flow_ops;
 		return 0;
-	case RTE_ETH_FILTER_FLEXIBLE:
 	case RTE_ETH_FILTER_SYN:
 	case RTE_ETH_FILTER_HASH:
 	case RTE_ETH_FILTER_L2_TUNNEL:
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 75f3a2f3d3..d976a57f2a 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1748,9 +1748,6 @@  sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
 	case RTE_ETH_FILTER_NONE:
 		sfc_err(sa, "Global filters configuration not supported");
 		break;
-	case RTE_ETH_FILTER_FLEXIBLE:
-		sfc_err(sa, "Flexible filters not supported");
-		break;
 	case RTE_ETH_FILTER_SYN:
 		sfc_err(sa, "SYN filters not supported");
 		break;