From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 4014EA00E6 for ; Wed, 17 Apr 2019 00:46:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5CD791B559; Wed, 17 Apr 2019 00:46:26 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50068.outbound.protection.outlook.com [40.107.5.68]) by dpdk.org (Postfix) with ESMTP id 6B34B1B557; Wed, 17 Apr 2019 00:46:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DrL5CS9ZPp9SZYu3rxqgjHrGC0SPY5EFVINHw0oCJy0=; b=yNJWm+/w0elDN+gZBvWCai3zgxi8dM1CyAp9BpI95QCsARo0yLcijzelgdkXP+AutXAoNnAkYzDCVYPeoPU8vovGLlSVr3nLya1CgW6lQhW6LT1CqE+wxOQrQlkHeN1zA3BVztU6CBJWCFVHqt5Tv4QMsb1TJKet1Xuu7ANtQAk= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4010.eurprd05.prod.outlook.com (52.134.66.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.17; Tue, 16 Apr 2019 22:46:23 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1813.011; Tue, 16 Apr 2019 22:46:23 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix release of jump to queue action Thread-Index: AQHU8v8Zb7Z6rMMHgEiuQZJWDsByR6Y/ZmaA Date: Tue, 16 Apr 2019 22:46:23 +0000 Message-ID: <20190416224615.GA21044@mtidpdk.mti.labs.mlnx> References: <1555273031-1672-1-git-send-email-orika@mellanox.com> In-Reply-To: <1555273031-1672-1-git-send-email-orika@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR04CA0033.namprd04.prod.outlook.com (2603:10b6:a03:40::46) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6d2bd267-1555-4347-167f-08d6c2bd59f6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600140)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB4010; x-ms-traffictypediagnostic: DB3PR0502MB4010: x-microsoft-antispam-prvs: x-forefront-prvs: 000947967F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(396003)(136003)(366004)(199004)(189003)(8676002)(6246003)(99286004)(450100002)(6436002)(26005)(486006)(256004)(2906002)(66066001)(54906003)(8936002)(186003)(6486002)(316002)(97736004)(6506007)(102836004)(71200400001)(53936002)(4326008)(68736007)(476003)(386003)(5660300002)(71190400001)(25786009)(33656002)(76176011)(446003)(7736002)(6862004)(3846002)(6512007)(9686003)(6636002)(305945005)(105586002)(11346002)(478600001)(6116002)(81156014)(86362001)(14454004)(229853002)(52116002)(81166006)(106356001)(1076003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4010; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TLIy1I+JFT983fIJTkoHYHTRLInBqvaMmHaeylzir74PA3FWwpnpRHy73ult+6w2FMBcYEZvv4bcWqgOCEAdDUwCcErHUcxCwsu/RcxjAurUeJ4WU7OtMjPhxLatsZ+3AQ/k+02uq2afvlU9C+bq4pTn95hr0WN3oH90mDtiRwtoOWN+HwSzQp5muAzLcHSeGykK01weGNUlMAjopthK5s5rbo8PT/peMGV83zDUyZEMh04KdO1ZCxTJn3q06J4QkWTrBpfCJMvHrKh8nLjFgIoOt3fPEkH0f7BhJeIDXYsk4MLS7/6wkh1CTRMYSizQJzR0rXjoqsM0B8r3vxRIP1BZfq4VxAwgelSgt4KWdL9M4kbNKLX/2qNS4n6uQ4YxV6PrJ56NWDYgjFmuIe9ZAgodc4BBCdRVK7ldsJTWo1k= Content-Type: text/plain; charset="UTF-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d2bd267-1555-4347-167f-08d6c2bd59f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Apr 2019 22:46:23.6753 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4010 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix release of jump to queue action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190416224623.dkRqAwD4wT9vz5SBP9WpD7UU3lQMi9JofQT5tEyMkHA@z> 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. >=20 > This patch fixes this issue by moving the allocation and release of the > jump to QP action to the responsiblity of the hrxq. >=20 > Fixes: cbb66daa3c85 ("net/mlx5: prepare Direct Verbs for Direct Rule") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ori Kam > --- Acked-by: Yongseok Koh > 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(-) >=20 > 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[] =3D { > "cannot get drop hash queue"); > goto error; > } > - dv->actions[n++] =3D > - mlx5_glue->dv_create_flow_action_dest_ibv_qp > - (dv->hrxq->qp); > + dv->actions[n++] =3D 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[] =3D { > goto error; > } > dv->hrxq =3D hrxq; > - dv->actions[n++] =3D > - mlx5_glue->dv_create_flow_action_dest_ibv_qp > - (dv->hrxq->qp); > + dv->actions[n++] =3D dv->hrxq->action; > } > dv->flow =3D > 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 =3D rss_key_len; > hrxq->hash_fields =3D hash_fields; > memcpy(hrxq->rss_key, rss_key, rss_key_len); > +#ifdef HAVE_IBV_FLOW_DV_SUPPORT > + hrxq->action =3D mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp)= ; > + if (!hrxq->action) { > + rte_errno =3D 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 =3D ind_tbl; > hrxq->qp =3D qp; > +#ifdef HAVE_IBV_FLOW_DV_SUPPORT > + hrxq->action =3D mlx5_glue->dv_create_flow_action_dest_ibv_qp(hrxq->qp)= ; > + if (!hrxq->action) { > + rte_errno =3D errno; > + goto error; > + } > +#endif > priv->drop_queue.hrxq =3D 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 =3D 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. */ > --=20 > 1.8.3.1 >=20