aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2019-08-01 15:15:36 -0400
committerDave Barach <openvpp@barachs.net>2019-08-01 22:53:14 +0000
commit778ce573180618d4f694f91bd662d92b3eada725 (patch)
tree08363730d419f9f35e0307337647272b9ad301b3
parent49568afd2096600f5d6745385d81d873c8893e29 (diff)
interface: fix pcap tx/rx trace cli handling
Provide default packet_to_capture value. Display interface name correctly for "pcap tx/rx trace status". Type: fix Signed-off-by: John Lo <loj@cisco.com> Change-Id: I7064d0dbea236a9aff68bba7fbaf2c4a73b16c6f Signed-off-by: John Lo <loj@cisco.com>
-rw-r--r--src/vlib/main.h6
-rw-r--r--src/vnet/interface_cli.c13
-rw-r--r--src/vnet/interface_output.c2
-rw-r--r--src/vppinfra/pcap.h2
4 files changed, 7 insertions, 16 deletions
diff --git a/src/vlib/main.h b/src/vlib/main.h
index 9b6311601d3..dd28cb85e22 100644
--- a/src/vlib/main.h
+++ b/src/vlib/main.h
@@ -153,12 +153,6 @@ typedef struct vlib_main_t
/* pcap rx / tx tracing */
vnet_pcap_t pcap[VLIB_N_RX_TX];
- int pcap_enable;
- pcap_main_t pcap_main;
- u8 *pcap_filename;
- u32 pcap_sw_if_index;
- u32 pcap_pkts_to_capture;
-
/* Error handling. */
vlib_error_main_t error_main;
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index f990cdeeb5d..437854476b4 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -1700,8 +1700,6 @@ pcap_trace_command_internal (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd, int rx_tx)
{
-#define PCAP_DEF_PKT_TO_CAPTURE (1000)
-
unformat_input_t _line_input, *line_input = &_line_input;
u8 *filename;
u8 *chroot_filename = 0;
@@ -1722,6 +1720,8 @@ pcap_trace_command_internal (vlib_main_t * vm,
if (vm->pcap[rx_tx].pcap_enable == 0)
{
enabled = 1;
+ vm->pcap[rx_tx].pcap_main.n_packets_to_capture =
+ PCAP_DEF_PKT_TO_CAPTURE;
}
else
{
@@ -1812,9 +1812,7 @@ pcap_trace_command_internal (vlib_main_t * vm,
{
vlib_cli_output
(vm, "max is %d for any interface to file %s",
- vm->pcap[rx_tx].pcap_main.n_packets_to_capture ?
- vm->pcap[rx_tx].pcap_main.n_packets_to_capture
- : PCAP_DEF_PKT_TO_CAPTURE,
+ vm->pcap[rx_tx].pcap_main.n_packets_to_capture,
vm->pcap[rx_tx].pcap_main.file_name ?
(u8 *) vm->pcap[rx_tx].pcap_main.file_name :
(u8 *) "/tmp/vpe.pcap");
@@ -1822,10 +1820,7 @@ pcap_trace_command_internal (vlib_main_t * vm,
else
{
vlib_cli_output (vm, "max is %d for interface %U to file %s",
- vm->pcap[rx_tx].pcap_main.n_packets_to_capture
- ? vm->pcap[rx_tx].
- pcap_main.n_packets_to_capture :
- PCAP_DEF_PKT_TO_CAPTURE,
+ vm->pcap[rx_tx].pcap_main.n_packets_to_capture,
format_vnet_sw_if_index_name, vnm,
vm->pcap[rx_tx].pcap_sw_if_index,
vm->pcap[rx_tx].
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 884c00d93cf..b4832bf2bba 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -1407,7 +1407,7 @@ pcap_drop_trace_command_fn (vlib_main_t * vm,
clib_memset (&im->pcap_main, 0, sizeof (im->pcap_main));
im->pcap_main.file_name = (char *) im->pcap_filename;
- im->pcap_main.n_packets_to_capture = 100;
+ im->pcap_main.n_packets_to_capture = PCAP_DEF_PKT_TO_CAPTURE;
if (im->pcap_pkts_to_capture)
im->pcap_main.n_packets_to_capture = im->pcap_pkts_to_capture;
diff --git a/src/vppinfra/pcap.h b/src/vppinfra/pcap.h
index 893c67b7580..c3e1fef71f3 100644
--- a/src/vppinfra/pcap.h
+++ b/src/vppinfra/pcap.h
@@ -193,6 +193,8 @@ typedef struct
u32 min_packet_bytes, max_packet_bytes;
} pcap_main_t;
+#define PCAP_DEF_PKT_TO_CAPTURE (100)
+
#endif /* included_vppinfra_pcap_h */
/*