From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matan Azrad Subject: Re: [PATCH v3 6/6] net/failsafe: fix removed device handling 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> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Adrien Mazarguil , Thomas Monjalon , "dev@dpdk.org" To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= 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) In-Reply-To: <20171219222131.plcfn5wqggyn5znw@bidouze.vm.6wind.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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