On Tue, Dec 22, 2020 at 07:28:10AM +0100, Martin Hundebøll wrote:
> Hi Andrew,
>
> On 21/12/2020 16.22, Andrew Lunn wrote:
> > On Mon, Dec 21, 2020 at 11:37:55AM +0100, Martin Hundebøll wrote:
> > > Hi Andrew,
> > >
> > > I've browsed the code in drivers/net/phy, but haven't found a place where
> > > the SFP module status/change is reported to user-space. Is there a
> > > "standard" way to report insert/remove events for SFP modules, or should
> > > we
> > > just add a custom sysfs attribute to our driver?
> >
> > Hi Martin
> >
> > There is currently no standard way of notifying user space. But it is
> > something which could be added. But it should not be systfs. This
> > should be a netlink notification, probably as part of ethtool netlink
> > API. Or maybe the extended link info.
> >
> > What is your intended use case? Why do you need to know when a module
> > has been inserted? It seems like you cannot do too much on such a
> > notification. It seems lots of modules don't conform to the standard,
> > will not immediately respond on the i2c bus. So ethtool -m is probably
> > not going to be useful. You probably need to poll until it does
> > respond, which defeats the purpose of having a notification.
>
> You're right; a notification isn't what I need. But a way to query the
> current state of the module would be nice, i.e. using ethtool.
What do you mean by state? ethtool -m gives you some state
information. ENODEV gives you an idea that there is no module
inserted. Lots of data suggests there is a module. You can decode the
data to get a lot of information.
There was also a patchset from Russell King a few weeks ago exposing
some information in debugfs. But since it is debugfs, you cannot rely
on it.
Back to, what is you real use cases here?
Andrew