From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0EFB61BBCE; Fri, 27 Oct 2017 18:24:44 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Oct 2017 09:24:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,304,1505804400"; d="scan'208";a="1236185457" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga002.fm.intel.com with SMTP; 27 Oct 2017 09:24:25 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 27 Oct 2017 18:24:11 +0200 From: Daniel Mrzyglod To: dev@dpdk.org Cc: Daniel Mrzyglod , cunming.liang@intel.com, stable@dpdk.org Date: Fri, 27 Oct 2017 18:24:08 +0200 Message-Id: <20171027162408.90288-1-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013142057.54980-1-michalx.k.jastrzebski@intel.com> References: <20171013142057.54980-1-michalx.k.jastrzebski@intel.com> Subject: [dpdk-dev] [PATCH v2] test/pmd_perf: fix for segmentation fault 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: , X-List-Received-Date: Fri, 27 Oct 2017 16:24:45 -0000 Error can be reproduce if we run pmd_perf_autotest with more then one device in such way: RTE>>set_rxtx_sc poll_before_xmit RTE>>pmd_perf_autotest if first burst was value less than MAX_PKT_BURST in the end we overwrite pkts_burst table for rx which was supposed for another interface. Fixes: 002ade70e933 ("app/test: measure cycles per packet in Rx/Tx") Cc: cunming.liang@intel.com Cc: stable@dpdk.org Signed-off-by: Daniel Mrzyglod --- test/test/test_pmd_perf.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index a3e29ed..255f260 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -572,6 +572,7 @@ poll_burst(void *args) unsigned i, portid, nb_rx = 0; uint64_t total; uint64_t timeout = MAX_IDLE; + int num[RTE_MAX_ETHPORTS]; lcore_id = rte_lcore_id(); conf = &lcore_conf[lcore_id]; @@ -591,6 +592,7 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; next[portid] = i * pkt_per_port; + num[portid] = pkt_per_port; } while (!rte_atomic64_read(&start)) @@ -601,8 +603,8 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; nb_rx = rte_eth_rx_burst(portid, 0, - &pkts_burst[next[portid]], - MAX_PKT_BURST); + &pkts_burst[next[portid]], + RTE_MIN(MAX_PKT_BURST, num[portid])); if (unlikely(nb_rx == 0)) { timeout--; if (unlikely(timeout == 0)) @@ -610,6 +612,7 @@ poll_burst(void *args) continue; } next[portid] += nb_rx; + num[portid] -= nb_rx; total -= nb_rx; } } @@ -618,7 +621,6 @@ poll_burst(void *args) printf("%"PRIu64" packets lost, IDLE %"PRIu64" times\n", total, MAX_IDLE - timeout); - /* clean up */ total = pkt_per_port * conf->nb_ports - total; for (i = 0; i < total; i++) @@ -644,7 +646,7 @@ exec_burst(uint32_t flags, int lcore) conf = &lcore_conf[lcore]; pkt_per_port = MAX_TRAFFIC_BURST; - num = pkt_per_port; + num = pkt_per_port * conf->nb_ports; rte_atomic64_init(&start); @@ -661,11 +663,12 @@ exec_burst(uint32_t flags, int lcore) nb_tx = RTE_MIN(MAX_PKT_BURST, num); for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - rte_eth_tx_burst(portid, 0, + nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx); idx += nb_tx; + num -= nb_tx; } - num -= nb_tx; + } sleep(5); -- 2.7.4