DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 12/15] testpmd: update function to show flow director information
Date: Thu, 29 Jan 2015 13:29:22 +0800	[thread overview]
Message-ID: <1422509365-13596-13-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1422509365-13596-1-git-send-email-jingjing.wu@intel.com>

update the function to print information includes:
 - capability
 - mask
 - flex configuration

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 app/test-pmd/config.c | 77 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 45 insertions(+), 32 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index c40f819..4db9b9a 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -98,6 +98,7 @@
 
 static const char *flowtype_str[RTE_ETH_FLOW_TYPE_MAX] = {
 	NULL,
+	"raw",
 	"udp4",
 	"tcp4",
 	"sctp4",
@@ -1822,14 +1823,34 @@ fdir_remove_signature_filter(portid_t port_id,
 }
 
 static inline void
-print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf)
+print_fdir_mask(struct rte_eth_fdir_masks *mask)
+{
+	printf("\n    vlan_tci: 0x%04x, src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+		      " src_port: 0x%04x, dst_port: 0x%04x",
+		mask->vlan_tci_mask, mask->ipv4_mask.src_ip,
+		mask->ipv4_mask.dst_ip,
+		mask->src_port_mask, mask->dst_port_mask);
+
+	printf("\n    src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
+		     " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+		mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
+		mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
+		mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
+		mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+	printf("\n");
+}
+
+static inline void
+print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
 {
 	struct rte_eth_flex_payload_cfg *cfg;
-	int i, j;
+	uint32_t i, j;
 
 	for (i = 0; i < flex_conf->nb_payloads; i++) {
 		cfg = &flex_conf->flex_set[i];
-		if (cfg->type == RTE_ETH_L2_PAYLOAD)
+		if (cfg->type == RTE_ETH_RAW_PAYLOAD)
+			printf("\n    RAW:  ");
+		else if (cfg->type == RTE_ETH_L2_PAYLOAD)
 			printf("\n    L2_PAYLOAD:  ");
 		else if (cfg->type == RTE_ETH_L3_PAYLOAD)
 			printf("\n    L3_PAYLOAD:  ");
@@ -1837,22 +1858,22 @@ print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf)
 			printf("\n    L4_PAYLOAD:  ");
 		else
 			printf("\n    UNKNOWN PAYLOAD(%u):  ", cfg->type);
-		for (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)
+		for (j = 0; j < num; j++)
 			printf("  %-5u", cfg->src_offset[j]);
 	}
 	printf("\n");
 }
 
 static inline void
-print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf)
+print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
 {
 	struct rte_eth_fdir_flex_mask *mask;
-	int i, j;
+	uint32_t 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++)
+		for (j = 0; j < num; j++)
 			printf(" %02x", mask->mask[j]);
 	}
 	printf("\n");
@@ -1885,26 +1906,8 @@ fdir_get_infos(portid_t port_id)
 		return;
 	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);
+		printf("\n FDIR is not supported on port %-2d\n",
+			port_id);
 		return;
 	}
 
@@ -1933,18 +1936,28 @@ fdir_get_infos(portid_t port_id)
 		fdir_info.flex_payload_unit,
 		fdir_info.max_flex_payload_segment_num,
 		fdir_info.flex_bitmask_unit, fdir_info.max_flex_bitmask_num);
+	printf("  MASK: ");
+	print_fdir_mask(&fdir_info.mask);
 	if (fdir_info.flex_conf.nb_payloads > 0) {
 		printf("  FLEX PAYLOAD SRC OFFSET:");
-		print_fdir_flex_payload(&fdir_info.flex_conf);
+		print_fdir_flex_payload(&fdir_info.flex_conf, fdir_info.max_flexpayload);
 	}
 	if (fdir_info.flex_conf.nb_flexmasks > 0) {
 		printf("  FLEX MASK CFG:");
-		print_fdir_flex_mask(&fdir_info.flex_conf);
+		print_fdir_flex_mask(&fdir_info.flex_conf, fdir_info.max_flexpayload);
 	}
-	printf("  guarant_count: %-10"PRIu32"  best_count:    %-10"PRIu32"\n",
+	printf("  guarant_count: %-10"PRIu32"  best_count:    %"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("  guarant_space: %-10"PRIu32"  best_space:    %"PRIu32"\n",
+	       fdir_info.guarant_spc, fdir_info.best_spc);
+	printf("  collision:     %-10"PRIu32"  free:          %"PRIu32"\n"
+	       "  maxhash:       %-10"PRIu32"  maxlen:        %"PRIu32"\n"
+	       "  add:	         %-10"PRIu64"  remove:        %"PRIu64"\n"
+	       "  f_add:         %-10"PRIu64"  f_remove:      %"PRIu64"\n",
+	       fdir_stat.collision, fdir_stat.free,
+	       fdir_stat.maxhash, fdir_stat.maxlen,
+	       fdir_stat.add, fdir_stat.remove,
+	       fdir_stat.f_add, fdir_stat.f_remove);
 	printf("  %s############################%s\n",
 	       fdir_stats_border, fdir_stats_border);
 }
-- 
1.9.3

  parent reply	other threads:[~2015-01-29  5:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29  5:29 [dpdk-dev] [PATCH 00/15] migrate flow director in ixgbe driver to new API Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 01/15] ixgbe: migrate flow director filter operations (add/delete/update) " Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 02/15] ethdev: extend flow type and flexible payload type definition for flow director Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 03/15] ixgbe: implement the flexpayload configuration of flow director filter Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 04/15] app/test: remove the flexbytes_offset setting in test_link_bonding Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 05/15] testpmd: remove the flexbytes_offset setting Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 06/15] ethdev: remove flexbytes_offset from rte_fdir_conf Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 07/15] ethdev: structures definition for flow director masks Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 08/15] ixgbe: implement the mask configuration of flow director filter Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 09/15] ixgbe: implement the get info and statistic operations of flow director Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 10/15] ixgbe: implement the flush operation " Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 11/15] testpmd: add and update commands for " Jingjing Wu
2015-01-29  5:29 ` Jingjing Wu [this message]
2015-01-29  5:29 ` [dpdk-dev] [PATCH 13/15] testpmd: set the default value of flow director's mask Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 14/15] testpmd: remove old commands for flow director Jingjing Wu
2015-01-29  5:29 ` [dpdk-dev] [PATCH 15/15] doc: commands changed in testpmd_funcs.rst " Jingjing Wu
2015-02-11  8:09 ` [dpdk-dev] [PATCH 00/15] migrate flow director in ixgbe driver to new API Zhang, Helin
2015-02-22  1:04   ` 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=1422509365-13596-13-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).