From: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: guillaume.gaudonville@6wind.com, adrien.mazarguil@6wind.com,
dev@dpdk.org, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix link status query
Date: Tue, 31 Jan 2017 16:42:01 +0100 [thread overview]
Message-ID: <20170131154201.GC16389@autoinstall.dev.6wind.com> (raw)
In-Reply-To: <1485863129-6326-1-git-send-email-shahafs@mellanox.com>
On Tue, Jan 31, 2017 at 01:45:29PM +0200, 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 <shahafs@mellanox.com>
> ---
> on v2:
> * remove HAVE_ETHTOOL_LINK_MODE_*
>
> ---
> drivers/net/mlx5/Makefile | 15 ---------------
> drivers/net/mlx5/mlx5_ethdev.c | 12 +++---------
> 2 files changed, 3 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
> index 671089c..0b8f7ba 100644
> --- a/drivers/net/mlx5/Makefile
> +++ b/drivers/net/mlx5/Makefile
> @@ -122,21 +122,6 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
> infiniband/mlx5_hw.h \
> enum MLX5_OPCODE_TSO \
> $(AUTOCONF_OUTPUT)
> - $Q sh -- '$<' '$@' \
> - HAVE_ETHTOOL_LINK_MODE_25G \
> - /usr/include/linux/ethtool.h \
> - enum ETHTOOL_LINK_MODE_25000baseCR_Full_BIT \
> - $(AUTOCONF_OUTPUT)
> - $Q sh -- '$<' '$@' \
> - HAVE_ETHTOOL_LINK_MODE_50G \
> - /usr/include/linux/ethtool.h \
> - enum ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT \
> - $(AUTOCONF_OUTPUT)
> - $Q sh -- '$<' '$@' \
> - HAVE_ETHTOOL_LINK_MODE_100G \
> - /usr/include/linux/ethtool.h \
> - enum ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT \
> - $(AUTOCONF_OUTPUT)
>
> # Create mlx5_autoconf.h or update it in case it differs from the new one.
>
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index 8efdff7..53599fa 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -46,6 +46,7 @@
> #include <netinet/in.h>
> #include <linux/ethtool.h>
> #include <linux/sockios.h>
> +#include <linux/version.h>
> #include <fcntl.h>
>
> /* DPDK headers don't like -pedantic. */
> @@ -697,7 +698,7 @@ struct priv *
>
> /**
> * Retrieve physical link information (unlocked version using new ioctl from
> - * Linux 4.5).
> + * Linux 4.9).
> *
> * @param dev
> * Pointer to Ethernet device structure.
> @@ -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
> struct priv *priv = mlx5_get_priv(dev);
> struct ethtool_link_settings edata = {
> .cmd = ETHTOOL_GLINKSETTINGS,
> @@ -757,25 +758,18 @@ struct priv *
> ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT |
> ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT))
> priv->link_speed_capa |= ETH_LINK_SPEED_56G;
> - /* Link speeds available in kernel v4.6. */
> -#ifdef HAVE_ETHTOOL_LINK_MODE_25G
> if (sc & (ETHTOOL_LINK_MODE_25000baseCR_Full_BIT |
> ETHTOOL_LINK_MODE_25000baseKR_Full_BIT |
> ETHTOOL_LINK_MODE_25000baseSR_Full_BIT))
> priv->link_speed_capa |= ETH_LINK_SPEED_25G;
> -#endif
> -#ifdef HAVE_ETHTOOL_LINK_MODE_50G
> if (sc & (ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT |
> ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT))
> priv->link_speed_capa |= ETH_LINK_SPEED_50G;
> -#endif
> -#ifdef HAVE_ETHTOOL_LINK_MODE_100G
> if (sc & (ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT |
> ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT |
> ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT |
> ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT))
> priv->link_speed_capa |= ETH_LINK_SPEED_100G;
> -#endif
> dev_link.link_duplex = ((edata.duplex == DUPLEX_HALF) ?
> ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX);
> dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
> --
> 1.8.3.1
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
--
Nélio Laranjeiro
6WIND
next prev parent reply other threads:[~2017-01-31 15:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 12:42 [dpdk-dev] [PATCH 1/2] " Shahaf Shuler
2017-01-30 15:25 ` Nélio Laranjeiro
2017-01-31 11:45 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
2017-01-31 15:42 ` Nélio Laranjeiro [this message]
2017-02-01 18:31 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2017-02-02 8:20 ` Nélio Laranjeiro
2017-02-02 10:18 ` Ferruh Yigit
2017-01-31 16:17 ` Ferruh Yigit
2017-02-01 6:53 ` Shahaf Shuler
2017-02-01 9:07 ` Adrien Mazarguil
2017-02-01 11:13 ` Ferruh Yigit
2017-02-01 12:57 ` Adrien Mazarguil
2017-02-01 18:11 ` Ferruh Yigit
2017-02-02 8:45 ` Adrien Mazarguil
2017-02-02 10:15 ` Ferruh Yigit
2017-02-02 10:37 ` Adrien Mazarguil
2017-02-02 10:43 ` Ferruh Yigit
2017-02-09 12:29 ` [dpdk-dev] [PATCH v3] " Shahaf Shuler
2017-02-09 14:45 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170131154201.GC16389@autoinstall.dev.6wind.com \
--to=nelio.laranjeiro@6wind.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=guillaume.gaudonville@6wind.com \
--cc=shahafs@mellanox.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).