From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00071.outbound.protection.outlook.com [40.107.0.71]) by dpdk.org (Postfix) with ESMTP id A458C1B6A3 for ; Sun, 8 Apr 2018 15:09:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=b30IY1OXyBBeUaefnw9kzoMsYLGBorOn12s12EEqWMY=; b=AaXx/3J+phtE41B9nhxgRs9QBehXiCDvIA91ao1IBh9BGbDTEnuZZYfHcTxT9Ck4d+gBjTge4srGugl0mwFxb/uoMfZl9eoKMk1OpAuCF6/yfEtiIU9SkM4anEaArWQV88zViOhwROzXXACNnLLPT/o8bvdyOEBAvgtDTcsi5DI= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4219.eurprd05.prod.outlook.com (52.134.108.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Sun, 8 Apr 2018 13:09:27 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::808d:386e:26f3:859f]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::808d:386e:26f3:859f%13]) with mapi id 15.20.0653.014; Sun, 8 Apr 2018 13:09:27 +0000 From: Shahaf Shuler To: =?iso-8859-1?Q?N=E9lio_Laranjeiro?= CC: Adrien Mazarguil , Yongseok Koh , "dev@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix link status initialization Thread-Index: AQHTy+bChNPXB2fkBUSu8VuSnLilOaPwRWOwgAA+wYCAASMw0IAAFd8AgAUdLcA= Date: Sun, 8 Apr 2018 13:09:27 +0000 Message-ID: References: <20180403044817.27457-1-shahafs@mellanox.com> <20180404073009.zgqu3yrj26trwdfr@laranjeiro-vm.dev.6wind.com> <20180404121051.ersiyf75gykwfon5@laranjeiro-vm.dev.6wind.com> <20180405065120.jqttkvlhjflpfdbj@laranjeiro-vm.dev.6wind.com> In-Reply-To: <20180405065120.jqttkvlhjflpfdbj@laranjeiro-vm.dev.6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4219; 7:SD449xLmFjsm/JTmxcJf/vDgH3sk3cbmTRQ9CEMvU7sSdGjXPfDWdX834FRYvH15kiA8u7sSN0XHKJ4ytQHk5iR3865kOoxLC5RJHo7PuAeCH9f/Lmecxs3AyjHMk9Z5MtRJN2jv8CN7RNwr6LHCG69bH9Dv+kRkio+0Wl3BtGHpu+flot3JDJwnAzgnXcsXc5Z48NtIJL2JIKy1++/jpP6c0LeEdi6RtT4zHPkduLt9OTQH4SIeW+1zFwT2OfZe x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 94f199f3-a568-4d95-3350-08d59d51f518 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4219; x-ms-traffictypediagnostic: DB7PR05MB4219: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231221)(944501327)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DB7PR05MB4219; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4219; x-forefront-prvs: 0636271852 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(346002)(366004)(39380400002)(376002)(189003)(199004)(2906002)(8676002)(6436002)(3846002)(33656002)(66066001)(4326008)(316002)(6116002)(229853002)(11346002)(93886005)(5250100002)(105586002)(54906003)(97736004)(486006)(106356001)(99286004)(86362001)(25786009)(305945005)(68736007)(478600001)(186003)(55016002)(6246003)(2900100001)(74316002)(81166006)(9686003)(3660700001)(5660300001)(6506007)(53936002)(476003)(7696005)(81156014)(7736002)(8936002)(6916009)(14454004)(76176011)(102836004)(3280700002)(26005)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4219; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: R4i5Z04a6c3ObSfP970V9OjH+Ksxpnn9isNG2FsUopCLokajacxPsVvYbTIrr2GsBs8pQq4VuoraCAmFiiJb7SBg6/zeenwE4J5IaelPz11db1Ul0bt7zrGuYZr5x65Y5ocB2d8x1tJYl68X18pyDY/PBXbcYLxMqwveb//KqsP7hVDkPyAx2At7eZkuJ5oaGnSeoH50GDWkIoKSt+FxomK3GfvaOnhtEVBRZP+tPpxA8KhWLtSuN5LVv0xWzuW6noaUrMvAote15VWvba2K43Xv07Vh2SzJK5CL+HM2yq6TAVpwHssJHNCscYxufjGmTXXkiCFYpFN8cvgOaK7z9NPWaQfuwKszA7W6smBKlujkSorj37EAMngN+Jt3cWeyM5FhSq0VB2AJ3o03WN3+7rUbzLaEX0u3x3ik7536WAs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94f199f3-a568-4d95-3350-08d59d51f518 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2018 13:09:27.1146 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4219 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix link status initialization 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: Sun, 08 Apr 2018 13:09:29 -0000 Thursday, April 5, 2018 9:51 AM, N=E9lio Laranjeiro: > Subject: Re: [PATCH] net/mlx5: fix link status initialization >=20 > On Thu, Apr 05, 2018 at 05:35:57AM +0000, Shahaf Shuler wrote: > > Wednesday, April 4, 2018 3:11 PM, N=E9lio Laranjeiro: > > > Subject: Re: [PATCH] net/mlx5: fix link status initialization > > > > > > On Wed, Apr 04, 2018 at 09:58:33AM +0000, Shahaf Shuler wrote: > > > > Wednesday, April 4, 2018 10:30 AM, N=E9lio Laranjeiro: > > > > > Subject: Re: [PATCH] net/mlx5: fix link status initialization > > > > > > > > > > On Tue, Apr 03, 2018 at 07:48:17AM +0300, Shahaf Shuler wrote: [..] > > > > > > According to your analysis, this is only necessary when the LCS is > > > configured in the device. Why not adding this call to > > > mlx5_dev_interrupt_handler_install() which is responsible to install > > > the LCS callback. > > > > I think it is good practice whether or not LSC is set. > > The link status should be initialized to the correct value after the pr= obe. >=20 > There is no guarantee the link will be accurate, at probe time the link m= ay be > up so internal information has a status up with a speed with this patch. > The application probes a second port, in the mean time the link of the fi= rst > port goes down, the interrupt is still not installed and the internal sta= tus > becomes wrong (still up whereas the port is down). >=20 > Finally at start, the device installs the handler, but the link is still = down > whereas internally it is up, the application will call > rte_eth_link_get_nowait() which will directly copy the wrong internal sta= tus > to the application. This is not correct. Using Verbs, the async_fd on which link status interrupts are reported is c= reated on probe.=20 Even if the interrupt handler is not installed, interrupts still trigger on= this fd. They will be processed when the interrupt handler will be install= ed as part of the port start.=20 So in fact you have the whole trace on the link status changes waiting to b= e processed upon port start.=20 Please try and see.=20 >=20 > There is also another situation, when the application stops the port, the > interrupt is also removed, which means during this time, the internal sta= tus > may be wrong as it won't be updated anymore. > This comes to the same possible situation as above. Same comment.=20 >=20 > > > Another point, the wait to complete flag is useless, if the link is > > > up, the status and speed will be accurate, if not, it will receive an= LSC > event later. > > > > Agree. > > > > So how about keeping the code on the current place, just removing the > > wait_to_complete? >=20 > The current place is not fixing the issue as there is still a possibility= to have a > wrong value. >=20 > Regards, >=20 > -- > N=E9lio Laranjeiro > 6WIND