From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 744082C15 for ; Tue, 11 Dec 2018 02:21:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 17:21:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,340,1539673200"; d="scan'208";a="282553321" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 10 Dec 2018 17:21:35 -0800 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 17:21:35 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 17:21:35 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.59]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.201]) with mapi id 14.03.0415.000; Tue, 11 Dec 2018 09:21:33 +0800 From: "Zhang, Qi Z" To: "Wang, Haiyue" , "Yan, Zhirun" , "dev@dpdk.org" Thread-Topic: [PATCH v1] net/i40e: remove redundant code in free queues. Thread-Index: AQHUkEzlQyuMvjmbUUyenDzaewH3paV35+9Q//9+UgCAAI+HwP//tvuAgAEHEfA= Date: Tue, 11 Dec 2018 01:21:32 +0000 Message-ID: <039ED4275CED7440929022BC67E70611532FC61C@SHSMSX103.ccr.corp.intel.com> References: <20181210133205.70401-1-zhirun.yan@intel.com> <039ED4275CED7440929022BC67E70611532FC030@SHSMSX103.ccr.corp.intel.com> <039ED4275CED7440929022BC67E70611532FC0A6@SHSMSX103.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTEzZTQxMzgtNTA2Yy00NGQ5LTg4ZjAtZGNkOTVhMGU1YThkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiK2l5Wk1JZkpXM0g1Q0ZiVTdxSnZGb2dCXC8rSk11TDlGTmwybFFoUWtYZXpSeEY5ZWNcL1B3dXhlc1kwajY4M3lJIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1] net/i40e: remove redundant code in free queues. 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: , X-List-Received-Date: Tue, 11 Dec 2018 01:21:38 -0000 > -----Original Message----- > From: Wang, Haiyue > Sent: Tuesday, December 11, 2018 1:00 AM > To: Zhang, Qi Z ; Yan, Zhirun ; > dev@dpdk.org > Subject: RE: [PATCH v1] net/i40e: remove redundant code in free queues. >=20 > > -----Original Message----- > > From: Zhang, Qi Z > > Sent: Monday, December 10, 2018 22:08 > > To: Wang, Haiyue ; Yan, Zhirun > > ; dev@dpdk.org > > Subject: RE: [PATCH v1] net/i40e: remove redundant code in free queues. > > > > > > > > > -----Original Message----- > > > From: Wang, Haiyue > > > Sent: Monday, December 10, 2018 8:47 PM > > > To: Zhang, Qi Z ; Yan, Zhirun > > > ; dev@dpdk.org > > > Subject: RE: [PATCH v1] net/i40e: remove redundant code in free queue= s. > > > > > > > -----Original Message----- > > > > From: Zhang, Qi Z > > > > Sent: Monday, December 10, 2018 20:36 > > > > To: Yan, Zhirun ; dev@dpdk.org; Wang, Haiyue > > > > > > > > Subject: RE: [PATCH v1] net/i40e: remove redundant code in free que= ues. > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: Yan, Zhirun > > > > > Sent: Monday, December 10, 2018 9:32 PM > > > > > To: dev@dpdk.org; Zhang, Qi Z ; Wang, > > > > > Haiyue > > > > > Cc: Yan, Zhirun > > > > > Subject: [PATCH v1] net/i40e: remove redundant code in free queue= s. > > > > > > > > > > Before this patch, there are two functions that will clear RX/TX > > > > > queues > > > > > number: rte_eth_dev_close() and i40e_dev_free_queues(). > > > > > > > > I agree with what the patch changed, but the commit log is not > > > comprehensive. > > > > I40e_dev_free_queues is not only in the path of rte_eth_dev_close > > > > but also rte_eth_dev_reset. > > > > So > > > > For rte_eth_dev_close, its redundant because of duplication. > > > > For rte_eth_dev_reset its redundant because of not necessary, > > > > since following dev_configure is required after dev_reset and it > > > > will be updated > > > correctly. > > > > > > > > > > How about this commit message ? > > > > > > net/i40e: queue management data set is out of the API scope. > > > > > > Function i40e_dev_free_queues is used to free specific i40e queue > > > entries, but should not be used to set the upper level queue > > > management data in 'struct rte_eth_dev_data', such as ' > > > nb_rx/tx_queues ', which are maintained by > 'rte_eth_dev_rx/tx_queue_config'. > > > > Ideally it should be what you described , but if you look at exist > > code in different PMD nb_rx/tx_queues is modified anywhere. > > so I'm not very sure if nb_rx/tx_queues should only be modified in > > rte_ethdev_rx/tx_queue_config is the original design, and I don't have > > confidence those cleanup is always correct, that's why I will prefer > > an explanation that prove this code clean is correct. I think your > > comment is much fit for a patch set that do all the cleanup. > > > I searched the " dev->data->nb_rx_queues =3D 0 ", 10 PMDs drivers write l= ike this, > and these functions nearly look like the same, like *copy*. :) that's not all the case, if you just search "nb_rx_queues =3D " you will ge= t more cases that nb_rx_queues is modified by PMD directly. We should make sure all of them can be cleanup with that way before have ou= r statement, but this is beyond this patch's scope. >=20 > Well, from the feature ' VIRTCHNL_OP_REQUEST_QUEUES ', it will cause the = VF > PMD internally reset after the application like testpmd calls the ' > rte_eth_dev_configure ' API. > The internal reset has to free the internal resource firstly, which will = call free > functions such as ' i40e_dev_free_queues ', if this function reset the up= per level > parameters like nb_rx/tx_queues from ' rte_eth_dev_configure ', then this > standard API will be changed to be more ugly, like: Yes, that's why I also recommend Zhirun to merge this change to the patch f= or VIRTCHNL_OP_REQUEST_QUEUES as another option. But as an independent patch, I think current comments should be OK, because= the context here is we have no idea about VIRTCHNL_OP_REQUEST_QUEUES yet. Again, the words in your comment=20 ".... but should not be used to set the upper level queue management data i= n 'struct rte_eth_dev_data', such as 'nb_rx/tx_queues ', which are maintain= ed by 'rte_eth_dev_rx/tx_queue_config" I think it is a good design, but I'm not sure if this is considered at orig= inal because it is broken everywhere with current implementations. So from my view, you are introducing a new design and should be covered in = a separate patch set which focus on it, but this is not current patch's pur= pose. >=20 > ' rte_eth_dev_configure ' > --> diag =3D (*dev->dev_ops->dev_configure)(dev); > the PMD's dev_configure needs to be changed the new return value= , > such as 1 to > tell the ' rte_eth_dev_configure ' reconfigures the nb_rx/tx_queu= es > again, such as > diag =3D (*dev->dev_ops->dev_configure)(dev); > if (diag =3D=3D 1) { > rte_eth_dev_rx_queue_config(dev, nb_rx_q); > rte_eth_dev_tx_queue_config(dev, nb_tx_q); > } else if (diag !=3D 0) { > RTE_PMD_DEBUG_TRACE("port%d dev_configure =3D %d\n", > port_id, diag); > rte_eth_dev_rx_queue_config(dev, 0); > rte_eth_dev_tx_queue_config(dev, 0); > return eth_err(port_id, diag); > } > This makes VIRTCHNL_OP_REQUEST_QUEUES work, but patch will be 100% > rejected. > Finally, we found that it we made i40e a good PMD boy, then all will be h= appy. > This is the long history. >=20 > And if ' nb_rx/tx_queues ' stands for the number of TX/RX queues array en= tries, > we'd better make code looks clean, like an OOP programming: let the > rte_eth_xxx API handle its data. >=20 > struct rte_eth_dev_data { > char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */ >=20 > void **rx_queues; /**< Array of pointers to RX queues. */ > void **tx_queues; /**< Array of pointers to TX queues. */ > uint16_t nb_rx_queues; /**< Number of RX queues. */ > uint16_t nb_tx_queues; /**< Number of TX queues. */ >=20 > And the API 'void rte_eth_dev_close(uint16_t port_id)' will make things c= lean: >=20 > /* old behaviour: only free queue arrays */ > dev->data->nb_rx_queues =3D 0; > rte_free(dev->data->rx_queues); > dev->data->rx_queues =3D NULL; > dev->data->nb_tx_queues =3D 0; > rte_free(dev->data->tx_queues); > dev->data->tx_queues =3D NULL; >=20 > > > > > > > > > > > > > This patch remove redundant code in i40e_dev_free_queues(). > > > > > > > > > > Signed-off-by: Zhirun Yan > > > > > Signed-off-by: Haiyue Wang > > > > > --- > > > > > drivers/net/i40e/i40e_rxtx.c | 2 -- > > > > > 1 file changed, 2 deletions(-) > > > > > > > > > > diff --git a/drivers/net/i40e/i40e_rxtx.c > > > > > b/drivers/net/i40e/i40e_rxtx.c index > > > > > e1152ff0e..cc953ad58 100644 > > > > > --- a/drivers/net/i40e/i40e_rxtx.c > > > > > +++ b/drivers/net/i40e/i40e_rxtx.c > > > > > @@ -2753,7 +2753,6 @@ i40e_dev_free_queues(struct rte_eth_dev > *dev) > > > > > i40e_dev_rx_queue_release(dev->data->rx_queues[i]); > > > > > dev->data->rx_queues[i] =3D NULL; > > > > > } > > > > > - dev->data->nb_rx_queues =3D 0; > > > > > > > > > > for (i =3D 0; i < dev->data->nb_tx_queues; i++) { > > > > > if (!dev->data->tx_queues[i]) @@ -2761,7 +2760,6 @@ > > > > > i40e_dev_free_queues(struct rte_eth_dev *dev) > > > > > i40e_dev_tx_queue_release(dev->data->tx_queues[i]); > > > > > dev->data->tx_queues[i] =3D NULL; > > > > > } > > > > > - dev->data->nb_tx_queues =3D 0; > > > > > } > > > > > > > > > > #define I40E_FDIR_NUM_TX_DESC I40E_MIN_RING_DESC > > > > > -- > > > > > 2.17.1