From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id 1ACBF9155 for ; Wed, 16 Aug 2017 16:39:16 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id z91so8249739wrc.4 for ; Wed, 16 Aug 2017 07:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=igIcMUBAQzcoFd/0oYByfehVI/ZF12zeqeWwvmOAqs0=; b=Xl6nSsKkGqwsPNPsVQN8n/5CZPzMrXpwA3iMtUN3jY1dF+gU1D9sUq5dha8jsSjv8z 7DGjLygHxeKpOhUCCW2hK58jdBwmam87yJg5bkOS/H3CvjoRsXh/d/hLhZ1kVHmdP/oH VPJwfaJLqti8i4jO/b5O6VeOwXq8WwEIPnQ4y3XrOBMJQwX3Oj4k+VBUTd6TdgdzuLd3 sSwXrUnQPPZe/7rNTSotO3B4VTPYZpznsrefqciWsspiBxglXekqLvVp+36csJb/sbhp IZnIdGnTgYl6PxYKiUSxLCc9fy4J8cBL2UgSFodyXjhZCK4wLMXg2a6/3dzzV/CMhK0o 9/xg== 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=igIcMUBAQzcoFd/0oYByfehVI/ZF12zeqeWwvmOAqs0=; b=jemnZ4ahUdKloNLpwWp6tatFwwZcghkPUNAbFcpz4AqER/4mbRS1mHnklGD0LaPtyT MNk6CVYY3t/9U3xGFAk9JJWfGWoL5xYHRdTKcQE2ND+jhjPgs1digsmtQ+S141b9Ju+w nT8QcEH161aJimimgxiO5pgLBw7b6sklLJS+LM57qVziMXm7Gj01/EWUDkHxnR/S6Z7R zn6AECvgMpxMlqc0211TJVwzPXzcxnJTK0Xkl8PaRndPRSgqbqB2ZpJOLon6Rw4hADLC 5igWtrINDaJ0CpZFwnHHGmgBnINwCSMs2yKPD65+z5m9tJvV4DDEkn1SZLBQ+hvvVGMU IaOQ== X-Gm-Message-State: AHYfb5gT9uH3Qj/Ogiw5pUB1VFWZ6P/pXCr2yFh4o9KGRW8W8bokkL68 jxqbKnPRaj1ZsN80 X-Received: by 10.223.161.133 with SMTP id u5mr1504812wru.191.1502894356475; Wed, 16 Aug 2017 07:39:16 -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 k45sm161423wre.1.2017.08.16.07.39.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Aug 2017 07:39:15 -0700 (PDT) Date: Wed, 16 Aug 2017 16:39:06 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Matan Azrad Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20170816143906.GN8124@bidouze.vm.6wind.com> References: <20170816125151.GM8124@bidouze.vm.6wind.com> <1502893168-61001-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1502893168-61001-1-git-send-email-matan@mellanox.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2] net/failsafe: fix tx sub device deactivating 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, 16 Aug 2017 14:39:17 -0000 On Wed, Aug 16, 2017 at 05:19:28PM +0300, Matan Azrad wrote: > The corrupted code couldn't recognize that all sub devices > were not ready for tx traffic when failsafe PMD was trying > to switch device because of an unreachable condition using. > > Hence, the current tx sub device variable was not updated > correctly. > > The fix removed the unreachable branch and added new one > in the right place respecting the original intent. > > Fixes: ebea83f899d8 ("net/failsafe: add plug-in support") > Fixes: 598fb8aec6f6 ("net/failsafe: support device removal") > Cc: stable@dpdk.org > > Signed-off-by: Matan Azrad > Acked-by: Gaetan Rivet > --- > drivers/net/failsafe/failsafe_private.h | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h > index 0361cf4..ef646db 100644 > --- a/drivers/net/failsafe/failsafe_private.h > +++ b/drivers/net/failsafe/failsafe_private.h > @@ -334,7 +334,7 @@ fs_switch_dev(struct rte_eth_dev *dev, > } else if ((txd && txd->state < req_state) || > txd == NULL || > txd == banned) { > - struct sub_device *sdev; > + struct sub_device *sdev = NULL; Good catch, actually this makes me think that the FOREACH_SUBDEV_STATE macro is not following the usual tailq API (which sets the iterator to NULL upon terminating). This can throw-off the unsuspecting writer. I will fix this soon™. In the meantime, sdev should be initialized to NULL. > uint8_t i; > > /* Using acceptable device */ > @@ -346,9 +346,10 @@ fs_switch_dev(struct rte_eth_dev *dev, > PRIV(dev)->subs_tx = i; > break; > } > - } else if (txd && txd->state < req_state) { > - DEBUG("No device ready, deactivating tx_dev"); > - PRIV(dev)->subs_tx = PRIV(dev)->subs_tail; > + if (i >= PRIV(dev)->subs_tail || sdev == NULL) { > + DEBUG("No device ready, deactivating tx_dev"); > + PRIV(dev)->subs_tx = PRIV(dev)->subs_tail; > + } > } else { > return; > } > -- > 2.7.4 > -- Gaëtan Rivet 6WIND