diff mbox

[dpdk-dev,v3,12/20] app/test-pmd: display fdir statistics

Message ID 1411711418-12881-13-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Wu, Jingjing Sept. 26, 2014, 6:03 a.m. UTC
display flow director's statistics information

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
---
 app/test-pmd/config.c | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 2a1b93f..f28e338 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1815,26 +1815,48 @@  fdir_remove_signature_filter(portid_t port_id,
 void
 fdir_get_infos(portid_t port_id)
 {
-	struct rte_eth_fdir fdir_infos;
+	struct rte_eth_fdir_info fdir_infos;
+	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);
-
+	memset(&fdir_infos, 0, sizeof(fdir_infos));
+	ret = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
+			       RTE_ETH_FILTER_OP_GET_INFO, &fdir_infos);
+	if (ret < 0) {
+		ret = rte_eth_dev_fdir_get_infos(port_id, &fdir_infos.info);
+		if (ret < 0) {
+			printf("\n getting fdir info fails on port %-2d\n",
+				port_id);
+			return;
+		}
+		fdir_infos.mode = (fdir_conf.mode == RTE_FDIR_MODE_NONE) ? 0 : 1;
+	}
 	printf("\n  %s FDIR infos for port %-2d     %s\n",
 	       fdir_stats_border, port_id, fdir_stats_border);
-
+	if (fdir_infos.mode)
+			printf("  FDIR is enabled\n");
+	else
+			printf("  FDIR is disabled\n");
 	printf("  collision: %-10"PRIu64"  free:     %"PRIu64"\n"
 	       "  maxhash:   %-10"PRIu64"  maxlen:   %"PRIu64"\n"
-	       "  add:       %-10"PRIu64"  remove:   %"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);
+	       (uint64_t)(fdir_infos.info.collision), (uint64_t)(fdir_infos.info.free),
+	       (uint64_t)(fdir_infos.info.maxhash), (uint64_t)(fdir_infos.info.maxlen),
+	       fdir_infos.info.add, fdir_infos.info.remove,
+	       fdir_infos.info.f_add, fdir_infos.info.f_remove);
+	printf("  guarant_space: %-10"PRIu16
+	       "  best_space:    %-10"PRIu16"\n",
+	       fdir_infos.info_ext.guarant_spc,
+	       fdir_infos.info_ext.best_spc);
+	printf("  guarant_count: %-10"PRIu16
+	       "  best_count:    %-10"PRIu16"\n",
+	       fdir_infos.info_ext.guarant_cnt,
+	       fdir_infos.info_ext.best_cnt);
 	printf("  %s############################%s\n",
 	       fdir_stats_border, fdir_stats_border);
 }