From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9023C43331 for ; Thu, 5 Sep 2019 16:25:10 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 1657F207E0 for ; Thu, 5 Sep 2019 16:25:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=6wind.com header.i=@6wind.com header.b="SRcDGqrZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1657F207E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=6wind.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5EDD71F03E; Thu, 5 Sep 2019 18:25:09 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 02E811F03C for ; Thu, 5 Sep 2019 18:25:08 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id w13so3517177wru.7 for ; Thu, 05 Sep 2019 09:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=5bFn8pr0GGcYvrjDk5jFu702NmcSpyihrc+XSqJiKNM=; b=SRcDGqrZS1CVpb/TmCE8gg0/GVSnw+46V/kqM+n/Y9PXxkaseja5Prlip0eelVLpdS Mu//dOqSTfe9TJkpPOtXCqeM8CXDhZRT+4iIKY7uDBUzH8qqB8drCU/bTEGz3MO7YfUK Z7wCjgEx5n9XiqRxU3ZSSegrYRV8lMdSTeGH+Mxysonv5RzZ2YOBg/fSoQrGyIYmMxcq e9ZyF5eEbnci/CIjurxDJP23NU9anOmb0hp84wC1EA7MwdqBsxyTX6+vzayCShO/7zt4 1o5zS56bdLLyVYTeR/SsJsgOJ8Ca5lKBIb2sjsGUxpVRLnfeA/XeqzYvdkQWTvYOuLJr NiyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=5bFn8pr0GGcYvrjDk5jFu702NmcSpyihrc+XSqJiKNM=; b=StoqxYeWbYLp+wJTMhcqfK14G2IBqM9xcXPNNImC80/y97XjT07XSfCW0tVpgJ3UA4 pde4uD4GJ8wT8+0R8z5uHJL2hAKYX31RwJ6JEK63dHUEMlFV62aAMC05xM9FLjM8meVs XmDqtH6GVLDTFN1LmsnOT7YzGK6NrBf00WztZfZCEQtsPpuPRGGOW13DhzOMLkBzwIsB U3RVmb/XZWrUALf87/nJZAe5fKDV0n1Fk8cd1yaO0g8R3EQBvGhUvL4mbw3RZlqRn/8g 7eawJbeXFOhEi3mZEHDmVYGi6qF5CvTJWDBv1/xcf5n0IDymcoX9sB1T4OWCdpuNhwx1 rfAQ== X-Gm-Message-State: APjAAAWOSLxzdWL1XRbLrTMiQ99k8lc+oe44q5OAFxOC3vx3oPTjv1h+ OVvpTRlCvS4vFeUVp/5CIhGoU1WNY4s= X-Google-Smtp-Source: APXvYqyDb5KUYTMHeMQ+kM4HDpaRZvDwCjabJoGKfVc3C+6sgefMWGCKryMv+EkBuKt6YaCMnRd/MQ== X-Received: by 2002:a5d:4a03:: with SMTP id m3mr3375264wrq.182.1567700707770; Thu, 05 Sep 2019 09:25:07 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 74sm3444605wma.15.2019.09.05.09.25.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Sep 2019 09:25:07 -0700 (PDT) Date: Thu, 5 Sep 2019 18:25:05 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Andrew Rybchenko Cc: dev@dpdk.org, Ivan Ilchenko Message-ID: <20190905162505.fsyabet322zymtj7@bidouze.vm.6wind.com> References: <1567699852-31693-1-git-send-email-arybchenko@solarflare.com> <1567699852-31693-3-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1567699852-31693-3-git-send-email-arybchenko@solarflare.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, On Thu, Sep 05, 2019 at 05:10:40PM +0100, Andrew Rybchenko wrote: > From: Ivan Ilchenko > > rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return > value was changed from void to int, so this patch modify usage > of these functions across net/failsafe according to new return type. > > Try to keep promiscuous mode consistent across all active > devices in the case of failure. > > Signed-off-by: Ivan Ilchenko > Signed-off-by: Andrew Rybchenko > --- > drivers/net/failsafe/failsafe_ether.c | 8 +++-- > drivers/net/failsafe/failsafe_ops.c | 44 ++++++++++++++++++++++++--- > 2 files changed, 46 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c > index 504c76edb0..bd38f1c1e4 100644 > --- a/drivers/net/failsafe/failsafe_ether.c > +++ b/drivers/net/failsafe/failsafe_ether.c > @@ -126,9 +126,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, > if (dev->data->promiscuous != edev->data->promiscuous) { > DEBUG("Configuring promiscuous"); > if (dev->data->promiscuous) > - rte_eth_promiscuous_enable(PORT_ID(sdev)); > + ret = rte_eth_promiscuous_enable(PORT_ID(sdev)); > else > - rte_eth_promiscuous_disable(PORT_ID(sdev)); > + ret = rte_eth_promiscuous_disable(PORT_ID(sdev)); > + if (ret != 0) { > + ERROR("Failed to apply promiscuous mode"); > + return ret; > + } > } else { > DEBUG("promiscuous already set"); > } > diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c > index cc14bc2bcc..cbf143fb3c 100644 > --- a/drivers/net/failsafe/failsafe_ops.c > +++ b/drivers/net/failsafe/failsafe_ops.c > @@ -659,11 +659,29 @@ fs_promiscuous_enable(struct rte_eth_dev *dev) > { > struct sub_device *sdev; > uint8_t i; > + int ret = 0; > > fs_lock(dev, 0); > - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) > - rte_eth_promiscuous_enable(PORT_ID(sdev)); > + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { > + ret = rte_eth_promiscuous_enable(PORT_ID(sdev)); > + if (ret != 0) { > + ERROR("Promiscuous mode enable failed for subdevice %d", > + PORT_ID(sdev)); > + break; > + } > + } > + if (ret != 0) { > + /* Rollback in the case of failure */ > + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { > + ret = rte_eth_promiscuous_disable(PORT_ID(sdev)); > + if (ret != 0) > + ERROR("Promiscuous mode disable failed for subdevice %d", > + PORT_ID(sdev)); > + } > + } > fs_unlock(dev, 0); > + > + return; This patch should be applied after the ethdev change to avoid breaking the build, I think? You should be able to change the ethdev API, leaving the fail-safe internals ignore the return value, then apply this patch and fix it. This way the patchset should not break the build mid-series. Otherwise good implementation with the rollback. -- Gaëtan Rivet 6WIND