From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shahaf Shuler Subject: Re: [dpdk-stable] [PATCH v2] net/mlx5: fix link status query Date: Wed, 1 Feb 2017 06:53:55 +0000 Message-ID: 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "stable@dpdk.org" To: Ferruh Yigit , Adrien Mazarguil , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= Return-path: In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" : 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 > > --- >=20 > <...> >=20 > > @@ -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) <=3D LINUX_VERSION_CODE >=20 > Mostly it is not good idea to do kernel version check in the .c file. >=20 > 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. >=20 > 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. >=20 > But it is your call, do you prefer to continue with this one? This is a good suggestion.=20 Adrien, N=E9lio what do you think? >=20 > > struct priv *priv =3D mlx5_get_priv(dev); > > struct ethtool_link_settings edata =3D { > > .cmd =3D ETHTOOL_GLINKSETTINGS, > <...>