From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by dpdk.org (Postfix) with ESMTP id 60C335687 for ; Mon, 5 Sep 2016 17:15:28 +0200 (CEST) Received: by mail-pf0-f195.google.com with SMTP id i6so9933144pfe.0 for ; Mon, 05 Sep 2016 08:15:28 -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:in-reply-to:references; bh=RHJMAJwJF74wT7gai+7VR/BIAglDK9xXGXxqq7s9YP4=; b=dM79/48Tlixulhjf63nziQoFmjQLbVofTvY4dRopixvtQXOFi+yJYy+fb+irzfsEiX XzE5cp9F2eqni1ORoqjCrlrkDgKm420I5yk4d2Hfq4F8BARQZ3e9lQOSn3GYqkxfgW1b bFz9QiT8ZfzdiXt0faLaq3YmdKz0jc5eLWeeQ94S6jWj4xjI43xQxlF17kJ+AXNma/FU 7nZj6pEP7Cb4fxfhZ7pxX0OnTBZz084CcwaR+DmgW58OGQJQaapfaWBNdJDTO390dAeg dw12j+y3lEpdmKNgZVKtK6sCMCw2ysmSEqhOZjmu6Z0lNGwXH5epQGcRm3QqXCEfLYgi HQ8A== 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:in-reply-to :references; bh=RHJMAJwJF74wT7gai+7VR/BIAglDK9xXGXxqq7s9YP4=; b=bjGPz/QpcFv6bBnUYaMwpqnaDFy4rY/TQrO3ucK4mE+1yO/A+5I8gxwcRSklr0vBN3 QTSwSzeZHGvz4V9A5wH7uXLQyqEZjMq9RPrLNJp2KOg/nT1q2a5vYhhSpRqU7TyQcQ3V NAhxbD6Td0sZJOeWkjjQE0jeab0+XtcXS0x2yUzSqGYmhAGdBh4eoBGVkAEfNyhwCTrS GLyj2dkZnbL3wYLW7wqeFmNmvdZvAFvMaAJcL9iNsJ2KeaBID6zinATItDXQZPMf9Uf5 nB/Z8EAHOIEMMptOoD47FgyA67iX38HozZ8maDObenmMH4hQoutqyhQ3rGAiforUHfBU jPzA== X-Gm-Message-State: AE9vXwNkT7QCAHmnM3RmnOlWz4WP4kek/Q9c0ZpNRNvNMLbnfOeDaPYzbs0W0LRhMs4oOw== X-Received: by 10.98.68.148 with SMTP id m20mr64948968pfi.0.1473088527559; Mon, 05 Sep 2016 08:15:27 -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 l74sm6304024pfi.95.2016.09.05.08.15.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Sep 2016 08:15:27 -0700 (PDT) From: Hiroyuki Mikita To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org Date: Tue, 6 Sep 2016 00:15:14 +0900 Message-Id: <1473088514-31836-1-git-send-email-h.mikita89@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472699482-1747-1-git-send-email-h.mikita89@gmail.com> References: <1472699482-1747-1-git-send-email-h.mikita89@gmail.com> Subject: [dpdk-dev] [PATCH v2] 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: Mon, 05 Sep 2016 15:15:28 -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 --- v2: * use rte_sched_port_queues_per_port to get the number of queues * mask incremented qr by qsize - 1 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); -- 2.7.4