From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40058.outbound.protection.outlook.com [40.107.4.58]) by dpdk.org (Postfix) with ESMTP id 45B3C1B03F for ; Wed, 20 Dec 2017 11:58:30 +0100 (CET) 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=Sza9bKpY1WkXNuBGGL+2YxV0kKDRJKyP6fa1FFPGLJk=; b=o/fQr4r+/e8y9isgKygFKUpSBFTVBWgyjjPumUF8+TN7RtGTsaMTvHaiq0ZajudySs86nJeq+6hYFHmvGBa4pEwasHKd7VzlW657uCH3HTKENu1eVskUSs0D5i1TOHv7BxjkIph8F3V+loa8THDGpwAzBvlCCtE1QteLdNdGxMk= Received: from HE1PR0502MB3659.eurprd05.prod.outlook.com (10.167.127.17) by HE1PR0502MB3657.eurprd05.prod.outlook.com (10.167.127.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 10:58:29 +0000 Received: from HE1PR0502MB3659.eurprd05.prod.outlook.com ([fe80::982e:2dce:9449:6891]) by HE1PR0502MB3659.eurprd05.prod.outlook.com ([fe80::982e:2dce:9449:6891%13]) with mapi id 15.20.0323.018; Wed, 20 Dec 2017 10:58:29 +0000 From: Matan Azrad To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: Adrien Mazarguil , Thomas Monjalon , "dev@dpdk.org" Thread-Topic: [PATCH v3 6/6] net/failsafe: fix removed device handling Thread-Index: AQHTeRfCVjig+VM1dkqFOSUojatLK6NMDewg Date: Wed, 20 Dec 2017 10:58:29 +0000 Message-ID: References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <1513703415-29145-1-git-send-email-matan@mellanox.com> <1513703415-29145-7-git-send-email-matan@mellanox.com> <20171219222131.plcfn5wqggyn5znw@bidouze.vm.6wind.com> In-Reply-To: <20171219222131.plcfn5wqggyn5znw@bidouze.vm.6wind.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0502MB3657; 6:3MVKTlgtlBBPOEzmuCBAKY2+pTVDRynif0SZHciWNkwy0deV3MdLDCURkNkfLLySNhy9Vtq6FKBrA3iIwx0e2+VqBZkWgYJrsrHQt7/XFAGlVRQ4UYZzD6uvxz0Kow5CtQAphvHNCI5p8f3mR4Fskh62hxMU5kT6PZIiPVs6Yo0GMWL4YWecLHLPqw9rohTfnAFPiOoXFGl3IMwCaSdSd1K+wmSbGKEEbyYcczsHWbZAC8di8xvBGKU5MNvXMlQ0yIq+UxZ9MDglz/3qGtqyfb23nDg2PS2Y2oMG/LVUELEx5ThU8ck+AZrBDjrLqxAIwIfN6t6enEI72zAjSFO5Sb3cgbuHblL4sOJRaSgUZBM=; 5:iUggglTcwFlWf3JS2mvf/4sMdw6UC0MpnXL6KzMrOs2X5Vsg9zekOMjdRzwHPiepSylK27JUsUtiKqN5SO9Kn6dmPjHfJX8zqfsNnPFX71ewpAlmL55se1zPJnCzEtAHcLwcy86nWhKWgToii7NQ8UpL3MkMi/0z/vDfi8WthCc=; 24:fgh2H6swu3gzflOjPsQQ0pBlcCWOLUPMQaoc1GiltH55ekukpj6IVWmR3sFglLE2VlyF0HgWJtuaDdNZIO7MZKabG+snQrBaS1A/BZlcNQg=; 7:Udfk+5GLoEaIhDWJIPs0Ymt3Dxs+RHaI/H8ub0Lvgl/Wj7BIYlDTZZ4tKfvyzIU+vznWp3xCHxs0PmwM376GULw2IM2jTo8jTrpVqD/FRihoIe5mfdv7TKSu0IptwpG9LKsq3mUsFGbGg5WozOqt/3jk20e8hA2cbcfIuiRDqoR6UFUmAVC/ntmfFZRL7FliY7XTmo5ZeFliqppehN9G++yelQP/hg1wH6v/uY0zyoiRpuISSVUxTtvy5uVuISd8 x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 78e71495-3c71-45d4-34fb-08d547989a84 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7153060); SRVR:HE1PR0502MB3657; x-ms-traffictypediagnostic: HE1PR0502MB3657: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231023)(3002001)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:HE1PR0502MB3657; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0502MB3657; x-forefront-prvs: 0527DFA348 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(376002)(346002)(39860400002)(39380400002)(189003)(13464003)(199004)(76104003)(51444003)(24454002)(105586002)(97736004)(229853002)(5250100002)(74316002)(478600001)(25786009)(59450400001)(6436002)(6506007)(55016002)(53546011)(68736007)(9686003)(86362001)(8936002)(106356001)(93886005)(316002)(2950100002)(7696005)(3660700001)(5660300001)(54906003)(2906002)(33656002)(14454004)(2900100001)(99286004)(53936002)(305945005)(66066001)(7736002)(3280700002)(102836003)(4326008)(76176011)(81166006)(81156014)(3846002)(6916009)(8676002)(6246003)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3657; H:HE1PR0502MB3659.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) 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: 78e71495-3c71-45d4-34fb-08d547989a84 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2017 10:58:29.5281 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3657 Subject: Re: [dpdk-dev] [PATCH v3 6/6] net/failsafe: fix removed device handling 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: Wed, 20 Dec 2017 10:58:31 -0000 Hi Gaetan > -----Original Message----- > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Wednesday, December 20, 2017 12:22 AM > To: Matan Azrad > Cc: Adrien Mazarguil ; Thomas Monjalon > ; dev@dpdk.org > Subject: Re: [PATCH v3 6/6] net/failsafe: fix removed device handling >=20 > Hi Matan, >=20 > On Tue, Dec 19, 2017 at 05:10:15PM +0000, Matan Azrad wrote: > > There is time between the physical removal of the device until > > sub-device PMDs get a RMV interrupt. At this time DPDK PMDs and > > applications still don't know about the removal and may call > > sub-device control operation which should return an error. > > > > In previous code this error is reported to the application contrary to > > fail-safe principle that the app should not be aware of device removal. > > > > Add an removal check in each relevant control command error flow and > > prevent an error report to application when the sub-device is removed. > > > > Fixes: a46f8d5 ("net/failsafe: add fail-safe PMD") > > Fixes: b737a1e ("net/failsafe: support flow API") > > > > Signed-off-by: Matan Azrad > > --- >=20 > >=20 > > +/* > > + * Check if error should be reported to the user. > > + */ > > +static inline bool > > +fs_is_error(struct sub_device *sdev, int err) { > > + /* A device removal shouldn't be reported as an error. */ > > + if (err =3D=3D 0 || sdev->remove =3D=3D 1 || err =3D=3D -EIO) > > + return false; > > + return true; > > +} >=20 > This is better, thanks. >=20 > However is there a reason you did not follow the same pattern as ethdev > with eth_err? I see the two functions as similar in their intent, making = them > close to each other would be clearer to a reader being familiar with the > ethdev API and that would be interested in fail-safe. >=20 > What do you think? >=20 I think that there is a real different between eth_err function to fs_is_er= ror: ethdev uses eth_err function to adjust removal return value to be -EIO. fail-safe uses fs_is_error function to check if an error should be reported= to the user to save the fail-safe principle that the app should not be awa= re of device removal - this is the main idea that also causes me to chang= e the name from fs_is_removed to fs_is_error. > -- > Ga=EBtan Rivet > 6WIND