vcl: RX event may lost when accept session repeatedly
[vpp.git] / src / vat / api_format.c
index 6e1ebf9..ff61e9a 100644 (file)
@@ -1100,7 +1100,6 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
-  api_main_t *am = vlibapi_get_main ();
   void *oldheap;
   u8 *reply;
 
@@ -1109,14 +1108,12 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp)
   vat_json_object_add_uint (&node, "reply_in_shmem",
                            ntohl (mp->reply_in_shmem));
   /* Toss the shared-memory original... */
-  pthread_mutex_lock (&am->vlib_rp->mutex);
-  oldheap = svm_push_data_heap (am->vlib_rp);
+  oldheap = vl_msg_push_heap ();
 
   reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
   vec_free (reply);
 
-  svm_pop_heap (oldheap);
-  pthread_mutex_unlock (&am->vlib_rp->mutex);
+  vl_msg_pop_heap (oldheap);
 
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
@@ -2710,7 +2707,6 @@ static void vl_api_get_node_graph_reply_t_handler
   (vl_api_get_node_graph_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  api_main_t *am = vlibapi_get_main ();
   i32 retval = ntohl (mp->retval);
   u8 *pvt_copy, *reply;
   void *oldheap;
@@ -2735,13 +2731,11 @@ static void vl_api_get_node_graph_reply_t_handler
   pvt_copy = vec_dup (reply);
 
   /* Toss the shared-memory original... */
-  pthread_mutex_lock (&am->vlib_rp->mutex);
-  oldheap = svm_push_data_heap (am->vlib_rp);
+  oldheap = vl_msg_push_heap ();
 
   vec_free (reply);
 
-  svm_pop_heap (oldheap);
-  pthread_mutex_unlock (&am->vlib_rp->mutex);
+  vl_msg_pop_heap (oldheap);
 
   if (vam->graph_nodes)
     {
@@ -2773,7 +2767,6 @@ static void vl_api_get_node_graph_reply_t_handler_json
   (vl_api_get_node_graph_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  api_main_t *am = vlibapi_get_main ();
   void *oldheap;
   vat_json_node_t node;
   u8 *reply;
@@ -2786,13 +2779,11 @@ static void vl_api_get_node_graph_reply_t_handler_json
   reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
 
   /* Toss the shared-memory original... */
-  pthread_mutex_lock (&am->vlib_rp->mutex);
-  oldheap = svm_push_data_heap (am->vlib_rp);
+  oldheap = vl_msg_push_heap ();
 
   vec_free (reply);
 
-  svm_pop_heap (oldheap);
-  pthread_mutex_unlock (&am->vlib_rp->mutex);
+  vl_msg_pop_heap (oldheap);
 
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
@@ -13116,11 +13107,18 @@ static void vl_api_sw_interface_vhost_user_details_t_handler
   (vl_api_sw_interface_vhost_user_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
+  u64 features;
+
+  features =
+    clib_net_to_host_u32 (mp->features_first_32) | ((u64)
+                                                   clib_net_to_host_u32
+                                                   (mp->features_last_32) <<
+                                                   32);
 
   print (vam->ofp, "%-25s %3" PRIu32 " %6" PRIu32 " %8x %6d %7d %s",
         (char *) mp->interface_name,
         ntohl (mp->sw_if_index), ntohl (mp->virtio_net_hdr_sz),
-        clib_net_to_host_u64 (mp->features), mp->is_server,
+        features, mp->is_server,
         ntohl (mp->num_regions), (char *) mp->sock_filename);
   print (vam->ofp, "    Status: '%s'", strerror (ntohl (mp->sock_errno)));
 }
@@ -13144,8 +13142,10 @@ static void vl_api_sw_interface_vhost_user_details_t_handler_json
                                   mp->interface_name);
   vat_json_object_add_uint (node, "virtio_net_hdr_sz",
                            ntohl (mp->virtio_net_hdr_sz));
-  vat_json_object_add_uint (node, "features",
-                           clib_net_to_host_u64 (mp->features));
+  vat_json_object_add_uint (node, "features_first_32",
+                           clib_net_to_host_u32 (mp->features_first_32));
+  vat_json_object_add_uint (node, "features_last_32",
+                           clib_net_to_host_u32 (mp->features_last_32));
   vat_json_object_add_uint (node, "is_server", mp->is_server);
   vat_json_object_add_string_copy (node, "sock_filename", mp->sock_filename);
   vat_json_object_add_uint (node, "num_regions", ntohl (mp->num_regions));