From patchwork Mon Jul 11 15:43:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luca Boccassi X-Patchwork-Id: 14750 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 431FA2BA1; Mon, 11 Jul 2016 17:43:29 +0200 (CEST) Received: from mx0a-000f0801.pphosted.com (mx0a-000f0801.pphosted.com [67.231.144.122]) by dpdk.org (Postfix) with ESMTP id 6A2012B91 for ; Mon, 11 Jul 2016 17:43:27 +0200 (CEST) Received: from pps.filterd (m0048193.ppops.net [127.0.0.1]) by mx0a-000f0801.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6BFhQ14007006; Mon, 11 Jul 2016 08:43:26 -0700 Received: from brmwp-exmb11.corp.brocade.com ([208.47.132.227]) by mx0a-000f0801.pphosted.com with ESMTP id 243007crx9-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 11 Jul 2016 08:43:25 -0700 Received: from EMEAWP-EXMB11.corp.brocade.com (172.29.11.85) by BRMWP-EXMB11.corp.brocade.com (172.16.59.77) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Mon, 11 Jul 2016 09:43:19 -0600 Received: from EMEAWP-EXMB11.corp.brocade.com (172.29.11.85) by EMEAWP-EXMB11.corp.brocade.com (172.29.11.85) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Mon, 11 Jul 2016 17:43:18 +0200 Received: from EMEAWP-EXMB11.corp.brocade.com ([fe80::85ea:b7da:48dd:1640]) by EMEAWP-EXMB11.corp.brocade.com ([fe80::85ea:b7da:48dd:1640%21]) with mapi id 15.00.1156.000; Mon, 11 Jul 2016 17:43:18 +0200 From: Luca Boccassi To: "wenzhuo.lu@intel.com" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v6 0/4] support reset of VF link Thread-Index: AQHRyrxwyGULMjtHKk+KVN3RtrtRvaAIX+qAgACYEYCAAJbpgIAA+XEAgAEGAACAAJMzgIAAmfGAgAAv8ACAADRUgIAAhJOAgAEdVICAA699AIAAsAUAgAA9vIA= Date: Mon, 11 Jul 2016 15:43:17 +0000 Message-ID: <1468251797.1762.47.camel@brocade.com> References: <1465191653-28408-1-git-send-email-wenzhuo.lu@intel.com> <1466403870-6840-1-git-send-email-wenzhuo.lu@intel.com> <1467647287.32386.8.camel@brocade.com> <6A0DE07E22DDAD4C9103DF62FEBC09090348D343@shsmsx102.ccr.corp.intel.com> <1467712351.32466.11.camel@brocade.com> <6A0DE07E22DDAD4C9103DF62FEBC09090348DB05@shsmsx102.ccr.corp.intel.com> <1467822182.32466.34.camel@brocade.com> <6A0DE07E22DDAD4C9103DF62FEBC09090348E088@shsmsx102.ccr.corp.intel.com> <1467886851.1762.6.camel@brocade.com> <6A0DE07E22DDAD4C9103DF62FEBC09090348E322@shsmsx102.ccr.corp.intel.com> <1467908383.1762.22.camel@brocade.com> <6A0DE07E22DDAD4C9103DF62FEBC09090348E4AF@shsmsx102.ccr.corp.intel.com> <1467998127.1762.30.camel@brocade.com> <6A0DE07E22DDAD4C9103DF62FEBC09090348F105@shsmsx102.ccr.corp.intel.com> <1468238540.1762.43.camel@brocade.com> In-Reply-To: <1468238540.1762.43.camel@brocade.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.27.212.167] Content-ID: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-11_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607110150 Subject: Re: [dpdk-dev] [PATCH v6 0/4] support reset of VF link 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 2016-07-11 at 13:02 +0100, Luca Boccassi wrote: > On Mon, 2016-07-11 at 01:32 +0000, Lu, Wenzhuo wrote: > > > > > > Unfortunately I found one issue: if PF is down, and then the VF on the guest is > > > down as well (ip link down) and then goes back up before the PF, then calling > > > rte_eth_dev_reset will return 0 (success), even though the PF is still down and it > > > should fail. This is with ixgbe. Any idea what could be the problem? > > I've found this interesting thing. I believe it’s the HW difference between igb and ixgbe. When the link is down, ixgbe VF can be reset successfully but igb VF cannot. The expression is the registers of the ixgbe VF can be accessed when the PF link is down but igb VF cannot. > > It means, on ixgbe, when PF link is down, we reset the VF link. Then PF link is up, we receive the message again and reset the VF link again. > > What message do you refer to here? I am seeing the RESET callback only > when the PF goes down, not when it goes up. > > At the moment, with ixgbe, this happens: > > PF down -> reset notification, rte_eth_dev_reset keeps failing -> VF > down -> VF up -> rte_eth_dev_reset in a loop/timer succeeds -> PF up -> > VF link has no-carrier, and traffic does NOT go through > > The problem is that there is just no way of being notified that PF is > up, and if rte_eth_dev_reset succeeds I have no way of knowing that I > need to run it again. I was now able to solve this use case, by having the rte_eth_dev_reset implementations return -EAGAIN if the dev is not up. This way I know, in the application, that I have to try again. What do you think? IMHO it makes sense, as the reset does not actually succeeds, and the caller should try again. The diff is very trivial, and attached for reference. -- Kind regards, Luca Boccassi Make rte_eth_dev_reset return EAGAIN if VF down If VF is down the reset will not happen, so the driver should return EAGAIN to signal the application that it needs to call again rte_eth_dev_reset. Signed-off-by: Luca Boccassi data->dev_started) - return 0; + return -EAGAIN; PMD_DRV_LOG(DEBUG, "Link up/down event detected."); --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1504,7 +1504,7 @@ i40evf_handle_vf_reset(struct rte_eth_de I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); if (!dev->data->dev_started) - return 0; + return -EAGAIN; adapter->reset_number = 1; i40e_vf_reset_dev(dev); --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2609,7 +2609,7 @@ igbvf_dev_reset(struct rte_eth_dev *dev, /* Nothing needs to be done if the device is not started. */ if (!dev->data->dev_started) - return 0; + return -EAGAIN; PMD_DRV_LOG(DEBUG, "Link up/down event detected.");