From ed7590408c276624fc36e23ce5ca43121bf39adc Mon Sep 17 00:00:00 2001 From: Peter Waskiewicz Date: Fri, 12 Feb 2010 13:48:25 +0000 Subject: [PATCH] --- yaml --- r: 184111 b: refs/heads/master c: 0d643e1fb4207711d9c148b5c6a2820550a4a154 h: refs/heads/master i: 184109: 6fe838b3d834678951a5911631550915d44dd675 184107: 246e31b73b55199b8f602e650c91b90768a5246a 184103: 5a5eb95785ad472dd4f1ec2e0b8abd200bbaac33 184095: 54d49faa10b701616f9e12b630222c307e1ea8c7 v: v3 --- [refs] | 2 +- trunk/net/core/ethtool.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 46ebe9e877a4..5d3d307bc438 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e858911804f5ecadb41afd61582a11f68d416328 +refs/heads/master: 0d643e1fb4207711d9c148b5c6a2820550a4a154 diff --git a/trunk/net/core/ethtool.c b/trunk/net/core/ethtool.c index fbbe4b49116b..794cf57078cd 100644 --- a/trunk/net/core/ethtool.c +++ b/trunk/net/core/ethtool.c @@ -134,15 +134,21 @@ u32 ethtool_op_get_flags(struct net_device *dev) int ethtool_op_set_flags(struct net_device *dev, u32 data) { + const struct ethtool_ops *ops = dev->ethtool_ops; + if (data & ETH_FLAG_LRO) dev->features |= NETIF_F_LRO; else dev->features &= ~NETIF_F_LRO; - if (data & ETH_FLAG_NTUPLE) + if (data & ETH_FLAG_NTUPLE) { + if (!ops->set_rx_ntuple) + return -EOPNOTSUPP; dev->features |= NETIF_F_NTUPLE; - else + } else { + /* safe to clear regardless */ dev->features &= ~NETIF_F_NTUPLE; + } return 0; } @@ -318,9 +324,6 @@ static int ethtool_set_rx_ntuple(struct net_device *dev, void __user *useraddr) struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL; int ret; - if (!ops->set_rx_ntuple) - return -EOPNOTSUPP; - if (!(dev->features & NETIF_F_NTUPLE)) return -EINVAL;