All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH 4/5] testpmd: new commands for ntuple filter
Date: Thu, 15 Jan 2015 09:46:00 +0800	[thread overview]
Message-ID: <1421286361-11504-5-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1421286361-11504-1-git-send-email-jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Following commands of 5tuple and 2tuple filter are removed:
 - add_2tuple_filter (port_id) protocol (pro_value) (pro_mask)
   dst_port (port_value) (port_mask) flags (flg_value) priority (prio
   queue (queue_id) index (idx)
 - remove_2tuple_filter (port_id) index (idx)
 - get_2tuple_filter (port_id) index (idx)
 - add_5tuple_filter (port_id) dst_ip (dst_address) src_ip (src_addres
   dst_port (dst_port_value) src_port (src_port_value) protocol (prot
   mask (mask_value) flags (flags_value) priority (prio_value)"
   queue (queue_id) index (idx)
 - remove_5tuple_filter (port_id) index (idx)
 - get_5tuple_filter (port_id) index (idx)

New commands are added for 5tuple and 2tuple filter by using filter_ctrl API
and new ntuple filter structure:
 - 2tuple_filter (port_id) (add|del)
   dst_port (dst_port_value) protocol (protocol_value)
   mask (mask_value) tcp_flags (tcp_flags_value)
   priority (prio_value) queue (queue_id)
 - 5tuple_filter (port_id) (add|del)
   dst_ip (dst_address) src_ip (src_address)
   dst_port (dst_port_value) src_port (src_port_value)
   protocol (protocol_value)
   mask (mask_value) tcp_flags (tcp_flags_value)
   priority (prio_value) queue (queue_id)

Signed-off-by: Jingjing Wu <jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 app/test-pmd/cmdline.c | 406 ++++++++++++++++++++++---------------------------
 app/test-pmd/config.c  |  65 --------
 2 files changed, 186 insertions(+), 285 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 882a5a2..1d74870 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -664,28 +664,19 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"get_ethertype_filter (port_id) index (idx)\n"
 			"    get info of a ethertype filter.\n\n"
 
-			"add_2tuple_filter (port_id) protocol (pro_value) (pro_mask)"
-			" dst_port (port_value) (port_mask) flags (flg_value) priority (prio_value)"
-			" queue (queue_id) index (idx)\n"
-			"    add a 2tuple filter.\n\n"
-
-			"remove_2tuple_filter (port_id) index (idx)\n"
-			"    remove a 2tuple filter.\n\n"
-
-			"get_2tuple_filter (port_id) index (idx)\n"
-			"    get info of a 2tuple filter.\n\n"
-
-			"add_5tuple_filter (port_id) dst_ip (dst_address) src_ip (src_address)"
-			" dst_port (dst_port_value) src_port (src_port_value) protocol (protocol_value)"
-			" mask (mask_value) flags (flags_value) priority (prio_value)"
-			" queue (queue_id) index (idx)\n"
-			"    add a 5tuple filter.\n\n"
-
-			"remove_5tuple_filter (port_id) index (idx)\n"
-			"    remove a 5tuple filter.\n\n"
-
-			"get_5tuple_filter (port_id) index (idx)\n"
-			"    get info of a 5tuple filter.\n\n"
+			"2tuple_filter (port_id) (add|del)"
+			" dst_port (dst_port_value) protocol (protocol_value)"
+			" mask (mask_value) tcp_flags (tcp_flags_value)"
+			" priority (prio_value) queue (queue_id)\n"
+			"    Add/Del a 2tuple filter.\n\n"
+
+			"5tuple_filter (port_id) (add|del)"
+			" dst_ip (dst_address) src_ip (src_address)"
+			" dst_port (dst_port_value) src_port (src_port_value)"
+			" protocol (protocol_value)"
+			" mask (mask_value) tcp_flags (tcp_flags_value)"
+			" priority (prio_value) queue (queue_id)\n"
+			"    Add/Del a 5tuple filter.\n\n"
 
 			"add_syn_filter (port_id) priority (high|low) queue (queue_id)"
 			"    add syn filter.\n\n"
@@ -7491,21 +7482,20 @@ cmdline_parse_inst_t cmd_get_syn_filter = {
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
 	cmdline_fixed_string_t filter;
-	uint8_t port_id;
-	cmdline_fixed_string_t protocol;
-	uint8_t protocol_value;
-	uint8_t protocol_mask;
+	uint8_t  port_id;
+	cmdline_fixed_string_t ops;
 	cmdline_fixed_string_t dst_port;
 	uint16_t dst_port_value;
-	uint16_t dst_port_mask;
-	cmdline_fixed_string_t flags;
-	uint8_t flags_value;
+	cmdline_fixed_string_t protocol;
+	uint8_t protocol_value;
+	cmdline_fixed_string_t mask;
+	uint8_t  mask_value;
+	cmdline_fixed_string_t tcp_flags;
+	uint8_t tcp_flags_value;
 	cmdline_fixed_string_t priority;
-	uint8_t priority_value;
+	uint8_t  priority_value;
 	cmdline_fixed_string_t queue;
-	uint16_t queue_id;
-	cmdline_fixed_string_t index;
-	uint16_t index_value;
+	uint16_t  queue_id;
 };
 
 static void
@@ -7513,59 +7503,92 @@ cmd_2tuple_filter_parsed(void *parsed_result,
 			__attribute__((unused)) struct cmdline *cl,
 			__attribute__((unused)) void *data)
 {
-	int ret = 0;
-	struct rte_2tuple_filter filter;
+	struct rte_eth_ntuple_filter filter;
 	struct cmd_2tuple_filter_result *res = parsed_result;
+	int ret = 0;
 
-	memset(&filter, 0, sizeof(struct rte_2tuple_filter));
+	ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_NTUPLE);
+	if (ret < 0) {
+		printf("ntuple filter is not supported on port %u.\n",
+			res->port_id);
+		return;
+	}
 
-	if (!strcmp(res->filter, "add_2tuple_filter")) {
-		/* need convert to big endian. */
-		filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
-		filter.protocol = res->protocol_value;
-		filter.dst_port_mask = (res->dst_port_mask) ? 0 : 1;
-		filter.protocol_mask = (res->protocol_mask) ? 0 : 1;
-		filter.priority = res->priority_value;
-		filter.tcp_flags = res->flags_value;
-		ret = rte_eth_dev_add_2tuple_filter(res->port_id,
-			res->index_value, &filter, res->queue_id);
-	} else if (!strcmp(res->filter, "remove_2tuple_filter"))
-		ret = rte_eth_dev_remove_2tuple_filter(res->port_id,
-			res->index_value);
-	else if (!strcmp(res->filter, "get_2tuple_filter"))
-		get_2tuple_filter(res->port_id, res->index_value);
+	memset(&filter, 0, sizeof(struct rte_eth_ntuple_filter));
+
+	filter.flags = RTE_2TUPLE_FLAGS;
+	filter.dst_port_mask = (res->mask_value & 0x02) ? UINT16_MAX : 0;
+	filter.proto_mask = (res->mask_value & 0x01) ? UINT8_MAX : 0;
+	filter.proto = res->protocol_value;
+	filter.priority = res->priority_value;
+	if (res->tcp_flags_value != 0 && filter.proto != IPPROTO_TCP) {
+		printf("nonzero tcp_flags is only meaningful"
+			" when protocol is TCP.\n");
+		return;
+	}
+	if (res->tcp_flags_value > TCP_FLAG_ALL) {
+		printf("invalid TCP flags.\n");
+		return;
+	}
+
+	if (res->tcp_flags_value != 0) {
+		filter.flags |= RTE_NTUPLE_FLAGS_TCP_FLAG;
+		filter.tcp_flags = res->tcp_flags_value;
+	}
+
+	/* need convert to big endian. */
+	filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
+	filter.queue = res->queue_id;
 
+	if (!strcmp(res->ops, "add"))
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+				RTE_ETH_FILTER_NTUPLE,
+				RTE_ETH_FILTER_ADD,
+				&filter);
+	else
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+				RTE_ETH_FILTER_NTUPLE,
+				RTE_ETH_FILTER_DELETE,
+				&filter);
 	if (ret < 0)
-		printf("2tuple filter setting error: (%s)\n", strerror(-ret));
+		printf("2tuple filter programming error: (%s)\n",
+			strerror(-ret));
+
 }
 
+cmdline_parse_token_string_t cmd_2tuple_filter_filter =
+	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
+				 filter, "2tuple_filter");
 cmdline_parse_token_num_t cmd_2tuple_filter_port_id =
 	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
 				port_id, UINT8);
-cmdline_parse_token_string_t cmd_2tuple_filter_protocol =
+cmdline_parse_token_string_t cmd_2tuple_filter_ops =
 	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-				 protocol, "protocol");
-cmdline_parse_token_num_t cmd_2tuple_filter_protocol_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-				 protocol_value, UINT8);
-cmdline_parse_token_num_t cmd_2tuple_filter_protocol_mask =
-	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-				protocol_mask, UINT8);
+				 ops, "add#del");
 cmdline_parse_token_string_t cmd_2tuple_filter_dst_port =
 	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
 				dst_port, "dst_port");
 cmdline_parse_token_num_t cmd_2tuple_filter_dst_port_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
 				dst_port_value, UINT16);
-cmdline_parse_token_num_t cmd_2tuple_filter_dst_port_mask =
+cmdline_parse_token_string_t cmd_2tuple_filter_protocol =
+	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
+				protocol, "protocol");
+cmdline_parse_token_num_t cmd_2tuple_filter_protocol_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-				dst_port_mask, UINT16);
-cmdline_parse_token_string_t cmd_2tuple_filter_flags =
+				protocol_value, UINT8);
+cmdline_parse_token_string_t cmd_2tuple_filter_mask =
 	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-				flags, "flags");
-cmdline_parse_token_num_t cmd_2tuple_filter_flags_value =
+				mask, "mask");
+cmdline_parse_token_num_t cmd_2tuple_filter_mask_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-				flags_value, UINT8);
+				mask_value, INT8);
+cmdline_parse_token_string_t cmd_2tuple_filter_tcp_flags =
+	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
+				tcp_flags, "tcp_flags");
+cmdline_parse_token_num_t cmd_2tuple_filter_tcp_flags_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
+				tcp_flags_value, UINT8);
 cmdline_parse_token_string_t cmd_2tuple_filter_priority =
 	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
 				priority, "priority");
@@ -7578,67 +7601,27 @@ cmdline_parse_token_string_t cmd_2tuple_filter_queue =
 cmdline_parse_token_num_t cmd_2tuple_filter_queue_id =
 	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
 				queue_id, UINT16);
-cmdline_parse_token_string_t cmd_2tuple_filter_index =
-	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-				index, "index");
-cmdline_parse_token_num_t cmd_2tuple_filter_index_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_2tuple_filter_result,
-				index_value, UINT16);
-cmdline_parse_token_string_t cmd_2tuple_filter_add_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-				filter, "add_2tuple_filter");
-cmdline_parse_inst_t cmd_add_2tuple_filter = {
+
+cmdline_parse_inst_t cmd_2tuple_filter = {
 	.f = cmd_2tuple_filter_parsed,
 	.data = NULL,
 	.help_str = "add a 2tuple filter",
 	.tokens = {
-		(void *)&cmd_2tuple_filter_add_filter,
+		(void *)&cmd_2tuple_filter_filter,
 		(void *)&cmd_2tuple_filter_port_id,
-		(void *)&cmd_2tuple_filter_protocol,
-		(void *)&cmd_2tuple_filter_protocol_value,
-		(void *)&cmd_2tuple_filter_protocol_mask,
+		(void *)&cmd_2tuple_filter_ops,
 		(void *)&cmd_2tuple_filter_dst_port,
 		(void *)&cmd_2tuple_filter_dst_port_value,
-		(void *)&cmd_2tuple_filter_dst_port_mask,
-		(void *)&cmd_2tuple_filter_flags,
-		(void *)&cmd_2tuple_filter_flags_value,
+		(void *)&cmd_2tuple_filter_protocol,
+		(void *)&cmd_2tuple_filter_protocol_value,
+		(void *)&cmd_2tuple_filter_mask,
+		(void *)&cmd_2tuple_filter_mask_value,
+		(void *)&cmd_2tuple_filter_tcp_flags,
+		(void *)&cmd_2tuple_filter_tcp_flags_value,
 		(void *)&cmd_2tuple_filter_priority,
 		(void *)&cmd_2tuple_filter_priority_value,
 		(void *)&cmd_2tuple_filter_queue,
 		(void *)&cmd_2tuple_filter_queue_id,
-		(void *)&cmd_2tuple_filter_index,
-		(void *)&cmd_2tuple_filter_index_value,
-		NULL,
-	},
-};
-
-cmdline_parse_token_string_t cmd_2tuple_filter_remove_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-				filter, "remove_2tuple_filter");
-cmdline_parse_inst_t cmd_remove_2tuple_filter = {
-	.f = cmd_2tuple_filter_parsed,
-	.data = NULL,
-	.help_str = "remove a 2tuple filter",
-	.tokens = {
-		(void *)&cmd_2tuple_filter_remove_filter,
-		(void *)&cmd_2tuple_filter_port_id,
-		(void *)&cmd_2tuple_filter_index,
-		(void *)&cmd_2tuple_filter_index_value,
-		NULL,
-	},
-};
-cmdline_parse_token_string_t cmd_2tuple_filter_get_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_2tuple_filter_result,
-				filter, "get_2tuple_filter");
-cmdline_parse_inst_t cmd_get_2tuple_filter = {
-	.f = cmd_2tuple_filter_parsed,
-	.data = NULL,
-	.help_str = "get a 2tuple filter",
-	.tokens = {
-		(void *)&cmd_2tuple_filter_get_filter,
-		(void *)&cmd_2tuple_filter_port_id,
-		(void *)&cmd_2tuple_filter_index,
-		(void *)&cmd_2tuple_filter_index_value,
 		NULL,
 	},
 };
@@ -7647,6 +7630,7 @@ cmdline_parse_inst_t cmd_get_2tuple_filter = {
 struct cmd_5tuple_filter_result {
 	cmdline_fixed_string_t filter;
 	uint8_t  port_id;
+	cmdline_fixed_string_t ops;
 	cmdline_fixed_string_t dst_ip;
 	cmdline_ipaddr_t dst_ip_value;
 	cmdline_fixed_string_t src_ip;
@@ -7659,14 +7643,12 @@ struct cmd_5tuple_filter_result {
 	uint8_t protocol_value;
 	cmdline_fixed_string_t mask;
 	uint8_t  mask_value;
-	cmdline_fixed_string_t flags;
-	uint8_t flags_value;
+	cmdline_fixed_string_t tcp_flags;
+	uint8_t tcp_flags_value;
 	cmdline_fixed_string_t priority;
 	uint8_t  priority_value;
 	cmdline_fixed_string_t queue;
 	uint16_t  queue_id;
-	cmdline_fixed_string_t index;
-	uint16_t  index_value;
 };
 
 static void
@@ -7674,62 +7656,92 @@ cmd_5tuple_filter_parsed(void *parsed_result,
 			__attribute__((unused)) struct cmdline *cl,
 			__attribute__((unused)) void *data)
 {
-	int ret = 0;
-	struct rte_5tuple_filter filter;
+	struct rte_eth_ntuple_filter filter;
 	struct cmd_5tuple_filter_result *res = parsed_result;
+	int ret = 0;
 
-	memset(&filter, 0, sizeof(struct rte_5tuple_filter));
+	ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_NTUPLE);
+	if (ret < 0) {
+		printf("ntuple filter is not supported on port %u.\n",
+			res->port_id);
+		return;
+	}
 
-	if (!strcmp(res->filter, "add_5tuple_filter")) {
-		filter.dst_ip_mask = (res->mask_value & 0x10) ? 0 : 1;
-		filter.src_ip_mask = (res->mask_value & 0x08) ? 0 : 1;
-		filter.dst_port_mask = (res->mask_value & 0x04) ? 0 : 1;
-		filter.src_port_mask = (res->mask_value & 0x02) ? 0 : 1;
-		filter.protocol = res->protocol_value;
-		filter.protocol_mask = (res->mask_value & 0x01) ? 0 : 1;
-		filter.priority = res->priority_value;
-		filter.tcp_flags = res->flags_value;
+	memset(&filter, 0, sizeof(struct rte_eth_ntuple_filter));
 
-		if (res->dst_ip_value.family == AF_INET)
-			/* no need to convert, already big endian. */
-			filter.dst_ip = res->dst_ip_value.addr.ipv4.s_addr;
-		else {
-			if (filter.dst_ip_mask == 0) {
-				printf("can not support ipv6 involved compare.\n");
-				return;
-			}
-			filter.dst_ip = 0;
+	filter.flags = RTE_5TUPLE_FLAGS;
+	filter.dst_ip_mask = (res->mask_value & 0x10) ? UINT32_MAX : 0;
+	filter.src_ip_mask = (res->mask_value & 0x08) ? UINT32_MAX : 0;
+	filter.dst_port_mask = (res->mask_value & 0x04) ? UINT16_MAX : 0;
+	filter.src_port_mask = (res->mask_value & 0x02) ? UINT16_MAX : 0;
+	filter.proto_mask = (res->mask_value & 0x01) ? UINT8_MAX : 0;
+	filter.proto = res->protocol_value;
+	filter.priority = res->priority_value;
+	if (res->tcp_flags_value != 0 && filter.proto != IPPROTO_TCP) {
+		printf("nonzero tcp_flags is only meaningful"
+			" when protocol is TCP.\n");
+		return;
+	}
+	if (res->tcp_flags_value > TCP_FLAG_ALL) {
+		printf("invalid TCP flags.\n");
+		return;
+	}
+
+	if (res->tcp_flags_value != 0) {
+		filter.flags |= RTE_NTUPLE_FLAGS_TCP_FLAG;
+		filter.tcp_flags = res->tcp_flags_value;
+	}
+
+	if (res->dst_ip_value.family == AF_INET)
+		/* no need to convert, already big endian. */
+		filter.dst_ip = res->dst_ip_value.addr.ipv4.s_addr;
+	else {
+		if (filter.dst_ip_mask == 0) {
+			printf("can not support ipv6 involved compare.\n");
+			return;
 		}
+		filter.dst_ip = 0;
+	}
 
-		if (res->src_ip_value.family == AF_INET)
-			/* no need to convert, already big endian. */
-			filter.src_ip = res->src_ip_value.addr.ipv4.s_addr;
-		else {
-			if (filter.src_ip_mask == 0) {
-				printf("can not support ipv6 involved compare.\n");
-				return;
-			}
-			filter.src_ip = 0;
+	if (res->src_ip_value.family == AF_INET)
+		/* no need to convert, already big endian. */
+		filter.src_ip = res->src_ip_value.addr.ipv4.s_addr;
+	else {
+		if (filter.src_ip_mask == 0) {
+			printf("can not support ipv6 involved compare.\n");
+			return;
 		}
-		/* need convert to big endian. */
-		filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
-		filter.src_port = rte_cpu_to_be_16(res->src_port_value);
+		filter.src_ip = 0;
+	}
+	/* need convert to big endian. */
+	filter.dst_port = rte_cpu_to_be_16(res->dst_port_value);
+	filter.src_port = rte_cpu_to_be_16(res->src_port_value);
+	filter.queue = res->queue_id;
 
-		ret = rte_eth_dev_add_5tuple_filter(res->port_id,
-			res->index_value, &filter, res->queue_id);
-	} else if (!strcmp(res->filter, "remove_5tuple_filter"))
-		ret = rte_eth_dev_remove_5tuple_filter(res->port_id,
-			res->index_value);
-	else if (!strcmp(res->filter, "get_5tuple_filter"))
-		get_5tuple_filter(res->port_id, res->index_value);
+	if (!strcmp(res->ops, "add"))
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+				RTE_ETH_FILTER_NTUPLE,
+				RTE_ETH_FILTER_ADD,
+				&filter);
+	else
+		ret = rte_eth_dev_filter_ctrl(res->port_id,
+				RTE_ETH_FILTER_NTUPLE,
+				RTE_ETH_FILTER_DELETE,
+				&filter);
 	if (ret < 0)
-		printf("5tuple filter setting error: (%s)\n", strerror(-ret));
+		printf("5tuple filter programming error: (%s)\n",
+			strerror(-ret));
 }
 
-
+cmdline_parse_token_string_t cmd_5tuple_filter_filter =
+	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
+				 filter, "5tuple_filter");
 cmdline_parse_token_num_t cmd_5tuple_filter_port_id =
 	TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
 				port_id, UINT8);
+cmdline_parse_token_string_t cmd_5tuple_filter_ops =
+	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
+				 ops, "add#del");
 cmdline_parse_token_string_t cmd_5tuple_filter_dst_ip =
 	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
 				dst_ip, "dst_ip");
@@ -7766,12 +7778,12 @@ cmdline_parse_token_string_t cmd_5tuple_filter_mask =
 cmdline_parse_token_num_t cmd_5tuple_filter_mask_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
 				mask_value, INT8);
-cmdline_parse_token_string_t cmd_5tuple_filter_flags =
+cmdline_parse_token_string_t cmd_5tuple_filter_tcp_flags =
 	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-				flags, "flags");
-cmdline_parse_token_num_t cmd_5tuple_filter_flags_value =
+				tcp_flags, "tcp_flags");
+cmdline_parse_token_num_t cmd_5tuple_filter_tcp_flags_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
-				flags_value, UINT8);
+				tcp_flags_value, UINT8);
 cmdline_parse_token_string_t cmd_5tuple_filter_priority =
 	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
 				priority, "priority");
@@ -7784,23 +7796,15 @@ cmdline_parse_token_string_t cmd_5tuple_filter_queue =
 cmdline_parse_token_num_t cmd_5tuple_filter_queue_id =
 	TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
 				queue_id, UINT16);
-cmdline_parse_token_string_t cmd_5tuple_filter_index =
-	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-				index, "index");
-cmdline_parse_token_num_t cmd_5tuple_filter_index_value =
-	TOKEN_NUM_INITIALIZER(struct cmd_5tuple_filter_result,
-				index_value, UINT16);
 
-cmdline_parse_token_string_t cmd_5tuple_filter_add_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-				 filter, "add_5tuple_filter");
-cmdline_parse_inst_t cmd_add_5tuple_filter = {
+cmdline_parse_inst_t cmd_5tuple_filter = {
 	.f = cmd_5tuple_filter_parsed,
 	.data = NULL,
-	.help_str = "add a 5tuple filter",
+	.help_str = "add/del a 5tuple filter",
 	.tokens = {
-		(void *)&cmd_5tuple_filter_add_filter,
+		(void *)&cmd_5tuple_filter_filter,
 		(void *)&cmd_5tuple_filter_port_id,
+		(void *)&cmd_5tuple_filter_ops,
 		(void *)&cmd_5tuple_filter_dst_ip,
 		(void *)&cmd_5tuple_filter_dst_ip_value,
 		(void *)&cmd_5tuple_filter_src_ip,
@@ -7813,46 +7817,12 @@ cmdline_parse_inst_t cmd_add_5tuple_filter = {
 		(void *)&cmd_5tuple_filter_protocol_value,
 		(void *)&cmd_5tuple_filter_mask,
 		(void *)&cmd_5tuple_filter_mask_value,
-		(void *)&cmd_5tuple_filter_flags,
-		(void *)&cmd_5tuple_filter_flags_value,
+		(void *)&cmd_5tuple_filter_tcp_flags,
+		(void *)&cmd_5tuple_filter_tcp_flags_value,
 		(void *)&cmd_5tuple_filter_priority,
 		(void *)&cmd_5tuple_filter_priority_value,
 		(void *)&cmd_5tuple_filter_queue,
 		(void *)&cmd_5tuple_filter_queue_id,
-		(void *)&cmd_5tuple_filter_index,
-		(void *)&cmd_5tuple_filter_index_value,
-		NULL,
-	},
-};
-
-cmdline_parse_token_string_t cmd_5tuple_filter_remove_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-				filter, "remove_5tuple_filter");
-cmdline_parse_inst_t cmd_remove_5tuple_filter = {
-	.f = cmd_5tuple_filter_parsed,
-	.data = NULL,
-	.help_str = "remove a 5tuple filter",
-	.tokens = {
-		(void *)&cmd_5tuple_filter_remove_filter,
-		(void *)&cmd_5tuple_filter_port_id,
-		(void *)&cmd_5tuple_filter_index,
-		(void *)&cmd_5tuple_filter_index_value,
-		NULL,
-	},
-};
-
-cmdline_parse_token_string_t cmd_5tuple_filter_get_filter =
-	TOKEN_STRING_INITIALIZER(struct cmd_5tuple_filter_result,
-				filter, "get_5tuple_filter");
-cmdline_parse_inst_t cmd_get_5tuple_filter = {
-	.f = cmd_5tuple_filter_parsed,
-	.data = NULL,
-	.help_str = "get a 5tuple filter",
-	.tokens = {
-		(void *)&cmd_5tuple_filter_get_filter,
-		(void *)&cmd_5tuple_filter_port_id,
-		(void *)&cmd_5tuple_filter_index,
-		(void *)&cmd_5tuple_filter_index_value,
 		NULL,
 	},
 };
@@ -8821,12 +8791,8 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_add_syn_filter,
 	(cmdline_parse_inst_t *)&cmd_remove_syn_filter,
 	(cmdline_parse_inst_t *)&cmd_get_syn_filter,
-	(cmdline_parse_inst_t *)&cmd_add_2tuple_filter,
-	(cmdline_parse_inst_t *)&cmd_remove_2tuple_filter,
-	(cmdline_parse_inst_t *)&cmd_get_2tuple_filter,
-	(cmdline_parse_inst_t *)&cmd_add_5tuple_filter,
-	(cmdline_parse_inst_t *)&cmd_remove_5tuple_filter,
-	(cmdline_parse_inst_t *)&cmd_get_5tuple_filter,
+	(cmdline_parse_inst_t *)&cmd_2tuple_filter,
+	(cmdline_parse_inst_t *)&cmd_5tuple_filter,
 	(cmdline_parse_inst_t *)&cmd_add_flex_filter,
 	(cmdline_parse_inst_t *)&cmd_remove_flex_filter,
 	(cmdline_parse_inst_t *)&cmd_get_flex_filter,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 97b6525..ae1439e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2213,73 +2213,8 @@ get_syn_filter(uint8_t port_id)
 		filter.hig_pri ? "high" : "low",
 		rx_queue);
 }
-void
-get_2tuple_filter(uint8_t port_id, uint16_t index)
-{
-	struct rte_2tuple_filter filter;
-	int ret = 0;
-	uint16_t rx_queue;
-
-	memset(&filter, 0, sizeof(filter));
-	ret = rte_eth_dev_get_2tuple_filter(port_id, index,
-				&filter, &rx_queue);
-	if (ret < 0) {
-		if (ret == (-ENOENT))
-			printf("filter[%d] is not enabled\n", index);
-		else
-			printf("get 2tuple filter fails(%s)\n", strerror(-ret));
-		return;
-	} else {
-		printf("filter[%d]:\n", index);
-		printf("    Destination Port:     0x%04x    mask: %d\n",
-			rte_be_to_cpu_16(filter.dst_port),
-			filter.dst_port_mask ? 0 : 1);
-		printf("    protocol:  0x%02x     mask:%d     tcp_flags: 0x%02x\n",
-			filter.protocol, filter.protocol_mask ? 0 : 1,
-			filter.tcp_flags);
-		printf("    priority: %d    queue: %d\n",
-			filter.priority, rx_queue);
-	}
-}
 
 void
-get_5tuple_filter(uint8_t port_id, uint16_t index)
-{
-	struct rte_5tuple_filter filter;
-	int ret = 0;
-	uint16_t rx_queue;
-
-	memset(&filter, 0, sizeof(filter));
-	ret = rte_eth_dev_get_5tuple_filter(port_id, index,
-				&filter, &rx_queue);
-	if (ret < 0) {
-		if (ret == (-ENOENT))
-			printf("filter[%d] is not enabled\n", index);
-		else
-			printf("get 5tuple filter fails(%s)\n", strerror(-ret));
-		return;
-	} else {
-		printf("filter[%d]:\n", index);
-		printf("    Destination IP:  0x%08x    mask: %d\n",
-			(unsigned)rte_be_to_cpu_32(filter.dst_ip),
-			filter.dst_ip_mask ? 0 : 1);
-		printf("    Source IP:       0x%08x    mask: %d\n",
-			(unsigned)rte_be_to_cpu_32(filter.src_ip),
-			filter.src_ip_mask ? 0 : 1);
-		printf("    Destination Port:       0x%04x    mask: %d\n",
-			rte_be_to_cpu_16(filter.dst_port),
-			filter.dst_port_mask ? 0 : 1);
-		printf("    Source Port:       0x%04x    mask: %d\n",
-			rte_be_to_cpu_16(filter.src_port),
-			filter.src_port_mask ? 0 : 1);
-		printf("    protocol:           0x%02x    mask: %d\n",
-			filter.protocol,
-			filter.protocol_mask ? 0 : 1);
-		printf("    priority: %d    flags: 0x%02x    queue: %d\n",
-			filter.priority, filter.tcp_flags, rx_queue);
-	}
-}
-void
 get_flex_filter(uint8_t port_id, uint16_t index)
 
 {
-- 
1.9.3

  parent reply	other threads:[~2015-01-15  1:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15  1:45 [PATCH 0/5] new ntuple filter replaces 2tuple and 5tuple filters Jingjing Wu
     [not found] ` <1421286361-11504-1-git-send-email-jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-15  1:45   ` [PATCH 1/5] ethdev: define ntuple filter type and its structure Jingjing Wu
2015-01-15  1:45   ` [PATCH 2/5] ixgbe: ntuple filter functions replace old ones for 5tuple filter Jingjing Wu
2015-01-15  1:45   ` [PATCH 3/5] e1000: ntuple filter functions replace old ones for 2tuple and " Jingjing Wu
2015-01-15  1:46   ` Jingjing Wu [this message]
2015-01-15  1:46   ` [PATCH 5/5] ethdev: remove old APIs and structures of 5tuple and 2tuple filters Jingjing Wu
2015-01-21 12:18   ` [PATCH 0/5] new ntuple filter replaces 2tuple and 5tuple filters De Lara Guarch, Pablo
     [not found]     ` <E115CCD9D858EF4F90C690B0DCB4D8972724C815-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-22  0:28       ` Wu, Jingjing
2015-01-22  7:38   ` [PATCH v2 0/6] " Jingjing Wu
     [not found]     ` <1421912305-2022-1-git-send-email-jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-22  7:38       ` [PATCH v2 1/6] ethdev: define ntuple filter type and its structure Jingjing Wu
2015-01-22  7:38       ` [PATCH v2 2/6] ixgbe: ntuple filter functions replace old ones for 5tuple filter Jingjing Wu
     [not found]         ` <1421912305-2022-3-git-send-email-jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-02 16:28           ` Thomas Monjalon
2015-01-22  7:38       ` [PATCH v2 3/6] e1000: ntuple filter functions replace old ones for 2tuple and " Jingjing Wu
2015-01-22  7:38       ` [PATCH v2 4/6] testpmd: new commands for ntuple filter Jingjing Wu
2015-01-22  7:38       ` [PATCH v2 5/6] ethdev: remove old APIs and structures of 5tuple and 2tuple filters Jingjing Wu
2015-01-22  7:38       ` [PATCH v2 6/6] doc: commands changed in testpmd_funcs for 2tuple amd 5tuple filter Jingjing Wu
2015-01-28 14:28       ` [PATCH v2 0/6] new ntuple filter replaces 2tuple and 5tuple filters De Lara Guarch, Pablo
     [not found]         ` <E115CCD9D858EF4F90C690B0DCB4D8972724F843-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-30  8:22           ` Wu, Jingjing
2015-02-10  4:48       ` [PATCH v3 " Jingjing Wu
     [not found]         ` <1423543713-21624-1-git-send-email-jingjing.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-10  4:48           ` [PATCH v3 1/6] ethdev: define ntuple filter type and its structure Jingjing Wu
2015-02-10  4:48           ` [PATCH v3 2/6] ixgbe: ntuple filter functions replace old ones for 5tuple filter Jingjing Wu
2015-02-10  4:48           ` [PATCH v3 3/6] e1000: ntuple filter functions replace old ones for 2tuple and " Jingjing Wu
2015-02-10  4:48           ` [PATCH v3 4/6] testpmd: new commands for ntuple filter Jingjing Wu
2015-02-10  4:48           ` [PATCH v3 5/6] ethdev: remove old APIs and structures of 5tuple and 2tuple filters Jingjing Wu
2015-02-10  4:48           ` [PATCH v3 6/6] doc: commands changed in testpmd_funcs for 2tuple amd 5tuple filter Jingjing Wu
2015-02-13  2:59           ` [PATCH v3 0/6] new ntuple filter replaces 2tuple and 5tuple filters Xu, HuilongX
2015-02-20 17:29           ` De Lara Guarch, Pablo
     [not found]             ` <E115CCD9D858EF4F90C690B0DCB4D89727261FFF-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-22  3:10               ` Thomas Monjalon

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=1421286361-11504-5-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /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 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.