From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nelio.laranjeiro@6wind.com>
Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68])
 by dpdk.org (Postfix) with ESMTP id EA7B41B293
 for <dev@dpdk.org>; Fri, 19 Jan 2018 09:35:13 +0100 (CET)
Received: by mail-wm0-f68.google.com with SMTP id t74so1771427wme.3
 for <dev@dpdk.org>; Fri, 19 Jan 2018 00:35:13 -0800 (PST)
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=jM8sVc4jWuAynhYUYu9MEnHXhlOKmt8uj31M+lmFFhQ=;
 b=jVqYJJ21eayEdDyvaDE/Q0pxuZ+Wr2WIxzpBb9dwYLnDZGsAuWOV4zVxNm1Sppnmny
 uKLB4BbOIFpkBDPmOtmOSII9Ly4R1EKeu9B+ylmY2IK3gFXPoFznDgVMJH+Dn3f95tMP
 VmPhtILlh23Pil5sl2gDpIRITDXed2S0oKmagSV4OW6pPtBcTv9zwbw3kAW0oANJpOLB
 5MMo1Eb90CXkHbkqyvg9J4UrWBQAoo4xWAdLaCVY2wS1CIWyepOPPIJpTqP3/Uhd+K4P
 6/6bFKvuQyJVQdHjnEhN/HE9GYaAvZMpDQ1gJsmkl14pmdfGh9dsF+T4CrWIhzORF9I7
 7uIQ==
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=jM8sVc4jWuAynhYUYu9MEnHXhlOKmt8uj31M+lmFFhQ=;
 b=laGNvSpGnlHxDLZATeeDTdfo3HD4jQUMyuiCUccFsMQawiXDKs4dOKbLIw5SRveQCR
 X6pQppCXjg0vsuMMMGw22LmDFTZhDdp0gLWAugvn2erunJXQK3eKuuRFUv0lGpaVTFkf
 KPwWoncwjh6bp3gUXX8/2pbbRJR1+UMQxA+6F0RpiLSdgcT+hWLt4uVnmuvDGiTf8AVe
 x8Gbf55gwpAsUhLdEThnEPGpE2nK0Dodq67GH2nV41MD7n2RBF6UpY8ZNZHqmkUwxOKl
 qNZHPnfWP8JIN5aLWGB8r4vlB1WadA2f0Gjd1cNMZvxhnWUWslgx36iOtYt9xbbch37n
 Q3Iw==
X-Gm-Message-State: AKwxytfeYyq7T6kQ3leYYo9KCD5aSB99EL38hZoKLNnsOUB/sR3V/+mS
 a4QO9eH666zo1uCd5HSH8MAcVsebtw==
X-Google-Smtp-Source: ACJfBosKRyWoCQsTV/hfx3cQVIBFU1Y9z4PVKic4a/w90rRXUxtbplHFgQ6raHD+gx6NP7hTKFE3xA==
X-Received: by 10.80.133.140 with SMTP id a12mr11966285edh.286.1516350913676; 
 Fri, 19 Jan 2018 00:35:13 -0800 (PST)
Received: from laranjeiro-vm.dev.6wind.com
 (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id m15sm300828edj.41.2018.01.19.00.35.12
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 19 Jan 2018 00:35:13 -0800 (PST)
Date: Fri, 19 Jan 2018 09:35:01 +0100
From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro <nelio.laranjeiro@6wind.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>,
 Yongseok Koh <yskoh@mellanox.com>, stable@dpdk.org
Message-ID: <20180119083501.osf4rnd4y4lwujwn@laranjeiro-vm.dev.6wind.com>
References: <20180118130043.31773-1-olivier.matz@6wind.com>
 <20180118160427.4fokyhq7koux6ga6@laranjeiro-vm.dev.6wind.com>
 <20180118161308.26ssahokrsu4e2rn@platinum>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20180118161308.26ssahokrsu4e2rn@platinum>
User-Agent: NeoMutt/20170113 (1.7.2)
Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx5: fix return value of start
	operation
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Jan 2018 08:35:14 -0000

On Thu, Jan 18, 2018 at 05:13:08PM +0100, Olivier Matz wrote:
> On Thu, Jan 18, 2018 at 05:04:27PM +0100, Nélio Laranjeiro wrote:
> > On Thu, Jan 18, 2018 at 02:00:42PM +0100, Olivier Matz wrote:
> > > On error, mlx5_dev_start() does not return a negative value
> > > as it is supposed to do. The consequence is that the application
> > > (ex: testpmd) does not notice that the port is not started
> > > and begins the rxtx on an uninitialized port, which crashes.
> > > 
> > > Fixes: e1016cb73383 ("net/mlx5: fix Rx interrupts management")
> > > Cc: stable@dpdk.org
> > > 
> > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > > ---
> > >  drivers/net/mlx5/mlx5_trigger.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
> > > index 1a20967a2..44f702daa 100644
> > > --- a/drivers/net/mlx5/mlx5_trigger.c
> > > +++ b/drivers/net/mlx5/mlx5_trigger.c
> > > @@ -166,6 +166,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
> > >  		ERROR("%p: an error occurred while configuring control flows:"
> > >  		      " %s",
> > >  		      (void *)priv, strerror(err));
> > > +		err = -err;
> > >  		goto error;
> > >  	}
> > >  	err = priv_flow_start(priv, &priv->flows);
> > > @@ -173,6 +174,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
> > >  		ERROR("%p: an error occurred while configuring flows:"
> > >  		      " %s",
> > >  		      (void *)priv, strerror(err));
> > > +		err = -err;
> > >  		goto error;
> > >  	}
> > >  	err = priv_rx_intr_vec_enable(priv);
> > > @@ -196,7 +198,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
> > >  	priv_rxq_stop(priv);
> > >  	priv_flow_delete_drop_queue(priv);
> > >  	priv_unlock(priv);
> > > -	return -err;
> > > +	return err;
> > >  }
> > >  
> > >  /**
> > 
> > err in the function is handled with positives errno's, adding only those
> > two and returning err will make the other positive.
> 
> I tried to check the return value of all functions called by mlx5_dev_start()
> (negative or positive). Do you see something wrong?

What I mean is priv_flow_start() is returning a positive errno as all
other functions priv_*() that's the main reason for the final rteurn -err;

Internally MLX5 driver only works with positives errnos as lot of them
are retuning the values from ioctl directly.  Only the public ones are
returning negatives.

-- 
Nélio Laranjeiro
6WIND