From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B112A04DD; Fri, 20 Nov 2020 18:50:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 457F0DED; Fri, 20 Nov 2020 18:50:25 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id A3D0523D for ; Fri, 20 Nov 2020 18:50:23 +0100 (CET) IronPort-SDR: akjZBGzsU0m2aogypzX+zPcHST+OIyJ9m9WJgCYLa811U1T4sX6kJkV+JWPOhivBBfG4y+8V/u wU73sUt+Vh4w== X-IronPort-AV: E=McAfee;i="6000,8403,9811"; a="256223087" X-IronPort-AV: E=Sophos;i="5.78,357,1599548400"; d="scan'208";a="256223087" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2020 09:50:19 -0800 IronPort-SDR: TanXR+u3glMXbPhVhsa+XN7Bj6cfcpHpEjPqCgdHP4lDRCJ8f9VHhNbqq6DOIPJ8rFZm1wdX5Y o1YwBd9cK+Ag== X-IronPort-AV: E=Sophos;i="5.78,357,1599548400"; d="scan'208";a="331397172" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.243.199]) ([10.213.243.199]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2020 09:50:17 -0800 To: Jiawei Wang , wenzhuo.lu@intel.com, beilei.xing@intel.com, bernard.iremonger@intel.com, orika@nvidia.com, viacheslavo@nvidia.com, thomas@monjalon.net, rasland@nvidia.com Cc: dev@dpdk.org References: <1605355308-427475-1-git-send-email-jiaweiw@nvidia.com> <1605893733-84486-1-git-send-email-jiaweiw@nvidia.com> From: Ferruh Yigit Message-ID: <5ce906d3-3790-a076-0744-309a8c860e85@intel.com> Date: Fri, 20 Nov 2020 17:50:13 +0000 MIME-Version: 1.0 In-Reply-To: <1605893733-84486-1-git-send-email-jiaweiw@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: fix testpmd packets dump overlapping X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 <...> > @@ -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?