aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-10-05 06:59:58 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-07 04:10:44 -0400
commitd73d3a8cb4723e161589864741d8528d70b350eb (patch)
treeeece04666dfccff368e7d6fc6665bd328987fd46 /net
parentd250a5f90e53f5e150618186230795352d154c88 (diff)
ethtool: Add reset operation
After updating firmware stored in flash, users may wish to reset the relevant hardware and start the new firmware immediately. This should not be completely automatic as it may be disruptive. A selective reset may also be useful for debugging or diagnostics. This adds a separate reset operation which takes flags indicating the components to be reset. Drivers are allowed to reset only a subset of those requested, and must indicate the actual subset. This allows the use of generic component masks and some future expansion. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/ethtool.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index e1951084b973..d8aee584e8d1 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -302,6 +302,26 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
302 return ret; 302 return ret;
303} 303}
304 304
305static int ethtool_reset(struct net_device *dev, char __user *useraddr)
306{
307 struct ethtool_value reset;
308 int ret;
309
310 if (!dev->ethtool_ops->reset)
311 return -EOPNOTSUPP;
312
313 if (copy_from_user(&reset, useraddr, sizeof(reset)))
314 return -EFAULT;
315
316 ret = dev->ethtool_ops->reset(dev, &reset.data);
317 if (ret)
318 return ret;
319
320 if (copy_to_user(useraddr, &reset, sizeof(reset)))
321 return -EFAULT;
322 return 0;
323}
324
305static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) 325static int ethtool_get_wol(struct net_device *dev, char __user *useraddr)
306{ 326{
307 struct ethtool_wolinfo wol = { ETHTOOL_GWOL }; 327 struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
@@ -1089,6 +1109,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
1089 case ETHTOOL_FLASHDEV: 1109 case ETHTOOL_FLASHDEV:
1090 rc = ethtool_flash_device(dev, useraddr); 1110 rc = ethtool_flash_device(dev, useraddr);
1091 break; 1111 break;
1112 case ETHTOOL_RESET:
1113 rc = ethtool_reset(dev, useraddr);
1114 break;
1092 default: 1115 default:
1093 rc = -EOPNOTSUPP; 1116 rc = -EOPNOTSUPP;
1094 } 1117 }