* [dpdk-dev] [PATCH] sched: fix releasing enqueued packets
@ 2016-09-01 3:11 Hiroyuki Mikita
2016-09-05 15:15 ` [dpdk-dev] [PATCH v2] " Hiroyuki Mikita
0 siblings, 1 reply; 4+ messages in thread
From: Hiroyuki Mikita @ 2016-09-01 3:11 UTC (permalink / raw)
To: cristian.dumitrescu; +Cc: dev
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] sched: fix releasing enqueued packets
2016-09-01 3:11 [dpdk-dev] [PATCH] sched: fix releasing enqueued packets Hiroyuki Mikita
@ 2016-09-05 15:15 ` Hiroyuki Mikita
2016-09-15 14:33 ` Dumitrescu, Cristian
0 siblings, 1 reply; 4+ messages in thread
From: Hiroyuki Mikita @ 2016-09-05 15:15 UTC (permalink / raw)
To: cristian.dumitrescu; +Cc: dev
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>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] sched: fix releasing enqueued packets
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
0 siblings, 1 reply; 4+ messages in thread
From: Dumitrescu, Cristian @ 2016-09-15 14:33 UTC (permalink / raw)
To: Hiroyuki Mikita; +Cc: dev
> -----Original Message-----
> From: Hiroyuki Mikita [mailto:h.mikita89@gmail.com]
> Sent: Monday, September 5, 2016 4:15 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v2] sched: fix releasing enqueued packets
>
> 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>
> ---
> 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
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Thank you!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] sched: fix releasing enqueued packets
2016-09-15 14:33 ` Dumitrescu, Cristian
@ 2016-09-23 19:17 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-09-23 19:17 UTC (permalink / raw)
To: Hiroyuki Mikita; +Cc: dev, Dumitrescu, Cristian
> > 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>
>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>
> Thank you!
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-23 19:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 3:11 [dpdk-dev] [PATCH] sched: fix releasing enqueued packets Hiroyuki Mikita
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
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).