From patchwork Wed Mar 2 21:19:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasvinder Singh X-Patchwork-Id: 11001 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C9DF7295B; Wed, 2 Mar 2016 22:13:32 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 45A102949 for ; Wed, 2 Mar 2016 22:13:31 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2016 13:13:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,530,1449561600"; d="scan'208";a="756976422" Received: from sie-lab-212-251.ir.intel.com (HELO silpixa00381635.ir.intel.com) ([10.237.212.251]) by orsmga003.jf.intel.com with ESMTP; 02 Mar 2016 13:13:13 -0800 From: Jasvinder Singh To: dev@dpdk.org Date: Wed, 2 Mar 2016 21:19:29 +0000 Message-Id: <1456953569-40406-1-git-send-email-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.5.0 Subject: [dpdk-dev] [PATCH] librte_port: fix segmentation fault for ethdev writer nodrop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Error log: [APP] Initializing PIPELINE0 ... pipeline> [APP] Initializing PIPELINE1 ... [PIPELINE1] Pass-through Segmentation fault (core dumped) Fixes: 304c8091e90a ("port: add ethdev writer nodrop") Signed-off-by: Jasvinder Singh Acked-by: Cristian Dumitrescu --- lib/librte_port/rte_port_ethdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index 1f0c81c..1c34602 100644 --- a/lib/librte_port/rte_port_ethdev.c +++ b/lib/librte_port/rte_port_ethdev.c @@ -390,16 +390,20 @@ send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p) p->tx_buf_count); /* We sent all the packets in a first try */ - if (nb_tx >= p->tx_buf_count) + if (nb_tx >= p->tx_buf_count) { + p->tx_buf_count = 0; return; + } for (i = 0; i < p->n_retries; i++) { nb_tx += rte_eth_tx_burst(p->port_id, p->queue_id, p->tx_buf + nb_tx, p->tx_buf_count - nb_tx); /* We sent all the packets in more than one try */ - if (nb_tx >= p->tx_buf_count) + if (nb_tx >= p->tx_buf_count) { + p->tx_buf_count = 0; return; + } } /* We didn't send the packets in maximum allowed attempts */