From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 92ACA9AAA for ; Tue, 21 Jun 2016 02:51:56 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 20 Jun 2016 17:51:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,501,1459839600"; d="scan'208";a="125654945" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2016 17:51:34 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 20 Jun 2016 17:51:33 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 20 Jun 2016 17:51:33 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.147]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.116]) with mapi id 14.03.0248.002; Tue, 21 Jun 2016 08:51:31 +0800 From: "Lu, Wenzhuo" To: Jerin Jacob CC: "dev@dpdk.org" , "Ananyev, Konstantin" , "Richardson, Bruce" , "Chen, Jing D" , "Liang, Cunming" , "Wu, Jingjing" , "Zhang, Helin" , "thomas.monjalon@6wind.com" Thread-Topic: [dpdk-dev] [PATCH v6 1/4] lib/librte_ether: support device reset Thread-Index: AQHRyrx6NqZsK6LoQ0Kr0EDRoXtySZ/xjKGAgAGGB0A= Date: Tue, 21 Jun 2016 00:51:30 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC090903488C1F@shsmsx102.ccr.corp.intel.com> References: <1465191653-28408-1-git-send-email-wenzhuo.lu@intel.com> <1466403870-6840-1-git-send-email-wenzhuo.lu@intel.com> <1466403870-6840-2-git-send-email-wenzhuo.lu@intel.com> <20160620091410.GA9323@localhost.localdomain> In-Reply-To: <20160620091410.GA9323@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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 v6 1/4] lib/librte_ether: support device reset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 00:51:57 -0000 Hi Jerin, > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Monday, June 20, 2016 5:14 PM > To: Lu, Wenzhuo > Cc: dev@dpdk.org; Ananyev, Konstantin; Richardson, Bruce; Chen, Jing D; L= iang, > Cunming; Wu, Jingjing; Zhang, Helin; thomas.monjalon@6wind.com > Subject: Re: [dpdk-dev] [PATCH v6 1/4] lib/librte_ether: support device r= eset >=20 > On Mon, Jun 20, 2016 at 02:24:27PM +0800, Wenzhuo Lu wrote: > > Add an API to reset the device. > > It's for VF device in this scenario, kernel PF + DPDK VF. > > When the PF port down->up, APP should call this API to reset VF port. > > Most likely, APP should call it in its management thread and guarantee > > the thread safe. It means APP should stop the rx/tx and the device, > > then reset the device, then recover the device and rx/tx. >=20 > Following is _a_ use-case for Device reset. But may be not be _the_ use c= ase. > IMO, We need to first say expected behavior of this API and add a use-cas= e later. Thanks for the suggestion, I'll reword it. >=20 > Other use-case would be, PCIe VF with functional level reset for SRIOV mi= gration. > Are we on same page? I'm not sure:) Does this SRIOV migration mean the migration of a Logical do= main that has a VF assigned to it? >=20 > > > > Signed-off-by: Wenzhuo Lu > > --- > > doc/guides/nics/overview.rst | 1 + > > lib/librte_ether/rte_ethdev.c | 17 +++++++++++++++++ > > lib/librte_ether/rte_ethdev.h | 24 ++++++++++++++++++++++++ > > lib/librte_ether/rte_ether_version.map | 7 +++++++ > > 4 files changed, 49 insertions(+) > > > > diff --git a/doc/guides/nics/overview.rst > > b/doc/guides/nics/overview.rst index 0bd8fae..c8a4985 100644 > > --- a/doc/guides/nics/overview.rst > > +++ b/doc/guides/nics/overview.rst > > @@ -89,6 +89,7 @@ Most of these differences are summarized below. > > Speed capabilities > > Link status Y Y Y Y Y Y Y Y Y Y Y Y Y = Y Y Y Y Y Y Y > > Link status event Y Y Y Y Y Y Y Y Y = Y Y Y Y > > + Link reset Y Y Y Y Y >=20 > More appropriate would be "Device reset" ? Right? Yes, sounds better :) >=20 > > Queue status event = Y > > Rx interrupt Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y > > Queue start/stop Y Y Y Y Y Y Y Y Y Y Y Y Y Y = Y Y Y Y > > diff --git a/lib/librte_ether/rte_ethdev.c > > b/lib/librte_ether/rte_ethdev.c index e148028..6c0449b 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -3346,3 +3346,20 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t > port_id, > > -ENOTSUP); > > return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, > > en); } > > + > > +int > > +rte_eth_dev_reset(uint8_t port_id) > > +{ > > + struct rte_eth_dev *dev; > > + int diag; > > + > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > + > > + dev =3D &rte_eth_devices[port_id]; > > + > > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP); > > + > > + diag =3D (*dev->dev_ops->dev_reset)(dev); > > + > > + return diag; > > +} > > diff --git a/lib/librte_ether/rte_ethdev.h > > b/lib/librte_ether/rte_ethdev.h index 2757510..5b3ba12 100644 > > --- a/lib/librte_ether/rte_ethdev.h > > +++ b/lib/librte_ether/rte_ethdev.h > > @@ -1318,6 +1318,9 @@ typedef int (*eth_l2_tunnel_offload_set_t) > > uint8_t en); > > /**< @internal enable/disable the l2 tunnel offload functions */ > > > > +typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev); /**< > > +@internal Function used to reset a configured Ethernet device. */ > > + > > #ifdef RTE_NIC_BYPASS > > > > enum { > > @@ -1508,6 +1511,8 @@ struct eth_dev_ops { > > eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf; > > /** Enable/disable l2 tunnel offload functions */ > > eth_l2_tunnel_offload_set_t l2_tunnel_offload_set; > > + /** Reset device. */ > > + eth_dev_reset_t dev_reset; > > }; > > > > /** > > @@ -4253,6 +4258,25 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t > port_id, > > uint32_t mask, > > uint8_t en); > > > > +/** > > + * Reset an ethernet device when it's not working. One scenario is, > > +after PF > > + * port is down and up, the related VF port should be reset. > > + * The API will stop the port, clear the rx/tx queues, re-setup the > > +rx/tx > > + * queues, restart the port. > > + * Before calling this API, APP should stop the rx/tx. When tx is > > +being stopped, > > + * APP can drop the packets and release the buffer instead of sending = them. >=20 > Same as first comment. I'll reword it. >=20 > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * > > + * @return > > + * - (0) if successful. > > + * - (-ENODEV) if port identifier is invalid. > > + * - (-ENOTSUP) if hardware doesn't support this function. > > + */ > > +int > > +rte_eth_dev_reset(uint8_t port_id); > > + > > #ifdef __cplusplus > > } > > #endif > > diff --git a/lib/librte_ether/rte_ether_version.map > > b/lib/librte_ether/rte_ether_version.map > > index 214ecc7..c34207e 100644 > > --- a/lib/librte_ether/rte_ether_version.map > > +++ b/lib/librte_ether/rte_ether_version.map > > @@ -132,3 +132,10 @@ DPDK_16.04 { > > rte_eth_tx_buffer_set_err_callback; > > > > } DPDK_2.2; > > + > > +DPDK_16.07 { > > + global: > > + > > + rte_eth_dev_reset; > > + > > +} DPDK_16.04; > > -- > > 1.9.3 > >