aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-09-15 17:41:06 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:17 -0400
commit88d3aafdae5c5e1d2dd9489a5c8a24e29d335f2e (patch)
tree272ce75c30a170420ac8bbfd679c3faed9f9d20a /net
parent09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (diff)
[ETHTOOL] Provide default behaviors for a few ethtool sub-ioctls
For the operations get-tx-csum get-sg get-tso get-ufo the default ethtool_op_xxx behavior is fine for all drivers, so we permit op==NULL to imply the default behavior. This provides a more uniform behavior across all drivers, eliminating ethtool(8) "ioctl not supported" errors on older drivers that had not been updated for the latest sub-ioctls. The ethtool_op_xxx() functions are left exported, in case anyone wishes to call them directly from a driver-private implementation -- a not-uncommon case. Should an ethtool_op_xxx() helper remain unused for a while, except by net/core/ethtool.c, we can un-export it at a later date. [ Resolved conflicts with set/get value ethtool patch... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_device.c3
-rw-r--r--net/core/ethtool.c16
2 files changed, 12 insertions, 7 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index f803e39eee28..c07bac5e3e10 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -150,11 +150,8 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
150static struct ethtool_ops br_ethtool_ops = { 150static struct ethtool_ops br_ethtool_ops = {
151 .get_drvinfo = br_getinfo, 151 .get_drvinfo = br_getinfo,
152 .get_link = ethtool_op_get_link, 152 .get_link = ethtool_op_get_link,
153 .get_sg = ethtool_op_get_sg,
154 .set_sg = br_set_sg, 153 .set_sg = br_set_sg,
155 .get_tx_csum = ethtool_op_get_tx_csum,
156 .set_tx_csum = br_set_tx_csum, 154 .set_tx_csum = br_set_tx_csum,
157 .get_tso = ethtool_op_get_tso,
158 .set_tso = br_set_tso, 155 .set_tso = br_set_tso,
159}; 156};
160 157
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 0d0b13cc1dd3..1163eb2256d0 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -893,21 +893,27 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
893 break; 893 break;
894 case ETHTOOL_GTXCSUM: 894 case ETHTOOL_GTXCSUM:
895 rc = ethtool_get_value(dev, useraddr, ethcmd, 895 rc = ethtool_get_value(dev, useraddr, ethcmd,
896 dev->ethtool_ops->get_tx_csum); 896 (dev->ethtool_ops->get_tx_csum ?
897 dev->ethtool_ops->get_tx_csum :
898 ethtool_op_get_tx_csum));
897 break; 899 break;
898 case ETHTOOL_STXCSUM: 900 case ETHTOOL_STXCSUM:
899 rc = ethtool_set_tx_csum(dev, useraddr); 901 rc = ethtool_set_tx_csum(dev, useraddr);
900 break; 902 break;
901 case ETHTOOL_GSG: 903 case ETHTOOL_GSG:
902 rc = ethtool_get_value(dev, useraddr, ethcmd, 904 rc = ethtool_get_value(dev, useraddr, ethcmd,
903 dev->ethtool_ops->get_sg); 905 (dev->ethtool_ops->get_sg ?
906 dev->ethtool_ops->get_sg :
907 ethtool_op_get_sg));
904 break; 908 break;
905 case ETHTOOL_SSG: 909 case ETHTOOL_SSG:
906 rc = ethtool_set_sg(dev, useraddr); 910 rc = ethtool_set_sg(dev, useraddr);
907 break; 911 break;
908 case ETHTOOL_GTSO: 912 case ETHTOOL_GTSO:
909 rc = ethtool_get_value(dev, useraddr, ethcmd, 913 rc = ethtool_get_value(dev, useraddr, ethcmd,
910 dev->ethtool_ops->get_tso); 914 (dev->ethtool_ops->get_tso ?
915 dev->ethtool_ops->get_tso :
916 ethtool_op_get_tso));
911 break; 917 break;
912 case ETHTOOL_STSO: 918 case ETHTOOL_STSO:
913 rc = ethtool_set_tso(dev, useraddr); 919 rc = ethtool_set_tso(dev, useraddr);
@@ -929,7 +935,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
929 break; 935 break;
930 case ETHTOOL_GUFO: 936 case ETHTOOL_GUFO:
931 rc = ethtool_get_value(dev, useraddr, ethcmd, 937 rc = ethtool_get_value(dev, useraddr, ethcmd,
932 dev->ethtool_ops->get_ufo); 938 (dev->ethtool_ops->get_ufo ?
939 dev->ethtool_ops->get_ufo :
940 ethtool_op_get_ufo));
933 break; 941 break;
934 case ETHTOOL_SUFO: 942 case ETHTOOL_SUFO:
935 rc = ethtool_set_ufo(dev, useraddr); 943 rc = ethtool_set_ufo(dev, useraddr);