DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Andrew Rybchenko <arybchenko@solarflare.com>
Cc: dev@dpdk.org, ferruh.yigit@intel.com,
	Liron Himi <lironh@marvell.com>, Ray Kinsella <mdr@ashroe.eu>,
	Neil Horman <nhorman@tuxdriver.com>,
	Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
	Gaetan Rivet <grive@u256.net>,
	Jakub Grajciar <jgrajcia@cisco.com>,
	Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Zyta Szpak <zr@semihalf.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Long Li <longli@microsoft.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 29/29] ethdev: allow close function to return an error
Date: Tue, 29 Sep 2020 13:47:32 +0200	[thread overview]
Message-ID: <2950783.NWLOan7DQ0@thomas> (raw)
In-Reply-To: <c24a651c-b8d4-518b-5004-d6f906e46d2d@solarflare.com>

29/09/2020 13:05, Andrew Rybchenko:
> On 9/29/20 2:14 AM, Thomas Monjalon wrote:
> > The API function rte_eth_dev_close() was returning void.
> > The return type is changed to int for notifying of errors.
> > 
> > If an error happens during a close operation,
> > the status of the port is undefined,
> > a maximum of resources having been freed.
[...]
> > @@ -135,7 +135,6 @@ Deprecation Notices
> >    invalid port ID, unsupported operation, failed operation):
> >  
> >    - ``rte_eth_dev_stop``
> > -  - ``rte_eth_dev_close``
> 
> Many thanks for continuing my unfinished job.

It is not finished.
Would you take rte_eth_dev_stop?

> >  rte_pmd_mvneta_remove(struct rte_vdev_device *vdev)
> >  {
> >  	uint16_t port_id;
> > +	int ret = 0;
> >  
> >  	RTE_ETH_FOREACH_DEV(port_id) {
> >  		if (rte_eth_devices[port_id].device != &vdev->device)
> >  			continue;
> > -		rte_eth_dev_close(port_id);
> > +		ret = rte_eth_dev_close(port_id);
> 
> I guess |= should be used here as well (similar as above).

Yes

> > -void
> > +int
> >  rte_eth_dev_close(uint16_t port_id)
> >  {
> >  	struct rte_eth_dev *dev;
> > +	int ret;
> >  
> > -	RTE_ETH_VALID_PORTID_OR_RET(port_id);
> > +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
> >  	dev = &rte_eth_devices[port_id];
> >  
> > -	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
> > -	(*dev->dev_ops->dev_close)(dev);
> > +	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
> > +	ret = (*dev->dev_ops->dev_close)(dev);
> >  
> >  	rte_ethdev_trace_close(port_id);
> > -	rte_eth_dev_release_port(dev);
> > +	ret = rte_eth_dev_release_port(dev);
> 
> It does not look good that it overwrites close return status.

Indeed, it seems I did not finish this patch,
or maybe I was drunk ;)

What do you think is the best strategy?
I think we must call rte_eth_dev_release_port()
even if dev_close returns an error.
Then which error to return? I would return the first non-zero one.



  reply	other threads:[~2020-09-29 11:47 UTC|newest]

Thread overview: 201+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 22:06 [dpdk-dev] [PATCH 00/20] cleanup ethdev close operation Thomas Monjalon
2020-09-13 22:06 ` [dpdk-dev] [PATCH 01/20] ethdev: reset device and interrupt pointers on release Thomas Monjalon
2020-09-23 16:41   ` Ferruh Yigit
2020-09-13 22:06 ` [dpdk-dev] [PATCH 02/20] ethdev: allow drivers to return error on close Thomas Monjalon
2020-09-23 16:41   ` Ferruh Yigit
2020-09-23 20:53     ` Thomas Monjalon
2020-09-23 21:02       ` Stephen Hemminger
2020-09-23 21:06         ` Thomas Monjalon
2020-09-23 21:47           ` Stephen Hemminger
2020-09-23 21:52             ` Thomas Monjalon
2020-09-23 22:02               ` Stephen Hemminger
2020-09-23 22:35                 ` Thomas Monjalon
2020-09-24  9:12                   ` Bruce Richardson
2020-09-24 10:07                     ` Thomas Monjalon
2020-09-24 12:09                       ` Ferruh Yigit
2020-09-24 14:48                     ` Stephen Hemminger
2020-09-13 22:06 ` [dpdk-dev] [PATCH 03/20] net/af_packet: release port upon close Thomas Monjalon
2020-09-23 16:41   ` Ferruh Yigit
2020-09-13 22:06 ` [dpdk-dev] [PATCH 04/20] net/atlantic: " Thomas Monjalon
2020-09-16 15:14   ` Igor Russkikh
2020-09-23 16:42   ` Ferruh Yigit
2020-09-23 20:50     ` Thomas Monjalon
2020-09-13 22:06 ` [dpdk-dev] [PATCH 05/20] net/axgbe: " Thomas Monjalon
2020-09-13 22:06 ` [dpdk-dev] [PATCH 06/20] net/bonding: " Thomas Monjalon
2020-09-13 22:06 ` [dpdk-dev] [PATCH 07/20] net/failsafe: " Thomas Monjalon
2020-09-23 21:24   ` Thomas Monjalon
2020-09-13 22:06 ` [dpdk-dev] [PATCH 08/20] net/iavf: " Thomas Monjalon
2020-09-13 22:07 ` [dpdk-dev] [PATCH 09/20] net/mlx4: " Thomas Monjalon
2020-09-13 22:07 ` [dpdk-dev] [PATCH 10/20] net/null: " Thomas Monjalon
2020-09-23 16:44   ` Ferruh Yigit
2020-09-23 20:47     ` Thomas Monjalon
2020-09-24 21:58       ` Thomas Monjalon
2020-09-25  8:52         ` Ferruh Yigit
2020-09-25 13:13           ` Thomas Monjalon
2020-09-13 22:07 ` [dpdk-dev] [PATCH 11/20] net/octeontx: " Thomas Monjalon
2020-09-13 22:07 ` [dpdk-dev] [PATCH 12/20] net/pcap: " Thomas Monjalon
2020-09-23 16:44   ` Ferruh Yigit
2020-09-23 20:44     ` Thomas Monjalon
2020-09-24 11:56       ` Ferruh Yigit
2020-09-13 22:07 ` [dpdk-dev] [PATCH 13/20] net/ring: " Thomas Monjalon
2020-09-14  8:51   ` Bruce Richardson
2020-09-13 22:07 ` [dpdk-dev] [PATCH 14/20] net/softnic: " Thomas Monjalon
2020-09-14 15:21   ` Dumitrescu, Cristian
2020-09-13 22:07 ` [dpdk-dev] [PATCH 15/20] net/tap: " Thomas Monjalon
2020-09-13 22:07 ` [dpdk-dev] [PATCH 16/20] ethdev: remove old close behaviour Thomas Monjalon
2020-09-23 16:44   ` Ferruh Yigit
2020-09-23 20:41     ` Thomas Monjalon
2020-09-24 12:00       ` Ferruh Yigit
2020-09-25  4:31     ` Rasesh Mody
2020-09-13 22:07 ` [dpdk-dev] [PATCH 17/20] drivers/net: accept removing device without any port Thomas Monjalon
2020-09-23 16:45   ` Ferruh Yigit
2020-09-27  6:25   ` Xu, Rosen
2020-09-13 22:07 ` [dpdk-dev] [PATCH 18/20] drivers/net: remove redundant MAC addresses freeing Thomas Monjalon
2020-09-23 16:45   ` Ferruh Yigit
2020-09-13 22:07 ` [dpdk-dev] [PATCH 19/20] app/testpmd: reset port status on close notification Thomas Monjalon
2020-09-23 16:45   ` Ferruh Yigit
2020-09-23 20:32     ` Thomas Monjalon
2020-09-24 12:07       ` Ferruh Yigit
2020-09-24 12:17         ` Thomas Monjalon
2020-09-24 13:06           ` Ferruh Yigit
2020-09-13 22:07 ` [dpdk-dev] [PATCH 20/20] app/testpmd: align behaviour of multi-port detach Thomas Monjalon
2020-09-23 16:44 ` [dpdk-dev] [PATCH 00/20] cleanup ethdev close operation Ferruh Yigit
2020-09-27 23:42 ` [dpdk-dev] [PATCH v2 00/25] " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 01/25] ethdev: reset device and interrupt pointers on release Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 02/25] ethdev: allow drivers to return error on close Thomas Monjalon
2020-09-28  0:46     ` Xu, Rosen
2020-09-28  9:51     ` Sachin Saxena (OSS)
2020-09-28 18:26     ` [dpdk-dev] [EXT] " Liron Himi
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 03/25] net/af_packet: release port upon close Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 04/25] net/atlantic: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 05/25] net/axgbe: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 06/25] net/bnx2x: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 07/25] net/bonding: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 08/25] net/failsafe: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 09/25] net/mlx4: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 10/25] net/null: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 11/25] net/octeontx: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 12/25] net/pcap: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 13/25] net/qede: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 14/25] net/ring: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 15/25] net/softnic: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 16/25] net/tap: " Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 17/25] ethdev: remove old close behaviour Thomas Monjalon
2020-09-28 18:25     ` [dpdk-dev] [EXT] " Liron Himi
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 18/25] drivers/net: accept removing device without any port Thomas Monjalon
2020-09-28  0:47     ` Xu, Rosen
2020-09-28  9:54     ` Sachin Saxena (OSS)
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 19/25] drivers/net: check process type in close operation Thomas Monjalon
2020-09-27 23:52     ` Thomas Monjalon
2020-09-28  0:50     ` Xu, Rosen
2020-09-28  9:55     ` Sachin Saxena (OSS)
2020-09-28 14:57       ` Ajit Khaparde
2020-09-28 18:25     ` [dpdk-dev] [EXT] " Liron Himi
2020-09-28 18:51     ` [dpdk-dev] " Stephen Hemminger
2020-09-28 20:57       ` Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 20/25] drivers/net: remove redundant MAC addresses freeing Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 21/25] app/testpmd: reset port status on close notification Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 22/25] app/testpmd: align behaviour of multi-port detach Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 23/25] ethdev: remove forcing stopped state upon close Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 24/25] ethdev: reset all when releasing a port Thomas Monjalon
2020-09-27 23:42   ` [dpdk-dev] [PATCH v2 25/25] ethdev: allow close function to return an error Thomas Monjalon
2020-09-28 18:24     ` [dpdk-dev] [EXT] " Liron Himi
2020-09-28 23:14 ` [dpdk-dev] [PATCH v3 00/29] cleanup ethdev close operation Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 01/29] ethdev: reset device and interrupt pointers on release Thomas Monjalon
2020-09-29 10:52     ` Andrew Rybchenko
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 02/29] ethdev: allow drivers to return error on close Thomas Monjalon
2020-09-29  2:16     ` Wang, Haiyue
2020-09-29  5:56     ` Guo, Jia
2020-09-29 10:53     ` Andrew Rybchenko
2020-09-30 12:12       ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 03/29] net/af_packet: release port upon close Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 04/29] net/atlantic: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 05/29] net/axgbe: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 06/29] net/bnx2x: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 07/29] net/bonding: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 08/29] net/dpaa: " Thomas Monjalon
2020-09-29  4:53     ` Hemant Agrawal
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 09/29] net/dpaa2: " Thomas Monjalon
2020-09-29  4:53     ` Hemant Agrawal
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 10/29] net/enetc: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 11/29] net/failsafe: " Thomas Monjalon
2020-10-05 10:19     ` Gaëtan Rivet
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 12/29] net/mlx4: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 13/29] net/null: " Thomas Monjalon
2020-09-29 16:47     ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 14/29] net/octeontx: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 15/29] net/pcap: " Thomas Monjalon
2020-09-29 16:49     ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 16/29] net/pfe: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 17/29] net/qede: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 18/29] net/ring: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 19/29] net/softnic: " Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 20/29] net/tap: " Thomas Monjalon
2020-09-30  8:34     ` wangyunjian
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 21/29] ethdev: remove old close behaviour Thomas Monjalon
2020-09-29  2:27     ` Wang, Haiyue
2020-09-29  5:55     ` Guo, Jia
2020-09-29 10:38     ` Andrew Rybchenko
2020-09-29 17:08     ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 22/29] drivers/net: accept removing device without any port Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 23/29] drivers/net: check process type in close operation Thomas Monjalon
2020-09-29  2:39     ` Wang, Haiyue
2020-09-29  5:53     ` Guo, Jia
2020-09-29 10:42     ` Andrew Rybchenko
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 24/29] drivers/net: remove redundant MAC addresses freeing Thomas Monjalon
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 25/29] app/testpmd: reset port status on close notification Thomas Monjalon
2020-09-30 12:15     ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 26/29] app/testpmd: align behaviour of multi-port detach Thomas Monjalon
2020-09-30 12:17     ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 27/29] ethdev: remove forcing stopped state upon close Thomas Monjalon
2020-09-29 10:44     ` Andrew Rybchenko
2020-09-29 16:01     ` Ferruh Yigit
2020-09-29 16:06       ` Thomas Monjalon
2020-09-29 16:39         ` Ferruh Yigit
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 28/29] ethdev: reset all when releasing a port Thomas Monjalon
2020-09-29  2:34     ` Wang, Haiyue
2020-09-29  5:51     ` Guo, Jia
2020-09-29 10:26     ` Maxime Coquelin
2020-09-29 10:36       ` Thomas Monjalon
2020-09-29 11:58         ` Wang, Haiyue
2020-09-29 15:50           ` Ferruh Yigit
2020-09-29 16:02             ` Thomas Monjalon
2020-09-29 16:35               ` Ferruh Yigit
2020-09-30 12:17                 ` Ferruh Yigit
2020-09-29 10:50     ` Andrew Rybchenko
2020-09-28 23:14   ` [dpdk-dev] [PATCH v3 29/29] ethdev: allow close function to return an error Thomas Monjalon
2020-09-29 11:05     ` Andrew Rybchenko
2020-09-29 11:47       ` Thomas Monjalon [this message]
2020-09-29 11:54         ` Andrew Rybchenko
2020-09-28 23:33   ` [dpdk-dev] [PATCH v3 00/29] cleanup ethdev close operation Stephen Hemminger
2020-09-30 12:22   ` Ferruh Yigit
2020-10-05 17:08 ` [dpdk-dev] [PATCH v4 0/3] " Thomas Monjalon
2020-10-05 17:08   ` [dpdk-dev] [PATCH v4 1/3] ethdev: remove forcing stopped state upon close Thomas Monjalon
2020-10-05 17:08   ` [dpdk-dev] [PATCH v4 2/3] ethdev: reset all when releasing a port Thomas Monjalon
2020-10-05 17:08   ` [dpdk-dev] [PATCH v4 3/3] ethdev: allow close function to return an error Thomas Monjalon
2020-10-06  9:43     ` Ferruh Yigit
2020-10-06 10:57       ` Thomas Monjalon
2020-10-13  8:40         ` Andrew Rybchenko
2020-10-13  8:55           ` Thomas Monjalon
2020-10-13  9:33             ` Ferruh Yigit
2020-10-13 10:06 ` [dpdk-dev] [PATCH v5 0/3] cleanup ethdev close operation Thomas Monjalon
2020-10-13 10:06   ` [dpdk-dev] [PATCH v5 1/3] ethdev: remove forcing stopped state upon close Thomas Monjalon
2020-10-13 12:36     ` Ferruh Yigit
2020-10-13 12:49       ` Thomas Monjalon
2020-10-13 12:45     ` Ferruh Yigit
2020-10-13 12:51       ` Thomas Monjalon
2020-10-13 17:54         ` Ferruh Yigit
2020-10-13 17:59           ` Thomas Monjalon
2020-10-13 10:06   ` [dpdk-dev] [PATCH v5 2/3] ethdev: reset all when releasing a port Thomas Monjalon
2020-10-13 13:10     ` Ferruh Yigit
2020-10-13 10:06   ` [dpdk-dev] [PATCH v5 3/3] ethdev: allow close function to return an error Thomas Monjalon
2020-10-13 10:41     ` Andrew Rybchenko
2020-10-13 10:43       ` Thomas Monjalon
2020-10-13 13:10     ` Ferruh Yigit
2020-10-16 13:32 ` [dpdk-dev] [PATCH v6 0/3] cleanup ethdev close operation Thomas Monjalon
2020-10-16 13:32   ` [dpdk-dev] [PATCH v6 1/3] ethdev: remove forcing stopped state upon close Thomas Monjalon
2020-10-16 13:32   ` [dpdk-dev] [PATCH v6 2/3] ethdev: reset all when releasing a port Thomas Monjalon
2020-10-16 15:21     ` Ajit Khaparde
2020-10-16 13:32   ` [dpdk-dev] [PATCH v6 3/3] ethdev: allow close function to return an error Thomas Monjalon
2020-10-16 17:55   ` [dpdk-dev] [PATCH v6 0/3] cleanup ethdev close operation Ferruh Yigit
2020-10-20 12:24     ` Bruce Richardson

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=2950783.NWLOan7DQ0@thomas \
    --to=thomas@monjalon.net \
    --cc=arybchenko@solarflare.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=grive@u256.net \
    --cc=haiyangz@microsoft.com \
    --cc=jgrajcia@cisco.com \
    --cc=kys@microsoft.com \
    --cc=lironh@marvell.com \
    --cc=longli@microsoft.com \
    --cc=matan@nvidia.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mdr@ashroe.eu \
    --cc=nhorman@tuxdriver.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=shahafs@nvidia.com \
    --cc=sthemmin@microsoft.com \
    --cc=viacheslavo@nvidia.com \
    --cc=zhihong.wang@intel.com \
    --cc=zr@semihalf.com \
    /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).