On Wed, Dec 30, 2020 at 03:55:02PM +0200, Vladyslav Tarasiuk wrote: > > On 29-Dec-20 18:25, Andrew Lunn wrote: > > > Hi Andrew, > > > > > > Following this conversation, I wrote some pseudocode checking if I'm on > > > right path here. > > > Please review: > > > > > > struct eeprom_page { > > > u8 page_number; > > > u8 bank_number; > > > u16 offset; > > > u16 data_length; > > > u8 *data; > > > } > > I'm wondering about offset and data_length, in this context. I would > > expect you always ask the kernel for the full page, not part of > > it. Even when user space asks for just part of a page. That keeps you > > cache management simpler. > As far as I know, there may be bytes, which may change on read. > For example, clear on read values in CMIS 4.0.
Ah, i did not know there were such bits. I will go read the spec. But it should not really matter. If the SFP driver is interested in these bits, it will have to intercept the read and act on the values. > I wasn't aware of that. It complicates things a bit, should we add a > parameter of i2c address? So in this case page 0 will be with i2c > address A0h. And if user needs page 0 from i2c address A2h, he will > specify it in command line. Not on the command line. You should be able to determine from reading page 0 at A0h is the diagnostics are at A2h or a page of A0h. That is the whole point of this API, we decode the first page, and that tells us what other pages should be available. So adding the i2c address to the netlink message would be sensible. And i would not be too surprised if there are SFPs with proprietary registers on other addresses, which could be interesting to dump, if you can get access to the needed datasheets. Andrew