DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v6 18/22] testpmd: display fdir info
Date: Fri, 21 Nov 2014 08:46:52 +0800
Message-ID: <1416530816-2159-19-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1416530816-2159-1-git-send-email-jingjing.wu@intel.com>

display flow director's information, includes
 - statistics
 - configuration
 - capability

Signed-off-by: jingjing.wu <jingjing.wu@intel.com>
---
 app/test-pmd/config.c | 141 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 128 insertions(+), 13 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b102b72..b7e4412 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -96,6 +96,20 @@
 
 #include "testpmd.h"
 
+static const char *flowtype_str[RTE_ETH_FLOW_TYPE_MAX] = {
+	NULL,
+	"udp4",
+	"tcp4",
+	"sctp4",
+	"ip4",
+	"ip4-frag",
+	"udp6",
+	"tcp6",
+	"sctp6",
+	"ip6",
+	"ip6-frag",
+};
+
 static void
 print_ethaddr(const char *name, struct ether_addr *eth_addr)
 {
@@ -1808,29 +1822,130 @@ fdir_remove_signature_filter(portid_t port_id,
 
 }
 
+static inline void
+print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf)
+{
+	struct rte_eth_flex_payload_cfg *cfg;
+	int i, j;
+
+	for (i = 0; i < flex_conf->nb_payloads; i++) {
+		cfg = &flex_conf->flex_set[i];
+		if (cfg->type == RTE_ETH_L2_PAYLOAD)
+			printf("\n    L2_PAYLOAD:  ");
+		else if (cfg->type == RTE_ETH_L3_PAYLOAD)
+			printf("\n    L3_PAYLOAD:  ");
+		else if (cfg->type == RTE_ETH_L4_PAYLOAD)
+			printf("\n    L4_PAYLOAD:  ");
+		else
+			printf("\n    UNKNOWN PAYLOAD(%u):  ", cfg->type);
+		for (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)
+			printf("  %-5u", cfg->src_offset[j]);
+	}
+	printf("\n");
+}
+
+static inline void
+print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf)
+{
+	struct rte_eth_fdir_flex_mask *mask;
+	int i, j;
+
+	for (i = 0; i < flex_conf->nb_flexmasks; i++) {
+		mask = &flex_conf->flex_mask[i];
+		printf("\n    %s:\t", flowtype_str[mask->flow_type]);
+		for (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)
+			printf(" %02x", mask->mask[j]);
+	}
+	printf("\n");
+}
+
+static inline void
+print_fdir_flow_type(uint32_t flow_types_mask)
+{
+	int i = 0;
+
+	for (i = RTE_ETH_FLOW_TYPE_UDPV4;
+	     i <= RTE_ETH_FLOW_TYPE_FRAG_IPV6;
+	     i++) {
+		if (flow_types_mask & (1 << i))
+			printf(" %s", flowtype_str[i]);
+	}
+	printf("\n");
+}
+
 void
 fdir_get_infos(portid_t port_id)
 {
-	struct rte_eth_fdir fdir_infos;
+	struct rte_eth_fdir_stats fdir_stat;
+	struct rte_eth_fdir_info fdir_info;
+	int ret;
 
 	static const char *fdir_stats_border = "########################";
 
 	if (port_id_is_invalid(port_id))
 		return;
-
-	rte_eth_dev_fdir_get_infos(port_id, &fdir_infos);
-
+	ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR);
+	if (ret < 0) {
+		/* use the old fdir APIs to get info */
+		struct rte_eth_fdir fdir;
+		memset(&fdir, 0, sizeof(fdir));
+		ret = rte_eth_dev_fdir_get_infos(port_id, &fdir);
+		if (ret < 0) {
+			printf("\n getting fdir info fails on port %-2d\n",
+				port_id);
+			return;
+		}
+		printf("\n  %s FDIR infos for port %-2d     %s\n",
+			fdir_stats_border, port_id, fdir_stats_border);
+		printf("  collision: %-10"PRIu64"  free:     %"PRIu64"\n"
+		       "  maxhash:   %-10"PRIu64"  maxlen:   %"PRIu64"\n"
+		       "  add:	     %-10"PRIu64"  remove:   %"PRIu64"\n"
+		       "  f_add:     %-10"PRIu64"  f_remove: %"PRIu64"\n",
+		       (uint64_t)(fdir.collision), (uint64_t)(fdir.free),
+		       (uint64_t)(fdir.maxhash), (uint64_t)(fdir.maxlen),
+		       fdir.add, fdir.remove, fdir.f_add, fdir.f_remove);
+		printf("  %s############################%s\n",
+		       fdir_stats_border, fdir_stats_border);
+		return;
+	}
+
+	memset(&fdir_info, 0, sizeof(fdir_info));
+	rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
+			       RTE_ETH_FILTER_INFO, &fdir_info);
+	memset(&fdir_stat, 0, sizeof(fdir_stat));
+	rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
+			       RTE_ETH_FILTER_STATS, &fdir_stat);
 	printf("\n  %s FDIR infos for port %-2d     %s\n",
 	       fdir_stats_border, port_id, fdir_stats_border);
-
-	printf("  collision: %-10"PRIu64"  free:     %"PRIu64"\n"
-	       "  maxhash:   %-10"PRIu64"  maxlen:   %"PRIu64"\n"
-	       "  add:       %-10"PRIu64"  remove:   %"PRIu64"\n"
-	       "  f_add:     %-10"PRIu64"  f_remove: %"PRIu64"\n",
-	       (uint64_t)(fdir_infos.collision), (uint64_t)(fdir_infos.free),
-	       (uint64_t)(fdir_infos.maxhash), (uint64_t)(fdir_infos.maxlen),
-	       fdir_infos.add, fdir_infos.remove,
-	       fdir_infos.f_add, fdir_infos.f_remove);
+	printf("  MODE: ");
+	if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
+			printf("  PERFECT\n");
+	else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
+			printf("  SIGNATURE\n");
+	else
+			printf("  DISABLE\n");
+	printf("  SUPPORTED FLOW TYPE: ");
+	print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+	printf("  FLEX PAYLOAD INFO:\n");
+	printf("  max_len:       %-10"PRIu32"  payload_limit: %-10"PRIu32"\n"
+	       "  payload_unit:  %-10"PRIu32"  payload_seg:   %-10"PRIu32"\n"
+	       "  bitmask_unit:  %-10"PRIu32"  bitmask_num:   %-10"PRIu32"\n",
+		fdir_info.max_flexpayload, fdir_info.flex_payload_limit,
+		fdir_info.flex_payload_unit,
+		fdir_info.max_flex_payload_segment_num,
+		fdir_info.flex_bitmask_unit, fdir_info.max_flex_bitmask_num);
+	if (fdir_info.flex_conf.nb_payloads > 0) {
+		printf("  FLEX PAYLOAD SRC OFFSET:");
+		print_fdir_flex_payload(&fdir_info.flex_conf);
+	}
+	if (fdir_info.flex_conf.nb_flexmasks > 0) {
+		printf("  FLEX MASK CFG:");
+		print_fdir_flex_mask(&fdir_info.flex_conf);
+	}
+	printf("  guarant_count: %-10"PRIu32"  best_count:    %-10"PRIu32"\n",
+	       fdir_stat.guarant_cnt, fdir_stat.best_cnt);
+	printf("  guarant_space: %-10"PRIu32"  best_space:    %-10"PRIu32"\n",
+	       fdir_info.guarant_spc, fdir_info.guarant_spc);
 	printf("  %s############################%s\n",
 	       fdir_stats_border, fdir_stats_border);
 }
-- 
1.8.1.4

  parent reply	other threads:[~2014-11-21  0:37 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26  6:03 [dpdk-dev] [PATCH v3 00/20] Support flow director programming on Fortville Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 01/20] i40e: set up and initialize flow director Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 02/20] i40e: tear down " Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 03/20] i40e: initialize flexible payload setting Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 04/20] lib/librte_ether: new filter APIs definition Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 05/20] lib/librte_ether: define structures for adding/deleting flow director Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 06/20] i40e: implement operations to add/delete " Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 07/20] app/test-pmd: add test commands to add/delete flow director filter Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 08/20] i40e: match counter for flow director Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 09/20] i40e: report flow director match info to mbuf Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 10/20] lib/librte_ether: define structures for getting flow director information Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 11/20] i40e: implement operations to get fdir info Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 12/20] app/test-pmd: display fdir statistics Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 13/20] i40e: implement operation to flush flow director table Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 14/20] app/test-pmd: add test command " Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 15/20] lib/librte_ether: define structures for configuring flexible payload Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v316/20] i40e: implement operations to configure " Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 17/20] app/test-pmd: add test command " Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 18/20] lib/librte_ether: define structures for configuring flex masks Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 19/20] i40e: implement operations to configure flexible masks Jingjing Wu
2014-09-26  6:03 ` [dpdk-dev] [PATCH v3 20/20] app/test-pmd: add test command " Jingjing Wu
2014-10-13 15:58   ` De Lara Guarch, Pablo
2014-10-22  1:01 ` [dpdk-dev] [PATCH v4 00/21] Support flow director programming on Fortville Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 01/21] i40e: set up and initialize flow director Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 02/21] i40e: tear down " Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 03/21] i40e: initialize flexible payload setting Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 04/21] ethdev: define structures for adding/deleting flow director Jingjing Wu
2014-10-27 16:57     ` Thomas Monjalon
2014-10-28  1:18       ` Wu, Jingjing
2014-10-28 13:17         ` Thomas Monjalon
2014-10-29  1:29           ` Wu, Jingjing
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 05/21] i40e: implement operations to add/delete " Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 06/21] testpmd: add test commands to add/delete flow director filter Jingjing Wu
2014-10-28 13:23     ` Thomas Monjalon
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 07/21] i40e: match counter for flow director Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 08/21] mbuf: extend fdir field Jingjing Wu
2014-10-28 13:28     ` Thomas Monjalon
2014-10-29  1:45       ` Wu, Jingjing
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 09/21] i40e: report flow director match info to mbuf Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 10/21] testpmd: print extended fdir info in mbuf Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 11/21] ethdev: define structures for getting flow director information Jingjing Wu
2014-10-28 13:44     ` Thomas Monjalon
2014-10-29  2:10       ` Wu, Jingjing
2014-10-29  9:48         ` Thomas Monjalon
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 12/21] i40e: implement operations to get fdir info Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 13/21] testpmd: display fdir statistics Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 14/21] i40e: implement operation to flush flow director table Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 15/21] testpmd: add test command " Jingjing Wu
2014-10-28 13:53     ` Thomas Monjalon
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 16/21] ethdev: define structures for configuring flexible payload Jingjing Wu
2014-10-28 14:14     ` Thomas Monjalon
2014-10-29  3:21       ` Wu, Jingjing
2014-10-29  9:55         ` Thomas Monjalon
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 17/21] i40e: implement operations to configure " Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 18/21] testpmd: add test command " Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 19/21] ethdev: define structures for configuring flex masks Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 20/21] i40e: implement operations to configure flexible masks Jingjing Wu
2014-10-22  1:01   ` [dpdk-dev] [PATCH v4 21/21] testpmd: add test command " Jingjing Wu
2014-10-28 14:18     ` Thomas Monjalon
2014-10-29  2:35       ` Wu, Jingjing
2014-10-27 15:22   ` [dpdk-dev] [PATCH v4 00/21] Support flow director programming on Fortville Thomas Monjalon
2014-10-28  0:48   ` Zhang, Helin
2014-10-30  7:26   ` [dpdk-dev] [PATCH v5 " Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 01/21] i40e: set up and initialize flow director Jingjing Wu
2014-10-30  8:25       ` Wu, Jingjing
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 02/21] i40e: tear down " Jingjing Wu
2014-11-19  7:53       ` Cao, Min
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 03/21] i40e: initialize flexible payload setting Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 04/21] ethdev: define structures for adding/deleting flow director Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 05/21] i40e: implement operations to add/delete " Jingjing Wu
2014-11-05 21:18       ` De Lara Guarch, Pablo
2014-11-13  9:50         ` Thomas Monjalon
2014-11-13 11:36           ` Wu, Jingjing
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 06/21] testpmd: add test commands to add/delete flow director filter Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 07/21] i40e: match counter for flow director Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 08/21] mbuf: extend fdir field Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 09/21] i40e: report flow director match info to mbuf Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 10/21] testpmd: print extended fdir info in mbuf Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 11/21] ethdev: define structures for getting flow director information Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 12/21] i40e: implement operations to get fdir info Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 13/21] testpmd: display fdir statistics Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 14/21] i40e: implement operation to flush flow director table Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 15/21] testpmd: add test command " Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 16/21] ethdev: define structures for configuring flexible payload Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 17/21] i40e: implement operations to configure " Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 18/21] testpmd: add test command " Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 19/21] ethdev: define structures for configuring flex masks Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 20/21] i40e: implement operations to configure flexible masks Jingjing Wu
2014-10-30  7:26     ` [dpdk-dev] [PATCH v5 21/21] testpmd: add test command " Jingjing Wu
2014-10-30  8:07     ` [dpdk-dev] [PATCH v5 01/21] i40e: set up and initialize flow director Jingjing Wu
2014-11-21  0:46     ` [dpdk-dev] [PATCH v6 00/22] Support flow director programming on Fortville Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 01/22] i40e: set up and initialize flow director Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 02/22] i40e: tear down " Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 03/22] i40e: initialize flexible payload setting Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 04/22] ethdev: define structures for adding/deleting flow director Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 05/22] i40e: define functions for transition between flow_type and pctype Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 06/22] i40e: implement operations to add/delete flow director Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 07/22] testpmd: add test commands to add/delete flow director filter Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 08/22] i40e: match counter for flow director Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field Jingjing Wu
2014-11-21 17:03         ` Chilikin, Andrey
2014-11-21 19:34           ` Ananyev, Konstantin
2014-11-21 19:37             ` Chilikin, Andrey
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 10/22] i40e: report flow director match info to mbuf Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 11/22] testpmd: print extended fdir info in mbuf Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 12/22] i40e: implement operation to flush flow director table Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 13/22] testpmd: add test command " Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 14/22] ethdev: define structures for getting flow director information Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 15/22] i40e: implement operations to get fdir info Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 16/22] ethdev: define structures for getting flow director statistics Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 17/22] i40e: implement operations to get fdir statistics Jingjing Wu
2014-11-21  0:46       ` Jingjing Wu [this message]
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 19/22] ethdev: add flexible payload setting in eth_conf Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 20/22] i40e: take flow director flexible payload configuration Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 21/22] testpmd: add test command to configure flexible mask Jingjing Wu
2014-11-21  0:46       ` [dpdk-dev] [PATCH v6 22/22] testpmd: add test command to configure flexible payload Jingjing Wu
2014-11-21 11:34       ` [dpdk-dev] [PATCH v6 00/22] Support flow director programming on Fortville Ananyev, Konstantin
2014-11-24 23:20         ` Thomas Monjalon
2014-11-25  4:51           ` Wu, Jingjing
2014-11-25  9:23             ` Thomas Monjalon
2014-10-30  7:34   ` [dpdk-dev] [PATCH v4 00/21] " Cao, Min
2014-11-19  7:53   ` Cao, Min
2014-10-30  7:12 ` [dpdk-dev] [PATCH v3 00/20] " Cao, Min

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=1416530816-2159-19-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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git