Skip to content

Commit a9828ec

Browse files
Ben Hutchingsdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 15f0a39 commit a9828ec

File tree

2 files changed

+10
-52
lines changed

2 files changed

+10
-52
lines changed

include/linux/ethtool.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,6 @@ struct ethtool_ops {
495495
u32 (*get_priv_flags)(struct net_device *);
496496
int (*set_priv_flags)(struct net_device *, u32);
497497
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 */
502498
int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
503499
int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
504500
int (*flash_device)(struct net_device *, struct ethtool_flash *);

net/core/ethtool.c

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,6 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
198198
rc = ops->get_sset_count(dev, ETH_SS_PRIV_FLAGS);
199199
if (rc >= 0)
200200
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);
208201
}
209202
if (ops->get_regs_len)
210203
info.regdump_len = ops->get_regs_len(dev);
@@ -684,16 +677,10 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
684677
u64 *data;
685678
int ret, test_len;
686679

687-
if (!ops->self_test)
688-
return -EOPNOTSUPP;
689-
if (!ops->get_sset_count && !ops->self_test_count)
680+
if (!ops->self_test || !ops->get_sset_count)
690681
return -EOPNOTSUPP;
691682

692-
if (ops->get_sset_count)
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);
683+
test_len = ops->get_sset_count(dev, ETH_SS_TEST);
697684
if (test_len < 0)
698685
return test_len;
699686
WARN_ON(test_len == 0);
@@ -728,36 +715,17 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
728715
u8 *data;
729716
int ret;
730717

731-
if (!ops->get_strings)
718+
if (!ops->get_strings || !ops->get_sset_count)
732719
return -EOPNOTSUPP;
733720

734721
if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
735722
return -EFAULT;
736723

737-
if (ops->get_sset_count) {
738-
ret = ops->get_sset_count(dev, gstrings.string_set);
739-
if (ret < 0)
740-
return ret;
741-
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-
}
724+
ret = ops->get_sset_count(dev, gstrings.string_set);
725+
if (ret < 0)
726+
return ret;
727+
728+
gstrings.len = ret;
761729

762730
data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
763731
if (!data)
@@ -798,16 +766,10 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
798766
u64 *data;
799767
int ret, n_stats;
800768

801-
if (!ops->get_ethtool_stats)
802-
return -EOPNOTSUPP;
803-
if (!ops->get_sset_count && !ops->get_stats_count)
769+
if (!ops->get_ethtool_stats || !ops->get_sset_count)
804770
return -EOPNOTSUPP;
805771

806-
if (ops->get_sset_count)
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);
772+
n_stats = ops->get_sset_count(dev, ETH_SS_STATS);
811773
if (n_stats < 0)
812774
return n_stats;
813775
WARN_ON(n_stats == 0);

0 commit comments

Comments
 (0)