From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 468992C6E for ; Wed, 1 Feb 2017 10:07:19 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id t18so27201513wmt.0 for ; Wed, 01 Feb 2017 01:07:19 -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; bh=gwyErplTudmGRs4VIb8Rlq3kBhxuDQSci/As3k4dpQY=; b=lnIqj0bE+cRebxbii7fR6j6niquTn6gCJIqBDjW4M10/qIswmqX1r1VxT9fE5k0EPE rOo6bRqflAkJy87Ro/Wz7eKsKOg06gyQ+RNRMizhD96r+10ZcbieO2KUlUfr1tZUEyBx A0Vvq1LIdQuudHkzi8fXkh7DBsNOPvzpKtvjPa5Iq7J+jQtZEMy7osYJEO2/18PpyYVR FFMQ5jKI9dC+2R3iCNZ5Uxmsm2cylfcm/cW97pN+Ks8MCnMGlW4X/64P6mRDcbzblreG HdW5LTe6Jqs7xLSlqla144LA81sVX3fbeX+tMo5V2xnz/4QCwRabszWiLlWeHAgiX5e7 W0vw== 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; bh=gwyErplTudmGRs4VIb8Rlq3kBhxuDQSci/As3k4dpQY=; b=i9z1ImYR2dJ+CEh94O2TDehoqoTxUktcSJ5vnXYqbZi9/ZCbxiyrF8b0o39WvgjWy8 FTv4ohq8r83SqoO8D3hLP53hLkT17e203kHbiyNOCE29jcBuKDdgp/d95ZalJ8peQI+W qJGAKmCg8olCoaXKwu57JlfShGOZMbgLYfkTxrYnK/QH9inLKLSQP8vHL1HWDVxxCnZm qcV37GBchVkgfT6sHutyNLmhtQ3jC+Yn11c1s5lXWwti9cf0DlUhsjnJp47Cp7OBPkmd Y6vc8CPDbq+9MHUtGZkv2PG5R4ErGkkyx8Nt8VhSZKmazM04xq72reKjVAJ1+9rSK+uw DfHA== X-Gm-Message-State: AIkVDXKPXPLnNPkhYJwWyXet3F4GG0IXluwK3RyGvusnItAXuzvUQPqbYlS06iCw5kD+bB8A X-Received: by 10.28.232.90 with SMTP id f87mr21109211wmh.35.1485940038985; Wed, 01 Feb 2017 01:07:18 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x25sm33010738wrx.27.2017.02.01.01.07.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 01:07:18 -0800 (PST) Date: Wed, 1 Feb 2017 10:07:11 +0100 From: Adrien Mazarguil To: Shahaf Shuler Cc: Ferruh Yigit , =?utf-8?B?TsOpbGlv?= Laranjeiro , "dev@dpdk.org" , "stable@dpdk.org" Message-ID: <20170201090711.GP10133@6wind.com> References: <1485348178-43771-1-git-send-email-shahafs@mellanox.com> <1485863129-6326-1-git-send-email-shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v2] net/mlx5: fix link status query 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, 01 Feb 2017 09:07:19 -0000 On Wed, Feb 01, 2017 at 06:53:55AM +0000, Shahaf Shuler wrote: > : Tuesday, January 31, 2017 6:17 PM, Ferruh Yigit: > > On 1/31/2017 11:45 AM, Shahaf Shuler wrote: > > > Trying to query the link status through new kernel ioctl API > > > ETHTOOL_GLINKSETTINGS was always failing due to kernel bug. > > > The bug was fixed on version 4.9 > > > this patch uses the legacy ioctl API for lower kernels. > > > > > > Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds") > > > CC: stable@dpdk.org > > > > > > Signed-off-by: Shahaf Shuler > > > --- > > > > <...> > > > > > @@ -707,7 +708,7 @@ struct priv * > > > static int > > > mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int > > > wait_to_complete) { -#ifdef ETHTOOL_GLINKSETTINGS > > > +#if KERNEL_VERSION(4, 9, 0) <= LINUX_VERSION_CODE > > > > Mostly it is not good idea to do kernel version check in the .c file. > > > > It is possible to move this comparison to the .h file, and set a feature > > macro based on comparison result, like HAVE_ETHTOOL_GLINKSETTINGS, > > and > > use this macro in the .c file. > > > > This makes .c code easier to understand. And the abstraction in the > > header file lets you update the comparison in the future without > > changing the code itself. > > > > But it is your call, do you prefer to continue with this one? > > This is a good suggestion. > Adrien, NĂ©lio what do you think? Let's include this patch as-is. Doing so in a header file such as mlx5.h would require including linux/version.h from that file and cause the entire PMD to be even more OS-dependent. We'll move this check elsewhere in the future if we need several such workarounds, thanks. > > > struct priv *priv = mlx5_get_priv(dev); > > > struct ethtool_link_settings edata = { > > > .cmd = ETHTOOL_GLINKSETTINGS, > > <...> -- Adrien Mazarguil 6WIND