misc: clean up "pcap [rx|tx] trace" debug CLI

Separate debug CLI arg parsing from the underlying action
function. Fixes a number of subtle ordering dependencies, and will
allow us to add a binary API to control the feature at some point in
the future.

Type: refactor
Ticket: VPP-1770

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: Id0dbeda06dad20e756c941c691e2088ce3c50ec7
(cherry picked from commit b97641c79f4aaf0069268c550f263167ddea2b34)
This commit is contained in:
Dave Barach
2019-09-09 16:38:17 -04:00
parent 1dafb7fd83
commit 4b943d6328
4 changed files with 197 additions and 169 deletions

View File

@ -0,0 +1,34 @@
set term pag off
loop create
loop create
set int ip address loop0 192.168.1.1/24
set int state loop0 up
set int ip address loop1 192.168.2.1/24
set int state loop1 up
packet-generator new {
name pg0
limit 1
size 300-300
interface loop0
node ethernet-input
data { IP4: 1.2.3 -> 4.5.6
UDP: 192.168.1.10 -> 192.168.2.10
UDP: 1234 -> 2345
incrementing 286
}
}
packet-generator new {
name pg1
limit 1
size 300-300
interface loop1
node ethernet-input
data { IP4: 1.2.3 -> 4.5.6
UDP: 192.168.2.10 -> 192.168.1.10
UDP: 1234 -> 2345
incrementing 286
}
}

View File

@ -2202,7 +2202,7 @@ vlib_pcap_dispatch_trace_configure (vlib_pcap_dispatch_trace_args_t * a)
return -81; /* VNET_API_ERROR_VALUE_EXIST */
/* Change number of packets to capture while capturing */
if (vm->dispatch_pcap_enable
if (vm->dispatch_pcap_enable && a->enable
&& (pm->n_packets_to_capture != a->packets_to_capture))
return -8; /* VNET_API_ERROR_INVALID_VALUE_2 */

View File

@ -893,6 +893,18 @@ void vnet_register_format_buffer_opaque_helper
void vnet_register_format_buffer_opaque2_helper
(vnet_buffer_opquae_formatter_t fn);
typedef struct
{
u8 *filename;
int enable;
int status;
u32 packets_to_capture;
vlib_rx_or_tx_t rxtx;
u32 sw_if_index;
} vnet_pcap_dispatch_trace_args_t;
int vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t *);
#endif /* included_vnet_interface_h */
/*

File diff suppressed because it is too large Load Diff