tapv2: add "tap_flags" field to the TAPv2 interface API 19/16719/3
authorAndrew Yourtchenko <ayourtch@gmail.com>
Mon, 7 Jan 2019 19:56:46 +0000 (20:56 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Mon, 7 Jan 2019 21:59:10 +0000 (21:59 +0000)
Change-Id: I26f99d95f52c9fe107d17dcbbf5c6185523beade
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
src/vat/api_format.c
src/vnet/devices/tap/tap.h
src/vnet/devices/tap/tapv2.api
src/vnet/devices/tap/tapv2_api.c

index db22f29..1b61af6 100644 (file)
@@ -12713,11 +12713,11 @@ static void vl_api_sw_interface_tap_v2_details_t_handler
                    mp->host_ip6_prefix_len);
 
   print (vam->ofp,
-        "\n%-16s %-12d %-5d %-12d %-12d %-14U %-30s %-20s %-20s %-30s",
+        "\n%-16s %-12d %-5d %-12d %-12d %-14U %-30s %-20s %-20s %-30s 0x%-08x",
         mp->dev_name, ntohl (mp->sw_if_index), ntohl (mp->id),
         ntohs (mp->rx_ring_sz), ntohs (mp->tx_ring_sz),
         format_ethernet_address, mp->host_mac_addr, mp->host_namespace,
-        mp->host_bridge, ip4, ip6);
+        mp->host_bridge, ip4, ip6, ntohl (mp->tap_flags));
 
   vec_free (ip4);
   vec_free (ip6);
@@ -12739,6 +12739,7 @@ static void vl_api_sw_interface_tap_v2_details_t_handler_json
   vat_json_init_object (node);
   vat_json_object_add_uint (node, "id", ntohl (mp->id));
   vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
+  vat_json_object_add_uint (node, "tap_flags", ntohl (mp->tap_flags));
   vat_json_object_add_string_copy (node, "dev_name", mp->dev_name);
   vat_json_object_add_uint (node, "rx_ring_sz", ntohs (mp->rx_ring_sz));
   vat_json_object_add_uint (node, "tx_ring_sz", ntohs (mp->tx_ring_sz));
index 7aebade..19dc88d 100644 (file)
@@ -29,6 +29,7 @@ typedef struct
   u8 mac_addr[6];
   u16 rx_ring_sz;
   u16 tx_ring_sz;
+  u32 tap_flags;
   u8 *host_namespace;
   u8 *host_if_name;
   u8 host_mac_addr[6];
@@ -52,6 +53,7 @@ typedef struct
 {
   u32 id;
   u32 sw_if_index;
+  u32 tap_flags;
   u8 dev_name[64];
   u16 tx_ring_sz;
   u16 rx_ring_sz;
index e65102c..fb90483 100644 (file)
@@ -47,6 +47,7 @@ option version = "2.0.0";
     @param host_ip4_gw - host IPv4 default gateway
     @param host_ip6_gw_set - host IPv6 default gateway should be set
     @param host_ip6_gw - host IPv6 default gateway
+    @param tap_flags - flags for the TAP interface creation
 */
 define tap_create_v2
 {
@@ -76,6 +77,7 @@ define tap_create_v2
   u8 host_ip6_gw_set;
   u8 host_ip6_gw[16];
   u8 tag[64];
+  u32 tap_flags;
 };
 
 /** \brief Reply for tap create reply
@@ -140,6 +142,7 @@ define sw_interface_tap_v2_details
   u8 host_ip4_prefix_len;
   u8 host_ip6_addr[16];
   u8 host_ip6_prefix_len;
+  u32 tap_flags;
 };
 
 /*
index e70d63f..1260afd 100644 (file)
@@ -109,6 +109,8 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
       ap->host_ip6_gw_set = 1;
     }
 
+  ap->tap_flags = ntohl (mp->tap_flags);
+
   tap_create_if (vm, ap);
 
   reg = vl_api_client_index_to_registration (mp->client_index);
@@ -194,6 +196,7 @@ tap_send_sw_interface_details (vpe_api_main_t * am,
   mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_TAP_V2_DETAILS);
   mp->id = htonl (tap_if->id);
   mp->sw_if_index = htonl (tap_if->sw_if_index);
+  mp->tap_flags = htonl (tap_if->tap_flags);
   clib_memcpy (mp->dev_name, tap_if->dev_name,
               MIN (ARRAY_LEN (mp->dev_name) - 1,
                    strlen ((const char *) tap_if->dev_name)));