From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: stable@dpdk.org, Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>,
"Adrien Mazarguil" <adrien.mazarguil@6wind.com>
Subject: [dpdk-stable] [PATCH v2 11/12] net/mlx5: fix link speed capability information
Date: Wed, 9 Nov 2016 10:57:50 +0100 [thread overview]
Message-ID: <3cf0a98c45dc3c5f0224b068e499d62124ff50e0.1478683594.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1478683594.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1478683594.git.nelio.laranjeiro@6wind.com>
From: Nélio Laranjeiro <nelio.laranjeiro@6wind.com>
[ upstream commit 75ef62a9430116e7a0d00fbec68af05a5333c116 ]
Make hard-coded values dynamic to return correct link speed capabilities
(not all ConnectX-4 NICs support everything).
Fixes: e274f5732225 ("ethdev: add speed capabilities")
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
drivers/net/mlx5/mlx5.h | 1 +
drivers/net/mlx5/mlx5_ethdev.c | 25 +++++++++++++++----------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 82172e4..79b7a60 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -135,6 +135,7 @@ struct priv {
unsigned int reta_idx_n; /* RETA index size. */
struct fdir_filter_list *fdir_filter_list; /* Flow director rules. */
struct fdir_queue *fdir_drop_queue; /* Flow director drop queue. */
+ uint32_t link_speed_capa; /* Link speed capabilities. */
rte_spinlock_t lock; /* Lock for control functions. */
};
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 90ad467..20c1c8a 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -603,15 +603,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
info->hash_key_size = ((*priv->rss_conf) ?
(*priv->rss_conf)[0]->rss_key_len :
0);
- info->speed_capa =
- ETH_LINK_SPEED_1G |
- ETH_LINK_SPEED_10G |
- ETH_LINK_SPEED_20G |
- ETH_LINK_SPEED_25G |
- ETH_LINK_SPEED_40G |
- ETH_LINK_SPEED_50G |
- ETH_LINK_SPEED_56G |
- ETH_LINK_SPEED_100G;
+ info->speed_capa = priv->link_speed_capa;
priv_unlock(priv);
}
@@ -646,7 +638,7 @@ mlx5_link_update_unlocked(struct rte_eth_dev *dev, int wait_to_complete)
{
struct priv *priv = mlx5_get_priv(dev);
struct ethtool_cmd edata = {
- .cmd = ETHTOOL_GSET
+ .cmd = ETHTOOL_GSET /* Deprecated since Linux v4.5. */
};
struct ifreq ifr;
struct rte_eth_link dev_link;
@@ -671,6 +663,19 @@ mlx5_link_update_unlocked(struct rte_eth_dev *dev, int wait_to_complete)
dev_link.link_speed = 0;
else
dev_link.link_speed = link_speed;
+ priv->link_speed_capa = 0;
+ if (edata.supported & SUPPORTED_Autoneg)
+ priv->link_speed_capa |= ETH_LINK_SPEED_AUTONEG;
+ if (edata.supported & (SUPPORTED_1000baseT_Full |
+ SUPPORTED_1000baseKX_Full))
+ priv->link_speed_capa |= ETH_LINK_SPEED_1G;
+ if (edata.supported & SUPPORTED_10000baseKR_Full)
+ priv->link_speed_capa |= ETH_LINK_SPEED_10G;
+ if (edata.supported & (SUPPORTED_40000baseKR4_Full |
+ SUPPORTED_40000baseCR4_Full |
+ SUPPORTED_40000baseSR4_Full |
+ SUPPORTED_40000baseLR4_Full))
+ priv->link_speed_capa |= ETH_LINK_SPEED_40G;
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 &
--
2.1.4
next prev parent reply other threads:[~2016-11-09 9:58 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 10:36 [dpdk-stable] [PATCH 00/14] Patches for 16.07.2 stable branch Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 01/14] net/mlx5: support Mellanox OFED 3.4 Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 02/14] net/mlx5: fix possible NULL dereference in Rx path Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 03/14] net/mlx5: fix inconsistent return value in flow director Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 04/14] net/mlx5: fix Rx VLAN offload capability report Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 05/14] net/mlx5: fix removing VLAN filter Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 06/14] net/mlx5: refactor allocation of flow director queues Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 07/14] net/mlx5: fix flow director drop mode Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 08/14] net/mlx5: re-factorize functions Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 09/14] net/mlx5: fix inline logic Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 10/14] net/mlx5: fix Rx function selection Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 11/14] net/mlx5: fix link status report Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 12/14] net/mlx5: fix initialization in secondary process Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 13/14] net/mlx5: fix link speed capability information Nelio Laranjeiro
2016-11-08 10:36 ` [dpdk-stable] [PATCH 14/14] net/mlx5: fix support for newer link speeds Nelio Laranjeiro
2016-11-09 5:39 ` [dpdk-stable] [PATCH 00/14] Patches for 16.07.2 stable branch Yuanhan Liu
2016-11-09 9:38 ` Nélio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 00/12] " Nelio Laranjeiro
2016-11-09 11:01 ` Yuanhan Liu
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 01/12] net/mlx5: support Mellanox OFED 3.4 Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 02/12] net/mlx5: fix possible NULL dereference in Rx path Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 03/12] net/mlx5: fix inconsistent return value in flow director Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 04/12] net/mlx5: fix Rx VLAN offload capability report Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 05/12] net/mlx5: fix removing VLAN filter Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 06/12] net/mlx5: refactor allocation of flow director queues Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 07/12] net/mlx5: fix flow director drop mode Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 08/12] net/mlx5: re-factorize functions Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 09/12] net/mlx5: fix inline logic Nelio Laranjeiro
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 10/12] net/mlx5: fix initialization in secondary process Nelio Laranjeiro
2016-11-09 9:57 ` Nelio Laranjeiro [this message]
2016-11-09 9:57 ` [dpdk-stable] [PATCH v2 12/12] net/mlx5: fix support for newer link speeds Nelio Laranjeiro
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=3cf0a98c45dc3c5f0224b068e499d62124ff50e0.1478683594.git.nelio.laranjeiro@6wind.com \
--to=nelio.laranjeiro@6wind.com \
--cc=adrien.mazarguil@6wind.com \
--cc=stable@dpdk.org \
--cc=yuanhan.liu@linux.intel.com \
/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).