From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23834A0C45; Wed, 22 Sep 2021 08:58:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CE264003F; Wed, 22 Sep 2021 08:58:26 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 5ED734003C for ; Wed, 22 Sep 2021 08:58:24 +0200 (CEST) Received: from dggeme762-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HDptV2qT5zbmg5 for ; Wed, 22 Sep 2021 14:54:10 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggeme762-chm.china.huawei.com (10.3.19.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 22 Sep 2021 14:58:21 +0800 Received: from dggpemm500008.china.huawei.com ([7.185.36.136]) by dggpemm500008.china.huawei.com ([7.185.36.136]) with mapi id 15.01.2308.008; Wed, 22 Sep 2021 14:58:21 +0800 From: wangyunjian To: "Wang, Haiyue" , "dev@dpdk.org" CC: "Xing, Beilei" , "Yang, Qiming" , "Zhang, Qi Z" , dingxiaoxiong Thread-Topic: [dpdk-dev] [PATCH v2 4/4] net/ixgbe: delete HW rings when releasing queues Thread-Index: AQHXrGkMlKORqtL+9kG9KJA0L5m4Q6uvFZSAgACO5tA= Date: Wed, 22 Sep 2021 06:58:21 +0000 Message-ID: <06c01dbba1db46a8970ded089ae05229@huawei.com> References: <22811a29652fba4827277ddebc578596ee2e766d.1631953295.git.wangyunjian@huawei.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.242.157] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v2 4/4] net/ixgbe: delete HW rings when releasing queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: Wang, Haiyue [mailto:haiyue.wang@intel.com] > Sent: Wednesday, September 22, 2021 2:23 PM > To: wangyunjian ; dev@dpdk.org > Cc: Xing, Beilei ; Yang, Qiming > ; Zhang, Qi Z ; dingxiaoxion= g > > Subject: RE: [dpdk-dev] [PATCH v2 4/4] net/ixgbe: delete HW rings when > releasing queues >=20 > > -----Original Message----- > > From: Yunjian Wang > > Sent: Saturday, September 18, 2021 16:42 > > To: dev@dpdk.org > > Cc: Wang, Haiyue ; Xing, Beilei > > ; Yang, Qiming ; Zhang, > > Qi Z ; dingxiaoxiong@huawei.com; Yunjian Wang > > > > Subject: [dpdk-dev] [PATCH v2 4/4] net/ixgbe: delete HW rings when > > releasing queues > > > > Normally when closing the device the queue memzone should be freed. > > But the memzone will be not freed, when device setup ops like: > > > > rte_eth_bond_slave_remove > > -->__eth_bond_slave_remove_lock_free > > ---->slave_remove > > ------>rte_eth_dev_internal_reset > > -------->rte_eth_dev_rx_queue_config > > ---------->eth_dev_rx_queue_config > > ------------>ixgbe_dev_rx_queue_release > > rte_eth_dev_close > > -->ixgbe_dev_close > > ---->ixgbe_dev_free_queues > > ------>ixgbe_dev_rx_queue_release > > (not been called due to nb_rx_queues and nb_tx_queues are 0) > > > > In order to free the memzone, we can release the memzone when > > releasing queues. > > >=20 > After re-check the eth dev API, I think we can simplify the commit messag= e to > such as: >=20 > Fix memzone leak when re-configure the RX/TX queues. >=20 > Please see 'rte_eth_dev_configure', when queue number is changed to small > size, the BIG memzone queue index will be lost. This will make it is a MU= ST > fix. ;-) >=20 > And add the Fixes tag and CC to stable. >=20 > What do you think ? OK, thanks for your suggestion, will include them in next version. >=20 > > Signed-off-by: Yunjian Wang > > --- > > drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++-- > > drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ > > 2 files changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c > > b/drivers/net/ixgbe/ixgbe_rxtx.c index bfdfd5e755..1b6e0489f4 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > @@ -2482,6 +2482,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue > *txq) > > if (txq !=3D NULL && txq->ops !=3D NULL) { > > txq->ops->release_mbufs(txq); > > txq->ops->free_swring(txq); > > + rte_memzone_free(txq->mz); > > rte_free(txq); > > } > > } > > @@ -2763,6 +2764,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev > *dev, > > return -ENOMEM; > > } > > > > + txq->mz =3D tz; > > txq->nb_tx_desc =3D nb_desc; > > txq->tx_rs_thresh =3D tx_rs_thresh; > > txq->tx_free_thresh =3D tx_free_thresh; @@ -2887,6 +2889,7 @@ > > ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq) > > ixgbe_rx_queue_release_mbufs(rxq); > > rte_free(rxq->sw_ring); > > rte_free(rxq->sw_sc_ring); > > + rte_memzone_free(rxq->mz); > > rte_free(rxq); > > } > > } > > @@ -3162,6 +3165,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev > *dev, > > return -ENOMEM; > > } > > > > + rxq->mz =3D rz; > > /* > > * Zero init all the descriptors in the ring. > > */ > > @@ -3433,14 +3437,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev) > > for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > > ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]); > > dev->data->rx_queues[i] =3D NULL; > > - rte_eth_dma_zone_free(dev, "rx_ring", i); > > } > > dev->data->nb_rx_queues =3D 0; > > > > for (i =3D 0; i < dev->data->nb_tx_queues; i++) { > > ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]); > > dev->data->tx_queues[i] =3D NULL; > > - rte_eth_dma_zone_free(dev, "tx_ring", i); > > } > > dev->data->nb_tx_queues =3D 0; > > } > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h > > b/drivers/net/ixgbe/ixgbe_rxtx.h index 476ef62cfd..a1764f2b08 100644 > > --- a/drivers/net/ixgbe/ixgbe_rxtx.h > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.h > > @@ -138,6 +138,7 @@ struct ixgbe_rx_queue { > > struct rte_mbuf fake_mbuf; > > /** hold packets to return to application */ > > struct rte_mbuf *rx_stage[RTE_PMD_IXGBE_RX_MAX_BURST*2]; > > + const struct rte_memzone *mz; > > }; > > > > /** > > @@ -236,6 +237,7 @@ struct ixgbe_tx_queue { > > uint8_t using_ipsec; > > /**< indicates that IPsec TX feature is in use */ #endif > > + const struct rte_memzone *mz; > > }; > > > > struct ixgbe_txq_ops { > > -- > > 2.23.0