* [PATCH] wext: add back wireless/ dir in sysfs for cfg80211 interfaces
@ 2009-09-28 9:34 Johannes Berg
2009-09-28 11:06 ` Hugh Dickins
2009-09-28 13:26 ` [PATCH v2] " Johannes Berg
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2009-09-28 9:34 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Hugh Dickins
The move away from wireless handlers the drivers assign
to wireless handlers being assigned by cfg80211 broke
the sysfs registration (the wireless/ dir went missing)
because the handlers were assigned only after sysfs
registration and thus the registration never noticed a
device was wireless.
Fix this by special-casing cfg80211-based devices, all
of which are required to have an ieee80211_ptr, in the
sysfs code, and also using get_wireless_stats() to have
the same values reported as in procfs.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
---
include/net/wext.h | 1 +
net/core/net-sysfs.c | 12 +++++-------
net/wireless/wext.c | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
--- wireless-testing.orig/net/core/net-sysfs.c 2009-09-28 10:41:50.000000000 +0200
+++ wireless-testing/net/core/net-sysfs.c 2009-09-28 11:24:12.000000000 +0200
@@ -16,7 +16,7 @@
#include <net/sock.h>
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
-#include <net/iw_handler.h>
+#include <net/wext.h>
#include "net-sysfs.h"
@@ -363,15 +363,13 @@ static ssize_t wireless_show(struct devi
char *))
{
struct net_device *dev = to_net_dev(d);
- const struct iw_statistics *iw = NULL;
+ const struct iw_statistics *iw;
ssize_t ret = -EINVAL;
read_lock(&dev_base_lock);
if (dev_isalive(dev)) {
- if (dev->wireless_handlers &&
- dev->wireless_handlers->get_wireless_stats)
- iw = dev->wireless_handlers->get_wireless_stats(dev);
- if (iw != NULL)
+ iw = get_wireless_stats(dev);
+ if (iw)
ret = (*format)(iw, buf);
}
read_unlock(&dev_base_lock);
@@ -505,7 +503,7 @@ int netdev_register_kobject(struct net_d
*groups++ = &netstat_group;
#ifdef CONFIG_WIRELESS_EXT_SYSFS
- if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
+ if (net->wireless_handlers || net->ieee80211_ptr)
*groups++ = &wireless_group;
#endif
#endif /* CONFIG_SYSFS */
--- wireless-testing.orig/include/net/wext.h 2009-09-28 10:41:50.000000000 +0200
+++ wireless-testing/include/net/wext.h 2009-09-28 11:09:06.000000000 +0200
@@ -14,6 +14,7 @@ extern int wext_handle_ioctl(struct net
void __user *arg);
extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
unsigned long arg);
+extern struct iw_statistics *get_wireless_stats(struct net_device *dev);
#else
static inline int wext_proc_init(struct net *net)
{
--- wireless-testing.orig/net/wireless/wext.c 2009-09-28 10:41:50.000000000 +0200
+++ wireless-testing/net/wireless/wext.c 2009-09-28 11:09:07.000000000 +0200
@@ -470,7 +470,7 @@ static iw_handler get_handler(struct net
/*
* Get statistics out of the driver
*/
-static struct iw_statistics *get_wireless_stats(struct net_device *dev)
+struct iw_statistics *get_wireless_stats(struct net_device *dev)
{
/* New location */
if ((dev->wireless_handlers != NULL) &&
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] wext: add back wireless/ dir in sysfs for cfg80211 interfaces
2009-09-28 9:34 [PATCH] wext: add back wireless/ dir in sysfs for cfg80211 interfaces Johannes Berg
@ 2009-09-28 11:06 ` Hugh Dickins
2009-09-28 13:26 ` [PATCH v2] " Johannes Berg
1 sibling, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2009-09-28 11:06 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
On Mon, 28 Sep 2009, Johannes Berg wrote:
> The move away from wireless handlers the drivers assign
> to wireless handlers being assigned by cfg80211 broke
> the sysfs registration (the wireless/ dir went missing)
> because the handlers were assigned only after sysfs
> registration and thus the registration never noticed a
> device was wireless.
I couldn't make much sense of that: too much assigning!
>
> Fix this by special-casing cfg80211-based devices, all
> of which are required to have an ieee80211_ptr, in the
> sysfs code, and also using get_wireless_stats() to have
> the same values reported as in procfs.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Reported-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
I confirm this works for me too: I won't venture an ignorant opinion
on which is the right solution; but my failed boots do suggest that
keeping away from the notifier infrastructure may make a wiser fix.
Thanks a lot for all your efforts on this, Johannes.
Hugh
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] wext: add back wireless/ dir in sysfs for cfg80211 interfaces
2009-09-28 9:34 [PATCH] wext: add back wireless/ dir in sysfs for cfg80211 interfaces Johannes Berg
2009-09-28 11:06 ` Hugh Dickins
@ 2009-09-28 13:26 ` Johannes Berg
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2009-09-28 13:26 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Hugh Dickins
The move away from having drivers assign wireless handlers,
in favour of making cfg80211 assign them, broke the sysfs
registration (the wireless/ dir went missing) because the
handlers are now assigned only after registration, which is
too late.
Fix this by special-casing cfg80211-based devices, all
of which are required to have an ieee80211_ptr, in the
sysfs code, and also using get_wireless_stats() to have
the same values reported as in procfs.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Tested-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
---
v2: reworded commit log
include/net/wext.h | 1 +
net/core/net-sysfs.c | 12 +++++-------
net/wireless/wext.c | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
--- wireless-testing.orig/net/core/net-sysfs.c 2009-09-28 10:41:50.000000000 +0200
+++ wireless-testing/net/core/net-sysfs.c 2009-09-28 11:24:12.000000000 +0200
@@ -16,7 +16,7 @@
#include <net/sock.h>
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
-#include <net/iw_handler.h>
+#include <net/wext.h>
#include "net-sysfs.h"
@@ -363,15 +363,13 @@ static ssize_t wireless_show(struct devi
char *))
{
struct net_device *dev = to_net_dev(d);
- const struct iw_statistics *iw = NULL;
+ const struct iw_statistics *iw;
ssize_t ret = -EINVAL;
read_lock(&dev_base_lock);
if (dev_isalive(dev)) {
- if (dev->wireless_handlers &&
- dev->wireless_handlers->get_wireless_stats)
- iw = dev->wireless_handlers->get_wireless_stats(dev);
- if (iw != NULL)
+ iw = get_wireless_stats(dev);
+ if (iw)
ret = (*format)(iw, buf);
}
read_unlock(&dev_base_lock);
@@ -505,7 +503,7 @@ int netdev_register_kobject(struct net_d
*groups++ = &netstat_group;
#ifdef CONFIG_WIRELESS_EXT_SYSFS
- if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
+ if (net->wireless_handlers || net->ieee80211_ptr)
*groups++ = &wireless_group;
#endif
#endif /* CONFIG_SYSFS */
--- wireless-testing.orig/include/net/wext.h 2009-09-28 10:41:50.000000000 +0200
+++ wireless-testing/include/net/wext.h 2009-09-28 11:09:06.000000000 +0200
@@ -14,6 +14,7 @@ extern int wext_handle_ioctl(struct net
void __user *arg);
extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
unsigned long arg);
+extern struct iw_statistics *get_wireless_stats(struct net_device *dev);
#else
static inline int wext_proc_init(struct net *net)
{
--- wireless-testing.orig/net/wireless/wext.c 2009-09-28 10:41:50.000000000 +0200
+++ wireless-testing/net/wireless/wext.c 2009-09-28 11:09:07.000000000 +0200
@@ -470,7 +470,7 @@ static iw_handler get_handler(struct net
/*
* Get statistics out of the driver
*/
-static struct iw_statistics *get_wireless_stats(struct net_device *dev)
+struct iw_statistics *get_wireless_stats(struct net_device *dev)
{
/* New location */
if ((dev->wireless_handlers != NULL) &&
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-28 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-28 9:34 [PATCH] wext: add back wireless/ dir in sysfs for cfg80211 interfaces Johannes Berg
2009-09-28 11:06 ` Hugh Dickins
2009-09-28 13:26 ` [PATCH v2] " Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox