interface: fix issue that pcap rx/tx trace not available when there are worker threads 42/20342/6
authorWei CHEN <weichen@astri.org>
Wed, 26 Jun 2019 03:01:15 +0000 (11:01 +0800)
committerDave Barach <openvpp@barachs.net>
Mon, 15 Jul 2019 11:09:53 +0000 (11:09 +0000)
Type: fix

Change-Id: Ie9a3a78b45b53344a0a5d7e2027c0e0354a49ebe
Signed-off-by: Wei CHEN <weichen@astri.org>
src/vnet/ethernet/node.c
src/vnet/interface_output.c

index eabcf42..4640540 100755 (executable)
@@ -990,7 +990,7 @@ ethernet_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
     }
 
   /* rx pcap capture if enabled */
-  if (PREDICT_FALSE (vm->pcap[VLIB_RX].pcap_enable))
+  if (PREDICT_FALSE (vlib_global_main.pcap[VLIB_RX].pcap_enable))
     {
       u32 bi0;
 
@@ -1003,11 +1003,12 @@ ethernet_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
          from++;
          b0 = vlib_get_buffer (vm, bi0);
 
-         if (vm->pcap[VLIB_RX].pcap_sw_if_index == 0 ||
-             vm->pcap[VLIB_RX].pcap_sw_if_index
+         if (vlib_global_main.pcap[VLIB_RX].pcap_sw_if_index == 0 ||
+             vlib_global_main.pcap[VLIB_RX].pcap_sw_if_index
              == vnet_buffer (b0)->sw_if_index[VLIB_RX])
            {
-             pcap_add_buffer (&vm->pcap[VLIB_RX].pcap_main, vm, bi0, 512);
+             pcap_add_buffer (&vlib_global_main.pcap[VLIB_RX].pcap_main, vm,
+                              bi0, 512);
            }
          n_left--;
        }
index 2a41271..1a9f5db 100644 (file)
@@ -800,7 +800,7 @@ static_always_inline void vnet_interface_pcap_tx_trace
   u32 n_left_from, *from;
   u32 sw_if_index;
 
-  if (PREDICT_TRUE (vm->pcap[VLIB_TX].pcap_enable == 0))
+  if (PREDICT_TRUE (vlib_global_main.pcap[VLIB_TX].pcap_enable == 0))
     return;
 
   if (sw_if_index_from_buffer == 0)
@@ -822,9 +822,10 @@ static_always_inline void vnet_interface_pcap_tx_trace
       if (sw_if_index_from_buffer)
        sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
 
-      if (vm->pcap[VLIB_TX].pcap_sw_if_index == 0 ||
-         vm->pcap[VLIB_TX].pcap_sw_if_index == sw_if_index)
-       pcap_add_buffer (&vm->pcap[VLIB_TX].pcap_main, vm, bi0, 512);
+      if (vlib_global_main.pcap[VLIB_TX].pcap_sw_if_index == 0 ||
+         vlib_global_main.pcap[VLIB_TX].pcap_sw_if_index == sw_if_index)
+       pcap_add_buffer (&vlib_global_main.pcap[VLIB_TX].pcap_main, vm, bi0,
+                        512);
       from++;
       n_left_from--;
     }