> Adrian, > > Thanks for the detailed response. I don't think the kernel should pass > fake pages only to make it easier for user space to parse the > information. What you are describing is basic dissection and it's done > all the time by wireshark / tcpdump. > > Anyway, even we pass a fake page 03h, page 11h can still be at a > variable offset. See table 8-28 [1], bits 1-0 at offset 142 in page 01h > determine the size of pages 10h and 11h: > > 0 - each page is 128 bytes in size > 1 - each page is 256 bytes in size > 2 - each page is 512 bytes in size > > So a completely stable layout (unless I missed something) will entail > the kernel sending 1664 bytes to user space each time. This looks > unnecessarily rigid to me. The people who wrote the standard obviously > took into account the fact that the page layout needs to be discoverable > from the data and I think we should embrace it and only pass valid > information to user space.
O.K. That makes things more complex. And i would say, Ido is correct, we need to make use of the discoverable features. I've no practice experience with modules other than plain old SFPs, 1G. And those have all sorts of errors, even basic things like the CRC are systematically incorrect because they are not recalculated after adding the serial number. We have had people trying to submit patches to ethtool to make it ignore bits so that it dumps more information, because the manufacturer failed to set the correct bits, etc. Ido, Adrian, what is your experience with these QSFP-DD devices. Are they generally of better quality, the EEPROM can be trusted? Is there any form of compliance test. If we go down the path of using the discovery information, it means we have no way for user space to try to correct for when the information is incorrect. It cannot request specific pages. So maybe we should consider an alternative? The netlink ethtool gives us more flexibility. How about we make a new API where user space can request any pages it want, and specify the size of the page. ethtool can start out by reading page 0. That should allow it to identify the basic class of device. It can then request additional pages as needed. The nice thing about that is we don't need two parsers of the discovery information, one in user and second in kernel space. We don't need to guarantee these two parsers agree with each other, in order to correctly decode what the kernel sent to user space. And user space has the flexibility to work around known issues when manufactures get their EEPROM wrong. Andrew