On 11/20/2020 5:35 PM, Jiawei Wang wrote:
When testpmd enabled the verbosity for the received packets, if two packets
were received at the same time, for example, sampling packet and normal
packet, the dump output of these packets may be overlapping due to multiple
core handling the multiple queues simultaneously.
The patch uses one string buffer that collects all the packet dump output
into this buffer and then printouts it at last, that guarantees to printout
separately the dump output per packet.
Fixes: d862c45 ("app/testpmd: move dumping packets to a separate function")
Signed-off-by: Jiawei Wang <jiaw...@nvidia.com>
<...>
@@ -74,13 +85,16 @@
uint32_t vx_vni;
const char *reason;
int dynf_index;
+ int buf_size = MAX_STRING_LEN;
+ char print_buf[buf_size];
+ int cur_len = 0;
+ memset(print_buf, 0, sizeof(print_buf));
Should 'print_buf' cleaned per each packet below, if not can we drop 'memset'
completely?
<...>
+ if (cur_len >= buf_size) {
+ printf("%s ...\n", print_buf);
+ break;
Why break here? Wouldn't just append some chars to indicate trancation and
continue be OK?