[dpdk-dev] [PATCH] rte_sched: release enqueued mbufs on rte_sched_port_free()
Stephen Hemminger
stephen at networkplumber.org
Wed Nov 4 19:14:26 CET 2015
On Wed, 28 Oct 2015 10:56:33 +0100
Simon Kagstrom <simon.kagstrom at netinsight.net> 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 <simon.kagstrom at netinsight.net>
Overall it looks good, and fixes a long standing bug.
Maybe good to expose it as a API function rte_sched_port_flush
to allow use from applications.
> +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]);
Please long expression over 80 characters onto multiple lines.
> 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;
> }
Please add blank line after declaration.
Ps: the rte_sched needs to be run through a reformatter. lots of whitespace issues.
More information about the dev
mailing list