From: Hiroyuki Mikita <h.mikita89@gmail.com>
To: cristian.dumitrescu@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] sched: fix releasing enqueued packets
Date: Thu, 1 Sep 2016 12:11:22 +0900 [thread overview]
Message-ID: <1472699482-1747-1-git-send-email-h.mikita89@gmail.com> (raw)
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 <h.mikita89@gmail.com>
---
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
next reply other threads:[~2016-09-01 3:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 3:11 Hiroyuki Mikita [this message]
2016-09-05 15:15 ` [dpdk-dev] [PATCH v2] " Hiroyuki Mikita
2016-09-15 14:33 ` Dumitrescu, Cristian
2016-09-23 19:17 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472699482-1747-1-git-send-email-h.mikita89@gmail.com \
--to=h.mikita89@gmail.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).