All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Don Bollinger" <don@thebollingers.org>
To: "'Andrew Lunn'" <andrew@lunn.ch>
Cc: "'Moshe Shemesh'" <moshe@nvidia.com>,
	"'David S. Miller'" <davem@davemloft.net>,
	"'Jakub Kicinski'" <kuba@kernel.org>,
	"'Adrian Pop'" <pop.adrian61@gmail.com>,
	"'Michal Kubecek'" <mkubecek@suse.cz>, <netdev@vger.kernel.org>,
	"'Vladyslav Tarasiuk'" <vladyslavt@nvidia.com>,
	<don@thebollingers.org>
Subject: RE: [RFC PATCH V4 net-next 1/5] ethtool: Allow network drivers to dump arbitrary EEPROM data
Date: Mon, 22 Mar 2021 18:23:49 -0700	[thread overview]
Message-ID: <007b01d71f83$2e0538f0$8a0faad0$@thebollingers.org> (raw)
In-Reply-To: <YFk13y19yMC0rr04@lunn.ch>

> Subject: Re: [RFC PATCH V4 net-next 1/5] ethtool: Allow network drivers to
> dump arbitrary EEPROM data
> 
> > > +#define ETH_MODULE_EEPROM_PAGE_LEN	256
> >
> > Sorry to keep raising issues, but I think you want to make this
> > constant 128.
> 
> Yes, i also think the KAPI should be limited to returning a maximum of a
1/2
> page per call.
> 
> > > +#define MODULE_EEPROM_MAX_OFFSET (257 *
> > > ETH_MODULE_EEPROM_PAGE_LEN)
> >
> > The device actually has 257 addressable chunks of 128 bytes each.
> > With ETH_MODULE_EEPROM_PAGE_LEN set to 256, your constant is 2X too
> big.
> >
> > Note also, SFP devices (but not QSFP or CMIS) actually have another
> > 256 bytes available at 0x50, in addition to the full 257*128 at 0x51.
> > So SFP is actually 259*128 or (256 + 257 * 128).
> >
> > Devices that don't support pages have much lower limits (256 bytes for
> > QSFP/CMIS and 512 for SFP).  Some SFP only support 256 bytes.  Most
> > devices will return nonsense for pages above 3.  So, this check is
> > really only an absolute limit.  The SFP driver that takes this request
> > will probably check against a more refined MAX length (eg modinfo-
> >eeprom_len).
> >
> > I suggest setting this constant to 259 * (ETH_MODULE_EEPROM_PAGE_LEN
> / 2).
> > Let the driver refine it from there.
> 
> I don't even see a need for this. The offset should be within one 1/2
page, of
> one bank. So offset >= 0 and <= 127. Length is also > 0 and
> <- 127. And offset+length is <= 127.

I like the clean approach, but...   How do you request low memory?  If all
of the pages start at offset 0, then page 0 is at page 0, offset 0.  That
has always referred to low memory.  (I have actually used 'page -1' for this
in some code I don't share with others.)  I believe all of this code
currently is consistent with the paged area starting at offset 128.  If that
changes to start paged memory at offset 0, there are several places that
will need to be adjusted.

Whatever choice is made, there should be documentation scattered around in
the code, man pages and Documentation directories to tell the
user/programmer whether the paged area starts at offset 0 or offset 128.  It
is constantly confusing, and there is no obvious answer.

> 
> For the moment, please forget about backwards compatibility with the IOCTL
> interface. Lets get a new clean KAPI and a new clean internal API between
> the ethtool core and the drivers. Once we have that agreed on, we can work
> on the various compatibility shims we need to work between old and new
> APIs in various places.
> 
>       Andrew

Don


  reply	other threads:[~2021-03-23  1:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 17:11 [RFC PATCH V4 net-next 0/5] ethtool: Extend module EEPROM dump API Moshe Shemesh
2021-03-22 17:11 ` [RFC PATCH V4 net-next 1/5] ethtool: Allow network drivers to dump arbitrary EEPROM data Moshe Shemesh
2021-03-22 18:17   ` Don Bollinger
2021-03-23  0:27     ` Andrew Lunn
2021-03-23  1:23       ` Don Bollinger [this message]
2021-03-23  2:03         ` Andrew Lunn
2021-03-23 17:47           ` Don Bollinger
2021-03-23 22:17             ` Andrew Lunn
2021-03-24 10:14             ` Moshe Shemesh
2021-03-24 10:03       ` Moshe Shemesh
2021-03-24 12:15         ` Andrew Lunn
2021-03-23  0:54   ` Andrew Lunn
2021-03-24 10:05     ` Moshe Shemesh
2021-03-22 17:11 ` [RFC PATCH V4 net-next 2/5] net/mlx5: Refactor module EEPROM query Moshe Shemesh
2021-03-22 17:11 ` [RFC PATCH V4 net-next 3/5] net/mlx5: Implement get_module_eeprom_by_page() Moshe Shemesh
2021-03-22 17:11 ` [RFC PATCH V4 net-next 4/5] net/mlx5: Add support for DSFP module EEPROM dumps Moshe Shemesh
2021-03-22 17:11 ` [RFC PATCH V4 net-next 5/5] ethtool: Add fallback to get_module_eeprom from netlink command Moshe Shemesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='007b01d71f83$2e0538f0$8a0faad0$@thebollingers.org' \
    --to=don@thebollingers.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pop.adrian61@gmail.com \
    --cc=vladyslavt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.