diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-09-15 17:41:06 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:17 -0400 |
commit | 88d3aafdae5c5e1d2dd9489a5c8a24e29d335f2e (patch) | |
tree | 272ce75c30a170420ac8bbfd679c3faed9f9d20a /net/core | |
parent | 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (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/core')
-rw-r--r-- | net/core/ethtool.c | 16 |
1 files changed, 12 insertions, 4 deletions
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); |