From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f46.google.com (mail-pg0-f46.google.com [74.125.83.46]) by dpdk.org (Postfix) with ESMTP id AB2AE9133 for ; Wed, 16 Aug 2017 10:15:51 +0200 (CEST) Received: by mail-pg0-f46.google.com with SMTP id v189so19942232pgd.2 for ; Wed, 16 Aug 2017 01:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=u8ZEdnGpKvtUTdPzVznSH6HhnCxqeQ+gQ11n850EfnA=; b=fcgznLlS1JayXZvpyuhZg4Ty++ZZDXofkcWvkqFkXCXkmn6SDbULtcDGVkWfNBgWh9 Ebf4Zpo5SyRoqOAwDXATljlklJvoLkdmV4WriLvkahnBbTir5d0MT4bROTNMN7ES0eRL GubJdoOq8fMXl8pNj/Qjcs7CeLKLEVZzw8Y3b0TBm7IRxZI8OQT8onZWbRPRKzOB2lod 86hij+QIOB4NbJTvH2YqQUfcLzsqSTZbHBqc+6dz4uA73qxqKVyIF8GcGzNnps2MF5rh ySZ3GzFEfr56xt8nHGa6jW69YZtYa2/uLIrkyn62QPjwY3GB9yNFmKroik3v0KukzbaH WxSw== 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:in-reply-to:user-agent; bh=u8ZEdnGpKvtUTdPzVznSH6HhnCxqeQ+gQ11n850EfnA=; b=WU2T4z6kgM1Rz4TXoKSiK4Fsu8gjiiDUS8NuQZ+FOX/KybeJfmQNlS442fL7S9olW2 rxdgtAGqnmh4ki3FhPDAUtUx2nEUtz3Wp5p/vw4PYHm6PqKpvpmwltbfASGPmYyKYPZ2 alIS20ZPx64xndseU6cIsbhB5espa11hjc1g32MQdaBAk24X6LifGjb0PlZa13MXU4Ve fnI2Mh+VUwSnpztHDnvpz5z3ychSOy77fZkDQDc5lXin664St8QacBQqi7RBWwmyUuzs 593i8CtaVQr6juogcoaBtMo4ok7EzKIrfpHZqkpPqmdh0sUc6rA7vsw1JP9cWz1cKybx o/SA== X-Gm-Message-State: AHYfb5g/Tw74ONgkK/PQqqH/m8xLNtfx7kCvAUYUAP7j0YBQ8ZmwTIAD SSstMxO3mgWerWFU X-Received: by 10.84.213.2 with SMTP id f2mr1036202pli.192.1502871350970; Wed, 16 Aug 2017 01:15:50 -0700 (PDT) Received: from yliu-home ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id q76sm1123483pfg.42.2017.08.16.01.15.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Aug 2017 01:15:49 -0700 (PDT) Date: Wed, 16 Aug 2017 16:15:41 +0800 From: Yuanhan Liu To: Matan Azrad Cc: stable@dpdk.org Message-ID: <20170816081541.GY9612@yliu-home> References: <1502870034-54324-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1502870034-54324-1-git-send-email-matan@mellanox.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-stable] [PATCH] net/mlx4: fix probe failure report X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 08:15:52 -0000 On Wed, Aug 16, 2017 at 10:53:54AM +0300, Matan Azrad wrote: > [ backported from upstream commit > 8d0f80167d43949bd24374bcf294a149246dfd1c ] Applied to dpdk-stable/16.11. Thank you! --yliu > > The corrupted code doesn't return error when probe function > fails due to error in device mac address getting. > By this way, the probe function may return success even if the > ETH dev is not allocated. > > Hence, the probe caller, for example failsafe PMD, fails when it > tries to get ETH dev after the device was plugged out while mlx4 > was probing it. > > The fix adds error report to the probe caller when priv_get_mac fails > and in all other failure options which are missing it. > > By this way, it prevents the unexpected behavior to miss ETH device > after the device was probed successfully. > > Fixes: 7fae69eeff13 ("mlx4: new poll mode driver") > Fixes: 7b0661539229 ("mlx4: check if port is configured for ethernet") > Fixes: fec3608673e6 ("mlx4: query netdevice to get initial MAC address") > Cc: stable@dpdk.org > > Signed-off-by: Matan Azrad > Acked-by: Adrien Mazarguil > --- > drivers/net/mlx4/mlx4.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c > index f682413..4a03d34 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -5625,8 +5625,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > ibv_dev = list[i]; > > DEBUG("device opened"); > - if (ibv_query_device(attr_ctx, &device_attr)) > + if (ibv_query_device(attr_ctx, &device_attr)) { > + err = EINVAL; > goto error; > + } > INFO("%u port(s) detected", device_attr.phys_port_cnt); > > for (i = 0; i < device_attr.phys_port_cnt; i++) { > @@ -5652,19 +5654,23 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > DEBUG("using port %u (%08" PRIx32 ")", port, test); > > ctx = ibv_open_device(ibv_dev); > - if (ctx == NULL) > + if (ctx == NULL) { > + err = ENODEV; > goto port_error; > + } > > /* Check port status. */ > err = ibv_query_port(ctx, port, &port_attr); > if (err) { > ERROR("port query failed: %s", strerror(err)); > + err = ENODEV; > goto port_error; > } > > if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { > ERROR("port %d is not configured in Ethernet mode", > port); > + err = EINVAL; > goto port_error; > } > > @@ -5701,6 +5707,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > #ifdef HAVE_EXP_QUERY_DEVICE > if (ibv_exp_query_device(ctx, &exp_device_attr)) { > ERROR("ibv_exp_query_device() failed"); > + err = ENODEV; > goto port_error; > } > #ifdef RSS_SUPPORT > @@ -5776,6 +5783,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > if (priv_get_mac(priv, &mac.addr_bytes)) { > ERROR("cannot get MAC address, is mlx4_en loaded?" > " (errno: %s)", strerror(errno)); > + err = ENODEV; > goto port_error; > } > INFO("port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x", > -- > 2.7.4