[dpdk-dev] [dpdk-stable] [PATCH v2] net/mlx5: fix link status query

Ferruh Yigit ferruh.yigit at intel.com
Tue Jan 31 17:17:09 CET 2017

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 at dpdk.org
> Signed-off-by: Shahaf Shuler <shahafs at mellanox.com>
> ---


> @@ -707,7 +708,7 @@ struct priv *
>  static int
>  mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
>  {

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?

>  	struct priv *priv = mlx5_get_priv(dev);
>  	struct ethtool_link_settings edata = {

More information about the dev mailing list