From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 5/6] testpmd: extend commands
Date: Mon, 11 May 2015 11:46:29 +0800 [thread overview]
Message-ID: <1431315990-3067-6-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1431315990-3067-1-git-send-email-jingjing.wu@intel.com>
This patch extends commands to support l2_payload flow type
and filtering in VFs of flow director.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
app/test-pmd/cmdline.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 81 insertions(+), 6 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f01db2a..438e948 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -632,7 +632,8 @@ static void cmd_help_long_parsed(void *parsed_result,
" flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
" src (src_ip_address) dst (dst_ip_address)"
" vlan (vlan_value) flexbytes (flexbytes_value)"
- " (drop|fwd) queue (queue_id) fd_id (fd_id_value)\n"
+ " (drop|fwd) pf|vf(vf_id) queue (queue_id)"
+ " fd_id (fd_id_value)\n"
" Add/Del an IP type flow director filter.\n\n"
"flow_director_filter (port_id) (add|del|update)"
@@ -640,7 +641,8 @@ static void cmd_help_long_parsed(void *parsed_result,
" src (src_ip_address) (src_port)"
" dst (dst_ip_address) (dst_port)"
" vlan (vlan_value) flexbytes (flexbytes_value)"
- " (drop|fwd) queue (queue_id) fd_id (fd_id_value)\n"
+ " (drop|fwd) pf|vf(vf_id)queue (queue_id)"
+ " fd_id (fd_id_value)\n"
" Add/Del an UDP/TCP type flow director filter.\n\n"
"flow_director_filter (port_id) (add|del|update)"
@@ -649,9 +651,15 @@ static void cmd_help_long_parsed(void *parsed_result,
" dst (dst_ip_address) (dst_port)"
" tag (verification_tag) vlan (vlan_value)"
" flexbytes (flexbytes_value) (drop|fwd)"
- " queue (queue_id) fd_id (fd_id_value)\n"
+ " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
" Add/Del a SCTP type flow director filter.\n\n"
+ "flow_director_filter (port_id) (add|del|update)"
+ " flow l2_payload ether (ethertype)"
+ " flexbytes (flexbytes_value) (drop|fwd)"
+ " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
+ " Add/Del a l2 payload type flow director filter.\n\n"
+
"flush_flow_director (port_id)\n"
" Flush all flow director entries of a device.\n\n"
@@ -662,7 +670,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"flow_director_flex_mask (port_id)"
" flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
- "ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all)"
+ "ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all)"
" (mask)\n"
" Configure mask of flex payload.\n\n"
@@ -7653,6 +7661,8 @@ struct cmd_flow_director_result {
cmdline_fixed_string_t ops;
cmdline_fixed_string_t flow;
cmdline_fixed_string_t flow_type;
+ cmdline_fixed_string_t ether;
+ uint16_t ether_type;
cmdline_fixed_string_t src;
cmdline_ipaddr_t ip_src;
uint16_t port_src;
@@ -7665,6 +7675,7 @@ struct cmd_flow_director_result {
uint16_t vlan_value;
cmdline_fixed_string_t flexbytes;
cmdline_fixed_string_t flexbytes_value;
+ cmdline_fixed_string_t pf_vf;
cmdline_fixed_string_t drop;
cmdline_fixed_string_t queue;
uint16_t queue_id;
@@ -7771,6 +7782,8 @@ cmd_flow_director_filter_parsed(void *parsed_result,
struct cmd_flow_director_result *res = parsed_result;
struct rte_eth_fdir_filter entry;
uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
+ char *end;
+ unsigned long vf_id;
int ret = 0;
ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_FDIR);
@@ -7837,6 +7850,10 @@ cmd_flow_director_filter_parsed(void *parsed_result,
entry.input.flow.sctp6_flow.verify_tag =
rte_cpu_to_be_32(res->verify_tag_value);
break;
+ case RTE_ETH_FLOW_L2_PAYLOAD:
+ entry.input.flow.l2_flow.ether_type =
+ rte_cpu_to_be_16(res->ether_type);
+ break;
default:
printf("invalid parameter.\n");
return;
@@ -7852,6 +7869,27 @@ cmd_flow_director_filter_parsed(void *parsed_result,
entry.action.behavior = RTE_ETH_FDIR_REJECT;
else
entry.action.behavior = RTE_ETH_FDIR_ACCEPT;
+
+ if (!strcmp(res->pf_vf, "pf"))
+ entry.input.flow_ext.is_vf = 0;
+ else if (!strncmp(res->pf_vf, "vf", 2)) {
+ struct rte_eth_dev_info dev_info;
+
+ memset(&dev_info, 0, sizeof(dev_info));
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+ errno = 0;
+ vf_id = strtoul(res->pf_vf + 2, &end, 10);
+ if (errno != 0 || *end != '\0' || vf_id >= dev_info.max_vfs) {
+ printf("invalid parameter %s.\n", res->pf_vf);
+ return;
+ }
+ entry.input.flow_ext.is_vf = 1;
+ entry.input.flow_ext.dst_id = (uint16_t)vf_id;
+ } else {
+ printf("invalid parameter %s.\n", res->pf_vf);
+ return;
+ }
+
/* set to report FD ID by default */
entry.action.report_status = RTE_ETH_FDIR_REPORT_ID;
entry.action.rx_queue = res->queue_id;
@@ -7885,7 +7923,13 @@ cmdline_parse_token_string_t cmd_flow_director_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");
+ "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload");
+cmdline_parse_token_string_t cmd_flow_director_ether =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ ether, "ether");
+cmdline_parse_token_num_t cmd_flow_director_ether_type =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ ether_type, UINT16);
cmdline_parse_token_string_t cmd_flow_director_src =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
src, "src");
@@ -7925,6 +7969,9 @@ cmdline_parse_token_string_t cmd_flow_director_flexbytes_value =
cmdline_parse_token_string_t cmd_flow_director_drop =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
drop, "drop#fwd");
+cmdline_parse_token_string_t cmd_flow_director_pf_vf =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ pf_vf, NULL);
cmdline_parse_token_string_t cmd_flow_director_queue =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
queue, "queue");
@@ -7957,6 +8004,7 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
(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,
@@ -7986,6 +8034,7 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
(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,
@@ -8017,6 +8066,31 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
(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,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a L2 flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_flow,
+ (void *)&cmd_flow_director_flow_type,
+ (void *)&cmd_flow_director_ether,
+ (void *)&cmd_flow_director_ether_type,
+ (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,
@@ -8278,7 +8352,7 @@ cmdline_parse_token_string_t cmd_flow_director_flexmask_flow =
cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
flow_type, "none#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
- "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#all");
+ "ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload#all");
cmdline_parse_token_string_t cmd_flow_director_flexmask_mask =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
mask, NULL);
@@ -8854,6 +8928,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(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,
+ (cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
(cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
--
1.9.3
next prev parent reply other threads:[~2015-05-11 3:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
2015-05-11 3:46 ` [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
2015-05-11 3:46 ` [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor " Jingjing Wu
2015-05-11 3:46 ` [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-06-12 16:45 ` Thomas Monjalon
2015-06-15 7:14 ` Wu, Jingjing
2015-05-11 3:46 ` [dpdk-dev] [PATCH 4/6] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-05-11 3:46 ` Jingjing Wu [this message]
2015-05-11 3:46 ` [dpdk-dev] [PATCH 6/6] doc: extend commands in testpmd Jingjing Wu
2015-06-02 7:33 ` [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Zhang, Helin
2015-06-16 3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
2015-06-16 3:43 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
2015-06-16 3:43 ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor " Jingjing Wu
2015-06-16 3:43 ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
2015-06-16 3:43 ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd Jingjing Wu
2015-06-26 2:26 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Xu, HuilongX
2015-06-26 3:14 ` Zhang, Helin
2015-07-07 21:24 ` 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=1431315990-3067-6-git-send-email-jingjing.wu@intel.com \
--to=jingjing.wu@intel.com \
--cc=dev@dpdk.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 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).