DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
To: dev@dpdk.org
Cc: kirill.rybalchenko@intel.com, andrey.chilikin@intel.com,
	beilei.xing@intel.com, jingjing.wu@intel.com
Subject: [dpdk-dev] [PATCH v4 3/4] app/testpmd: add raw flow type to flow director
Date: Tue, 10 Oct 2017 21:13:31 +0100	[thread overview]
Message-ID: <1507666412-15320-4-git-send-email-kirill.rybalchenko@intel.com> (raw)
In-Reply-To: <1507666412-15320-1-git-send-email-kirill.rybalchenko@intel.com>

v3:
Add raw flow type support to flow_director_filter command

v4:
Remove unnecessary flexbytes parameter for raw flow type flow
director.
Add possibility for arbitrary flow type for set_fdir_input_set
and set_hash_global_config commands.

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
 app/test-pmd/cmdline.c | 99 +++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 77 insertions(+), 22 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a72679d..0512be0 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -862,6 +862,11 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" queue (queue_id) fd_id (fd_id_value)\n"
 			"    Add/Del a Tunnel flow director filter.\n\n"
 
+			"flow_director_filter (port_id) mode raw (add|del|update)"
+			" flow (flow_id) (drop|fwd) pf|vf(vf_id) queue (queue_id)"
+			" fd_id (fd_id_value) packet (packet file name)\n"
+			"    Add/Del a raw type flow director filter.\n\n"
+
 			"flush_flow_director (port_id)\n"
 			"    Flush all flow director entries of a device.\n\n"
 
@@ -902,8 +907,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set_hash_global_config (port_id) (toeplitz|simple_xor|default)"
 			" (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|"
-			"ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload)"
-			" (enable|disable)\n"
+			"ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|"
+			"<flowtype_id>) (enable|disable)\n"
 			"    Set the global configurations of hash filters.\n\n"
 
 			"set_hash_input_set (port_id) (ipv4|ipv4-frag|"
@@ -921,7 +926,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set_fdir_input_set (port_id) "
 			"(ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
 			"ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
-			"l2_payload) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|"
+			"l2_payload|<flowtype_id>) "
+			"(ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|"
 			"dst-ipv6|ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|"
 			"ipv6-next-header|ipv6-hop-limits|udp-src-port|"
 			"udp-dst-port|tcp-src-port|tcp-dst-port|"
@@ -9154,6 +9160,8 @@ struct cmd_flow_director_result {
 	cmdline_fixed_string_t tunnel_type;
 	cmdline_fixed_string_t tunnel_id;
 	uint32_t tunnel_id_value;
+	cmdline_fixed_string_t packet;
+	char filepath[];
 };
 
 static inline int
@@ -9280,6 +9288,8 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 	struct rte_eth_fdir_filter entry;
 	uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
 	char *end;
+	uint8_t *raw_packet_buff;
+	uint32_t raw_packet_size;
 	unsigned long vf_id;
 	int ret = 0;
 
@@ -9303,19 +9313,26 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 			return;
 		}
 	} else {
-		if (strcmp(res->mode_value, "IP")) {
-			printf("Please set mode to IP.\n");
+		if (!strcmp(res->mode_value, "raw")) {
+			entry.input.flow_type = RTE_ETH_FLOW_RAW;
+			entry.input.flow.raw_flow.flow =
+						str2flowtype(res->flow_type);
+		} else if (!strcmp(res->mode_value, "IP")) {
+			entry.input.flow_type = str2flowtype(res->flow_type);
+		} else {
+			printf("Please set mode to IP or raw.\n");
 			return;
 		}
-		entry.input.flow_type = str2flowtype(res->flow_type);
 	}
 
-	ret = parse_flexbytes(res->flexbytes_value,
-					flexbytes,
-					RTE_ETH_FDIR_MAX_FLEXLEN);
-	if (ret < 0) {
-		printf("error: Cannot parse flexbytes input.\n");
-		return;
+	if (entry.input.flow_type != RTE_ETH_FLOW_RAW) {
+		ret = parse_flexbytes(res->flexbytes_value,
+						flexbytes,
+						RTE_ETH_FDIR_MAX_FLEXLEN);
+		if (ret < 0) {
+			printf("error: Cannot parse flexbytes input.\n");
+			return;
+		}
 	}
 
 	switch (entry.input.flow_type) {
@@ -9389,6 +9406,14 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 		entry.input.flow.l2_flow.ether_type =
 			rte_cpu_to_be_16(res->ether_type);
 		break;
+	case RTE_ETH_FLOW_RAW:
+		raw_packet_buff = open_ddp_package_file(res->filepath,
+							&raw_packet_size);
+		if (!raw_packet_buff)
+			return;
+		entry.input.flow.raw_flow.packet = raw_packet_buff;
+		entry.input.flow.raw_flow.length = (uint32_t)raw_packet_size;
+		break;
 	default:
 		break;
 	}
@@ -9476,8 +9501,7 @@ cmdline_parse_token_string_t cmd_flow_director_flow =
 				 flow, "flow");
 cmdline_parse_token_string_t cmd_flow_director_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
-		flow_type, "ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
-		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload");
+		flow_type, NULL);
 cmdline_parse_token_string_t cmd_flow_director_ether =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 ether, "ether");
@@ -9569,6 +9593,9 @@ cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
 cmdline_parse_token_string_t cmd_flow_director_mode_tunnel =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mode_raw =
+	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+				 mode_value, "raw");
 cmdline_parse_token_string_t cmd_flow_director_mac =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 mac, "mac");
@@ -9587,6 +9614,12 @@ cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
 cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
 			      tunnel_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_packet =
+	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+				 packet, "packet");
+cmdline_parse_token_string_t cmd_flow_director_filepath =
+	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+				 filepath, NULL);
 
 cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
 	.f = cmd_flow_director_filter_parsed,
@@ -9790,6 +9823,31 @@ cmdline_parse_inst_t cmd_add_del_tunnel_flow_director = {
 	},
 };
 
+cmdline_parse_inst_t cmd_add_del_raw_flow_director = {
+	.f = cmd_flow_director_filter_parsed,
+	.data = NULL,
+	.help_str = "flow_director_filter ... : Add or delete a raw flow "
+		"director entry on NIC",
+	.tokens = {
+		(void *)&cmd_flow_director_filter,
+		(void *)&cmd_flow_director_port_id,
+		(void *)&cmd_flow_director_mode,
+		(void *)&cmd_flow_director_mode_raw,
+		(void *)&cmd_flow_director_ops,
+		(void *)&cmd_flow_director_flow,
+		(void *)&cmd_flow_director_flow_type,
+		(void *)&cmd_flow_director_drop,
+		(void *)&cmd_flow_director_pf_vf,
+		(void *)&cmd_flow_director_queue,
+		(void *)&cmd_flow_director_queue_id,
+		(void *)&cmd_flow_director_fd_id,
+		(void *)&cmd_flow_director_fd_id_value,
+		(void *)&cmd_flow_director_packet,
+		(void *)&cmd_flow_director_filepath,
+		NULL,
+	},
+};
+
 struct cmd_flush_flow_director_result {
 	cmdline_fixed_string_t flush_flow_director;
 	uint8_t port_id;
@@ -10589,9 +10647,7 @@ cmdline_parse_token_string_t cmd_set_hash_global_config_hash_func =
 		hash_func, "toeplitz#simple_xor#default");
 cmdline_parse_token_string_t cmd_set_hash_global_config_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result,
-		flow_type,
-		"ipv4#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#ipv4-other#ipv6#"
-		"ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#ipv6-other#l2_payload");
+		flow_type, NULL);
 cmdline_parse_token_string_t cmd_set_hash_global_config_enable =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_hash_global_config_result,
 		enable, "enable#disable");
@@ -10603,7 +10659,7 @@ cmdline_parse_inst_t cmd_set_hash_global_config = {
 		"toeplitz|simple_xor|default "
 		"ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
 		"ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|"
-		"l2_payload enable|disable",
+		"l2_payload|<flow_id> enable|disable",
 	.tokens = {
 		(void *)&cmd_set_hash_global_config_all,
 		(void *)&cmd_set_hash_global_config_port_id,
@@ -10775,9 +10831,7 @@ cmdline_parse_token_num_t cmd_set_fdir_input_set_port_id =
 	port_id, UINT8);
 cmdline_parse_token_string_t cmd_set_fdir_input_set_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result,
-	flow_type,
-	"ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#ipv4-other#"
-	"ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#ipv6-other#l2_payload");
+	flow_type, NULL);
 cmdline_parse_token_string_t cmd_set_fdir_input_set_field =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result,
 	inset_field,
@@ -10795,7 +10849,7 @@ cmdline_parse_inst_t cmd_set_fdir_input_set = {
 	.data = NULL,
 	.help_str = "set_fdir_input_set <port_id> "
 	"ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|"
-	"ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload "
+	"ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flow_id> "
 	"ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|"
 	"ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|"
 	"ipv6-hop-limits|udp-src-port|udp-dst-port|"
@@ -15055,6 +15109,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director,
+	(cmdline_parse_inst_t *)&cmd_add_del_raw_flow_director,
 	(cmdline_parse_inst_t *)&cmd_flush_flow_director,
 	(cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
 	(cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
-- 
2.5.5

  parent reply	other threads:[~2017-10-10 20:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 15:30 [dpdk-dev] [PATCH 0/2] ethdev: add support for raw flow type for " Kirill Rybalchenko
2017-08-24 15:30 ` [dpdk-dev] [PATCH 1/2] " Kirill Rybalchenko
2017-09-04 10:35   ` Radu Nicolau
2017-08-24 15:30 ` [dpdk-dev] [PATCH 2/2] net/i40e: " Kirill Rybalchenko
2017-09-04 10:38   ` Radu Nicolau
2017-09-20  8:42 ` [dpdk-dev] [PATCH v2 0/2] ethdev: " Kirill Rybalchenko
2017-09-20  8:42   ` [dpdk-dev] [PATCH v2 1/2] " Kirill Rybalchenko
2017-09-20  8:42   ` [dpdk-dev] [PATCH v2 2/2] net/i40e: " Kirill Rybalchenko
2017-10-03 19:02   ` [dpdk-dev] [PATCH v2 0/2] ethdev: " Ferruh Yigit
2017-10-04 16:57     ` Thomas Monjalon
2017-10-04 17:44       ` Ferruh Yigit
2017-10-04 17:56         ` Thomas Monjalon
2017-10-04 19:47           ` Ferruh Yigit
2017-10-04 22:42             ` Thomas Monjalon
2017-10-05  9:09             ` Rybalchenko, Kirill
2017-10-05 20:52   ` [dpdk-dev] [PATCH v3 0/4] " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 1/4] " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 2/4] net/i40e: " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: add raw flow type to " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 4/4] doc: add description of raw flow type in flow director in testpmd Kirill Rybalchenko
2017-10-10 20:13     ` [dpdk-dev] [PATCH v4 0/4] add support for raw flow type for flow director Kirill Rybalchenko
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 1/4] ethdev: " Kirill Rybalchenko
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 2/4] net/i40e: " Kirill Rybalchenko
2017-10-10 20:13       ` Kirill Rybalchenko [this message]
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 4/4] doc: add description of raw mode in flow director in testpmd Kirill Rybalchenko
2017-10-10 20:28       ` [dpdk-dev] [PATCH v5 0/4] add support for raw flow type for flow director Kirill Rybalchenko
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 1/4] ethdev: " Kirill Rybalchenko
2017-10-11 22:26           ` Thomas Monjalon
2017-10-12 11:41             ` Rybalchenko, Kirill
2017-10-12 12:01               ` Thomas Monjalon
2017-10-12 16:14               ` Adrien Mazarguil
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 2/4] net/i40e: " Kirill Rybalchenko
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 3/4] app/testpmd: add raw flow type to " Kirill Rybalchenko
2017-10-13  3:27           ` Wu, Jingjing
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 4/4] doc: add description of raw mode in flow director in testpmd Kirill Rybalchenko

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=1507666412-15320-4-git-send-email-kirill.rybalchenko@intel.com \
    --to=kirill.rybalchenko@intel.com \
    --cc=andrey.chilikin@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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).