From: Yongseok Koh <yskoh@mellanox.com>
To: Ori Kam <orika@mellanox.com>
Cc: Shahaf Shuler <shahafs@mellanox.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix release of jump to queue action
Date: Tue, 16 Apr 2019 22:46:23 +0000 [thread overview]
Message-ID: <20190416224615.GA21044@mtidpdk.mti.labs.mlnx> (raw)
Message-ID: <20190416224623.dkRqAwD4wT9vz5SBP9WpD7UU3lQMi9JofQT5tEyMkHA@z> (raw)
In-Reply-To: <1555273031-1672-1-git-send-email-orika@mellanox.com>
On Sun, Apr 14, 2019 at 08:17:11PM +0000, Ori Kam wrote:
> Currenlty the allocation of the jump to QP is done in flow apply,
> this results in memory leak.
>
> This patch fixes this issue by moving the allocation and release of the
> jump to QP action to the responsiblity of the hrxq.
>
> Fixes: cbb66daa3c85 ("net/mlx5: prepare Direct Verbs for Direct Rule")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
> drivers/net/mlx5/mlx5_flow_dv.c | 8 ++------
> drivers/net/mlx5/mlx5_rxq.c | 20 ++++++++++++++++++++
> drivers/net/mlx5/mlx5_rxtx.h | 3 +++
> 3 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index 3862b26..04ab3d6 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -3651,9 +3651,7 @@ struct field_modify_info modify_tcp[] = {
> "cannot get drop hash queue");
> goto error;
> }
> - dv->actions[n++] =
> - mlx5_glue->dv_create_flow_action_dest_ibv_qp
> - (dv->hrxq->qp);
> + dv->actions[n++] = dv->hrxq->action;
> } else if (flow->actions &
> (MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS)) {
> struct mlx5_hrxq *hrxq;
> @@ -3678,9 +3676,7 @@ struct field_modify_info modify_tcp[] = {
> goto error;
> }
> dv->hrxq = hrxq;
> - dv->actions[n++] =
> - mlx5_glue->dv_create_flow_action_dest_ibv_qp
> - (dv->hrxq->qp);
> + dv->actions[n++] = dv->hrxq->action;
> }
> dv->flow =
> mlx5_glue->dv_create_flow(dv->matcher->matcher_object,
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 8a84b0a..836bec9 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -1864,6 +1864,13 @@ struct mlx5_hrxq *
> hrxq->rss_key_len = rss_key_len;
> hrxq->hash_fields = hash_fields;
> memcpy(hrxq->rss_key, rss_key, rss_key_len);
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> + hrxq->action = mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp);
> + if (!hrxq->action) {
> + rte_errno = errno;
> + goto error;
> + }
> +#endif
> rte_atomic32_inc(&hrxq->refcnt);
> LIST_INSERT_HEAD(&priv->hrxqs, hrxq, next);
> return hrxq;
> @@ -1941,6 +1948,9 @@ struct mlx5_hrxq *
> if (rte_atomic32_dec_and_test(&hrxq->refcnt)) {
> claim_zero(mlx5_glue->destroy_qp(hrxq->qp));
> mlx5_ind_table_ibv_release(dev, hrxq->ind_table);
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> + mlx5_glue->destroy_flow_action(hrxq->action);
> +#endif
> LIST_REMOVE(hrxq, next);
> rte_free(hrxq);
> return 0;
> @@ -2178,6 +2188,13 @@ struct mlx5_hrxq *
> }
> hrxq->ind_table = ind_tbl;
> hrxq->qp = qp;
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> + hrxq->action = mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp);
> + if (!hrxq->action) {
> + rte_errno = errno;
> + goto error;
> + }
> +#endif
> priv->drop_queue.hrxq = hrxq;
> rte_atomic32_set(&hrxq->refcnt, 1);
> return hrxq;
> @@ -2202,6 +2219,9 @@ struct mlx5_hrxq *
> if (rte_atomic32_dec_and_test(&hrxq->refcnt)) {
> claim_zero(mlx5_glue->destroy_qp(hrxq->qp));
> mlx5_ind_table_ibv_drop_release(dev);
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> + mlx5_glue->destroy_flow_action(hrxq->action);
> +#endif
> rte_free(hrxq);
> priv->drop_queue.hrxq = NULL;
> }
> diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
> index 5d49892..4339aaf 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.h
> +++ b/drivers/net/mlx5/mlx5_rxtx.h
> @@ -166,6 +166,9 @@ struct mlx5_hrxq {
> rte_atomic32_t refcnt; /* Reference counter. */
> struct mlx5_ind_table_ibv *ind_table; /* Indirection table. */
> struct ibv_qp *qp; /* Verbs queue pair. */
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> + void *action; /* DV QP action pointer. */
> +#endif
> uint64_t hash_fields; /* Verbs Hash fields. */
> uint32_t rss_key_len; /* Hash key length in bytes. */
> uint8_t rss_key[]; /* Hash key. */
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2019-04-16 22:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-14 20:17 Ori Kam
2019-04-14 20:17 ` Ori Kam
2019-04-16 22:46 ` Yongseok Koh [this message]
2019-04-16 22:46 ` Yongseok Koh
2019-04-18 18:55 ` Shahaf Shuler
2019-04-18 18:55 ` Shahaf Shuler
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=20190416224615.GA21044@mtidpdk.mti.labs.mlnx \
--to=yskoh@mellanox.com \
--cc=dev@dpdk.org \
--cc=orika@mellanox.com \
--cc=shahafs@mellanox.com \
--cc=stable@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).