diff mbox series

[API-NEXT,v1,4/6] test: l2fwd: add verbose option

Message ID 1510844412-21931-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/6] api: pktio: add max frame length | expand

Commit Message

Github ODP bot Nov. 16, 2017, 3 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Added verbose command line option. When enabled, pktio interface
details are printed after open. This can be used for debugging
interface configuration.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 298 (psavol:next-frame-len)
 ** https://github.com/Linaro/odp/pull/298
 ** Patch: https://github.com/Linaro/odp/pull/298.patch
 ** Base sha: d4b364849c4abb4c71e0c5260e1a793ebb8dc97d
 ** Merge commit sha: f65f2a6ea63917fca4366f41eeac436d31acec9f
 **/
 test/performance/odp_l2fwd.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 42d8f49a2..2daf0e2db 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -108,6 +108,7 @@  typedef struct {
 	int error_check;        /**< Check packet errors */
 	int sched_mode;         /**< Scheduler mode */
 	int num_groups;         /**< Number of scheduling groups */
+	int verbose;		/**< Verbose output */
 } appl_args_t;
 
 static int exit_threads;	/**< Break workers loop if set to 1 */
@@ -697,6 +698,9 @@  static int create_pktio(const char *dev, int idx, int num_rx, int num_tx,
 	printf("created pktio %" PRIu64 ", dev: %s, drv: %s\n",
 	       odp_pktio_to_u64(pktio), dev, info.drv_name);
 
+	if (gbl_args->appl.verbose)
+		odp_pktio_print(pktio);
+
 	if (odp_pktio_capability(pktio, &capa)) {
 		LOG_ERR("Error: capability query failed %s\n", dev);
 		return -1;
@@ -1163,11 +1167,12 @@  static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
 		{"src_change", required_argument, NULL, 's'},
 		{"error_check", required_argument, NULL, 'e'},
 		{"groups", required_argument, NULL, 'g'},
+		{"verbose", no_argument, NULL, 'v'},
 		{"help", no_argument, NULL, 'h'},
 		{NULL, 0, NULL, 0}
 	};
 
-	static const char *shortopts =  "+c:+t:+a:i:m:o:r:d:s:e:g:h";
+	static const char *shortopts =  "+c:+t:+a:i:m:o:r:d:s:e:g:vh";
 
 	/* let helper collect its own arguments (e.g. --odph_proc) */
 	odph_parse_options(argc, argv, shortopts, longopts);
@@ -1178,6 +1183,7 @@  static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
 	appl_args->src_change = 1; /* change eth src address by default */
 	appl_args->num_groups = 0; /* use default group */
 	appl_args->error_check = 0; /* don't check packet errors by default */
+	appl_args->verbose = 0;
 
 	opterr = 0; /* do not issue errors on helper options */
 
@@ -1305,6 +1311,9 @@  static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
 		case 'g':
 			appl_args->num_groups = atoi(optarg);
 			break;
+		case 'v':
+			appl_args->verbose = 1;
+			break;
 		case 'h':
 			usage(argv[0]);
 			exit(EXIT_SUCCESS);