Stanislaw Gruszka <sgruszka@xxxxxxxxxx> writes: > On Thu, Dec 06, 2012 at 12:15:28PM -0800, Ben Greear wrote: >> I don't have time to work on this today...maybe not tomorrow either. >> >> So, if someone else feels like fixing it, please feel free. > > Ok, I'll try to fix that. However this could require modification > of all cfg80211 drivers, so could not be fast. I wonder if that strategy isn't just adding unnecessary complexity? How about using something like the (completely untested) patch below instead? Bjørn
>From 6b6ce488f64d5530e1886072f64b034d5a65e5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@xxxxxxx> Date: Fri, 7 Dec 2012 12:14:02 +0100 Subject: [RFC] net: fix ethtool_ops for wireless MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 2c60db03 ("net: provide a default dev->ethtool_ops") made tests for unset ethtool_ops always fail. This caused a regression for wireless drivers relying on the wireless specific ethtool_ops default. Adding a new test for code which need to know whether ethtool_ops was changed after netdev allocation, and update the wireless core to use it. Signed-off-by: Bjørn Mork <bjorn@xxxxxxx> --- include/linux/netdevice.h | 14 ++++++++++++++ net/core/dev.c | 1 + net/wireless/core.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 18c5dc9..95741f1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2707,6 +2707,20 @@ static inline bool netif_supports_nofcs(struct net_device *dev) extern struct pernet_operations __net_initdata loopback_net_ops; +extern struct ethtool_ops default_ethtool_ops; + +/** + * netdev_has_default_ethtool_ops - test for default ethtool_ops + * @dev: device + * + * This function returns true if dev is using the generic default + * ethtool_ops + */ +static inline bool netdev_has_default_ethtool_ops(struct net_device *dev) +{ + return dev->ethtool_ops && (dev->ethtool_ops == &default_ethtool_ops); +} + /* Logging, debugging and troubleshooting/diagnostic helpers. */ /* netdev_printk helpers, similar to dev_printk */ diff --git a/net/core/dev.c b/net/core/dev.c index 0aea3fe..0b20be5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6107,6 +6107,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) } static const struct ethtool_ops default_ethtool_ops; +EXPORT_SYMBOL_GPL(default_ethtool_ops); /** * alloc_netdev_mqs - allocate network device diff --git a/net/wireless/core.c b/net/wireless/core.c index 14d9904..95467d0 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -866,7 +866,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, /* allow mac80211 to determine the timeout */ wdev->ps_timeout = -1; - if (!dev->ethtool_ops) + if (netdev_has_default_ethtool_ops(dev) dev->ethtool_ops = &cfg80211_ethtool_ops; if ((wdev->iftype == NL80211_IFTYPE_STATION || -- 1.7.10.4