2007-05-06 02:46:38 +08: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-09 03:14:40 +08:00
|
|
|
#include "rate.h"
|
2007-05-06 02:46:38 +08: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 06:10:22 +08:00
|
|
|
if (sdata->dev->reg_state == NETREG_REGISTERED)
|
2007-05-06 02:46:38 +08:00
|
|
|
ret = (*format)(sdata, buf, sizeof(buf));
|
|
|
|
read_unlock(&dev_base_lock);
|
2008-04-01 06:10:22 +08:00
|
|
|
|
|
|
|
if (ret != -EINVAL)
|
|
|
|
ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-12-01 20:37:02 +08:00
|
|
|
static ssize_t ieee80211_if_write(
|
|
|
|
struct ieee80211_sub_if_data *sdata,
|
|
|
|
const char __user *userbuf,
|
|
|
|
size_t count, loff_t *ppos,
|
|
|
|
ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int))
|
|
|
|
{
|
|
|
|
u8 *buf;
|
|
|
|
ssize_t ret = -ENODEV;
|
|
|
|
|
|
|
|
buf = kzalloc(count, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
if (copy_from_user(buf, userbuf, count))
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
rtnl_lock();
|
|
|
|
if (sdata->dev->reg_state == NETREG_REGISTERED)
|
|
|
|
ret = (*write)(sdata, buf, count);
|
|
|
|
rtnl_unlock();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
#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-28 06:56:10 +08:00
|
|
|
return scnprintf(buf, buflen, "%pM\n", sdata->field); \
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
2009-12-01 20:37:02 +08:00
|
|
|
#define __IEEE80211_IF_FILE(name, _write) \
|
2007-05-06 02:46:38 +08:00
|
|
|
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, \
|
2009-12-01 20:37:02 +08:00
|
|
|
.write = (_write), \
|
2007-05-06 02:46:38 +08:00
|
|
|
.open = mac80211_open_file_generic, \
|
|
|
|
}
|
|
|
|
|
2009-12-01 20:37:02 +08:00
|
|
|
#define __IEEE80211_IF_FILE_W(name) \
|
|
|
|
static ssize_t ieee80211_if_write_##name(struct file *file, \
|
|
|
|
const char __user *userbuf, \
|
|
|
|
size_t count, loff_t *ppos) \
|
|
|
|
{ \
|
|
|
|
return ieee80211_if_write(file->private_data, userbuf, count, \
|
|
|
|
ppos, ieee80211_if_parse_##name); \
|
|
|
|
} \
|
|
|
|
__IEEE80211_IF_FILE(name, ieee80211_if_write_##name)
|
|
|
|
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
#define IEEE80211_IF_FILE(name, field, format) \
|
|
|
|
IEEE80211_IF_FMT_##format(name, field) \
|
2009-12-01 20:37:02 +08:00
|
|
|
__IEEE80211_IF_FILE(name, NULL)
|
2007-05-06 02:46:38 +08:00
|
|
|
|
|
|
|
/* common attributes */
|
|
|
|
IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
|
2010-01-06 19:09:08 +08:00
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
|
|
|
|
HEX);
|
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
|
|
|
|
HEX);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
2009-02-15 19:44:28 +08:00
|
|
|
/* STA attributes */
|
|
|
|
IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
|
|
|
|
IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
2009-12-01 20:37:02 +08:00
|
|
|
static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
|
|
|
|
enum ieee80211_smps_mode smps_mode)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_STATIC_SMPS) &&
|
|
|
|
smps_mode == IEEE80211_SMPS_STATIC)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* auto should be dynamic if in PS mode */
|
|
|
|
if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) &&
|
|
|
|
(smps_mode == IEEE80211_SMPS_DYNAMIC ||
|
|
|
|
smps_mode == IEEE80211_SMPS_AUTOMATIC))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* supported only on managed interfaces for now */
|
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_STATION)
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
mutex_lock(&local->iflist_mtx);
|
|
|
|
err = __ieee80211_request_smps(sdata, smps_mode);
|
|
|
|
mutex_unlock(&local->iflist_mtx);
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = {
|
|
|
|
[IEEE80211_SMPS_AUTOMATIC] = "auto",
|
|
|
|
[IEEE80211_SMPS_OFF] = "off",
|
|
|
|
[IEEE80211_SMPS_STATIC] = "static",
|
|
|
|
[IEEE80211_SMPS_DYNAMIC] = "dynamic",
|
|
|
|
};
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_STATION)
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
return snprintf(buf, buflen, "request: %s\nused: %s\n",
|
|
|
|
smps_modes[sdata->u.mgd.req_smps],
|
|
|
|
smps_modes[sdata->u.mgd.ap_smps]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata,
|
|
|
|
const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
enum ieee80211_smps_mode mode;
|
|
|
|
|
|
|
|
for (mode = 0; mode < IEEE80211_SMPS_NUM_MODES; mode++) {
|
|
|
|
if (strncmp(buf, smps_modes[mode], buflen) == 0) {
|
|
|
|
int err = ieee80211_set_smps(sdata, mode);
|
|
|
|
if (!err)
|
|
|
|
return buflen;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
__IEEE80211_IF_FILE_W(smps);
|
|
|
|
|
2007-05-06 02:46:38 +08: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));
|
|
|
|
}
|
2009-12-01 20:37:02 +08:00
|
|
|
__IEEE80211_IF_FILE(num_buffered_multicast, NULL);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
|
|
|
/* WDS attributes */
|
|
|
|
IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC);
|
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
/* Mesh stats attributes */
|
2009-08-19 01:59:00 +08:00
|
|
|
IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC);
|
|
|
|
IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC);
|
2008-09-11 06:01:49 +08: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 22:17:16 +08:00
|
|
|
IEEE80211_IF_FILE(dropped_frames_no_route,
|
2008-09-11 06:01:49 +08:00
|
|
|
u.mesh.mshstats.dropped_frames_no_route, DEC);
|
|
|
|
IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
|
2008-02-23 22:17:16 +08:00
|
|
|
|
|
|
|
/* Mesh parameters */
|
2008-10-07 18:04:31 +08: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);
|
2009-11-10 07:46:57 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPRootMode,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC);
|
2008-02-23 22:17:16 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-01-11 00:12:41 +08:00
|
|
|
#define DEBUGFS_ADD(name) \
|
2009-10-27 19:59:03 +08:00
|
|
|
debugfs_create_file(#name, 0400, sdata->debugfs.dir, \
|
|
|
|
sdata, &name##_ops);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
2009-12-01 20:37:02 +08:00
|
|
|
#define DEBUGFS_ADD_MODE(name, mode) \
|
|
|
|
debugfs_create_file(#name, mode, sdata->debugfs.dir, \
|
|
|
|
sdata, &name##_ops);
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
static void add_sta_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(drop_unencrypted);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_5ghz);
|
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 20:40:34 +08:00
|
|
|
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(bssid);
|
|
|
|
DEBUGFS_ADD(aid);
|
2009-12-01 20:37:02 +08:00
|
|
|
DEBUGFS_ADD_MODE(smps, 0600);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_ap_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(drop_unencrypted);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_5ghz);
|
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 20:40:34 +08:00
|
|
|
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(num_sta_ps);
|
|
|
|
DEBUGFS_ADD(dtim_count);
|
|
|
|
DEBUGFS_ADD(num_buffered_multicast);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_wds_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(drop_unencrypted);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_5ghz);
|
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 20:40:34 +08:00
|
|
|
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(peer);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(drop_unencrypted);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_5ghz);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
|
|
|
|
static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2009-10-27 19:59:03 +08:00
|
|
|
struct dentry *dir = debugfs_create_dir("mesh_stats",
|
|
|
|
sdata->debugfs.dir);
|
|
|
|
|
|
|
|
#define MESHSTATS_ADD(name)\
|
|
|
|
debugfs_create_file(#name, 0400, dir, sdata, &name##_ops);
|
|
|
|
|
2009-08-19 01:59:00 +08:00
|
|
|
MESHSTATS_ADD(fwded_mcast);
|
|
|
|
MESHSTATS_ADD(fwded_unicast);
|
2008-02-23 22:17:16 +08:00
|
|
|
MESHSTATS_ADD(fwded_frames);
|
|
|
|
MESHSTATS_ADD(dropped_frames_ttl);
|
|
|
|
MESHSTATS_ADD(dropped_frames_no_route);
|
|
|
|
MESHSTATS_ADD(estab_plinks);
|
2009-10-27 19:59:03 +08:00
|
|
|
#undef MESHSTATS_ADD
|
2008-02-23 22:17:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2009-10-27 19:59:03 +08:00
|
|
|
struct dentry *dir = debugfs_create_dir("mesh_config",
|
|
|
|
sdata->debugfs.dir);
|
|
|
|
|
|
|
|
#define MESHPARAMS_ADD(name) \
|
|
|
|
debugfs_create_file(#name, 0600, dir, sdata, &name##_ops);
|
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
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);
|
2009-10-27 19:59:03 +08:00
|
|
|
|
|
|
|
#undef MESHPARAMS_ADD
|
2008-02-23 22:17:16 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
static void add_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2009-10-27 19:59:03 +08:00
|
|
|
if (!sdata->debugfs.dir)
|
2007-05-06 02:46:38 +08:00
|
|
|
return;
|
|
|
|
|
2007-12-19 08:31:27 +08:00
|
|
|
switch (sdata->vif.type) {
|
2008-09-11 06:01:58 +08:00
|
|
|
case NL80211_IFTYPE_MESH_POINT:
|
2008-02-23 22:17:16 +08:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
add_mesh_stats(sdata);
|
|
|
|
add_mesh_config(sdata);
|
|
|
|
#endif
|
2008-09-11 06:01:49 +08:00
|
|
|
break;
|
2008-09-11 06:01:58 +08:00
|
|
|
case NL80211_IFTYPE_STATION:
|
2007-05-06 02:46:38 +08:00
|
|
|
add_sta_files(sdata);
|
|
|
|
break;
|
2009-02-15 19:44:28 +08:00
|
|
|
case NL80211_IFTYPE_ADHOC:
|
|
|
|
/* XXX */
|
|
|
|
break;
|
2008-09-11 06:01:58 +08:00
|
|
|
case NL80211_IFTYPE_AP:
|
2007-05-06 02:46:38 +08:00
|
|
|
add_ap_files(sdata);
|
|
|
|
break;
|
2008-09-11 06:01:58 +08:00
|
|
|
case NL80211_IFTYPE_WDS:
|
2007-05-06 02:46:38 +08:00
|
|
|
add_wds_files(sdata);
|
|
|
|
break;
|
2008-09-11 06:01:58 +08:00
|
|
|
case NL80211_IFTYPE_MONITOR:
|
2007-05-06 02:46:38 +08:00
|
|
|
add_monitor_files(sdata);
|
|
|
|
break;
|
2008-09-11 06:01:58 +08:00
|
|
|
case NL80211_IFTYPE_AP_VLAN:
|
2007-05-06 02:46:38 +08:00
|
|
|
add_vlan_files(sdata);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
char buf[10+IFNAMSIZ];
|
|
|
|
|
2009-11-26 00:46:19 +08:00
|
|
|
sprintf(buf, "netdev:%s", sdata->name);
|
2009-10-27 19:59:03 +08:00
|
|
|
sdata->debugfs.dir = debugfs_create_dir(buf,
|
2007-05-06 02:46:38 +08:00
|
|
|
sdata->local->hw.wiphy->debugfsdir);
|
2008-07-09 20:40:35 +08:00
|
|
|
add_files(sdata);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2009-10-27 19:59:03 +08:00
|
|
|
if (!sdata->debugfs.dir)
|
|
|
|
return;
|
|
|
|
|
|
|
|
debugfs_remove_recursive(sdata->debugfs.dir);
|
|
|
|
sdata->debugfs.dir = NULL;
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
2009-11-26 00:46:19 +08:00
|
|
|
void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
|
2007-05-06 02:46:38 +08:00
|
|
|
{
|
2007-06-22 00:30:19 +08:00
|
|
|
struct dentry *dir;
|
2009-11-26 00:46:19 +08:00
|
|
|
char buf[10 + IFNAMSIZ];
|
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 20:40:34 +08:00
|
|
|
|
2009-10-27 19:59:03 +08:00
|
|
|
dir = sdata->debugfs.dir;
|
2008-10-08 16:18:36 +08:00
|
|
|
|
|
|
|
if (!dir)
|
2009-11-26 00:46:19 +08:00
|
|
|
return;
|
2008-10-08 16:18:36 +08:00
|
|
|
|
2009-11-26 00:46:19 +08:00
|
|
|
sprintf(buf, "netdev:%s", sdata->name);
|
2007-06-22 00:30:19 +08: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-06 02:46:38 +08:00
|
|
|
}
|