On 9/27/2018 5:52 PM, Andrew Lunn wrote:
Both drivers read up to 256 bytes. 0-127 (from page 0). and 128-256 (from
page 0). Driver is not capable of reading over 256 bytes currently.

Hi Erin

There should not be any need to read more than 256 bytes. For older
SFP devices, two addresses on the i2c bus are used, each with 256
bytes. For QSFP, one address is used, and you swap page by writing to
offset 127.

looking on qsfp.c parser in ethtool.c (user space), I see an uninitialized
bug issue that have caused bug #1 + #2.
Applied it locally solved the issue (Not showing alarm data, which should be
expected as driver do not fill it).

There appears to be a second bug somewhere. dumping the module info
using HEX returned 256 bytes. But the binary dump had more bytes.
Since you have the hardware, could you look into this?

See fix I posted few minutes ago.
title: [PATCH ethtool] ethtool: Fix uninitialized variable use at qsfp dump

This is HEX dump, similar for both with/without the fix:
Offset          Values
------          ------
0x0000:         11 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0010:         00 00 00 00 00 00 2a 2a 00 00 7f 0b 00 00 00 00
0x0020:         00 00 38 b6 3e 50 2b e9 40 0d 47 0d 47 ac 48 58
0x0030:         49 0f 3a 09 36 77 39 c9 3a 6a 00 00 00 00 00 00
0x0040:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0050:         00 00 00 00 00 00 00 aa aa 00 00 00 00 01 00 00
0x0060:         00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0070:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0080:         11 cc 07 80 00 00 00 00 00 00 00 05 ff 00 0a 00
0x0090:         00 00 00 44 4d 65 6c 6c 61 6e 6f 78 20 20 20 20
0x00a0:         20 20 20 20 00 00 02 c9 4d 4d 41 31 4c 31 30 2d
0x00b0:         43 52 20 20 20 20 20 20 41 31 65 bf 00 ce 00 60
0x00c0:         03 07 ff de 4d 54 31 36 33 39 44 4d 30 30 30 32
0x00d0:         36 20 20 20 31 36 30 39 32 36 20 20 0c 10 68 40
0x00e0:         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00f0:         00 00 00 00 00 00 00 00 00 00 00 00 14 31 00 00

This is parsed output before the fix:
        Identifier                                : 0x11 (QSFP28)
        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 : 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Transceiver type : 100G Ethernet: 100G Base-LR4
        Encoding                                  : 0x05 (64B/66B)
        BR, Nominal                               : 25500Mbps
        Rate identifier                           : 0x00
        Length (SMF,km)                           : 10km
        Length (OM3 50um)                         : 0m
        Length (OM2 50um)                         : 0m
        Length (OM1 62.5um)                       : 0m
        Length (Copper or Active cable)           : 0m
        Transmitter technology                    : 0x40 (1310 nm DFB)
        Laser wavelength                          : 1302.350nm
        Laser wavelength tolerance                : 1.030nm
        Vendor name                               : Mellanox
        Vendor OUI                                : 00:02:c9
        Vendor PN                                 : MMA1L10-CR
        Vendor rev                                : A1
        Vendor SN                                 : MT1639DM00026
        Date code                                 : 160926
Revision Compliance : SFF-8636 Rev 2.5/2.6/2.7 Module temperature : 42.16 degrees C / 107.90 degrees F
        Module voltage                            : 3.2523 V
        Alarm/warning flags implemented           : Yes
        Laser tx bias current (Channel 1)         : 36.454 mA
        Laser tx bias current (Channel 2)         : 36.696 mA
        Laser tx bias current (Channel 3)         : 37.006 mA
        Laser tx bias current (Channel 4)         : 37.404 mA
        Transmit avg optical power (Channel 1)    : 1.4812 mW / 1.71 dBm
        Transmit avg optical power (Channel 2)    : 1.3942 mW / 1.44 dBm
        Transmit avg optical power (Channel 3)    : 1.4793 mW / 1.70 dBm
        Transmit avg optical power (Channel 4)    : 1.4949 mW / 1.75 dBm
        Rcvr signal avg optical power(Channel 1)  : 1.4489 mW / 1.61 dBm
        Rcvr signal avg optical power(Channel 2)  : 1.5911 mW / 2.02 dBm
        Rcvr signal avg optical power(Channel 3)  : 1.1196 mW / 0.49 dBm
        Rcvr signal avg optical power(Channel 4)  : 1.6397 mW / 2.15 dBm
        Laser bias current high alarm   (Chan 1)  : Off
        Laser bias current low alarm    (Chan 1)  : Off
        Laser bias current high warning (Chan 1)  : Off
        Laser bias current low warning  (Chan 1)  : Off
        Laser bias current high alarm   (Chan 2)  : Off
        Laser bias current low alarm    (Chan 2)  : Off
        Laser bias current high warning (Chan 2)  : Off
        Laser bias current low warning  (Chan 2)  : Off
        Laser bias current high alarm   (Chan 3)  : Off
        Laser bias current low alarm    (Chan 3)  : Off
        Laser bias current high warning (Chan 3)  : Off
        Laser bias current low warning  (Chan 3)  : Off
        Laser bias current high alarm   (Chan 4)  : Off
        Laser bias current low alarm    (Chan 4)  : Off
        Laser bias current high warning (Chan 4)  : Off
        Laser bias current low warning  (Chan 4)  : Off
        Module temperature high alarm             : Off
        Module temperature low alarm              : Off
        Module temperature high warning           : Off
        Module temperature low warning            : Off
        Module voltage high alarm                 : Off
        Module voltage low alarm                  : Off
        Module voltage high warning               : Off
        Module voltage low warning                : Off
        Laser tx power high alarm   (Channel 1)   : Off
        Laser tx power low alarm    (Channel 1)   : Off
        Laser tx power high warning (Channel 1)   : Off
        Laser tx power low warning  (Channel 1)   : Off
        Laser tx power high alarm   (Channel 2)   : Off
        Laser tx power low alarm    (Channel 2)   : Off
        Laser tx power high warning (Channel 2)   : Off
        Laser tx power low warning  (Channel 2)   : Off
        Laser tx power high alarm   (Channel 3)   : Off
        Laser tx power low alarm    (Channel 3)   : Off
        Laser tx power high warning (Channel 3)   : Off
        Laser tx power low warning  (Channel 3)   : Off
        Laser tx power high alarm   (Channel 4)   : Off
        Laser tx power low alarm    (Channel 4)   : Off
        Laser tx power high warning (Channel 4)   : Off
        Laser tx power low warning  (Channel 4)   : Off
        Laser rx power high alarm   (Channel 1)   : Off
        Laser rx power low alarm    (Channel 1)   : Off
        Laser rx power high warning (Channel 1)   : Off
        Laser rx power low warning  (Channel 1)   : Off
        Laser rx power high alarm   (Channel 2)   : Off
        Laser rx power low alarm    (Channel 2)   : Off
        Laser rx power high warning (Channel 2)   : Off
        Laser rx power low warning  (Channel 2)   : Off
        Laser rx power high alarm   (Channel 3)   : Off
        Laser rx power low alarm    (Channel 3)   : Off
        Laser rx power high warning (Channel 3)   : Off
        Laser rx power low warning  (Channel 3)   : Off
        Laser rx power high alarm   (Channel 4)   : Off
        Laser rx power low alarm    (Channel 4)   : Off
        Laser rx power high warning (Channel 4)   : Off
        Laser rx power low warning  (Channel 4)   : Off
        Laser bias current high alarm threshold   : 0.000 mA
        Laser bias current low alarm threshold    : 0.000 mA
        Laser bias current high warning threshold : 0.000 mA
        Laser bias current low warning threshold  : 0.000 mA
        Laser output power high alarm threshold   : 0.0000 mW / -inf dBm
        Laser output power low alarm threshold    : 0.0000 mW / -inf dBm
        Laser output power high warning threshold : 0.0000 mW / -inf dBm
        Laser output power low warning threshold  : 0.0000 mW / -inf dBm
Module temperature high alarm threshold : 0.00 degrees C / 32.00 degrees F Module temperature low alarm threshold : 0.00 degrees C / 32.00 degrees F Module temperature high warning threshold : 0.00 degrees C / 32.00 degrees F Module temperature low warning threshold : 0.00 degrees C / 32.00 degrees F
        Module voltage high alarm threshold       : 0.0000 V
        Module voltage low alarm threshold        : 0.0000 V
        Module voltage high warning threshold     : 0.0000 V
        Module voltage low warning threshold      : 0.0000 V
        Laser rx power high alarm threshold       : 0.0000 mW / -inf dBm
        Laser rx power low alarm threshold        : 0.0000 mW / -inf dBm
        Laser rx power high warning threshold     : 0.0000 mW / -inf dBm
        Laser rx power low warning threshold      : 0.0000 mW / -inf dBm




This is parsed output after the fix:
        Identifier                                : 0x11 (QSFP28)
        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 : 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Transceiver type : 100G Ethernet: 100G Base-LR4
        Encoding                                  : 0x05 (64B/66B)
        BR, Nominal                               : 25500Mbps
        Rate identifier                           : 0x00
        Length (SMF,km)                           : 10km
        Length (OM3 50um)                         : 0m
        Length (OM2 50um)                         : 0m
        Length (OM1 62.5um)                       : 0m
        Length (Copper or Active cable)           : 0m
        Transmitter technology                    : 0x40 (1310 nm DFB)
        Laser wavelength                          : 1302.350nm
        Laser wavelength tolerance                : 1.030nm
        Vendor name                               : Mellanox
        Vendor OUI                                : 00:02:c9
        Vendor PN                                 : MMA1L10-CR
        Vendor rev                                : A1
        Vendor SN                                 : MT1639DM00026
        Date code                                 : 160926
Revision Compliance : SFF-8636 Rev 2.5/2.6/2.7 Module temperature : 42.16 degrees C / 107.90 degrees F
        Module voltage                            : 3.2523 V
        Alarm/warning flags implemented           : No
        Laser tx bias current (Channel 1)         : 36.462 mA
        Laser tx bias current (Channel 2)         : 36.668 mA
        Laser tx bias current (Channel 3)         : 37.000 mA
        Laser tx bias current (Channel 4)         : 37.416 mA
        Transmit avg optical power (Channel 1)    : 1.4812 mW / 1.71 dBm
        Transmit avg optical power (Channel 2)    : 1.3940 mW / 1.44 dBm
        Transmit avg optical power (Channel 3)    : 1.4829 mW / 1.71 dBm
        Transmit avg optical power (Channel 4)    : 1.4866 mW / 1.72 dBm
        Rcvr signal avg optical power(Channel 1)  : 1.4518 mW / 1.62 dBm
        Rcvr signal avg optical power(Channel 2)  : 1.5938 mW / 2.02 dBm
        Rcvr signal avg optical power(Channel 3)  : 1.1211 mW / 0.50 dBm
        Rcvr signal avg optical power(Channel 4)  : 1.6378 mW / 2.14 dBm




Major diff:
* Alarm/warning flags implemented           : No
* All alarm data is not presented.

Driver return 256 bytes (reading it correctly, I verified it, no overruns), however the extra bytes are presented due to this bug (expecting to parse 640 bytes).

Do you see another bug here? Am I missing something?

Eran



Thanks
        Andrew

Reply via email to