Mlx5 driver returning incorrect speed capability

Any reason for DPDK-mlx5 driver returning incorrect speed-capability. Reports 40G when NIC is easily capable of 100G with other end connected to a 100G link. rte_eth_dev_info_get is returning incorrect struct rte_eth_dev_info–>speed_capa (40G). When links come up they do come up as 100G which is more than 40G. rte function to return the link speed (rte_eth_link_get) also returns 100G but speed_capa is still falling off (40G). Can you please provide a patch to fix this or provide any initialization setting during rte_eth_dev_register or other calls that fixes this?

lspci-output:
65:00.4 Ethernet controller: Mellanox Technologies ConnectX Family mlx5Gen Virtual Function
Subsystem: Mellanox Technologies ConnectX Family mlx5Gen Virtual Function
Control: I/O- Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- SERR- <PERR- INTx-
Latency: 0
NUMA node: 0
Region 0: Memory at 240004200000 (64-bit, prefetchable) [virtual] [size=1M]
Capabilities: [60] Express (v2) Endpoint, MSI 00
DevCap: MaxPayload 512 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop- FLReset-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr- TransPend-
LnkCap: Port #0, Speed 16GT/s, Width x16, ASPM not supported
ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk-
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed unknown (downgraded), Width x0 (downgraded)
TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Range ABC, TimeoutDis+, NROPrPrP-, LTR-
10BitTagComp+, 10BitTagReq-, OBFF Not Supported, ExtFmt-, EETLPPrefix-
EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
FRS-, TPHComp-, ExtTPHComp-
AtomicOpsCap: 32bit- 64bit- 128bitCAS-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
AtomicOpsCtl: ReqEn-
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [9c] MSI-X: Enable+ Count=12 Masked-
Vector table: BAR=0 offset=00002000
PBA: BAR=0 offset=00003000
Capabilities: [100 v1] Vendor Specific Information: ID=0000 Rev=0 Len=00c <?>
Capabilities: [150 v1] Alternative Routing-ID Interpretation (ARI)
ARICap: MFVC- ACS-, Next Function: 0
ARICtl: MFVC- ACS-, Function Group: 0
Kernel driver in use: mlx5_core
Kernel modules: mlx5_core

bash-4.4$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-ia32:core-4.1-noarch
Distributor ID: OracleServer
Description: Oracle Linux Server release 8.8
Release: 8.8
Codename: n/a
bash-4.4$

ethtool output:
r750-1:~/cloudy-saos$ ethtool ens1f1np1
Settings for ens1f1np1:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseT/Full
1000baseKX/Full
10000baseT/Full
10000baseKR/Full
10000baseR_FEC
40000baseKR4/Full
40000baseCR4/Full
40000baseSR4/Full
40000baseLR4/Full
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
50000baseCR2/Full
50000baseKR2/Full
100000baseKR4/Full
100000baseSR4/Full
100000baseCR4/Full
100000baseLR4_ER4/Full
50000baseSR2/Full
1000baseX/Full
10000baseCR/Full
10000baseSR/Full
10000baseLR/Full
10000baseER/Full
50000baseKR/Full
50000baseSR/Full
50000baseCR/Full
50000baseLR_ER_FR/Full
50000baseDR/Full
100000baseKR2/Full
100000baseSR2/Full
100000baseCR2/Full
100000baseLR2_ER2_FR2/Full
100000baseDR2/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Supported FEC modes: None BaseR RS
Advertised link modes: 1000baseT/Full
1000baseKX/Full
10000baseT/Full
10000baseKR/Full
10000baseR_FEC
40000baseKR4/Full
40000baseCR4/Full
40000baseSR4/Full
40000baseLR4/Full
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
50000baseCR2/Full
50000baseKR2/Full
100000baseKR4/Full
100000baseSR4/Full
100000baseCR4/Full
100000baseLR4_ER4/Full
50000baseSR2/Full
1000baseX/Full
10000baseCR/Full
10000baseSR/Full
10000baseLR/Full
10000baseER/Full
50000baseKR/Full
50000baseSR/Full
50000baseCR/Full
50000baseLR_ER_FR/Full
50000baseDR/Full
100000baseKR2/Full
100000baseSR2/Full
100000baseCR2/Full
100000baseLR2_ER2_FR2/Full
100000baseDR2/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Advertised FEC modes: None
Speed: 100000Mb/s
Duplex: Full
Port: FIBRE
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x00000004 (4)
link
Link detected: yes

Few DPDK functions traversed:
rte_eth_dev_info_get()->mlx5_dev_infos_get()->
info->speed_capa = priv->link_speed_capa;

Do see supported/advertised link-modes in ethtool output (pasted above) showing corresponding100G below in the driver logic, assuming I am looking at the right file that picks speed_capa

DPDK Mlx5 driver code-snippets

542 if (sc & (MLX5_BITSHIFT(ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT) |
543 MLX5_BITSHIFT(ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT) |
544 MLX5_BITSHIFT(ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT) |
545 MLX5_BITSHIFT(ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT)))
546 priv->link_speed_capa |= ETH_LINK_SPEED_40G;

Versus

559 if (sc & (MLX5_BITSHIFT(ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT) |
560 MLX5_BITSHIFT(ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT) |
561 MLX5_BITSHIFT(ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT) |
562 MLX5_BITSHIFT(ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT)))
563 priv->link_speed_capa |= ETH_LINK_SPEED_100G;

Please let me know if you need additional information. Thanks

Hi @pgajarampalli ,

I added two lines in the dpdk-test app to display the link speed capabilities returned by rte_eth_dev_info_get.

In port_init_common:

if (dev_info.speed_capa & RTE_ETH_LINK_SPEED_100G)
printf(“Port Speed supports 100G, and capability of 100G is set.\n”);

It printed correctly that the link speed capability is 100G.

I’m using DPDK 22.03.

To address any additional debugging needs, kindly utilize the support ticket channel according to your entitlement.

Regards,
Chen

It turned out to be an incorrectly applied DPDK patch that resulted into this. Existing mlx5 driver indeed was getting the speed capability correctly on VFs