Subject: Re: bug: 'ethtool -m' reports spurious alarm & warning threshold values for QSFP28 transceivers

From: Andrew Lunn <[email-masked]>
Date: Wed, 26 Sep 2018 23:46:49 +0200

On Wed, Sep 26, 2018 at 08:47:34PM +0000, Chris Preimesberger wrote:
> Hello Andrew,
> 
> Thank you for the quick response!!
> Apologies in advance for my use of outlook and top-posting, etc...
> 
> I've run the raw option and the hex option, and pasted the results below.
> Since the raw option printed strange characters on the CLI, I re-ran it,
> Sending the output to a file (raw.txt) and attached that file as well.
> 
> Pasted from Ubuntu CLI:
> 
> tech1@D7:~$ 
> tech1@D7:~$ 
> tech1@D7:~$ 
> tech1@D7:~$ 
> tech1@D7:~$ sudo ethtool -m enp1s0 raw on
> UU$��pA`?�@�G#
>                  �v���@TRANSITION      ��TNQSFP100GCWDM4 1AfX%F??�TN02000301      180919  
>     h�I��_��'��Ri=`��Zntech1@D7:~$ 
> tech1@D7:~$ 
> tech1@D7:~$ 
> tech1@D7:~$ 
> tech1@D7:~$ sudo ethtool -m enp1s0 hex on
> Offset		Values
> ------		------
> 0x0000:		11 00 00 0f 00 00 00 00 00 55 55 00 00 00 00 00 
> 0x0010:		00 00 00 00 00 00 24 e2 00 00 81 68 00 00 00 00 
> 0x0020:		00 00 00 00 00 00 00 00 00 00 41 60 3f e0 40 e0 
> 0x0030:		47 00 1f 10 0e 1e 0b f7 12 76 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 00 00 00 00 00 00 01 00 00 
> 0x0060:		00 00 00 00 00 00 00 00 00 00 1f 00 00 00 00 00 
> 0x0070:		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
> 0x0080:		11 fc 07 80 00 00 00 00 00 00 00 03 ff 00 02 00 
> 0x0090:		00 00 00 40 54 52 41 4e 53 49 54 49 4f 4e 20 20 
> 0x00a0:		20 20 20 20 00 00 c0 f2 54 4e 51 53 46 50 31 30 
> 0x00b0:		30 47 43 57 44 4d 34 20 31 41 66 58 25 1c 46 3f 
> 0x00c0:		06 00 3f d6 54 4e 30 32 30 30 30 33 30 31 20 20 
> 0x00d0:		20 20 20 20 31 38 30 39 31 39 20 20 0c 00 68 f3 
> 0x00e0:		00 00 02 49 80 a0 5f 1f de c9 27 16 f8 ae 52 69 
> 0x00f0:		3d 02 60 00 00 00 00 00 00 00 00 00 83 f4 5a 6e 

Hi Chris

I've only recently got involved with SFP modules. ethtool says this is
a SFF-8636 SFP. So a QSFP. It has multiple pages, each 128 bytes in
length, which should be returned in a concatenated form. Here we see
256 bytes, meaning there are two pages. There can be up to 5 pages.

ethtool is looking for the temperature alarms at offset 0x200. So that
does not exist in this hex dump. But the raw dump you provided has
more bytes, 0x400 of them.

So i would say the first bug is that ethtool dumps different amounts
of data in hex than raw.

The fact you get different alarm thresholds on different runs suggests
to me we might only be getting two pages from the kernel?

Can you build ethtool from source and run it inside a debugger?
ethtool makes two IOCTL calls. The first is ETHTOOL_GMODULEINFO.
Could you print out the modinfo which is returned. It then does a
ETHTOOL_GMODULEEEPROM. Can you print out eeprom after the second
IOCTL.

Thanks
	Andrew