All of lore.kernel.org
 help / color / mirror / Atom feed
* Reporting SFP presence status
@ 2020-12-21 10:37 Martin Hundebøll
  2020-12-21 15:22 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Hundebøll @ 2020-12-21 10:37 UTC (permalink / raw)
  To: netdev, Andrew Lunn

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?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reporting SFP presence status
  2020-12-21 10:37 Reporting SFP presence status Martin Hundebøll
@ 2020-12-21 15:22 ` Andrew Lunn
  2020-12-22  6:28   ` Martin Hundebøll
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2020-12-21 15:22 UTC (permalink / raw)
  To: Martin Hundebøll; +Cc: netdev

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.

	Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reporting SFP presence status
  2020-12-21 15:22 ` Andrew Lunn
@ 2020-12-22  6:28   ` Martin Hundebøll
  2020-12-22 14:22     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Hundebøll @ 2020-12-22  6:28 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

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.

// Martin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reporting SFP presence status
  2020-12-22  6:28   ` Martin Hundebøll
@ 2020-12-22 14:22     ` Andrew Lunn
  2021-01-04 11:52       ` Martin Hundebøll
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2020-12-22 14:22 UTC (permalink / raw)
  To: Martin Hundebøll; +Cc: netdev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reporting SFP presence status
  2020-12-22 14:22     ` Andrew Lunn
@ 2021-01-04 11:52       ` Martin Hundebøll
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Hundebøll @ 2021-01-04 11:52 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

Hi Andrew,

On 22/12/2020 15.22, Andrew Lunn wrote:
>> 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.

Using ENODEV would be enough, thanks.

> 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?

Similar to the NO-CARRIER / LOWER_UP flags from network interfaces, a 
NO_SFP flag can aid when maintaining remote systems. So it's definitely 
nice-to-have.

// Martin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-04 11:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 10:37 Reporting SFP presence status Martin Hundebøll
2020-12-21 15:22 ` Andrew Lunn
2020-12-22  6:28   ` Martin Hundebøll
2020-12-22 14:22     ` Andrew Lunn
2021-01-04 11:52       ` Martin Hundebøll

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.