mlx5: fix link speed capabilities
cover mlx5: fix link speed capabilities
Make hard-coded values dynamic to return correct link speed capabilities (not all ConnectX-4 NICs support everything).
Nelio Laranjeiro (2):
net/mlx5: fix link speed capability information
net/mlx5: fix support for newer link speeds
drivers/net/mlx5/Makefile | 15 +++++ drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_ethdev.c | 148 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 151 insertions(+), 13 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 net/mlx5: fix link speed capability information
Make hard-coded values dynamic to return correct link speed capabilities (not all ConnectX-4 NICs support everything).
--- drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_ethdev.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-)
drivers/net/mlx5/mlx5.h +1 -0
@@ -139,6 +139,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. */ };
drivers/net/mlx5/mlx5_ethdev.c +15 -10
@@ -604,15 +604,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); }
@@ -647,7 +639,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;
@@ -672,6 +664,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 &
Signature · 1 line
2.1.4
PATCH 2/2 net/mlx5: fix support for newer link speeds
In reply to Nelio LaranjeiroNot all speed capabilities can be reported properly before Linux 4.8 (25G, 50G and 100G speeds are missing), moreover the API to retrieve them only exists since Linux 4.5, this commit thus implements compatibility code for all versions.
--- drivers/net/mlx5/Makefile | 15 +++++ drivers/net/mlx5/mlx5_ethdev.c | 123 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 135 insertions(+), 3 deletions(-)
drivers/net/mlx5/Makefile +15 -0
@@ -121,6 +121,21 @@ mlx5_autoconf.h.new: $(RTE_SDK)/scripts/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.
drivers/net/mlx5/mlx5_ethdev.c +120 -3
141 lines not on this page · raw message
Signature · 1 line
2.1.4
Bruce Richardson
AppliedQuoted 7 lines · Nelio Laranjeiro
Make hard-coded values dynamic to return correct link speed capabilities (not all ConnectX-4 NICs support everything).
Nelio Laranjeiro (2):
net/mlx5: fix link speed capability information
net/mlx5: fix support for newer link speeds
Applied to dpdk-next-net/rel_16_11
/Bruce