As suggested by Ben Hutchings I made "carrier" attribute writeable.
With this patchset one can set carrier on/off on dummy. Might by also handy
to implement this for other devices.
Jiri Pirko (2):
net: allow to change carrier via sysfs
dummy: implement carrier change
drivers/net/dummy.c | 10 ++++++++++
include/linux/netdevice.h | 4 ++++
net/core/dev.c | 19 +++++++++++++++++++
net/core/net-sysfs.c | 26 +++++++++++++++++++++++++-
4 files changed, 58 insertions(+), 1 deletions(-)
--
1.7.6
+ if (sscanf(buf, "%d", &new_value) != 1)
+ return -EINVAL;
kstrtoint()
(Or maybe we should have kstrobool().)
+ if (!rtnl_trylock())
+ return restart_syscall();
[...]
This is consistent with other attributes, but it seems like a really bad
practice as it will generally result in the process busy-waiting on the
RTNL lock! I think it would be better to add and use an
rtnl_lock_interruptible().
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
+ if (sscanf(buf, "%d", &new_value) != 1)
+ return -EINVAL;
kstrtoint()
Okay.
(Or maybe we should have kstrobool().)
quoted
+ if (!rtnl_trylock())
+ return restart_syscall();
[...]
This is consistent with other attributes, but it seems like a really bad
practice as it will generally result in the process busy-waiting on the
RTNL lock! I think it would be better to add and use an
rtnl_lock_interruptible().
Right. But as you said, this is the same as with others. I would replace
this in another patch.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Michał Mirosław <hidden> Date: 2011-08-30 18:11:58
2011/8/30 Jiri Pirko [off-list ref]:
Allow to write to "carrier" attribute. Devices may implement ndo_change_carrier
callback to allow changing carrier from userspace.
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
BTW, I like this feature!
Best Regards,
Michał Mirosław
From: Stephen Hemminger <hidden> Date: 2011-08-30 18:25:43
On Tue, 30 Aug 2011 20:11:37 +0200
Michał Mirosław [off-list ref] wrote:
2011/8/30 Jiri Pirko [off-list ref]:
quoted
Allow to write to "carrier" attribute. Devices may implement ndo_change_carrier
callback to allow changing carrier from userspace.
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
BTW, I like this feature!
Ok for virtual devices, but please don't implement it in real hardware.
There is already enough breakage in carrier management in applications.
It also overlaps with operstate perhaps that is a more more complete
solution.
Tue, Aug 30, 2011 at 08:25:53PM CEST, shemminger@vyatta.com wrote:
On Tue, 30 Aug 2011 20:11:37 +0200
Michał Mirosław [off-list ref] wrote:
quoted
2011/8/30 Jiri Pirko [off-list ref]:
quoted
Allow to write to "carrier" attribute. Devices may implement ndo_change_carrier
callback to allow changing carrier from userspace.
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
BTW, I like this feature!
Ok for virtual devices, but please don't implement it in real hardware.
There is already enough breakage in carrier management in applications.
It also overlaps with operstate perhaps that is a more more complete
solution.
Looking at operstate doc, I'm not sure what exactly do you mean by
"overlapping".
The main purpose of my patch is to give certain virt devices the
opportunity to emulate carrier loss. But I do not see reason why this
can't be implemented by real hw. Or course there should be explicitelly
documented the purpose of this feature.
Jirka
From: Michał Mirosław <hidden> Date: 2011-08-31 08:34:11
W dniu 31 sierpnia 2011 10:26 użytkownik Jiri Pirko [off-list ref] napisał:
Tue, Aug 30, 2011 at 08:11:37PM CEST, mirqus@gmail.com wrote:
quoted
2011/8/30 Jiri Pirko [off-list ref]:
quoted
Allow to write to "carrier" attribute. Devices may implement ndo_change_carrier
callback to allow changing carrier from userspace.
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Best Regards,
Michał Mirosław
Wed, Aug 31, 2011 at 10:33:50AM CEST, mirqus@gmail.com wrote:
W dniu 31 sierpnia 2011 10:26 użytkownik Jiri Pirko [off-list ref] napisał:
quoted
Tue, Aug 30, 2011 at 08:11:37PM CEST, mirqus@gmail.com wrote:
quoted
2011/8/30 Jiri Pirko [off-list ref]:
quoted
Allow to write to "carrier" attribute. Devices may implement ndo_change_carrier
callback to allow changing carrier from userspace.
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
From: Nicolas de Pesloüan <hidden> Date: 2011-08-31 20:03:41
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and register this default ndo_change_carrier callback for every device ?
Device drivers willing to do something different can install a different callback if appropriate.
This would avoid duplicating the following code in most drivers, that don't need something special.
static int dummy_change_carrier(struct net_device *dev, bool new_carrier)
{
if (new_carrier)
netif_carrier_on(dev);
else
netif_carrier_off(dev);
return 0;
}
If someone is not confident with this default callback registered for all device, at least, we can put this code in a common place, so that a driver willing to use it doesn't need to have its own version of it.
Nicolas.
From: Ben Hutchings <hidden> Date: 2011-08-31 20:12:21
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
[...]
If someone is not confident with this default callback registered for
all device, at least, we can
put this code in a common place, so that a driver willing to use it
doesn't need to have its own
version of it.
I agree that this might be useful in some other software devices,
though.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
Wed, Aug 31, 2011 at 10:12:17PM CEST, bhutchings@solarflare.com wrote:
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
[...]
quoted
If someone is not confident with this default callback registered for
all device, at least, we can
put this code in a common place, so that a driver willing to use it
doesn't need to have its own
version of it.
I agree that this might be useful in some other software devices,
though.
Maybe it would be better to just add priv_flag for this instead of
introducing netdev_op. Then do on/off is this flag is set. Not sure
though...
Jirka
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Nicolas de Pesloüan <hidden> Date: 2011-08-31 20:31:44
Le 31/08/2011 22:12, Ben Hutchings a écrit :
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the switch port (physical or virtual), but echo 0 > /sys/class/net/eth0/carrier would be nice too.
Of course, I assume that netif_carrier_on and netif_carrier_off are only called on real link status change. So the value written into /sys/class/net/eth0/carrier would stay until the link revert it, due to a double status change (up-down-up or down-up-down). But I may miss totally this point.
Nicolas.
From: Ben Hutchings <hidden> Date: 2011-08-31 20:44:44
On Wed, 2011-08-31 at 22:31 +0200, Nicolas de Pesloüan wrote:
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would
use every day, but...
Testing a cluster reaction to a link down event would be easier if one
doesn't need to unplug the
cable for the test. I understand that one can turn off the switch port
(physical or virtual), but
echo 0 > /sys/class/net/eth0/carrier would be nice too.
Of course, I assume that netif_carrier_on and netif_carrier_off are
only called on real link status
change. So the value written into /sys/class/net/eth0/carrier would
stay until the link revert it,
due to a double status change (up-down-up or down-up-down). But I may
miss totally this point.
Think what happens if the user sets carrier on, when the link is
actually down.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Ben Greear <hidden> Date: 2011-08-31 20:48:38
On 08/31/2011 01:31 PM, Nicolas de Pesloüan wrote:
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the
switch port (physical or virtual), but echo 0 > /sys/class/net/eth0/carrier would be nice too.
There is special hardware out there that can do bypass, and often it also has a mode
that will programatically cut link by throwing some relays. We use this for our
testing equipment...
If there is some way to twiddle standard-ish hardware to actually drop link, that
would be neat. I'd think it should be an ethtool type of thing, however.
Actually dropping link, and letting that naturally propagate up the stack seems
more reasonable than lying about the status half way up the stack.
Thanks,
Ben
--
Ben Greear [off-list ref]
Candela Technologies Inc http://www.candelatech.com
From: Ben Hutchings <hidden> Date: 2011-08-31 21:36:53
On Wed, 2011-08-31 at 13:48 -0700, Ben Greear wrote:
On 08/31/2011 01:31 PM, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the
switch port (physical or virtual), but echo 0 > /sys/class/net/eth0/carrier would be nice too.
There is special hardware out there that can do bypass, and often it also has a mode
that will programatically cut link by throwing some relays. We use this for our
testing equipment...
If there is some way to twiddle standard-ish hardware to actually drop link, that
would be neat. I'd think it should be an ethtool type of thing, however.
We need to be able to control this as part of our driver test suite (on
the peer, not the device under test). There are various MDIO bits that
look like they should do this but unfortunately they don't have
consistent effects. Besides that, many PHYs are not MDIO-manageable.
So this would have to be a device-specific operation, whether it's
exposed through ethtool or sysfs.
Actually dropping link, and letting that naturally propagate up the stack seems
more reasonable than lying about the status half way up the stack.
Right.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Stephen Hemminger <hidden> Date: 2011-08-31 21:40:15
On Wed, 31 Aug 2011 22:36:45 +0100
Ben Hutchings [off-list ref] wrote:
On Wed, 2011-08-31 at 13:48 -0700, Ben Greear wrote:
quoted
On 08/31/2011 01:31 PM, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the
switch port (physical or virtual), but echo 0 > /sys/class/net/eth0/carrier would be nice too.
There is special hardware out there that can do bypass, and often it also has a mode
that will programatically cut link by throwing some relays. We use this for our
testing equipment...
If there is some way to twiddle standard-ish hardware to actually drop link, that
would be neat. I'd think it should be an ethtool type of thing, however.
We need to be able to control this as part of our driver test suite (on
the peer, not the device under test). There are various MDIO bits that
look like they should do this but unfortunately they don't have
consistent effects. Besides that, many PHYs are not MDIO-manageable.
So this would have to be a device-specific operation, whether it's
exposed through ethtool or sysfs.
quoted
Actually dropping link, and letting that naturally propagate up the stack seems
more reasonable than lying about the status half way up the stack.
For testing clustering, there are hooks in vmware and QEMU/KVM to allow
dropping carrier on the VM side.
From: Ben Greear <hidden> Date: 2011-08-31 21:49:53
On 08/31/2011 02:36 PM, Ben Hutchings wrote:
On Wed, 2011-08-31 at 13:48 -0700, Ben Greear wrote:
quoted
On 08/31/2011 01:31 PM, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the
switch port (physical or virtual), but echo 0> /sys/class/net/eth0/carrier would be nice too.
There is special hardware out there that can do bypass, and often it also has a mode
that will programatically cut link by throwing some relays. We use this for our
testing equipment...
If there is some way to twiddle standard-ish hardware to actually drop link, that
would be neat. I'd think it should be an ethtool type of thing, however.
We need to be able to control this as part of our driver test suite (on
the peer, not the device under test). There are various MDIO bits that
look like they should do this but unfortunately they don't have
consistent effects. Besides that, many PHYs are not MDIO-manageable.
So this would have to be a device-specific operation, whether it's
exposed through ethtool or sysfs.
Well, I have boxes that can act as the peer. Nics are intel chipset 1G,
the bypass/link-drop feature is some separate hardware on the NIC, and
there is a hack of a driver & user-space tools that controls those bits.
But, if there is a way to fiddle normal NICs w/out the special bypass/disconnect
hardware, that would be welcome. Even if it's different for each driver, and
not supported by all, ethtool can deal with that sort of thing.
Here's a link to the hardware we use...it comes with drivers, though we've hacked on
ours a bit.
http://silicom-usa.com/upload/Downloads/Product_102.pdf
Thanks,
Ben
--
Ben Greear [off-list ref]
Candela Technologies Inc http://www.candelatech.com
Wed, Aug 31, 2011 at 10:48:22PM CEST, greearb@candelatech.com wrote:
On 08/31/2011 01:31 PM, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the
switch port (physical or virtual), but echo 0 > /sys/class/net/eth0/carrier would be nice too.
There is special hardware out there that can do bypass, and often it also has a mode
that will programatically cut link by throwing some relays. We use this for our
testing equipment...
If there is some way to twiddle standard-ish hardware to actually drop link, that
would be neat. I'd think it should be an ethtool type of thing, however.
Ethtool can implement this eventually by calling the same ndo.
Actually dropping link, and letting that naturally propagate up the stack seems
more reasonable than lying about the status half way up the stack.
Yes, that is really the intension of the proposed ndo. Real hw driver
should implement that as you say, not directly setting carrier_on/off
Wed, Aug 31, 2011 at 11:40:23PM CEST, shemminger@vyatta.com wrote:
On Wed, 31 Aug 2011 22:36:45 +0100
Ben Hutchings [off-list ref] wrote:
quoted
On Wed, 2011-08-31 at 13:48 -0700, Ben Greear wrote:
quoted
On 08/31/2011 01:31 PM, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 22:12, Ben Hutchings a écrit :
quoted
On Wed, 2011-08-31 at 22:03 +0200, Nicolas de Pesloüan wrote:
quoted
Le 31/08/2011 10:45, Jiri Pirko a écrit :
quoted
quoted
quoted
quoted
Do you expect drivers using implementation different than just calling
netif_carrier_on/off? Or is it supposed to also e.g. power down PHYs?
Yes, generally it can be used also for en/disable phy, for testing
purposes if hw and driver would support it.
I'd like to see this working for GRE tunnel devices (for keepalive
daemon to be able to indicate to routing daemons whether tunnel is
really working) - implementation would be identical to dummy's case.
Should I prepare a patch or can I leave it to you?
Ok, I can include it to this patchset (I'm going to repost first patch
anyway)
Can't we assume that the dummy's case is the default behavior and
register this default
ndo_change_carrier callback for every device ?
You have got to be joking. No device driver that has real link
monitoring should use this implementation.
Well, why not? Arguably, this is probably not the feature one would use every day, but...
Testing a cluster reaction to a link down event would be easier if one doesn't need to unplug the cable for the test. I understand that one can turn off the
switch port (physical or virtual), but echo 0 > /sys/class/net/eth0/carrier would be nice too.
There is special hardware out there that can do bypass, and often it also has a mode
that will programatically cut link by throwing some relays. We use this for our
testing equipment...
If there is some way to twiddle standard-ish hardware to actually drop link, that
would be neat. I'd think it should be an ethtool type of thing, however.
We need to be able to control this as part of our driver test suite (on
the peer, not the device under test). There are various MDIO bits that
look like they should do this but unfortunately they don't have
consistent effects. Besides that, many PHYs are not MDIO-manageable.
So this would have to be a device-specific operation, whether it's
exposed through ethtool or sysfs.
quoted
Actually dropping link, and letting that naturally propagate up the stack seems
more reasonable than lying about the status half way up the stack.
For testing clustering, there are hooks in vmware and QEMU/KVM to allow
dropping carrier on the VM side.
Afaik in kvm this is only possible on emulated e1000 (last time I
checked).