netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Don Bollinger <don@thebollingers.org>
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>
Subject: Re: [RFC PATCH V2 net-next 5/5] ethtool: Add fallback to get_module_eeprom from netlink command
Date: Fri, 5 Mar 2021 02:50:35 +0100	[thread overview]
Message-ID: <YEGOa2NFiw3fc5sT@lunn.ch> (raw)
In-Reply-To: <001201d71159$88013120$98039360$@thebollingers.org>

> > +static int fallback_set_params(struct eeprom_data_req_info *request,
> > +			       struct ethtool_modinfo *modinfo,
> > +			       struct ethtool_eeprom *eeprom) {
> 
> This is translating the new data structure into the old.  Hence, I assume we
> have i2c_addr, page, bank, offset, len to work with, and we should use
> all of them.

Nope. We actually have none of them. The old API just asked the driver
to give me the data in the SFP. And the driver gets to decide what it
returns, following a well known layout. The driver can decide to give
just the first 1/2 page, or any number of multiple 1/2 pages in a well
known linear way, which ethtool knows how to decode.

So when mapping the new KAPI onto the old driver API, you need to call
the old API, and see if what is returned can be used to fulfil the
KAPI request. If the bytes are there, great, return them, otherwise
EOPNOTSUPP.

And we also need to consider the other way around. The old KAPI is
used, and the MAC driver only supports the new driver API. Since the
linear layout is well know, you need to make a number of calls into
the driver to read the 1/2 pages, and them glue them together and
return them.

I've not reviewed this code in detail yet, so i've no idea how it
actually works. But i would like to see as much compatibility as
possible. That has been the approach with moving from IOCTL to netlink
with ethool. Everything the old KAPI can do, netlink should also be
able to, plus there can be additional features.

> > +	switch (modinfo->type) {
> > +	case ETH_MODULE_SFF_8079:
> > +		if (request->page > 1)
> > +			return -EINVAL;
> > +		break;
> > +	case ETH_MODULE_SFF_8472:
> > +		if (request->page > 3)
> 
> Not sure this is needed, there can be pages higher than 3.

Not with the old KAPI call. As far as i remember, it stops at three
pages. But i need to check the ethtool(1) sources to be sure.

       Andrew


  reply	other threads:[~2021-03-05  1:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 18:57 [RFC PATCH V2 net-next 0/5] ethtool: Extend module EEPROM dump API Moshe Shemesh
2021-03-04 18:57 ` [RFC PATCH V2 net-next 1/5] ethtool: Allow network drivers to dump arbitrary EEPROM data Moshe Shemesh
2021-03-05  0:50   ` Don Bollinger
2021-03-05  1:32     ` Andrew Lunn
2021-03-08  8:45     ` Moshe Shemesh
2021-03-05  1:58   ` Andrew Lunn
2021-03-08  8:54     ` Moshe Shemesh
2021-03-04 18:57 ` [RFC PATCH V2 net-next 2/5] net/mlx5: Refactor module EEPROM query Moshe Shemesh
2021-03-04 18:57 ` [RFC PATCH V2 net-next 3/5] net/mlx5: Implement get_module_eeprom_data_by_page() Moshe Shemesh
2021-03-04 18:57 ` [RFC PATCH V2 net-next 4/5] net/mlx5: Add support for DSFP module EEPROM dumps Moshe Shemesh
2021-03-04 18:57 ` [RFC PATCH V2 net-next 5/5] ethtool: Add fallback to get_module_eeprom from netlink command Moshe Shemesh
2021-03-05  0:50   ` Don Bollinger
2021-03-05  1:50     ` Andrew Lunn [this message]
2021-03-05  2:44       ` Don Bollinger
2021-03-05  2:53     ` Don Bollinger
2021-03-08  9:04     ` Moshe Shemesh
2021-03-05  0:50 ` [RFC PATCH V2 net-next 0/5] ethtool: Extend module EEPROM dump API Don Bollinger

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=YEGOa2NFiw3fc5sT@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=don@thebollingers.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).