From patchwork Fri Jun 14 17:19:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 54811 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 757FD1D595; Fri, 14 Jun 2019 19:19:46 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 223301D587 for ; Fri, 14 Jun 2019 19:19:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 10:19:43 -0700 X-ExtLoop1: 1 Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.223.78]) by orsmga008.jf.intel.com with ESMTP; 14 Jun 2019 10:19:41 -0700 From: Ferruh Yigit To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, Sunil Kumar Kori , YufengX Mo Date: Fri, 14 Jun 2019 18:19:39 +0100 Message-Id: <20190614171939.94095-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] app/testpmd: fix crash 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" Testpmd tries to calculate mbuf size based on "max Rx packet size" and "max MTU segment number". When driver set a "nb_mtu_seg_max" to zero, it causes division by zero segmentation fault in testpmd. If the PMD set "nb_mtu_seg_max" to zero, testpmd shouldn't try to calculate the mbuf size. Fixes: 33f9630fc23d ("app/testpmd: create mbuf based on max supported segments") Signed-off-by: Ferruh Yigit --- Cc: Sunil Kumar Kori Cc: YufengX Mo --- app/test-pmd/testpmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0f2fffec3..4e958bc44 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1174,7 +1174,8 @@ init_config(void) /* Check for maximum number of segments per MTU. Accordingly * update the mbuf data size. */ - if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX) { + if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX && + port->dev_info.rx_desc_lim.nb_mtu_seg_max != 0) { data_size = rx_mode.max_rx_pkt_len / port->dev_info.rx_desc_lim.nb_mtu_seg_max;