From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f67.google.com (mail-pa0-f67.google.com [209.85.220.67]) by dpdk.org (Postfix) with ESMTP id E56D137A6 for ; Thu, 1 Sep 2016 05:11:43 +0200 (CEST) Received: by mail-pa0-f67.google.com with SMTP id vy10so3507918pac.0 for ; Wed, 31 Aug 2016 20:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=8ZiCzoAr6gGpRjYLR3rtLXdXoKRqbmUEo2/kMbUJx0w=; b=ucff3c8iE75q9tpa/Jt6nPblIiLD59c4o287Ggm+GXHvOP79osLd7mX7+MfyPkH0fd YQ8wW5RUqQi4G5bZfk8FaXxFsA6oE4o7Et5XZlOI5IQl+fPlgXFnlYwfemlOoYzsuEfL LVCCD1U06FQGB332VPsFi2avazzpu/NSwL2tMuzD2PnZ6+K8taP4+n4SPGtmYcNsPFTD 8E/K91wE9caagQlTOwFXrwe4/aP4H+7ps5cwbM+4ZWG5FPAAJVSCgJ6OErTPbnfG85wO DG0s04IHQLyi0fKLzVUX7/eBQu/rpHsHpCZeDU/QIqbkx3ttq+Vd+drkRYSBrnK2I7zo 31ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8ZiCzoAr6gGpRjYLR3rtLXdXoKRqbmUEo2/kMbUJx0w=; b=U+AwhvBrqMOQToI1SLvvEjd4YpZdViX+vKulBAcqK6OYgX0MfHGxSWeh2h7xADxErQ MynB7+fmbtiPJhPfqCIp2ZU34oyN2H5roH23vqqjv7uKXUVAI6A05UWdrJ8h6zTg0Ijw TtZ5Ys67ZoKtd0XaYfUg4JuVnF308/nnoN+BTeV4Q1yUXi268n6NJXezlVB9P51F9JpT ruKqy1jApSx9EJlro1xf9HVvFcoNsFZLv66R1DLP/ZzWmWOhiw/8gU5/+X/SNAp6+Xhf 16quNK4nEsbv0C3IhV8fmG7J+8Znm+vy8cGXo5y+xqakZzTR+4pyUXidmPLf6DwxlCmc ugtg== X-Gm-Message-State: AE9vXwMYzn6aSzzBkiQcV1H07LuUxHpmPg6zkEkrku2grAroYWkaktZRj0Ydty5WkyzF6Q== X-Received: by 10.66.25.8 with SMTP id y8mr22743767paf.64.1472699491330; Wed, 31 Aug 2016 20:11:31 -0700 (PDT) Received: from localhost.localdomain (183.180.67.214.ap.gmobb-fix.jp. [183.180.67.214]) by smtp.gmail.com with ESMTPSA id l81sm2780791pfi.50.2016.08.31.20.11.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Aug 2016 20:11:30 -0700 (PDT) From: Hiroyuki Mikita To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org Date: Thu, 1 Sep 2016 12:11:22 +0900 Message-Id: <1472699482-1747-1-git-send-email-h.mikita89@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] sched: fix releasing enqueued packets 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: , X-List-Received-Date: Thu, 01 Sep 2016 03:11:44 -0000 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 --- lib/librte_sched/rte_sched.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 8696423..371003e 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -734,19 +734,24 @@ 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_QUEUES_PER_PIPE * + port->n_pipes_per_subport * port->n_subports_per_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++) + rte_pktmbuf_free(mbufs[qr]); } rte_bitmap_free(port->bmp); -- 2.7.4