memif: mode ip is not settable from binary API 68/8368/2
authorSteven <sluong@cisco.com>
Fri, 8 Sep 2017 22:40:32 +0000 (15:40 -0700)
committerDamjan Marion <dmarion.lists@gmail.com>
Mon, 11 Sep 2017 10:15:43 +0000 (10:15 +0000)
While mode ip is supported via the CLI for creating a memif interface,
it is not settable from the binary API due to missing code.

While at it, update the help usage to include the missing keyword secret.

Change-Id: Ia9c71f4017210a5e1733ce4992fbb566b7d20c1a
Signed-off-by: Steven <sluong@cisco.com>
src/plugins/memif/cli.c
src/plugins/memif/memif_api.c
src/plugins/memif/memif_test.c

index 8af7616..e1bd044 100644 (file)
@@ -109,8 +109,8 @@ VLIB_CLI_COMMAND (memif_create_command, static) = {
   .path = "create memif",
   .short_help = "create memif [id <id>] [socket <path>] "
                 "[ring-size <size>] [buffer-size <size>] [hw-addr <mac-address>] "
-               "<master|slave> [rx-queues <number>] [tx-queues <number>]"
-               "[mode ip]",
+               "<master|slave> [rx-queues <number>] [tx-queues <number>] "
+               "[mode ip] [secret <string>]",
   .function = memif_create_command_fn,
 };
 /* *INDENT-ON* */
index 89afdb8..07347bc 100644 (file)
@@ -133,6 +133,9 @@ vl_api_memif_create_t_handler (vl_api_memif_create_t * mp)
   /* role */
   args.is_master = (mp->role == 0);
 
+  /* mode */
+  args.mode = mp->mode;
+
   /* rx/tx queues */
   if (args.is_master == 0)
     {
index a7c23da..4ca7526 100644 (file)
@@ -129,7 +129,7 @@ api_memif_create (vat_main_t * vam)
   u32 rx_queues = MEMIF_DEFAULT_RX_QUEUES;
   u32 tx_queues = MEMIF_DEFAULT_TX_QUEUES;
   int ret;
-
+  u8 mode = MEMIF_INTERFACE_MODE_ETHERNET;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -148,6 +148,8 @@ api_memif_create (vat_main_t * vam)
       else if (unformat (i, "slave %U",
                         unformat_memif_queues, &rx_queues, &tx_queues))
        role = 1;
+      else if (unformat (i, "mode ip"))
+       mode = MEMIF_INTERFACE_MODE_IP;
       else if (unformat (i, "hw_addr %U", unformat_ethernet_address, hw_addr))
        ;
       else
@@ -177,6 +179,7 @@ api_memif_create (vat_main_t * vam)
 
   M (MEMIF_CREATE, mp);
 
+  mp->mode = mode;
   mp->id = clib_host_to_net_u32 (id);
   mp->role = role;
   mp->ring_size = clib_host_to_net_u32 (ring_size);
@@ -309,7 +312,7 @@ static void vl_api_memif_details_t_handler (vl_api_memif_details_t * mp)
 #define foreach_vpe_api_msg                                      \
 _(memif_create, "[id <id>] [socket <path>] [ring_size <size>] " \
                "[buffer_size <size>] [hw_addr <mac_address>] "   \
-               "<master|slave>")                                 \
+               "[secret <string>] [mode ip] <master|slave>")     \
 _(memif_delete, "<sw_if_index>")                                  \
 _(memif_dump, "")