From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ernst.netinsight.se (ernst.netinsight.se [194.16.221.21]) by dpdk.org (Postfix) with SMTP id B058B8E7B for ; Wed, 4 Nov 2015 08:49:48 +0100 (CET) Received: from [10.100.1.152] (unverified [10.100.1.152]) by ernst.netinsight.se (EMWAC SMTPRS 0.83) with SMTP id ; Wed, 04 Nov 2015 08:49:45 +0100 To: cristian.dumitrescu@intel.com References: <20151028105633.6a507c98@miho> From: =?UTF-8?Q?Simon_K=c3=a5gstr=c3=b6m?= Message-ID: <5639B899.7080006@netinsight.net> Date: Wed, 4 Nov 2015 08:49:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151028105633.6a507c98@miho> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] rte_sched: release enqueued mbufs on rte_sched_port_free() 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: Wed, 04 Nov 2015 07:49:48 -0000 Ping? (CC:ing Stephen Hemminger as well) // Simon On 2015-10-28 10:56, Simon Kagstrom wrote: > Otherwise mbufs will leak when the port is destroyed. The > rte_sched_port_qbase() and rte_sched_port_qsize() functions are used > in free now, so move them up. > > Signed-off-by: Simon Kagstrom > --- > lib/librte_sched/rte_sched.c | 44 +++++++++++++++++++++++++++----------------- > 1 file changed, 27 insertions(+), 17 deletions(-) > > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c > index 9c9419d..81462cd 100644 > --- a/lib/librte_sched/rte_sched.c > +++ b/lib/librte_sched/rte_sched.c > @@ -312,6 +312,23 @@ rte_sched_port_queues_per_port(struct rte_sched_port *port) > return RTE_SCHED_QUEUES_PER_PIPE * port->n_pipes_per_subport * port->n_subports_per_port; > } > > +static inline struct rte_mbuf ** > +rte_sched_port_qbase(struct rte_sched_port *port, uint32_t qindex) > +{ > + uint32_t pindex = qindex >> 4; > + uint32_t qpos = qindex & 0xF; > + > + return (port->queue_array + pindex * port->qsize_sum + port->qsize_add[qpos]); > +} > + > +static inline uint16_t > +rte_sched_port_qsize(struct rte_sched_port *port, uint32_t qindex) > +{ > + uint32_t tc = (qindex >> 2) & 0x3; > + > + return port->qsize[tc]; > +} > + > static int > rte_sched_port_check_params(struct rte_sched_port_params *params) > { > @@ -717,11 +734,21 @@ rte_sched_port_config(struct rte_sched_port_params *params) > void > rte_sched_port_free(struct rte_sched_port *port) > { > + unsigned int queue; > /* Check user parameters */ > if (port == NULL){ > return; > } > > + /* Free enqueued mbufs */ > + for (queue = 0; queue < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; queue++) { > + unsigned int i; > + struct rte_mbuf **mbufs = rte_sched_port_qbase(port, queue); > + > + for (i = 0; i < rte_sched_port_qsize(port, queue); i++) > + rte_pktmbuf_free(mbufs[i]); > + } > + > rte_bitmap_free(port->bmp); > rte_free(port); > } > @@ -1032,23 +1059,6 @@ rte_sched_port_qindex(struct rte_sched_port *port, uint32_t subport, uint32_t pi > return result; > } > > -static inline struct rte_mbuf ** > -rte_sched_port_qbase(struct rte_sched_port *port, uint32_t qindex) > -{ > - uint32_t pindex = qindex >> 4; > - uint32_t qpos = qindex & 0xF; > - > - return (port->queue_array + pindex * port->qsize_sum + port->qsize_add[qpos]); > -} > - > -static inline uint16_t > -rte_sched_port_qsize(struct rte_sched_port *port, uint32_t qindex) > -{ > - uint32_t tc = (qindex >> 2) & 0x3; > - > - return port->qsize[tc]; > -} > - > #if RTE_SCHED_DEBUG > > static inline int >