From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9F14D6CD1 for ; Wed, 12 Oct 2016 12:26:37 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 12 Oct 2016 03:26:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,333,1473145200"; d="scan'208";a="1063752665" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 12 Oct 2016 03:26:32 -0700 Date: Wed, 12 Oct 2016 18:27:22 +0800 From: Yuanhan Liu To: Hiroyuki Mikita Cc: dpdk stable , Cristian Dumitrescu Message-ID: <57fe100a.ndL9QUZi69oSJ3b1%yuanhan.liu@linux.intel.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [dpdk-stable] patch 'sched: fix releasing enqueued packets' has been queued to stable release 16.07.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2016 10:26:38 -0000 Hi, FYI, your patch has been queued to stable release 16.07.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before this Friday. So please shutout if anyone has objections. Thanks. --yliu --- >>From 39bc45ed9424583d9250a9e98d95d7801f8bb7e2 Mon Sep 17 00:00:00 2001 From: Hiroyuki Mikita Date: Tue, 6 Sep 2016 00:15:14 +0900 Subject: [PATCH] sched: fix releasing enqueued packets [ upstream commit 7b3c4f351708a4bf5d311266d9f8c32e5704701f ] rte_sched_port_free should release only enqueued packets of all queues. Previous behavior is that enqueued and already dequeued packets of only first 4 queues are released. Fixes: 61383240 ("sched: release enqueued mbufs when freeing port") Signed-off-by: Hiroyuki Mikita Acked-by: Cristian Dumitrescu --- lib/librte_sched/rte_sched.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 8696423..e6dace2 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -734,19 +734,23 @@ rte_sched_port_config(struct rte_sched_port_params *params) void rte_sched_port_free(struct rte_sched_port *port) { - unsigned int queue; + uint32_t qindex; + uint32_t n_queues_per_port = rte_sched_port_queues_per_port(port); /* Check user parameters */ if (port == NULL) return; /* Free enqueued mbufs */ - for (queue = 0; queue < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; queue++) { - struct rte_mbuf **mbufs = rte_sched_port_qbase(port, queue); - unsigned int i; - - for (i = 0; i < rte_sched_port_qsize(port, queue); i++) - rte_pktmbuf_free(mbufs[i]); + for (qindex = 0; qindex < n_queues_per_port; qindex++) { + struct rte_mbuf **mbufs = rte_sched_port_qbase(port, qindex); + uint16_t qsize = rte_sched_port_qsize(port, qindex); + struct rte_sched_queue *queue = port->queue + qindex; + uint16_t qr = queue->qr & (qsize - 1); + uint16_t qw = queue->qw & (qsize - 1); + + for (; qr != qw; qr = (qr + 1) & (qsize - 1)) + rte_pktmbuf_free(mbufs[qr]); } rte_bitmap_free(port->bmp); -- 1.9.0