From: Stanislaw Gruszka <sgruszka@redhat.com>
To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Cc: "Eric Dumazet" <edumazet@google.com>,
"Ben Greear" <greearb@candelatech.com>,
"Bjørn Mork" <bjorn@mork.no>,
linux-wireless@vger.kernel.org,
"Ben Hutchings" <bhutchings@solarflare.com>,
"Michał Mirosław" <mirqus@gmail.com>,
"Johannes Berg" <johannes@sipsolutions.net>
Subject: [PATCH v3] net, wireless: overwrite default_ethtool_ops
Date: Fri, 11 Jan 2013 10:19:10 +0100 [thread overview]
Message-ID: <20130111091909.GA2347@redhat.com> (raw)
Since:
commit 2c60db037034d27f8c636403355d52872da92f81
Author: Eric Dumazet <edumazet@google.com>
Date: Sun Sep 16 09:17:26 2012 +0000
net: provide a default dev->ethtool_ops
wireless core does not correctly assign ethtool_ops.
After alloc_netdev*() call, some cfg80211 drivers provide they own
ethtool_ops, but some do not. For them, wireless core provide generic
cfg80211_ethtool_ops, which is assigned in NETDEV_REGISTER notify call:
if (!dev->ethtool_ops)
dev->ethtool_ops = &cfg80211_ethtool_ops;
But after Eric's commit, dev->ethtool_ops is no longer NULL (on cfg80211
drivers without custom ethtool_ops), but points to &default_ethtool_ops.
In order to fix the problem, provide function which will overwrite
default_ethtool_ops and use it by wireless core.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
v1 -> v2: change order of default_ethtool_ops initialization to avoid
the problem. Change the subject accordingly.
v2 -> v3: provide function to overwrite default_ethtool_ops, describe
problem a bit more detailed in the changelog
include/linux/netdevice.h | 3 +++
net/core/dev.c | 8 ++++++++
net/wireless/core.c | 3 +--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c599e47..9ef07d0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -60,6 +60,9 @@ struct wireless_dev;
#define SET_ETHTOOL_OPS(netdev,ops) \
( (netdev)->ethtool_ops = (ops) )
+extern void netdev_set_default_ethtool_ops(struct net_device *dev,
+ const struct ethtool_ops *ops);
+
/* hardware address assignment types */
#define NET_ADDR_PERM 0 /* address is permanent (default) */
#define NET_ADDR_RANDOM 1 /* address is generated randomly */
diff --git a/net/core/dev.c b/net/core/dev.c
index 515473e..f64e439 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6121,6 +6121,14 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
static const struct ethtool_ops default_ethtool_ops;
+void netdev_set_default_ethtool_ops(struct net_device *dev,
+ const struct ethtool_ops *ops)
+{
+ if (dev->ethtool_ops == &default_ethtool_ops)
+ dev->ethtool_ops = ops;
+}
+EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops);
+
/**
* alloc_netdev_mqs - allocate network device
* @sizeof_priv: size of private data to allocate space for
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 747dd93..7cbd3bf 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -858,8 +858,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)
- dev->ethtool_ops = &cfg80211_ethtool_ops;
+ netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
if ((wdev->iftype == NL80211_IFTYPE_STATION ||
wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
--
1.7.1
next reply other threads:[~2013-01-11 9:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 9:19 Stanislaw Gruszka [this message]
2013-01-11 10:51 ` [PATCH v3] net, wireless: overwrite default_ethtool_ops Johannes Berg
2013-01-11 20:00 ` Ben Hutchings
[not found] ` <1357934432.2643.4.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
2013-01-11 23:59 ` David Miller
2013-01-21 20:52 ` Luis R. Rodriguez
2013-01-21 21:04 ` David Miller
[not found] ` <20130121.160404.1007504714461228602.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2013-01-21 21:47 ` Luis R. Rodriguez
2013-01-22 10:56 ` Stanislaw Gruszka
[not found] ` <20130122105618.GB2328-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-01-22 19:06 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130111091909.GA2347@redhat.com \
--to=sgruszka@redhat.com \
--cc=bhutchings@solarflare.com \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=greearb@candelatech.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=mirqus@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).