Examine SFP/QSFP model and optical quality

I used to be able to do this with mst, but this is absent in the current mlx5_core driver.
mstflint and mstconfig don’t appear to have this ability

here is an example of the old tools:

is there a way?

When you stated that ethtool does not tell you anything, what do ethtool -m $interface_name or ethtool -i $interface_name have to say?

for instance, on the switch side, I can see the TX/RX optical levels

vdx-1161-3# show media int Fo 10/0/51
  Interface      FortyGigabitEthernet 10/0/51
  Identifier     13   QSFPP
  Connector      7    LC
  Transceiver            0000000000000002 40_GB/s  Long_dist
  Name           lw
  Encoding       5    IEEE 802.3ab
  Baud Rate      140 (units 100 megabaud)
  Length 9u      2   (units km)
  Length E-50u   0   (units 2 meters)
  Length 50u     0   (units 1 meters)
  Length 62.5u   0   (units 1 meters)
  Length Cu      0   (units 1 meter)
  Vendor Name    BROCADE         
  Vendor OUI     00:05:1e
  Vendor PN      QSFP-IR4-40G    
  Vendor Rev     A
  Wavelength     26200(units 0.05 nm)
  Options        0000 
  BR Max         15  
  BR Minute         2
  Serial No      F1712075956     
  Date Code      180106  
  Optical Monitor yes
  Temperature    33 Centigrade
  Voltage        3309.0  (mVolts)
  Current        29.844  (mAmps)
  TX Power       N/A
  RX Power       460.7  (uWatts)


I see you are partly correct, I can identify the SFP with ethtool. Thank You for that.

grant@trl-ctdb01:~[20220714-7:07][#360]$ sudo ethtool -m ens3f0
[sudo] password for grant: 
        Identifier                                : 0x0d (QSFP+)
        Extended identifier                       : 0xcc
        Extended identifier description           : 3.5W max. Power consumption
        Extended identifier description           : CDR present in TX, CDR present in RX
        Extended identifier description           : High Power Class (> 3.5 W) not enabled
        Connector                                 : 0x07 (LC)
        Transceiver codes                         : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
        Encoding                                  : 0x05 (64B/66B)
        BR, Nominal                               : 20600Mbps
        Rate identifier                           : 0x00
        Length (SMF,km)                           : 0km
        Length (OM3 50um)                         : 100m
        Length (OM2 50um)                         : 0m
        Length (OM1 62.5um)                       : 0m
        Length (Copper or Active cable)           : 0m
        Transmitter technology                    : 0x00 (850 nm VCSEL)
        Laser wavelength                          : 850.000nm
        Laser wavelength tolerance                : 18.000nm
        Vendor name                               : BROCADE
        Vendor OUI                                : 00:05:1e
        Vendor PN                                 : 57-1000339-01
        Vendor rev                                : 0A
        Vendor SN                                 : LKA116380054534
        Revision Compliance                       : Revision not specified
        Module temperature                        : 0.00 degrees C / 32.00 degrees F
        Module voltage                            : 0.0000 V
grant@trl-ctdb01:~[20220714-7:08][#361]$ sudo ethtool -i ens3f0
driver: mlx5_core
version: 5.5-1.0.3
firmware-version: 12.28.2006 (MT_2190110032)
bus-info: 0000:d8:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes

is there a way to examine the optical level on the HBA side?

It might be that your driver/card/transceiver is not keen exposing this information - above ethtool -m gives me plenty of optical level information with Juniper transceivers for example with connectx4/5 etc.

I have absolutely no idea if this works with your combination and if you have the required bits installed but you could also consider trying to query this information with these cmds:
sudo mst start
sudo mst cable add
sudo mlxcables
sudo mlxcables --DDM -d $pci_device_id

Like said, it is completely within the realm of possibility that your combination of transceiver and card is simply not willing to part with the DDM/DOM information.

yes, mlxcables is how this used to be done (see NOTE above: here is an example of the old tools:)
in the current mlx5_core driver, mst no longer installs as an application. mstflint and mstconfig and the other apps don’t appear to have this ability.

grant@trl-ctdb01:~[20220715-3:36][#381]$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
grant@trl-ctdb01:~[20220715-3:36][#382]$ modinfo mlx5_core
filename:       /lib/modules/3.10.0-1160.11.1.el7.x86_64/weak-updates/mlnx-en/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko
alias:          auxiliary:mlx5_core.eth-rep
alias:          auxiliary:mlx5_core.eth
version:        5.5-1.0.3
license:        Dual BSD/GPL
description:    Mellanox 5th generation network adapters (ConnectX series) core driver
author:         Eli Cohen <eli@mellanox.com>
retpoline:      Y
rhelversion:    7.9
srcversion:     E20537D5A92509ACF3B4F5B
alias:          pci:v000015B3d0000A2DCsv*sd*bc*sc*i*
alias:          pci:v000015B3d0000A2D6sv*sd*bc*sc*i*
alias:          pci:v000015B3d0000A2D3sv*sd*bc*sc*i*
alias:          pci:v000015B3d0000A2D2sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001021sv*sd*bc*sc*i*
alias:          pci:v000015B3d0000101Fsv*sd*bc*sc*i*
alias:          pci:v000015B3d0000101Esv*sd*bc*sc*i*
alias:          pci:v000015B3d0000101Dsv*sd*bc*sc*i*
alias:          pci:v000015B3d0000101Csv*sd*bc*sc*i*
alias:          pci:v000015B3d0000101Bsv*sd*bc*sc*i*
alias:          pci:v000015B3d0000101Asv*sd*bc*sc*i*
alias:          pci:v000015B3d00001019sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001018sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001017sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001016sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001015sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001014sv*sd*bc*sc*i*
alias:          pci:v000015B3d00001013sv*sd*bc*sc*i*
depends:        devlink,mlx_compat,auxiliary,ptp,mlxfw,psample
vermagic:       3.10.0-1160.el7.x86_64 SMP mod_unload modversions 
signer:         Mellanox Technologies signing key
sig_key:        61:FE:B0:74:FC:72:92:F9:58:41:93:86:FF:DD:9D:5C:A9:99:E4:03
sig_hashalgo:   sha256
parm:           guids:charp
parm:           node_guid:guids configuration. This module parameter will be obsolete!
parm:           num_of_groups:Eswitch offloads number of big groups in FDB table. Valid range 1 - 1024. Default 15 (uint)
parm:           debug_mask:debug mask: 1 = dump cmd data, 2 = dump cmd exec time, 3 = both. Default=0 (uint)
parm:           prof_sel:profile selector. Valid range 0 - 3 (uint)
parm:           probe_vf:probe VFs or not, 0 = not probe, 1 = probe. Default = 1 (bool)