All of lore.kernel.org
 help / color / mirror / Atom feed
* Request for feature: force carrier up/on flag
@ 2021-02-09 17:35 Anton Hvornum
  2021-02-10  0:32 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Hvornum @ 2021-02-09 17:35 UTC (permalink / raw)
  To: netdev

Hi.

I am a bit new to ethtool, kernel drivers and all the surrounding aspects.
I also recognize that my use case is of low priority and a bit niche,
but any response would be greatly appreciated.

I'm modifying an existing Intel driver, and I'm looking for a way to
integrate/add another ethtool hook to force call `netif_carrier_on`.
There's plenty of hooks/listeners (not clear as to what you call
these) between the Intel driver and ethtool via C API's today that
allows for ethtool to control the driver. Many of which are for speed,
autonegotiation etc. But I don't see any flags/functions to force a
carrier state to up.

This would be very useful for many reasons, primarily on fiber optic
setups where you are developing hardware such as switches, routers and
even developing network cards. Or if you've got a passive device such
as IDS or something similar that passively monitors network traffic
and can't/shouldn't send out link requests.
There are commercial products with modified drivers that support this,
but since the Intel hardware in this case seems to support it - just
that there's no way controlling it with the tools that exist today. I
would therefore request a feature for consideration to ethtool that
can force carrier states up/down.

A intuitive option I think would be:
ethtool --change carrier on

Assuming that drivers follow suit and allow this. But a first step
would be for the tools to support it in the API so drivers have
something to call/listen for. In the meantime, I can probably
integrate a private flag and go that route, but that feels hacky and
won't foster driver developers to follow suit. My goal is to empower
more open source alternatives to otherwise expensive commercials
solutions.

Best wishes,
Anton Hvornum

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

* Re: Request for feature: force carrier up/on flag
  2021-02-09 17:35 Request for feature: force carrier up/on flag Anton Hvornum
@ 2021-02-10  0:32 ` Stephen Hemminger
  2021-02-10  6:57   ` Heiner Kallweit
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2021-02-10  0:32 UTC (permalink / raw)
  To: Anton Hvornum; +Cc: netdev

On Tue, 9 Feb 2021 18:35:54 +0100
Anton Hvornum <anton@hvornum.se> wrote:

> Hi.
> 
> I am a bit new to ethtool, kernel drivers and all the surrounding aspects.
> I also recognize that my use case is of low priority and a bit niche,
> but any response would be greatly appreciated.
> 
> I'm modifying an existing Intel driver, and I'm looking for a way to
> integrate/add another ethtool hook to force call `netif_carrier_on`.
> There's plenty of hooks/listeners (not clear as to what you call
> these) between the Intel driver and ethtool via C API's today that
> allows for ethtool to control the driver. Many of which are for speed,
> autonegotiation etc. But I don't see any flags/functions to force a
> carrier state to up.
> 
> This would be very useful for many reasons, primarily on fiber optic
> setups where you are developing hardware such as switches, routers and
> even developing network cards. Or if you've got a passive device such
> as IDS or something similar that passively monitors network traffic
> and can't/shouldn't send out link requests.
> There are commercial products with modified drivers that support this,
> but since the Intel hardware in this case seems to support it - just
> that there's no way controlling it with the tools that exist today. I
> would therefore request a feature for consideration to ethtool that
> can force carrier states up/down.
> 
> A intuitive option I think would be:
> ethtool --change carrier on
> 
> Assuming that drivers follow suit and allow this. But a first step
> would be for the tools to support it in the API so drivers have
> something to call/listen for. In the meantime, I can probably
> integrate a private flag and go that route, but that feels hacky and
> won't foster driver developers to follow suit. My goal is to empower
> more open source alternatives to otherwise expensive commercials
> solutions.
> 
> Best wishes,
> Anton Hvornum

Normally, carrier just reflects the state of what the hardware is
reporting. Why not set admin down which tells the NIC to take
the device offline, and that drops the fiber link.

Or maybe what you want is already there.
Try writing to /sys/class/net/ethX/carrier which forces a carrier change?

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

* Re: Request for feature: force carrier up/on flag
  2021-02-10  0:32 ` Stephen Hemminger
@ 2021-02-10  6:57   ` Heiner Kallweit
  0 siblings, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2021-02-10  6:57 UTC (permalink / raw)
  To: Anton Hvornum; +Cc: netdev, Stephen Hemminger

On 10.02.2021 01:32, Stephen Hemminger wrote:
> On Tue, 9 Feb 2021 18:35:54 +0100
> Anton Hvornum <anton@hvornum.se> wrote:
> 
>> Hi.
>>
>> I am a bit new to ethtool, kernel drivers and all the surrounding aspects.
>> I also recognize that my use case is of low priority and a bit niche,
>> but any response would be greatly appreciated.
>>
>> I'm modifying an existing Intel driver, and I'm looking for a way to
>> integrate/add another ethtool hook to force call `netif_carrier_on`.
>> There's plenty of hooks/listeners (not clear as to what you call
>> these) between the Intel driver and ethtool via C API's today that
>> allows for ethtool to control the driver. Many of which are for speed,
>> autonegotiation etc. But I don't see any flags/functions to force a
>> carrier state to up.
>>
>> This would be very useful for many reasons, primarily on fiber optic
>> setups where you are developing hardware such as switches, routers and
>> even developing network cards. Or if you've got a passive device such
>> as IDS or something similar that passively monitors network traffic
>> and can't/shouldn't send out link requests.
>> There are commercial products with modified drivers that support this,
>> but since the Intel hardware in this case seems to support it - just
>> that there's no way controlling it with the tools that exist today. I
>> would therefore request a feature for consideration to ethtool that
>> can force carrier states up/down.
>>
>> A intuitive option I think would be:
>> ethtool --change carrier on
>>
>> Assuming that drivers follow suit and allow this. But a first step
>> would be for the tools to support it in the API so drivers have
>> something to call/listen for. In the meantime, I can probably
>> integrate a private flag and go that route, but that feels hacky and
>> won't foster driver developers to follow suit. My goal is to empower
>> more open source alternatives to otherwise expensive commercials
>> solutions.
>>
>> Best wishes,
>> Anton Hvornum
> 
> Normally, carrier just reflects the state of what the hardware is
> reporting. Why not set admin down which tells the NIC to take
> the device offline, and that drops the fiber link.
> 
> Or maybe what you want is already there.
> Try writing to /sys/class/net/ethX/carrier which forces a carrier change?
> 

This attribute uses callback ndo_change_carrier in struct net_device_ops.
The kerneldoc provides further details.

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

end of thread, other threads:[~2021-02-10  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 17:35 Request for feature: force carrier up/on flag Anton Hvornum
2021-02-10  0:32 ` Stephen Hemminger
2021-02-10  6:57   ` Heiner Kallweit

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.