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 v3 3/4] app/testpmd: add raw flow type to flow director
Date: Thu,  5 Oct 2017 21:52:50 +0100	[thread overview]
Message-ID: <1507236771-85423-4-git-send-email-kirill.rybalchenko@intel.com> (raw)
In-Reply-To: <1507236771-85423-1-git-send-email-kirill.rybalchenko@intel.com>

v3:
Add raw flow type support to flow_director_filter command

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index cdde5a1..b08c1b4 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -843,6 +843,12 @@ 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) flexbytes (flexbytes_value) (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"
 
@@ -8904,6 +8910,7 @@ struct cmd_flow_director_result {
 	cmdline_fixed_string_t mode_value;
 	cmdline_fixed_string_t ops;
 	cmdline_fixed_string_t flow;
+	uint16_t flow_id;
 	cmdline_fixed_string_t flow_type;
 	cmdline_fixed_string_t ether;
 	uint16_t ether_type;
@@ -8937,6 +8944,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
@@ -9063,6 +9072,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;
 
@@ -9086,11 +9097,14 @@ 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;
+		} 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,
@@ -9172,6 +9186,15 @@ 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:
+		entry.input.flow.raw_flow.flow = res->flow_id;
+		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 = (uint16_t)raw_packet_size;
+		break;
 	default:
 		break;
 	}
@@ -9261,6 +9284,9 @@ 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");
+cmdline_parse_token_num_t cmd_flow_director_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+			      flow_id, UINT16);
 cmdline_parse_token_string_t cmd_flow_director_ether =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 ether, "ether");
@@ -9352,6 +9378,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");
@@ -9370,6 +9399,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,
@@ -9573,6 +9608,33 @@ 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_id,
+		(void *)&cmd_flow_director_flexbytes,
+		(void *)&cmd_flow_director_flexbytes_value,
+		(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;
@@ -14755,6 +14817,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-05 20:53 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     ` Kirill Rybalchenko [this message]
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       ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: add raw flow type to " Kirill Rybalchenko
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=1507236771-85423-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).