aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-10-01 07:33:03 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-05 03:10:11 -0400
commita9828ec6bc0b7e19a65f7e13daa8bd35a926a753 (patch)
treed948be63a1cd06721cd89a496ff69ac4800e16a5
parent15f0a394c6573f4cb65a13095288ab9b9f8135f9 (diff)
ethtool: Remove support for obsolete string query operations
The in-tree implementations have all been converted to get_sset_count(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--net/core/ethtool.c58
2 files changed, 10 insertions, 52 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 15e4eb713694..aa0dcb3833d1 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -495,10 +495,6 @@ struct ethtool_ops {
495 u32 (*get_priv_flags)(struct net_device *); 495 u32 (*get_priv_flags)(struct net_device *);
496 int (*set_priv_flags)(struct net_device *, u32); 496 int (*set_priv_flags)(struct net_device *, u32);
497 int (*get_sset_count)(struct net_device *, int); 497 int (*get_sset_count)(struct net_device *, int);
498
499 /* the following hooks are obsolete */
500 int (*self_test_count)(struct net_device *);/* use get_sset_count */
501 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
502 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 498 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
503 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 499 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
504 int (*flash_device)(struct net_device *, struct ethtool_flash *); 500 int (*flash_device)(struct net_device *, struct ethtool_flash *);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 4c12ddb5f5ee..e1951084b973 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -198,13 +198,6 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
198 rc = ops->get_sset_count(dev, ETH_SS_PRIV_FLAGS); 198 rc = ops->get_sset_count(dev, ETH_SS_PRIV_FLAGS);
199 if (rc >= 0) 199 if (rc >= 0)
200 info.n_priv_flags = rc; 200 info.n_priv_flags = rc;
201 } else {
202 /* code path for obsolete hooks */
203
204 if (ops->self_test_count)
205 info.testinfo_len = ops->self_test_count(dev);
206 if (ops->get_stats_count)
207 info.n_stats = ops->get_stats_count(dev);
208 } 201 }
209 if (ops->get_regs_len) 202 if (ops->get_regs_len)
210 info.regdump_len = ops->get_regs_len(dev); 203 info.regdump_len = ops->get_regs_len(dev);
@@ -684,16 +677,10 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
684 u64 *data; 677 u64 *data;
685 int ret, test_len; 678 int ret, test_len;
686 679
687 if (!ops->self_test) 680 if (!ops->self_test || !ops->get_sset_count)
688 return -EOPNOTSUPP;
689 if (!ops->get_sset_count && !ops->self_test_count)
690 return -EOPNOTSUPP; 681 return -EOPNOTSUPP;
691 682
692 if (ops->get_sset_count) 683 test_len = ops->get_sset_count(dev, ETH_SS_TEST);
693 test_len = ops->get_sset_count(dev, ETH_SS_TEST);
694 else
695 /* code path for obsolete hook */
696 test_len = ops->self_test_count(dev);
697 if (test_len < 0) 684 if (test_len < 0)
698 return test_len; 685 return test_len;
699 WARN_ON(test_len == 0); 686 WARN_ON(test_len == 0);
@@ -728,36 +715,17 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
728 u8 *data; 715 u8 *data;
729 int ret; 716 int ret;
730 717
731 if (!ops->get_strings) 718 if (!ops->get_strings || !ops->get_sset_count)
732 return -EOPNOTSUPP; 719 return -EOPNOTSUPP;
733 720
734 if (copy_from_user(&gstrings, useraddr, sizeof(gstrings))) 721 if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
735 return -EFAULT; 722 return -EFAULT;
736 723
737 if (ops->get_sset_count) { 724 ret = ops->get_sset_count(dev, gstrings.string_set);
738 ret = ops->get_sset_count(dev, gstrings.string_set); 725 if (ret < 0)
739 if (ret < 0) 726 return ret;
740 return ret; 727
741 728 gstrings.len = ret;
742 gstrings.len = ret;
743 } else {
744 /* code path for obsolete hooks */
745
746 switch (gstrings.string_set) {
747 case ETH_SS_TEST:
748 if (!ops->self_test_count)
749 return -EOPNOTSUPP;
750 gstrings.len = ops->self_test_count(dev);
751 break;
752 case ETH_SS_STATS:
753 if (!ops->get_stats_count)
754 return -EOPNOTSUPP;
755 gstrings.len = ops->get_stats_count(dev);
756 break;
757 default:
758 return -EINVAL;
759 }
760 }
761 729
762 data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); 730 data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
763 if (!data) 731 if (!data)
@@ -798,16 +766,10 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
798 u64 *data; 766 u64 *data;
799 int ret, n_stats; 767 int ret, n_stats;
800 768
801 if (!ops->get_ethtool_stats) 769 if (!ops->get_ethtool_stats || !ops->get_sset_count)
802 return -EOPNOTSUPP;
803 if (!ops->get_sset_count && !ops->get_stats_count)
804 return -EOPNOTSUPP; 770 return -EOPNOTSUPP;
805 771
806 if (ops->get_sset_count) 772 n_stats = ops->get_sset_count(dev, ETH_SS_STATS);
807 n_stats = ops->get_sset_count(dev, ETH_SS_STATS);
808 else
809 /* code path for obsolete hook */
810 n_stats = ops->get_stats_count(dev);
811 if (n_stats < 0) 773 if (n_stats < 0)
812 return n_stats; 774 return n_stats;
813 WARN_ON(n_stats == 0); 775 WARN_ON(n_stats == 0);