From patchwork Thu Nov 21 19:22:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 63211 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2FDCA04C1; Thu, 21 Nov 2019 20:22:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 70F6D2BA3; Thu, 21 Nov 2019 20:22:48 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 91F34237; Thu, 21 Nov 2019 20:22:46 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xALJKaLE019956; Thu, 21 Nov 2019 11:22:44 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=y48vZYiv6s/EqEmpXPrMpZFx16QOreckeT2PAWMpGw0=; b=dhZv0PKuNOP3JNfOyHR5z8WYemuEn+njRPgIlYxplVLr+JksE5h18leBlVuD8Wo/3aQ+ CH90JCq5nG8+nkLX1u+2Rnq0tvOciAqfeUmATKsY3DYO0w/HtfWnX539RTMBrH95US1w TI5BJCOouFFuQ04Rp27T5ju3ZwBW+C3yKxh/ImgaTifqPdqIx0DE+V6GHVcWXyOUoBCi MyJfc6KGz/NhDU0ftdMEFQ27To/27L1AQ2eP4/8OkxBMt/wVhHVM/in8+eHJkQcHVlgh d9TT6J8REMC3vTa7TkmvnhmGqTSygXRnNfJaT7TCgGcnbbNioSZ57pIRmLXf7B1Hpmvy wg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2wc842fbhq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2019 11:22:44 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 21 Nov 2019 11:22:43 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 21 Nov 2019 11:22:43 -0800 Received: from BG-LT7430.marvell.com (unknown [10.28.17.72]) by maili.marvell.com (Postfix) with ESMTP id CA1F03F7040; Thu, 21 Nov 2019 11:22:41 -0800 (PST) From: To: CC: , Pavan Nikhilesh , Date: Fri, 22 Nov 2019 00:52:38 +0530 Message-ID: <20191121192240.12326-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-21_05:2019-11-21,2019-11-21 signatures=0 Subject: [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero 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" From: Pavan Nikhilesh Fix possible divide by zero condition when calculating percentages. Coverity Issue: 277205 Coverity Issue: 277234 Fixes: d008f20bce23 ("app/eventdev: add event timer adapter as a producer") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh --- app/test-eventdev/test_perf_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index e7cf75a7d..b3af4bfec 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -133,8 +133,9 @@ perf_event_timer_producer(void *arg) fflush(stdout); rte_delay_ms(1000); printf("%s(): lcore %d Average event timer arm latency = %.3f us\n", - __func__, rte_lcore_id(), (float)(arm_latency / count) / - (rte_get_timer_hz() / 1000000)); + __func__, rte_lcore_id(), + count ? (float)(arm_latency / count) / + (rte_get_timer_hz() / 1000000) : 0); return 0; } @@ -194,8 +195,9 @@ perf_event_timer_producer_burst(void *arg) fflush(stdout); rte_delay_ms(1000); printf("%s(): lcore %d Average event timer arm latency = %.3f us\n", - __func__, rte_lcore_id(), (float)(arm_latency / count) / - (rte_get_timer_hz() / 1000000)); + __func__, rte_lcore_id(), + count ? (float)(arm_latency / count) / + (rte_get_timer_hz() / 1000000) : 0); return 0; } From patchwork Thu Nov 21 19:22:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 63212 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD3C2A04C1; Thu, 21 Nov 2019 20:22:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 149DB2BE2; Thu, 21 Nov 2019 20:22:50 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C3AD8237; Thu, 21 Nov 2019 20:22:47 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xALJKbmP019966; Thu, 21 Nov 2019 11:22:47 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=rV+AZaONdAAdYJgIMmHixWVSC69wyKihsOzzJVnpiog=; b=lY2tD6LvGFcW1ZU3ezjDt9ZsBhzEmMdPXLeU27MoKjUIrWpPwspf8sQ14r+AD1Xw11zL UbuIQxDbUOusBjPTZa2yYzDTEC14MQnScFjsG3QbT3mseYq9FOw4asaGsnsA8xYEA41K 8K23WHAP8IsB9cWyJgFTut0jG25ooL3FYP1Xir0rQLFRne1BfaFTzYrkVFWZ4Z5fINEp yebxrSB+esAm3Vbgpof4XTq3xq8i37laWHkm9ovHkOqnGK4+ndnUOVb4C4lO2+eM0DGb pewNop7OJaq4CLqW4mXinUi8m9bY7G9RbPSx+YprD6YaifGjPer05Wxrqzbo7DAMo9lr Lg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2wc842fbhv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2019 11:22:46 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 21 Nov 2019 11:22:45 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 21 Nov 2019 11:22:45 -0800 Received: from BG-LT7430.marvell.com (unknown [10.28.17.72]) by maili.marvell.com (Postfix) with ESMTP id 5E9703F703F; Thu, 21 Nov 2019 11:22:44 -0800 (PST) From: To: CC: , Pavan Nikhilesh , Date: Fri, 22 Nov 2019 00:52:39 +0530 Message-ID: <20191121192240.12326-2-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191121192240.12326-1-pbhagavatula@marvell.com> References: <20191121192240.12326-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-21_05:2019-11-21,2019-11-21 signatures=0 Subject: [dpdk-dev] [PATCH 2/2] app/test-evnetdev: fix unchecked return value 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" From: Pavan Nikhilesh Fix unchecked return values reported by coverity. Coverity Issue: 336861 Coverity Issue: 349906 Fixes: 032a965a8f1d ("app/eventdev: support Tx adapter") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob --- app/test-eventdev/test_pipeline_common.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 160461fb2..fa91bf229 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -196,7 +196,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_eth_conf local_port_conf = port_conf; uint32_t caps = 0; - rte_event_eth_tx_adapter_caps_get(opt->dev_id, i, &caps); + ret = rte_event_eth_tx_adapter_caps_get(opt->dev_id, i, &caps); + if (ret != 0) { + evt_err("failed to get event tx adapter[%d] caps", i); + return ret; + } + if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)) t->internal_port = 0; @@ -424,7 +429,7 @@ int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt) { struct test_pipeline *t = evt_test_priv(test); - int i; + int i, ret; if (!opt->mbuf_sz) opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE; @@ -437,7 +442,13 @@ pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt) uint16_t data_size = 0; memset(&dev_info, 0, sizeof(dev_info)); - rte_eth_dev_info_get(i, &dev_info); + ret = rte_eth_dev_info_get(i, &dev_info); + if (ret != 0) { + evt_err("Error during getting device (port %u) info: %s\n", + i, strerror(-ret)); + return ret; + } + if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX && dev_info.rx_desc_lim.nb_mtu_seg_max != 0) { data_size = opt->max_pkt_sz /