2007-05-05 20:46:38 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
|
|
|
|
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/if.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/rtnetlink.h>
|
|
|
|
#include <linux/notifier.h>
|
|
|
|
#include <net/mac80211.h>
|
|
|
|
#include <net/cfg80211.h>
|
|
|
|
#include "ieee80211_i.h"
|
2008-04-08 21:14:40 +02:00
|
|
|
#include "rate.h"
|
2007-05-05 20:46:38 +02:00
|
|
|
#include "debugfs.h"
|
|
|
|
#include "debugfs_netdev.h"
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_read(
|
|
|
|
struct ieee80211_sub_if_data *sdata,
|
|
|
|
char __user *userbuf,
|
|
|
|
size_t count, loff_t *ppos,
|
|
|
|
ssize_t (*format)(const struct ieee80211_sub_if_data *, char *, int))
|
|
|
|
{
|
|
|
|
char buf[70];
|
|
|
|
ssize_t ret = -EINVAL;
|
|
|
|
|
|
|
|
read_lock(&dev_base_lock);
|
2008-04-01 00:10:22 +02:00
|
|
|
if (sdata->dev->reg_state == NETREG_REGISTERED)
|
2007-05-05 20:46:38 +02:00
|
|
|
ret = (*format)(sdata, buf, sizeof(buf));
|
|
|
|
read_unlock(&dev_base_lock);
|
2008-04-01 00:10:22 +02:00
|
|
|
|
|
|
|
if (ret != -EINVAL)
|
|
|
|
ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
|
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IEEE80211_IF_FMT(name, field, format_string) \
|
|
|
|
static ssize_t ieee80211_if_fmt_##name( \
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, \
|
|
|
|
int buflen) \
|
|
|
|
{ \
|
|
|
|
return scnprintf(buf, buflen, format_string, sdata->field); \
|
|
|
|
}
|
|
|
|
#define IEEE80211_IF_FMT_DEC(name, field) \
|
|
|
|
IEEE80211_IF_FMT(name, field, "%d\n")
|
|
|
|
#define IEEE80211_IF_FMT_HEX(name, field) \
|
|
|
|
IEEE80211_IF_FMT(name, field, "%#x\n")
|
|
|
|
#define IEEE80211_IF_FMT_SIZE(name, field) \
|
|
|
|
IEEE80211_IF_FMT(name, field, "%zd\n")
|
|
|
|
|
|
|
|
#define IEEE80211_IF_FMT_ATOMIC(name, field) \
|
|
|
|
static ssize_t ieee80211_if_fmt_##name( \
|
|
|
|
const struct ieee80211_sub_if_data *sdata, \
|
|
|
|
char *buf, int buflen) \
|
|
|
|
{ \
|
|
|
|
return scnprintf(buf, buflen, "%d\n", atomic_read(&sdata->field));\
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IEEE80211_IF_FMT_MAC(name, field) \
|
|
|
|
static ssize_t ieee80211_if_fmt_##name( \
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, \
|
|
|
|
int buflen) \
|
|
|
|
{ \
|
2008-10-27 23:56:10 +01:00
|
|
|
return scnprintf(buf, buflen, "%pM\n", sdata->field); \
|
2007-05-05 20:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define __IEEE80211_IF_FILE(name) \
|
|
|
|
static ssize_t ieee80211_if_read_##name(struct file *file, \
|
|
|
|
char __user *userbuf, \
|
|
|
|
size_t count, loff_t *ppos) \
|
|
|
|
{ \
|
|
|
|
return ieee80211_if_read(file->private_data, \
|
|
|
|
userbuf, count, ppos, \
|
|
|
|
ieee80211_if_fmt_##name); \
|
|
|
|
} \
|
|
|
|
static const struct file_operations name##_ops = { \
|
|
|
|
.read = ieee80211_if_read_##name, \
|
|
|
|
.open = mac80211_open_file_generic, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IEEE80211_IF_FILE(name, field, format) \
|
|
|
|
IEEE80211_IF_FMT_##format(name, field) \
|
|
|
|
__IEEE80211_IF_FILE(name)
|
|
|
|
|
|
|
|
/* common attributes */
|
|
|
|
IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC);
|
|
|
|
IEEE80211_IF_FILE(max_ratectrl_rateidx, max_ratectrl_rateidx, DEC);
|
2007-05-05 20:46:38 +02:00
|
|
|
|
2009-02-15 12:44:28 +01:00
|
|
|
/* STA attributes */
|
|
|
|
IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
|
|
|
|
IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
|
|
|
|
IEEE80211_IF_FILE(capab, u.mgd.capab, HEX);
|
2007-05-05 20:46:38 +02:00
|
|
|
|
|
|
|
/* AP attributes */
|
|
|
|
IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC);
|
|
|
|
IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC);
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_fmt_num_buffered_multicast(
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
|
|
|
|
{
|
|
|
|
return scnprintf(buf, buflen, "%u\n",
|
|
|
|
skb_queue_len(&sdata->u.ap.ps_bc_buf));
|
|
|
|
}
|
|
|
|
__IEEE80211_IF_FILE(num_buffered_multicast);
|
|
|
|
|
|
|
|
/* WDS attributes */
|
|
|
|
IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC);
|
|
|
|
|
2008-02-23 15:17:16 +01:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
/* Mesh stats attributes */
|
2008-09-11 00:01:49 +02:00
|
|
|
IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC);
|
|
|
|
IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC);
|
2008-02-23 15:17:16 +01:00
|
|
|
IEEE80211_IF_FILE(dropped_frames_no_route,
|
2008-09-11 00:01:49 +02:00
|
|
|
u.mesh.mshstats.dropped_frames_no_route, DEC);
|
|
|
|
IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
|
2008-02-23 15:17:16 +01:00
|
|
|
|
|
|
|
/* Mesh parameters */
|
2008-10-07 12:04:31 +02:00
|
|
|
IEEE80211_IF_FILE(dot11MeshMaxRetries,
|
|
|
|
u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshRetryTimeout,
|
|
|
|
u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
|
|
|
|
u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
|
|
|
|
u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
|
|
|
|
IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
|
|
|
|
u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
|
|
|
|
IEEE80211_IF_FILE(path_refresh_time,
|
|
|
|
u.mesh.mshcfg.path_refresh_time, DEC);
|
|
|
|
IEEE80211_IF_FILE(min_discovery_timeout,
|
|
|
|
u.mesh.mshcfg.min_discovery_timeout, DEC);
|
2008-02-23 15:17:16 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
#define DEBUGFS_ADD(name, type)\
|
2008-04-04 23:33:37 +02:00
|
|
|
sdata->debugfs.type.name = debugfs_create_file(#name, 0400,\
|
2007-05-05 20:46:38 +02:00
|
|
|
sdata->debugfsdir, sdata, &name##_ops);
|
|
|
|
|
|
|
|
static void add_sta_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_ADD(drop_unencrypted, sta);
|
2008-08-25 10:57:06 +02:00
|
|
|
DEBUGFS_ADD(force_unicast_rateidx, sta);
|
|
|
|
DEBUGFS_ADD(max_ratectrl_rateidx, sta);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
DEBUGFS_ADD(bssid, sta);
|
|
|
|
DEBUGFS_ADD(aid, sta);
|
|
|
|
DEBUGFS_ADD(capab, sta);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_ap_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_ADD(drop_unencrypted, ap);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
DEBUGFS_ADD(force_unicast_rateidx, ap);
|
|
|
|
DEBUGFS_ADD(max_ratectrl_rateidx, ap);
|
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
DEBUGFS_ADD(num_sta_ps, ap);
|
|
|
|
DEBUGFS_ADD(dtim_count, ap);
|
|
|
|
DEBUGFS_ADD(num_buffered_multicast, ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_wds_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_ADD(drop_unencrypted, wds);
|
2008-08-25 10:57:06 +02:00
|
|
|
DEBUGFS_ADD(force_unicast_rateidx, wds);
|
|
|
|
DEBUGFS_ADD(max_ratectrl_rateidx, wds);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
DEBUGFS_ADD(peer, wds);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_ADD(drop_unencrypted, vlan);
|
2008-08-25 10:57:06 +02:00
|
|
|
DEBUGFS_ADD(force_unicast_rateidx, vlan);
|
|
|
|
DEBUGFS_ADD(max_ratectrl_rateidx, vlan);
|
2007-05-05 20:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-02-23 15:17:16 +01:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
#define MESHSTATS_ADD(name)\
|
2008-04-04 23:33:37 +02:00
|
|
|
sdata->mesh_stats.name = debugfs_create_file(#name, 0400,\
|
2008-02-23 15:17:16 +01:00
|
|
|
sdata->mesh_stats_dir, sdata, &name##_ops);
|
|
|
|
|
|
|
|
static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
sdata->mesh_stats_dir = debugfs_create_dir("mesh_stats",
|
|
|
|
sdata->debugfsdir);
|
|
|
|
MESHSTATS_ADD(fwded_frames);
|
|
|
|
MESHSTATS_ADD(dropped_frames_ttl);
|
|
|
|
MESHSTATS_ADD(dropped_frames_no_route);
|
|
|
|
MESHSTATS_ADD(estab_plinks);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MESHPARAMS_ADD(name)\
|
2008-04-04 23:33:37 +02:00
|
|
|
sdata->mesh_config.name = debugfs_create_file(#name, 0600,\
|
2008-02-23 15:17:16 +01:00
|
|
|
sdata->mesh_config_dir, sdata, &name##_ops);
|
|
|
|
|
|
|
|
static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
sdata->mesh_config_dir = debugfs_create_dir("mesh_config",
|
|
|
|
sdata->debugfsdir);
|
|
|
|
MESHPARAMS_ADD(dot11MeshMaxRetries);
|
|
|
|
MESHPARAMS_ADD(dot11MeshRetryTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshConfirmTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHoldingTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshTTL);
|
|
|
|
MESHPARAMS_ADD(auto_open_plinks);
|
|
|
|
MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries);
|
|
|
|
MESHPARAMS_ADD(path_refresh_time);
|
|
|
|
MESHPARAMS_ADD(min_discovery_timeout);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
static void add_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
if (!sdata->debugfsdir)
|
|
|
|
return;
|
|
|
|
|
2007-12-19 01:31:27 +01:00
|
|
|
switch (sdata->vif.type) {
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_MESH_POINT:
|
2008-02-23 15:17:16 +01:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
add_mesh_stats(sdata);
|
|
|
|
add_mesh_config(sdata);
|
|
|
|
#endif
|
2008-09-11 00:01:49 +02:00
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_STATION:
|
2007-05-05 20:46:38 +02:00
|
|
|
add_sta_files(sdata);
|
|
|
|
break;
|
2009-02-15 12:44:28 +01:00
|
|
|
case NL80211_IFTYPE_ADHOC:
|
|
|
|
/* XXX */
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_AP:
|
2007-05-05 20:46:38 +02:00
|
|
|
add_ap_files(sdata);
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_WDS:
|
2007-05-05 20:46:38 +02:00
|
|
|
add_wds_files(sdata);
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_MONITOR:
|
2007-05-05 20:46:38 +02:00
|
|
|
add_monitor_files(sdata);
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_AP_VLAN:
|
2007-05-05 20:46:38 +02:00
|
|
|
add_vlan_files(sdata);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-27 15:43:23 +02:00
|
|
|
#define DEBUGFS_DEL(name, type) \
|
|
|
|
do { \
|
|
|
|
debugfs_remove(sdata->debugfs.type.name); \
|
|
|
|
sdata->debugfs.type.name = NULL; \
|
|
|
|
} while (0)
|
2007-05-05 20:46:38 +02:00
|
|
|
|
|
|
|
static void del_sta_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_DEL(drop_unencrypted, sta);
|
2008-08-25 10:57:06 +02:00
|
|
|
DEBUGFS_DEL(force_unicast_rateidx, sta);
|
|
|
|
DEBUGFS_DEL(max_ratectrl_rateidx, sta);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
DEBUGFS_DEL(bssid, sta);
|
|
|
|
DEBUGFS_DEL(aid, sta);
|
|
|
|
DEBUGFS_DEL(capab, sta);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void del_ap_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_DEL(drop_unencrypted, ap);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
DEBUGFS_DEL(force_unicast_rateidx, ap);
|
|
|
|
DEBUGFS_DEL(max_ratectrl_rateidx, ap);
|
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
DEBUGFS_DEL(num_sta_ps, ap);
|
|
|
|
DEBUGFS_DEL(dtim_count, ap);
|
|
|
|
DEBUGFS_DEL(num_buffered_multicast, ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void del_wds_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_DEL(drop_unencrypted, wds);
|
2008-08-25 10:57:06 +02:00
|
|
|
DEBUGFS_DEL(force_unicast_rateidx, wds);
|
|
|
|
DEBUGFS_DEL(max_ratectrl_rateidx, wds);
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
|
2007-05-05 20:46:38 +02:00
|
|
|
DEBUGFS_DEL(peer, wds);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void del_vlan_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_DEL(drop_unencrypted, vlan);
|
2008-08-25 10:57:06 +02:00
|
|
|
DEBUGFS_DEL(force_unicast_rateidx, vlan);
|
|
|
|
DEBUGFS_DEL(max_ratectrl_rateidx, vlan);
|
2007-05-05 20:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void del_monitor_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-02-23 15:17:16 +01:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
#define MESHSTATS_DEL(name) \
|
|
|
|
do { \
|
|
|
|
debugfs_remove(sdata->mesh_stats.name); \
|
|
|
|
sdata->mesh_stats.name = NULL; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static void del_mesh_stats(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
MESHSTATS_DEL(fwded_frames);
|
|
|
|
MESHSTATS_DEL(dropped_frames_ttl);
|
|
|
|
MESHSTATS_DEL(dropped_frames_no_route);
|
|
|
|
MESHSTATS_DEL(estab_plinks);
|
|
|
|
debugfs_remove(sdata->mesh_stats_dir);
|
|
|
|
sdata->mesh_stats_dir = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MESHPARAMS_DEL(name) \
|
|
|
|
do { \
|
|
|
|
debugfs_remove(sdata->mesh_config.name); \
|
|
|
|
sdata->mesh_config.name = NULL; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static void del_mesh_config(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
MESHPARAMS_DEL(dot11MeshMaxRetries);
|
|
|
|
MESHPARAMS_DEL(dot11MeshRetryTimeout);
|
|
|
|
MESHPARAMS_DEL(dot11MeshConfirmTimeout);
|
|
|
|
MESHPARAMS_DEL(dot11MeshHoldingTimeout);
|
|
|
|
MESHPARAMS_DEL(dot11MeshTTL);
|
|
|
|
MESHPARAMS_DEL(auto_open_plinks);
|
|
|
|
MESHPARAMS_DEL(dot11MeshMaxPeerLinks);
|
|
|
|
MESHPARAMS_DEL(dot11MeshHWMPactivePathTimeout);
|
|
|
|
MESHPARAMS_DEL(dot11MeshHWMPpreqMinInterval);
|
|
|
|
MESHPARAMS_DEL(dot11MeshHWMPnetDiameterTraversalTime);
|
|
|
|
MESHPARAMS_DEL(dot11MeshHWMPmaxPREQretries);
|
|
|
|
MESHPARAMS_DEL(path_refresh_time);
|
|
|
|
MESHPARAMS_DEL(min_discovery_timeout);
|
|
|
|
debugfs_remove(sdata->mesh_config_dir);
|
|
|
|
sdata->mesh_config_dir = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-07-09 14:40:35 +02:00
|
|
|
static void del_files(struct ieee80211_sub_if_data *sdata)
|
2007-05-05 20:46:38 +02:00
|
|
|
{
|
|
|
|
if (!sdata->debugfsdir)
|
|
|
|
return;
|
|
|
|
|
2008-07-09 14:40:35 +02:00
|
|
|
switch (sdata->vif.type) {
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_MESH_POINT:
|
2008-02-23 15:17:16 +01:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
del_mesh_stats(sdata);
|
|
|
|
del_mesh_config(sdata);
|
|
|
|
#endif
|
2008-09-11 00:01:49 +02:00
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_STATION:
|
2007-05-05 20:46:38 +02:00
|
|
|
del_sta_files(sdata);
|
|
|
|
break;
|
2009-02-15 12:44:28 +01:00
|
|
|
case NL80211_IFTYPE_ADHOC:
|
|
|
|
/* XXX */
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_AP:
|
2007-05-05 20:46:38 +02:00
|
|
|
del_ap_files(sdata);
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_WDS:
|
2007-05-05 20:46:38 +02:00
|
|
|
del_wds_files(sdata);
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_MONITOR:
|
2007-05-05 20:46:38 +02:00
|
|
|
del_monitor_files(sdata);
|
|
|
|
break;
|
2008-09-11 00:01:58 +02:00
|
|
|
case NL80211_IFTYPE_AP_VLAN:
|
2007-05-05 20:46:38 +02:00
|
|
|
del_vlan_files(sdata);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int notif_registered;
|
|
|
|
|
|
|
|
void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
char buf[10+IFNAMSIZ];
|
|
|
|
|
|
|
|
if (!notif_registered)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sprintf(buf, "netdev:%s", sdata->dev->name);
|
|
|
|
sdata->debugfsdir = debugfs_create_dir(buf,
|
|
|
|
sdata->local->hw.wiphy->debugfsdir);
|
2008-07-09 14:40:35 +02:00
|
|
|
add_files(sdata);
|
2007-05-05 20:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2008-07-09 14:40:35 +02:00
|
|
|
del_files(sdata);
|
2007-05-05 20:46:38 +02:00
|
|
|
debugfs_remove(sdata->debugfsdir);
|
|
|
|
sdata->debugfsdir = NULL;
|
|
|
|
}
|
|
|
|
|
2008-04-17 19:21:22 +02:00
|
|
|
static int netdev_notify(struct notifier_block *nb,
|
2007-05-05 20:46:38 +02:00
|
|
|
unsigned long state,
|
|
|
|
void *ndev)
|
|
|
|
{
|
|
|
|
struct net_device *dev = ndev;
|
2007-06-21 18:30:19 +02:00
|
|
|
struct dentry *dir;
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
struct ieee80211_sub_if_data *sdata;
|
2007-05-05 20:46:38 +02:00
|
|
|
char buf[10+IFNAMSIZ];
|
|
|
|
|
|
|
|
if (state != NETDEV_CHANGENAME)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
|
|
|
|
return 0;
|
|
|
|
|
mac80211: make master netdev handling sane
Currently, almost every interface type has a 'bss' pointer
pointing to BSS information. This BSS information, however,
is for a _local_ BSS, not for the BSS we joined, so having
it on a STA mode interface makes little sense, but now they
have it pointing to the master device, which is an AP mode
virtual interface. However, except for some bitrate control
data, this pointer is only used in AP/VLAN modes (for power
saving stations.)
Overall, it is not necessary to even have the master netdev
be a valid virtual interface, and it doesn't have to be on
the list of interfaces either.
This patch changes the master netdev to be special, it now
- no longer is on the list of virtual interfaces, which
lets me remove a lot of tests for that
- no longer has sub_if_data attached, since that isn't used
Additionally, this patch changes some vlan/ap mode handling
that is related to these 'bss' pointers described above (but
in the VLAN case they actually make sense because there they
point to the AP they belong to); it also adds some debugging
code to IEEE80211_DEV_TO_SUB_IF to validate it is not called
on the master netdev any more.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-09 14:40:34 +02:00
|
|
|
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
|
|
|
|
2007-06-21 18:30:19 +02:00
|
|
|
dir = sdata->debugfsdir;
|
2008-10-08 10:18:36 +02:00
|
|
|
|
|
|
|
if (!dir)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
sprintf(buf, "netdev:%s", dev->name);
|
2007-06-21 18:30:19 +02:00
|
|
|
if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
|
|
|
|
printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
|
|
|
|
"dir to %s\n", buf);
|
2007-05-05 20:46:38 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct notifier_block mac80211_debugfs_netdev_notifier = {
|
|
|
|
.notifier_call = netdev_notify,
|
|
|
|
};
|
|
|
|
|
|
|
|
void ieee80211_debugfs_netdev_init(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = register_netdevice_notifier(&mac80211_debugfs_netdev_notifier);
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR
|
|
|
|
"mac80211: failed to install netdev notifier,"
|
|
|
|
" disabling per-netdev debugfs!\n");
|
|
|
|
} else
|
|
|
|
notif_registered = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_debugfs_netdev_exit(void)
|
|
|
|
{
|
|
|
|
unregister_netdevice_notifier(&mac80211_debugfs_netdev_notifier);
|
|
|
|
notif_registered = 0;
|
|
|
|
}
|