pg: add support for ip mode through cli

Type: improvement

Change-Id: I5dda196ab8f1b634fcac46acd5c57a6dd726759c
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index e57e725..6715bbd 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -689,6 +689,7 @@
   unformat_input_t _line_input, *line_input = &_line_input;
   u32 if_id, gso_enabled = 0, gso_size = 0, coalesce_enabled = 0;
   clib_error_t *error = NULL;
+  pg_interface_mode_t mode = PG_MODE_ETHERNET;
 
   if (!unformat_user (input, unformat_line_input, line_input))
     return 0;
@@ -710,6 +711,10 @@
 	      goto done;
 	    }
 	}
+      else if (unformat (line_input, "mode ip4"))
+	mode = PG_MODE_IP4;
+      else if (unformat (line_input, "mode ip6"))
+	mode = PG_MODE_IP6;
       else
 	{
 	  error = clib_error_create ("unknown input `%U'",
@@ -719,7 +724,7 @@
     }
 
   pg_interface_add_or_get (pg, if_id, gso_enabled, gso_size, coalesce_enabled,
-			   PG_MODE_ETHERNET);
+			   mode);
 
 done:
   unformat_free (line_input);
@@ -731,7 +736,8 @@
 VLIB_CLI_COMMAND (create_pg_if_cmd, static) = {
   .path = "create packet-generator",
   .short_help = "create packet-generator interface <interface name>"
-                " [gso-enabled gso-size <size> [coalesce-enabled]]",
+		" [gso-enabled gso-size <size> [coalesce-enabled]]"
+		" [mode <ethernet | ip4 | ip6>]",
   .function = create_pg_if_cmd_fn,
 };
 /* *INDENT-ON* */