From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH v3 6/6] net/failsafe: fix removed device handling Date: Tue, 19 Dec 2017 23:21:31 +0100 Message-ID: <20171219222131.plcfn5wqggyn5znw@bidouze.vm.6wind.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Adrien Mazarguil , Thomas Monjalon , dev@dpdk.org To: Matan Azrad Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id E0784324B for ; Tue, 19 Dec 2017 23:21:44 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id t8so6482096wmc.3 for ; Tue, 19 Dec 2017 14:21:44 -0800 (PST) Content-Disposition: inline In-Reply-To: <1513703415-29145-7-git-send-email-matan@mellanox.com> 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 Matan, 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 > --- > +/* > + * 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 == 0 || sdev->remove == 1 || err == -EIO) > + return false; > + return true; > +} This is better, thanks. 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. What do you think? -- Gaëtan Rivet 6WIND