diff options
author | Ajit Khaparde <ajitk@serverengines.com> | 2009-09-02 13:02:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-03 02:07:39 -0400 |
commit | 05c6a8d7a7d778f26d8eb821556988993b766092 (patch) | |
tree | ff76707c7433b2931a66d209d09e01325fc75274 /net | |
parent | 451f14439847db302e5104c44458b2dbb4b1829d (diff) |
net/ethtool: Add support for the ethtool feature to flash firmware image from a specified file.
This patch adds support to flash a firmware image to a device using ethtool.
The driver gets the filename of the firmware image and flashes the image
using the request firmware path.
The region "on the chip" to be flashed can be specified by an option.
It is upto the device driver to enumerate the region number passed by ethtool,
to the region to be flashed.
The default behavior is to flash all the regions on the chip.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/ethtool.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 44e571111d3a..4c12ddb5f5ee 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -898,6 +898,19 @@ static int ethtool_set_value(struct net_device *dev, char __user *useraddr, | |||
898 | return actor(dev, edata.data); | 898 | return actor(dev, edata.data); |
899 | } | 899 | } |
900 | 900 | ||
901 | static int ethtool_flash_device(struct net_device *dev, char __user *useraddr) | ||
902 | { | ||
903 | struct ethtool_flash efl; | ||
904 | |||
905 | if (copy_from_user(&efl, useraddr, sizeof(efl))) | ||
906 | return -EFAULT; | ||
907 | |||
908 | if (!dev->ethtool_ops->flash_device) | ||
909 | return -EOPNOTSUPP; | ||
910 | |||
911 | return dev->ethtool_ops->flash_device(dev, &efl); | ||
912 | } | ||
913 | |||
901 | /* The main entry point in this file. Called from net/core/dev.c */ | 914 | /* The main entry point in this file. Called from net/core/dev.c */ |
902 | 915 | ||
903 | int dev_ethtool(struct net *net, struct ifreq *ifr) | 916 | int dev_ethtool(struct net *net, struct ifreq *ifr) |
@@ -1111,6 +1124,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | |||
1111 | case ETHTOOL_SGRO: | 1124 | case ETHTOOL_SGRO: |
1112 | rc = ethtool_set_gro(dev, useraddr); | 1125 | rc = ethtool_set_gro(dev, useraddr); |
1113 | break; | 1126 | break; |
1127 | case ETHTOOL_FLASHDEV: | ||
1128 | rc = ethtool_flash_device(dev, useraddr); | ||
1129 | break; | ||
1114 | default: | 1130 | default: |
1115 | rc = -EOPNOTSUPP; | 1131 | rc = -EOPNOTSUPP; |
1116 | } | 1132 | } |