From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0070.outbound.protection.outlook.com [157.56.111.70]) by dpdk.org (Postfix) with ESMTP id 1C79B95CD for ; Mon, 20 Jun 2016 11:14:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fYVVM2tGyyGUzPvX4RmwwE0CIDdEAUH1wKaqfujKA8I=; b=aDSp0ewGMrsda/gvUvmZz4TVx1AGixSgvfrJc5rmafp2kbYzzNoxzqyf8qqfzaDVTk9Aj/NYSEJzcaj6JnvGsLklTlueUKAQvpiPqFv8qNariSGLmiFQAXa9THvYe0LZGZ+CaYkzixSPZXDx4EbLUZHtjCnSgCs2eQTqGRq5yIU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain (122.166.159.122) by BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) with Microsoft SMTP Server (TLS) id 15.1.517.8; Mon, 20 Jun 2016 09:14:32 +0000 Date: Mon, 20 Jun 2016 14:44:11 +0530 From: Jerin Jacob To: Wenzhuo Lu CC: , , , , , , , Message-ID: <20160620091410.GA9323@localhost.localdomain> 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> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1466403870-6840-2-git-send-email-wenzhuo.lu@intel.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [122.166.159.122] X-ClientProxiedBy: BM1PR01CA0044.INDPRD01.PROD.OUTLOOK.COM (10.163.199.16) To BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) X-MS-Office365-Filtering-Correlation-Id: 1e018224-c21b-4ad1-da3e-08d398eb4c7a X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 2:Tojyybnf/bb2dvnfxTpUIh09cXxXbyHGjqjj7SV21McFBLvjU+DjJagHTIx0984NFHQLRUuydjO5pGD5H2J8AZ8P+BZxoaD8G0KrJZDPAp1bzBdemR5ECTxlvJ7FMzx7O5MPm+G8LNpWX+HqlbyfdFgcLdVAZdRyXnNn8DYZNyuvbjcDeZdzi63TiReg9og0; 3:owmbruGUD+KGbHQDhCxklH4ZEtXQwss8IH5K1Rhc2mTOL3bh2uH28vx5/J0xMI2En6NPApeubJ77o1Oy4CRGW+suKg7eye7sWy3ikcqZrvw1GdghRE4eorE3Nn0AQpTN X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 25:gOm0lekVtwutXuj1vIJn1SH6KMgAze0ZYU77DqMdheAg3tnWy0sXfXIkC/8iEv4HdN0A+BmP88zllNM7X4c39MIa+RuCVHL3fzDlzJJiU/bOOdvSSbajwYxIgsK9zsQLWvF8y7PcB5qGNJnYlv92jzrTFlRVCh30B5PU9YUIHpAyddhGRXqPU+Q7pIdHy9u9tU+0HFWakSz0t0/NDlaINnRYh34AYHMItM1vkfKlP/Hiey4g7PCUJ4WnPATS+vlgpBcyScr1mBXRAFnw2LO87cZMCw5PzpC5WHpHLnyw3Er4sdlZUw4CERhqgjPiTmh0rpYCOleHiMMo8On8GuEAd8Wua8qNbGODVtS9dpBa2vjvS1X5+CseGYtXqPnUwLJJalGYDkfzEeVlAqNfaK4NhPY1vQxPepxyZxmJZdGXf8dQQCfk54EHcWarVnA77Qymv8YZByl0popUya9rs/z+npaOqqDYfewALnAALVzm9EEI6/mn8Zb12RyS4XmTpreKlmeAhGHAyb7WMwuEzDir45z9feqLE8oqf5qhQWjstZUpsbkj9RiW1n/TBH44oZuZZ68bNSqtyGjvcJitvUNo3O1dD36nc6SSWkWEssvQ5qlDuwAh1yFZxyJc0txInT7Uug3l6l5AvnQsnY6zA2QLckGI3F69RVEwL5wvD3Em2DJ4fXz580AMtJLShzh/JW3h7SQ9tlx6piDWQalgXQNsW+zLmps+t89M6/enF4Ajqzb18ZLhxsrDV1t2Id/lKfyb X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 20:AotnQ7IB7juEEkKeXzSUx7UIxRkQkggdnBeU4iQlKhVCm2ZOSvRkJXCzED1HmIuW+/YWTscVBHg0mbmpLGuzzSiTLSaKZtkkD7/n4qdeQcdeWRZUnRpRKn7O6jdEw8KyTqIHH1pz+8VGsYIpX1KZLB+q3kFEW5vFQTQ/4ppLE+orDRdQw/fSuVu029Galce5ZlSKoz1t2TWtNeElQgjy5ck7b9RxRdTirZC2k6OaBcA1f8iw7H81r1GU7mOrJc+orJdYPp8yFP7b2KSanwJMAcCqeKPXSYC5AyEfjHPtwZt0ZTDiZzBa4XymykfI4SiyM3MnnG7Q1WucS2pgy0qmhdIi5+cYnbQe8n0OXqF39JWRHjtUGc3hz1YsYsE7gWzPR6akNaw/rN9LoVfk/Rmkjr0UP2z938JgsGFdcPjKP89/bR0QwdIprZu3UTkWQcXxIiWOWO3iGrXBFULaHor67K20kPMD/bSkwZ20KF8RxUa0/17QECWo7EN6lDSusJcFpkRVgGQ3wxvoQFWE5q5m5mYIPjL0+Nud3OonKI6MQE8yn9bYgkIIOoBIyDhgGmGOqmWbl6B/jwmWjxkVPrOUqYBYjQzHuJnGSYoMoVyzO3E= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BLUPR0701MB1716; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 4:EF7nGLSaz216nK9nlZA3J8eDepCl4I93GPfO/DQY7Dsf8UPzf2C9l+6lphw+18dmYbM2grEBTyrl8kBZeoW37ai/39hMuc8+4sEyac80BTkaC9PfWWX04XVQO/blK4ZjtwRibrpmejv/sqzFW73D7Ekw1n6iUpPpJOoeTR+aVEGD2pDb9fYbf1vv+q0JXaBoPowVzTbVGCor7+fym84eZKyqdt28IdTvkmkE1GTY8DV8dy/eQUi5YYILEB6/lgArQohqHjeAEWmF41bYI45Ei8qZPP0Fe0h+f6xkGo6+Nt46FG/KiWH/neEVztak5VQmApqNnd1gOEkgiRxLzHbKoEn8GEoeNMYrcC1FSAOFbdOebdDNaoEm2bz4mybEVzE1bNsQEiQ8iQ3yTvVfeJQ1Yv936yFvpPqgViWKmQHRy9M= X-Forefront-PRVS: 09796A1B83 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(24454002)(33656002)(19580395003)(101416001)(105586002)(47776003)(66066001)(83506001)(8676002)(4001350100001)(97736004)(7846002)(106356001)(9686002)(586003)(81156014)(6116002)(3846002)(81166006)(68736007)(189998001)(50466002)(4326007)(77096005)(23726003)(2906002)(1076002)(2950100001)(92566002)(19580405001)(110136002)(46406003)(5004730100002)(97756001)(61506002)(76176999)(42186005)(54356999)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1716; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; CAT:NONE; LANG:en; CAT:NONE; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1716; 23:awbF8LfNNJ/Ttai5I3y9DZbos1b1aOj4JWy9pPa?= =?us-ascii?Q?4IMB4Xh+LDojliauQnbsLd0WZY3Uk5imZLE7a+Bthc2VaMctqAFuVzFuwpwn?= =?us-ascii?Q?nIwJp3MqtYj8wohJsRucOFX6KiVx3f8n0k+8fmvCb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3Hos+o/8z/HKLfBCeg8CEbML2h3tf9jzjfqG542+5bVPTV?= =?us-ascii?Q?MJtJBXfCyPTnnlrrOK1gxD3Q6tZMYVxjfPREV9t8gl2kD4ZykcVoqctMonux?= =?us-ascii?Q?rsUuS1XOidk68Yk6HGtG1epFU7WGp69CU?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 6:6hZfAyiUM4T8vFH78y57LP41DuxIn1h+J+O/kumVs/vPugQ3nExfjsuGieIsMZ7eBzte2WDe/QNz3i6Y2s5IDtiuKk4WSKky+KQV8UQKX1ptCRLRDVDSg1lMtJ9N8jTGneaKEceV91xxgoFHDCqlGbW4pPnnwRocppOb70bKovfm8ZEmsGNWrJzxhTYohO8HkO4wLvYefB1JhheAjxipNYJOBcoboIW2jiwD2yaQbqLHNdCEdqhazbEsd9kjdDTqH8JdnM3fLUmSueOLCR5stOhgENT6F8ro/yL/yJ49nuQ=; 5:ISxghj78cKbH/S2fLnHRZR89EJgo2w0gZZa7VeOztiMpMnbSvewVWOknFE5x8tObW1qYH8rHrtolk7121G2I1gYrq8kH4Ph8Xi3rw8nabn75qf6/fthRozvPJw2GX0VXwMloktJLpGPZPVypqnqdDw==; 24:28FbjhjipC7NqEDZno4KD7ptzOU6fIxfigcTk/cUBol+xsS9MpDHJ3ZjUPerHjASfOLPRRTL3Bmh3JrPQl0nMhl+3eLpNCjtS/sEeK/lg2I=; 7:jxvZvtLHAN975dVGx1+OkExztq49iZGaX92+HQ/1a87fVw2eNpNG0ch2LSCtvj7ajZoYc11mGn9YcogMRBw3fm4WA/MxvCjNfZo6DHiifoAgd/OUDEiC2s675DbKX8dz4kxft2kKZTFYJundPIdoo9DCoozXqKkKQzbYTrAfErTN9sVW4GL9DOO9Cf/rG3Gp0cekiJSjf8pyL1TmxATQQg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2016 09:14:32.0035 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1716 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: Mon, 20 Jun 2016 09:14:37 -0000 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. Following is _a_ use-case for Device reset. But may be not be _the_ use case. IMO, We need to first say expected behavior of this API and add a use-case later. Other use-case would be, PCIe VF with functional level reset for SRIOV migration. Are we on same page? > > 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 More appropriate would be "Device reset" ? Right? > 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 = &rte_eth_devices[port_id]; > + > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP); > + > + diag = (*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. Same as first comment. > + * > + * @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 >