2019-06-04 16:11:33 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2007-05-06 02:46:38 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
|
|
|
|
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
|
wifi: mac80211: move interface config to new struct
We'll use bss_conf for per-link configuration later, so
move out all the non-link-specific data out into a new
struct ieee80211_vif_cfg used in the vif.
Some adjustments were done with the following spatch:
@@
expression sdata;
struct ieee80211_vif *vifp;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
(
-sdata->vif.bss_conf.var
+sdata->vif.cfg.var
|
-vifp->bss_conf.var
+vifp->cfg.var
)
@bss_conf@
struct ieee80211_bss_conf *bss_conf;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
-bss_conf->var
+vif_cfg->var
(though more manual fixups were needed, e.g. replacing
"vif_cfg->" by "vif->cfg." in many files.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-05-10 23:05:04 +08:00
|
|
|
* Copyright (C) 2020-2022 Intel Corporation
|
2007-05-06 02:46:38 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/if.h>
|
2012-11-06 03:24:38 +08:00
|
|
|
#include <linux/if_ether.h>
|
2007-05-06 02:46:38 +08:00
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/rtnetlink.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2007-05-06 02:46:38 +08:00
|
|
|
#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"
|
2011-09-21 19:06:11 +08:00
|
|
|
#include "driver-ops.h"
|
2007-05-06 02:46:38 +08:00
|
|
|
|
|
|
|
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))
|
|
|
|
{
|
2016-09-12 21:55:43 +08:00
|
|
|
char buf[200];
|
2007-05-06 02:46:38 +08:00
|
|
|
ssize_t ret = -EINVAL;
|
|
|
|
|
|
|
|
read_lock(&dev_base_lock);
|
2014-05-26 19:40:51 +08:00
|
|
|
ret = (*format)(sdata, buf, sizeof(buf));
|
2007-05-06 02:46:38 +08:00
|
|
|
read_unlock(&dev_base_lock);
|
2008-04-01 06:10:22 +08:00
|
|
|
|
2011-02-04 00:35:19 +08:00
|
|
|
if (ret >= 0)
|
2008-04-01 06:10:22 +08:00
|
|
|
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))
|
|
|
|
{
|
2012-03-14 22:15:02 +08:00
|
|
|
char buf[64];
|
2010-03-11 00:13:36 +08:00
|
|
|
ssize_t ret;
|
2009-12-01 20:37:02 +08:00
|
|
|
|
2012-03-14 22:15:02 +08:00
|
|
|
if (count >= sizeof(buf))
|
|
|
|
return -E2BIG;
|
2009-12-01 20:37:02 +08:00
|
|
|
|
|
|
|
if (copy_from_user(buf, userbuf, count))
|
2012-03-14 22:15:02 +08:00
|
|
|
return -EFAULT;
|
|
|
|
buf[count] = '\0';
|
2009-12-01 20:37:02 +08:00
|
|
|
|
|
|
|
rtnl_lock();
|
2014-05-26 19:40:51 +08:00
|
|
|
ret = (*write)(sdata, buf, count);
|
2009-12-01 20:37:02 +08:00
|
|
|
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")
|
2011-01-28 14:09:34 +08:00
|
|
|
#define IEEE80211_IF_FMT_LHEX(name, field) \
|
|
|
|
IEEE80211_IF_FMT(name, field, "%#lx\n")
|
2007-05-06 02:46:38 +08:00
|
|
|
|
2012-01-29 00:25:33 +08:00
|
|
|
#define IEEE80211_IF_FMT_HEXARRAY(name, field) \
|
|
|
|
static ssize_t ieee80211_if_fmt_##name( \
|
|
|
|
const struct ieee80211_sub_if_data *sdata, \
|
|
|
|
char *buf, int buflen) \
|
|
|
|
{ \
|
|
|
|
char *p = buf; \
|
|
|
|
int i; \
|
|
|
|
for (i = 0; i < sizeof(sdata->field); i++) { \
|
|
|
|
p += scnprintf(p, buflen + buf - p, "%.2x ", \
|
|
|
|
sdata->field[i]); \
|
|
|
|
} \
|
|
|
|
p += scnprintf(p, buflen + buf - p, "\n"); \
|
|
|
|
return p - buf; \
|
|
|
|
}
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2013-03-26 02:19:34 +08:00
|
|
|
#define IEEE80211_IF_FMT_JIFFIES_TO_MS(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", \
|
|
|
|
jiffies_to_msecs(sdata->field)); \
|
|
|
|
}
|
|
|
|
|
2014-01-06 22:47:15 +08:00
|
|
|
#define _IEEE80211_IF_FILE_OPS(name, _read, _write) \
|
|
|
|
static const struct file_operations name##_ops = { \
|
|
|
|
.read = (_read), \
|
|
|
|
.write = (_write), \
|
|
|
|
.open = simple_open, \
|
|
|
|
.llseek = generic_file_llseek, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define _IEEE80211_IF_FILE_R_FN(name) \
|
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); \
|
|
|
|
}
|
|
|
|
|
2014-01-06 22:47:15 +08:00
|
|
|
#define _IEEE80211_IF_FILE_W_FN(name) \
|
2009-12-01 20:37:02 +08:00
|
|
|
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); \
|
2014-01-06 22:47:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define IEEE80211_IF_FILE_R(name) \
|
|
|
|
_IEEE80211_IF_FILE_R_FN(name) \
|
|
|
|
_IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, NULL)
|
|
|
|
|
|
|
|
#define IEEE80211_IF_FILE_W(name) \
|
|
|
|
_IEEE80211_IF_FILE_W_FN(name) \
|
|
|
|
_IEEE80211_IF_FILE_OPS(name, NULL, ieee80211_if_write_##name)
|
2009-12-01 20:37:02 +08:00
|
|
|
|
2014-01-06 22:47:15 +08:00
|
|
|
#define IEEE80211_IF_FILE_RW(name) \
|
|
|
|
_IEEE80211_IF_FILE_R_FN(name) \
|
|
|
|
_IEEE80211_IF_FILE_W_FN(name) \
|
|
|
|
_IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, \
|
|
|
|
ieee80211_if_write_##name)
|
2009-12-01 20:37:02 +08:00
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
#define IEEE80211_IF_FILE(name, field, format) \
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FMT_##format(name, field) \
|
|
|
|
IEEE80211_IF_FILE_R(name)
|
2007-05-06 02:46:38 +08:00
|
|
|
|
|
|
|
/* common attributes */
|
2016-04-12 21:56:15 +08:00
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[NL80211_BAND_2GHZ],
|
2010-01-06 19:09:08 +08:00
|
|
|
HEX);
|
2016-04-12 21:56:15 +08:00
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[NL80211_BAND_5GHZ],
|
2010-01-06 19:09:08 +08:00
|
|
|
HEX);
|
2012-01-29 00:25:33 +08:00
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mcs_mask_2ghz,
|
2016-04-12 21:56:15 +08:00
|
|
|
rc_rateidx_mcs_mask[NL80211_BAND_2GHZ], HEXARRAY);
|
2012-01-29 00:25:33 +08:00
|
|
|
IEEE80211_IF_FILE(rc_rateidx_mcs_mask_5ghz,
|
2016-04-12 21:56:15 +08:00
|
|
|
rc_rateidx_mcs_mask[NL80211_BAND_5GHZ], HEXARRAY);
|
2012-01-29 00:25:33 +08:00
|
|
|
|
2015-08-07 05:47:33 +08:00
|
|
|
static ssize_t ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_2ghz(
|
|
|
|
const struct ieee80211_sub_if_data *sdata,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
|
|
|
int i, len = 0;
|
2016-04-12 21:56:15 +08:00
|
|
|
const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_2GHZ];
|
2015-08-07 05:47:33 +08:00
|
|
|
|
|
|
|
for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
|
|
|
|
len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]);
|
|
|
|
len += scnprintf(buf + len, buflen - len, "\n");
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
IEEE80211_IF_FILE_R(rc_rateidx_vht_mcs_mask_2ghz);
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_5ghz(
|
|
|
|
const struct ieee80211_sub_if_data *sdata,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
|
|
|
int i, len = 0;
|
2016-04-12 21:56:15 +08:00
|
|
|
const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_5GHZ];
|
2015-08-07 05:47:33 +08:00
|
|
|
|
|
|
|
for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
|
|
|
|
len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]);
|
|
|
|
len += scnprintf(buf + len, buflen - len, "\n");
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
IEEE80211_IF_FILE_R(rc_rateidx_vht_mcs_mask_5ghz);
|
|
|
|
|
2011-01-28 14:09:34 +08:00
|
|
|
IEEE80211_IF_FILE(flags, flags, HEX);
|
|
|
|
IEEE80211_IF_FILE(state, state, LHEX);
|
2012-10-24 16:59:25 +08:00
|
|
|
IEEE80211_IF_FILE(txpower, vif.bss_conf.txpower, DEC);
|
2022-05-16 21:00:15 +08:00
|
|
|
IEEE80211_IF_FILE(ap_power_level, deflink.ap_power_level, DEC);
|
|
|
|
IEEE80211_IF_FILE(user_power_level, deflink.user_power_level, DEC);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
2012-11-08 22:29:28 +08:00
|
|
|
static ssize_t
|
|
|
|
ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = scnprintf(buf, buflen, "AC queues: VO:%d VI:%d BE:%d BK:%d\n",
|
|
|
|
sdata->vif.hw_queue[IEEE80211_AC_VO],
|
|
|
|
sdata->vif.hw_queue[IEEE80211_AC_VI],
|
|
|
|
sdata->vif.hw_queue[IEEE80211_AC_BE],
|
|
|
|
sdata->vif.hw_queue[IEEE80211_AC_BK]);
|
|
|
|
|
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_AP)
|
|
|
|
len += scnprintf(buf + len, buflen - len, "cab queue: %d\n",
|
|
|
|
sdata->vif.cab_queue);
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_R(hw_queues);
|
2012-11-08 22:29:28 +08:00
|
|
|
|
2009-02-15 19:44:28 +08:00
|
|
|
/* STA attributes */
|
2022-05-16 21:00:15 +08:00
|
|
|
IEEE80211_IF_FILE(bssid, deflink.u.mgd.bssid, MAC);
|
wifi: mac80211: move interface config to new struct
We'll use bss_conf for per-link configuration later, so
move out all the non-link-specific data out into a new
struct ieee80211_vif_cfg used in the vif.
Some adjustments were done with the following spatch:
@@
expression sdata;
struct ieee80211_vif *vifp;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
(
-sdata->vif.bss_conf.var
+sdata->vif.cfg.var
|
-vifp->bss_conf.var
+vifp->cfg.var
)
@bss_conf@
struct ieee80211_bss_conf *bss_conf;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
-bss_conf->var
+vif_cfg->var
(though more manual fixups were needed, e.g. replacing
"vif_cfg->" by "vif->cfg." in many files.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-05-10 23:05:04 +08:00
|
|
|
IEEE80211_IF_FILE(aid, vif.cfg.aid, DEC);
|
2013-03-26 02:19:34 +08:00
|
|
|
IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
|
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;
|
|
|
|
|
2014-09-10 19:07:36 +08:00
|
|
|
if (!(local->hw.wiphy->features & NL80211_FEATURE_STATIC_SMPS) &&
|
2009-12-01 20:37:02 +08:00
|
|
|
smps_mode == IEEE80211_SMPS_STATIC)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* auto should be dynamic if in PS mode */
|
2014-09-10 19:07:36 +08:00
|
|
|
if (!(local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) &&
|
2009-12-01 20:37:02 +08:00
|
|
|
(smps_mode == IEEE80211_SMPS_DYNAMIC ||
|
|
|
|
smps_mode == IEEE80211_SMPS_AUTOMATIC))
|
|
|
|
return -EINVAL;
|
|
|
|
|
2020-01-31 19:12:56 +08:00
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_STATION)
|
2009-12-01 20:37:02 +08:00
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
2013-05-10 18:32:47 +08:00
|
|
|
sdata_lock(sdata);
|
2022-06-18 04:36:37 +08:00
|
|
|
err = __ieee80211_request_smps_mgd(sdata, &sdata->deflink, smps_mode);
|
2013-05-10 18:32:47 +08:00
|
|
|
sdata_unlock(sdata);
|
2009-12-01 20:37:02 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2013-10-01 21:45:43 +08:00
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_STATION)
|
|
|
|
return snprintf(buf, buflen, "request: %s\nused: %s\n",
|
2022-05-16 21:00:15 +08:00
|
|
|
smps_modes[sdata->deflink.u.mgd.req_smps],
|
|
|
|
smps_modes[sdata->deflink.smps_mode]);
|
2013-10-01 21:45:43 +08:00
|
|
|
return -EINVAL;
|
2009-12-01 20:37:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_RW(smps);
|
2011-02-04 00:35:19 +08:00
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_tkip_mic_test(
|
|
|
|
struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
u8 addr[ETH_ALEN];
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct ieee80211_hdr *hdr;
|
|
|
|
__le16 fc;
|
|
|
|
|
2012-11-06 03:24:38 +08:00
|
|
|
if (!mac_pton(buf, addr))
|
2011-02-04 00:35:19 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (!ieee80211_sdata_running(sdata))
|
|
|
|
return -ENOTCONN;
|
|
|
|
|
|
|
|
skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24 + 100);
|
|
|
|
if (!skb)
|
|
|
|
return -ENOMEM;
|
|
|
|
skb_reserve(skb, local->hw.extra_tx_headroom);
|
|
|
|
|
networking: convert many more places to skb_put_zero()
There were many places that my previous spatch didn't find,
as pointed out by yuan linyu in various patches.
The following spatch found many more and also removes the
now unnecessary casts:
@@
identifier p, p2;
expression len;
expression skb;
type t, t2;
@@
(
-p = skb_put(skb, len);
+p = skb_put_zero(skb, len);
|
-p = (t)skb_put(skb, len);
+p = skb_put_zero(skb, len);
)
... when != p
(
p2 = (t2)p;
-memset(p2, 0, len);
|
-memset(p, 0, len);
)
@@
type t, t2;
identifier p, p2;
expression skb;
@@
t *p;
...
(
-p = skb_put(skb, sizeof(t));
+p = skb_put_zero(skb, sizeof(t));
|
-p = (t *)skb_put(skb, sizeof(t));
+p = skb_put_zero(skb, sizeof(t));
)
... when != p
(
p2 = (t2)p;
-memset(p2, 0, sizeof(*p));
|
-memset(p, 0, sizeof(*p));
)
@@
expression skb, len;
@@
-memset(skb_put(skb, len), 0, len);
+skb_put_zero(skb, len);
Apply it to the tree (with one manual fixup to keep the
comment in vxlan.c, which spatch removed.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 20:29:19 +08:00
|
|
|
hdr = skb_put_zero(skb, 24);
|
2011-02-04 00:35:19 +08:00
|
|
|
fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA);
|
|
|
|
|
|
|
|
switch (sdata->vif.type) {
|
|
|
|
case NL80211_IFTYPE_AP:
|
|
|
|
fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
|
|
|
|
/* DA BSSID SA */
|
|
|
|
memcpy(hdr->addr1, addr, ETH_ALEN);
|
|
|
|
memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
|
|
|
|
memcpy(hdr->addr3, sdata->vif.addr, ETH_ALEN);
|
|
|
|
break;
|
|
|
|
case NL80211_IFTYPE_STATION:
|
|
|
|
fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
|
|
|
|
/* BSSID SA DA */
|
2013-05-10 18:32:47 +08:00
|
|
|
sdata_lock(sdata);
|
2012-11-06 03:27:57 +08:00
|
|
|
if (!sdata->u.mgd.associated) {
|
2013-05-10 18:32:47 +08:00
|
|
|
sdata_unlock(sdata);
|
2011-02-04 00:35:19 +08:00
|
|
|
dev_kfree_skb(skb);
|
|
|
|
return -ENOTCONN;
|
|
|
|
}
|
2022-05-16 21:00:15 +08:00
|
|
|
memcpy(hdr->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN);
|
2011-02-04 00:35:19 +08:00
|
|
|
memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
|
|
|
|
memcpy(hdr->addr3, addr, ETH_ALEN);
|
2013-05-10 18:32:47 +08:00
|
|
|
sdata_unlock(sdata);
|
2011-02-04 00:35:19 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
hdr->frame_control = fc;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add some length to the test frame to make it look bit more valid.
|
|
|
|
* The exact contents does not matter since the recipient is required
|
|
|
|
* to drop this because of the Michael MIC failure.
|
|
|
|
*/
|
networking: convert many more places to skb_put_zero()
There were many places that my previous spatch didn't find,
as pointed out by yuan linyu in various patches.
The following spatch found many more and also removes the
now unnecessary casts:
@@
identifier p, p2;
expression len;
expression skb;
type t, t2;
@@
(
-p = skb_put(skb, len);
+p = skb_put_zero(skb, len);
|
-p = (t)skb_put(skb, len);
+p = skb_put_zero(skb, len);
)
... when != p
(
p2 = (t2)p;
-memset(p2, 0, len);
|
-memset(p, 0, len);
)
@@
type t, t2;
identifier p, p2;
expression skb;
@@
t *p;
...
(
-p = skb_put(skb, sizeof(t));
+p = skb_put_zero(skb, sizeof(t));
|
-p = (t *)skb_put(skb, sizeof(t));
+p = skb_put_zero(skb, sizeof(t));
)
... when != p
(
p2 = (t2)p;
-memset(p2, 0, sizeof(*p));
|
-memset(p, 0, sizeof(*p));
)
@@
expression skb, len;
@@
-memset(skb_put(skb, len), 0, len);
+skb_put_zero(skb, len);
Apply it to the tree (with one manual fixup to keep the
comment in vxlan.c, which spatch removed.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 20:29:19 +08:00
|
|
|
skb_put_zero(skb, 50);
|
2011-02-04 00:35:19 +08:00
|
|
|
|
|
|
|
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_TKIP_MIC_FAILURE;
|
|
|
|
|
|
|
|
ieee80211_tx_skb(sdata, skb);
|
|
|
|
|
|
|
|
return buflen;
|
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_W(tkip_mic_test);
|
2011-02-04 00:35:19 +08:00
|
|
|
|
2014-02-11 18:36:18 +08:00
|
|
|
static ssize_t ieee80211_if_parse_beacon_loss(
|
|
|
|
struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
|
|
|
|
{
|
wifi: mac80211: move interface config to new struct
We'll use bss_conf for per-link configuration later, so
move out all the non-link-specific data out into a new
struct ieee80211_vif_cfg used in the vif.
Some adjustments were done with the following spatch:
@@
expression sdata;
struct ieee80211_vif *vifp;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
(
-sdata->vif.bss_conf.var
+sdata->vif.cfg.var
|
-vifp->bss_conf.var
+vifp->cfg.var
)
@bss_conf@
struct ieee80211_bss_conf *bss_conf;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
-bss_conf->var
+vif_cfg->var
(though more manual fixups were needed, e.g. replacing
"vif_cfg->" by "vif->cfg." in many files.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-05-10 23:05:04 +08:00
|
|
|
if (!ieee80211_sdata_running(sdata) || !sdata->vif.cfg.assoc)
|
2014-02-11 18:36:18 +08:00
|
|
|
return -ENOTCONN;
|
|
|
|
|
|
|
|
ieee80211_beacon_loss(&sdata->vif);
|
|
|
|
|
|
|
|
return buflen;
|
|
|
|
}
|
|
|
|
IEEE80211_IF_FILE_W(beacon_loss);
|
|
|
|
|
2012-03-14 22:15:03 +08:00
|
|
|
static ssize_t ieee80211_if_fmt_uapsd_queues(
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
|
|
|
|
{
|
|
|
|
const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
|
|
|
|
|
|
|
return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_queues);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_uapsd_queues(
|
|
|
|
struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
|
|
|
u8 val;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = kstrtou8(buf, 0, &val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
|
|
|
|
return -ERANGE;
|
|
|
|
|
|
|
|
ifmgd->uapsd_queues = val;
|
|
|
|
|
|
|
|
return buflen;
|
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_RW(uapsd_queues);
|
2012-03-14 22:15:03 +08:00
|
|
|
|
|
|
|
static ssize_t ieee80211_if_fmt_uapsd_max_sp_len(
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
|
|
|
|
{
|
|
|
|
const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
|
|
|
|
|
|
|
return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_max_sp_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_uapsd_max_sp_len(
|
|
|
|
struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
|
|
|
unsigned long val;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = kstrtoul(buf, 0, &val);
|
|
|
|
if (ret)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK)
|
|
|
|
return -ERANGE;
|
|
|
|
|
|
|
|
ifmgd->uapsd_max_sp_len = val;
|
|
|
|
|
|
|
|
return buflen;
|
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_RW(uapsd_max_sp_len);
|
2012-03-14 22:15:03 +08:00
|
|
|
|
2015-08-16 03:39:46 +08:00
|
|
|
static ssize_t ieee80211_if_fmt_tdls_wider_bw(
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
|
|
|
|
{
|
|
|
|
const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
|
|
|
bool tdls_wider_bw;
|
|
|
|
|
|
|
|
tdls_wider_bw = ieee80211_hw_check(&sdata->local->hw, TDLS_WIDER_BW) &&
|
|
|
|
!ifmgd->tdls_wider_bw_prohibited;
|
|
|
|
|
|
|
|
return snprintf(buf, buflen, "%d\n", tdls_wider_bw);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_tdls_wider_bw(
|
|
|
|
struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
|
|
|
u8 val;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = kstrtou8(buf, 0, &val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ifmgd->tdls_wider_bw_prohibited = !val;
|
|
|
|
return buflen;
|
|
|
|
}
|
|
|
|
IEEE80211_IF_FILE_RW(tdls_wider_bw);
|
|
|
|
|
2007-05-06 02:46:38 +08:00
|
|
|
/* AP attributes */
|
2012-04-24 01:49:02 +08:00
|
|
|
IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);
|
2012-10-11 03:39:50 +08:00
|
|
|
IEEE80211_IF_FILE(num_sta_ps, u.ap.ps.num_sta_ps, ATOMIC);
|
|
|
|
IEEE80211_IF_FILE(dtim_count, u.ap.ps.dtim_count, DEC);
|
2016-10-11 01:12:21 +08:00
|
|
|
IEEE80211_IF_FILE(num_mcast_sta_vlan, u.vlan.num_mcast_sta, ATOMIC);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
|
|
|
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",
|
2012-10-11 03:39:50 +08:00
|
|
|
skb_queue_len(&sdata->u.ap.ps.bc_buf));
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_R(num_buffered_multicast);
|
2007-05-06 02:46:38 +08:00
|
|
|
|
2016-09-12 21:55:43 +08:00
|
|
|
static ssize_t ieee80211_if_fmt_aqm(
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
2019-09-27 10:03:16 +08:00
|
|
|
struct txq_info *txqi;
|
2016-09-12 21:55:43 +08:00
|
|
|
int len;
|
|
|
|
|
2019-09-27 10:03:16 +08:00
|
|
|
if (!sdata->vif.txq)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
txqi = to_txq_info(sdata->vif.txq);
|
|
|
|
|
2016-09-12 21:55:43 +08:00
|
|
|
spin_lock_bh(&local->fq.lock);
|
|
|
|
rcu_read_lock();
|
|
|
|
|
|
|
|
len = scnprintf(buf,
|
|
|
|
buflen,
|
|
|
|
"ac backlog-bytes backlog-packets new-flows drops marks overlimit collisions tx-bytes tx-packets\n"
|
|
|
|
"%u %u %u %u %u %u %u %u %u %u\n",
|
|
|
|
txqi->txq.ac,
|
|
|
|
txqi->tin.backlog_bytes,
|
|
|
|
txqi->tin.backlog_packets,
|
|
|
|
txqi->tin.flows,
|
|
|
|
txqi->cstats.drop_count,
|
|
|
|
txqi->cstats.ecn_mark,
|
|
|
|
txqi->tin.overlimit,
|
|
|
|
txqi->tin.collisions,
|
|
|
|
txqi->tin.tx_bytes,
|
|
|
|
txqi->tin.tx_packets);
|
|
|
|
|
|
|
|
rcu_read_unlock();
|
|
|
|
spin_unlock_bh(&local->fq.lock);
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
IEEE80211_IF_FILE_R(aqm);
|
|
|
|
|
2016-11-22 18:52:18 +08:00
|
|
|
IEEE80211_IF_FILE(multicast_to_unicast, u.ap.multicast_to_unicast, HEX);
|
|
|
|
|
2011-09-21 19:06:11 +08:00
|
|
|
/* IBSS attributes */
|
|
|
|
static ssize_t ieee80211_if_fmt_tsf(
|
|
|
|
const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
u64 tsf;
|
|
|
|
|
|
|
|
tsf = drv_get_tsf(local, (struct ieee80211_sub_if_data *)sdata);
|
|
|
|
|
|
|
|
return scnprintf(buf, buflen, "0x%016llx\n", (unsigned long long) tsf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_tsf(
|
|
|
|
struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
unsigned long long tsf;
|
|
|
|
int ret;
|
2012-04-01 02:31:31 +08:00
|
|
|
int tsf_is_delta = 0;
|
2011-09-21 19:06:11 +08:00
|
|
|
|
|
|
|
if (strncmp(buf, "reset", 5) == 0) {
|
|
|
|
if (local->ops->reset_tsf) {
|
|
|
|
drv_reset_tsf(local, sdata);
|
|
|
|
wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
|
|
|
|
}
|
|
|
|
} else {
|
2012-04-01 02:31:31 +08:00
|
|
|
if (buflen > 10 && buf[1] == '=') {
|
|
|
|
if (buf[0] == '+')
|
|
|
|
tsf_is_delta = 1;
|
|
|
|
else if (buf[0] == '-')
|
|
|
|
tsf_is_delta = -1;
|
|
|
|
else
|
|
|
|
return -EINVAL;
|
|
|
|
buf += 2;
|
|
|
|
}
|
2011-09-21 19:06:11 +08:00
|
|
|
ret = kstrtoull(buf, 10, &tsf);
|
|
|
|
if (ret < 0)
|
2012-11-06 03:30:39 +08:00
|
|
|
return ret;
|
2016-09-29 07:56:28 +08:00
|
|
|
if (tsf_is_delta && local->ops->offset_tsf) {
|
|
|
|
drv_offset_tsf(local, sdata, tsf_is_delta * tsf);
|
|
|
|
wiphy_info(local->hw.wiphy,
|
|
|
|
"debugfs offset TSF by %018lld\n",
|
|
|
|
tsf_is_delta * tsf);
|
|
|
|
} else if (local->ops->set_tsf) {
|
|
|
|
if (tsf_is_delta)
|
|
|
|
tsf = drv_get_tsf(local, sdata) +
|
|
|
|
tsf_is_delta * tsf;
|
2011-09-21 19:06:11 +08:00
|
|
|
drv_set_tsf(local, sdata, tsf);
|
|
|
|
wiphy_info(local->hw.wiphy,
|
|
|
|
"debugfs set TSF to %#018llx\n", tsf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-20 02:25:15 +08:00
|
|
|
ieee80211_recalc_dtim(local, sdata);
|
2011-09-21 19:06:11 +08:00
|
|
|
return buflen;
|
|
|
|
}
|
2014-01-06 22:47:15 +08:00
|
|
|
IEEE80211_IF_FILE_RW(tsf);
|
2011-09-21 19:06:11 +08:00
|
|
|
|
2022-09-02 22:12:56 +08:00
|
|
|
static ssize_t ieee80211_if_fmt_valid_links(const struct ieee80211_sub_if_data *sdata,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
|
|
|
return snprintf(buf, buflen, "0x%x\n", sdata->vif.valid_links);
|
|
|
|
}
|
|
|
|
IEEE80211_IF_FILE_R(valid_links);
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_fmt_active_links(const struct ieee80211_sub_if_data *sdata,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
|
|
|
return snprintf(buf, buflen, "0x%x\n", sdata->vif.active_links);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ieee80211_if_parse_active_links(struct ieee80211_sub_if_data *sdata,
|
|
|
|
const char *buf, int buflen)
|
|
|
|
{
|
|
|
|
u16 active_links;
|
|
|
|
|
|
|
|
if (kstrtou16(buf, 0, &active_links))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
return ieee80211_set_active_links(&sdata->vif, active_links) ?: buflen;
|
|
|
|
}
|
|
|
|
IEEE80211_IF_FILE_RW(active_links);
|
2011-09-21 19:06:11 +08:00
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
2013-05-14 08:08:04 +08:00
|
|
|
IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC);
|
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
/* 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,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshstats.dropped_frames_no_route, DEC);
|
2008-02-23 22:17:16 +08:00
|
|
|
|
|
|
|
/* Mesh parameters */
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshMaxRetries,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshRetryTimeout,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
|
2010-12-03 16:20:40 +08:00
|
|
|
IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
|
2011-11-25 09:15:24 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPperrMinInterval,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPperrMinInterval, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(path_refresh_time,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.path_refresh_time, DEC);
|
2008-10-07 18:04:31 +08:00
|
|
|
IEEE80211_IF_FILE(min_discovery_timeout,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.min_discovery_timeout, DEC);
|
2009-11-10 07:46:57 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPRootMode,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC);
|
2011-08-10 07:45:11 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC);
|
2011-08-10 07:45:10 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPRannInterval,
|
2012-06-11 11:59:36 +08:00
|
|
|
u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC);
|
2012-01-21 01:02:16 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC);
|
2012-02-29 09:04:08 +08:00
|
|
|
IEEE80211_IF_FILE(rssi_threshold, u.mesh.mshcfg.rssi_threshold, DEC);
|
2012-05-08 12:00:32 +08:00
|
|
|
IEEE80211_IF_FILE(ht_opmode, u.mesh.mshcfg.ht_opmode, DEC);
|
2012-06-14 02:06:06 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPactivePathToRootTimeout,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPactivePathToRootTimeout, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMProotInterval,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMProotInterval, DEC);
|
2012-06-14 02:06:10 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshHWMPconfirmationInterval,
|
|
|
|
u.mesh.mshcfg.dot11MeshHWMPconfirmationInterval, DEC);
|
2013-01-31 01:14:08 +08:00
|
|
|
IEEE80211_IF_FILE(power_mode, u.mesh.mshcfg.power_mode, DEC);
|
|
|
|
IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration,
|
|
|
|
u.mesh.mshcfg.dot11MeshAwakeWindowDuration, DEC);
|
2018-10-26 05:36:34 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshConnectedToMeshGate,
|
|
|
|
u.mesh.mshcfg.dot11MeshConnectedToMeshGate, DEC);
|
2020-06-17 15:30:33 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshNolearn, u.mesh.mshcfg.dot11MeshNolearn, DEC);
|
2020-06-11 22:02:37 +08:00
|
|
|
IEEE80211_IF_FILE(dot11MeshConnectedToAuthServer,
|
|
|
|
u.mesh.mshcfg.dot11MeshConnectedToAuthServer, DEC);
|
2008-02-23 22:17:16 +08:00
|
|
|
#endif
|
|
|
|
|
2009-12-01 20:37:02 +08:00
|
|
|
#define DEBUGFS_ADD_MODE(name, mode) \
|
2013-03-08 21:46:14 +08:00
|
|
|
debugfs_create_file(#name, mode, sdata->vif.debugfs_dir, \
|
2020-11-28 03:38:42 +08:00
|
|
|
sdata, &name##_ops)
|
2009-12-01 20:37:02 +08:00
|
|
|
|
2012-03-19 05:58:05 +08:00
|
|
|
#define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400)
|
|
|
|
|
|
|
|
static void add_common_files(struct ieee80211_sub_if_data *sdata)
|
2007-05-06 02:46:38 +08:00
|
|
|
{
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mask_5ghz);
|
2012-01-29 00:25:33 +08:00
|
|
|
DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
|
2015-08-07 05:47:33 +08:00
|
|
|
DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_2ghz);
|
|
|
|
DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz);
|
2012-11-08 22:29:28 +08:00
|
|
|
DEBUGFS_ADD(hw_queues);
|
2016-09-12 21:55:43 +08:00
|
|
|
|
2022-10-10 00:30:40 +08:00
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
|
2022-06-26 05:24:05 +08:00
|
|
|
sdata->vif.type != NL80211_IFTYPE_NAN)
|
2016-09-12 21:55:43 +08:00
|
|
|
DEBUGFS_ADD(aqm);
|
2012-03-19 05:58:05 +08:00
|
|
|
}
|
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
|
|
|
|
2012-03-19 05:58:05 +08:00
|
|
|
static void add_sta_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(bssid);
|
|
|
|
DEBUGFS_ADD(aid);
|
2013-03-26 02:19:34 +08:00
|
|
|
DEBUGFS_ADD(beacon_timeout);
|
2009-12-01 20:37:02 +08:00
|
|
|
DEBUGFS_ADD_MODE(smps, 0600);
|
2011-02-04 00:35:19 +08:00
|
|
|
DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
|
2014-02-11 18:36:18 +08:00
|
|
|
DEBUGFS_ADD_MODE(beacon_loss, 0200);
|
2012-03-14 22:15:03 +08:00
|
|
|
DEBUGFS_ADD_MODE(uapsd_queues, 0600);
|
|
|
|
DEBUGFS_ADD_MODE(uapsd_max_sp_len, 0600);
|
2015-08-16 03:39:46 +08:00
|
|
|
DEBUGFS_ADD_MODE(tdls_wider_bw, 0600);
|
2022-09-02 22:12:56 +08:00
|
|
|
DEBUGFS_ADD_MODE(valid_links, 0200);
|
|
|
|
DEBUGFS_ADD_MODE(active_links, 0600);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_ap_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
2012-04-24 01:49:02 +08:00
|
|
|
DEBUGFS_ADD(num_mcast_sta);
|
2013-10-01 21:45:43 +08:00
|
|
|
DEBUGFS_ADD_MODE(smps, 0600);
|
2010-01-11 00:12:41 +08:00
|
|
|
DEBUGFS_ADD(num_sta_ps);
|
|
|
|
DEBUGFS_ADD(dtim_count);
|
|
|
|
DEBUGFS_ADD(num_buffered_multicast);
|
2011-02-04 00:35:19 +08:00
|
|
|
DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
|
2016-11-22 18:52:18 +08:00
|
|
|
DEBUGFS_ADD_MODE(multicast_to_unicast, 0600);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|
|
|
|
|
2016-10-11 01:12:21 +08:00
|
|
|
static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
/* add num_mcast_sta_vlan using name num_mcast_sta */
|
|
|
|
debugfs_create_file("num_mcast_sta", 0400, sdata->vif.debugfs_dir,
|
|
|
|
sdata, &num_mcast_sta_vlan_ops);
|
|
|
|
}
|
|
|
|
|
2011-09-21 19:06:11 +08:00
|
|
|
static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_ADD_MODE(tsf, 0600);
|
|
|
|
}
|
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
#ifdef CONFIG_MAC80211_MESH
|
|
|
|
|
2012-03-06 09:20:38 +08:00
|
|
|
static void add_mesh_files(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
DEBUGFS_ADD_MODE(tsf, 0600);
|
2013-05-14 08:08:04 +08:00
|
|
|
DEBUGFS_ADD_MODE(estab_plinks, 0400);
|
2012-03-06 09:20:38 +08:00
|
|
|
}
|
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
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",
|
2013-03-08 21:46:14 +08:00
|
|
|
sdata->vif.debugfs_dir);
|
2009-10-27 19:59:03 +08:00
|
|
|
#define MESHSTATS_ADD(name)\
|
2020-11-28 03:38:42 +08:00
|
|
|
debugfs_create_file(#name, 0400, dir, sdata, &name##_ops)
|
2009-10-27 19:59:03 +08:00
|
|
|
|
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);
|
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",
|
2013-03-08 21:46:14 +08:00
|
|
|
sdata->vif.debugfs_dir);
|
2009-10-27 19:59:03 +08:00
|
|
|
|
|
|
|
#define MESHPARAMS_ADD(name) \
|
2020-11-28 03:38:42 +08:00
|
|
|
debugfs_create_file(#name, 0600, dir, sdata, &name##_ops)
|
2009-10-27 19:59:03 +08:00
|
|
|
|
2008-02-23 22:17:16 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshMaxRetries);
|
|
|
|
MESHPARAMS_ADD(dot11MeshRetryTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshConfirmTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHoldingTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshTTL);
|
2010-12-03 16:20:40 +08:00
|
|
|
MESHPARAMS_ADD(element_ttl);
|
2008-02-23 22:17:16 +08:00
|
|
|
MESHPARAMS_ADD(auto_open_plinks);
|
|
|
|
MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval);
|
2011-11-25 09:15:24 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPperrMinInterval);
|
2008-02-23 22:17:16 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries);
|
|
|
|
MESHPARAMS_ADD(path_refresh_time);
|
|
|
|
MESHPARAMS_ADD(min_discovery_timeout);
|
2011-08-10 07:45:09 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPRootMode);
|
2011-08-10 07:45:10 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPRannInterval);
|
2012-05-31 18:17:30 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshForwarding);
|
2011-08-10 07:45:11 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshGateAnnouncementProtocol);
|
2012-02-29 09:04:08 +08:00
|
|
|
MESHPARAMS_ADD(rssi_threshold);
|
2012-05-08 12:00:32 +08:00
|
|
|
MESHPARAMS_ADD(ht_opmode);
|
2012-06-14 02:06:06 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPactivePathToRootTimeout);
|
|
|
|
MESHPARAMS_ADD(dot11MeshHWMProotInterval);
|
2012-06-14 02:06:10 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshHWMPconfirmationInterval);
|
2013-01-31 01:14:08 +08:00
|
|
|
MESHPARAMS_ADD(power_mode);
|
|
|
|
MESHPARAMS_ADD(dot11MeshAwakeWindowDuration);
|
2018-10-26 05:36:34 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshConnectedToMeshGate);
|
2020-06-17 15:30:33 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshNolearn);
|
2020-06-11 22:02:37 +08:00
|
|
|
MESHPARAMS_ADD(dot11MeshConnectedToAuthServer);
|
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)
|
|
|
|
{
|
2013-03-08 21:46:14 +08:00
|
|
|
if (!sdata->vif.debugfs_dir)
|
2007-05-06 02:46:38 +08:00
|
|
|
return;
|
|
|
|
|
2012-03-19 05:58:05 +08:00
|
|
|
DEBUGFS_ADD(flags);
|
|
|
|
DEBUGFS_ADD(state);
|
2012-10-24 16:59:25 +08:00
|
|
|
DEBUGFS_ADD(txpower);
|
|
|
|
DEBUGFS_ADD(user_power_level);
|
|
|
|
DEBUGFS_ADD(ap_power_level);
|
2012-03-19 05:58:05 +08:00
|
|
|
|
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
|
|
|
|
add_common_files(sdata);
|
|
|
|
|
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
|
2012-03-06 09:20:38 +08:00
|
|
|
add_mesh_files(sdata);
|
2008-02-23 22:17:16 +08:00
|
|
|
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:
|
2011-09-21 19:06:11 +08:00
|
|
|
add_ibss_files(sdata);
|
2009-02-15 19:44:28 +08:00
|
|
|
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;
|
2016-10-11 01:12:21 +08:00
|
|
|
case NL80211_IFTYPE_AP_VLAN:
|
|
|
|
add_vlan_files(sdata);
|
|
|
|
break;
|
2007-05-06 02:46:38 +08:00
|
|
|
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);
|
2013-03-08 21:46:14 +08:00
|
|
|
sdata->vif.debugfs_dir = debugfs_create_dir(buf,
|
2007-05-06 02:46:38 +08:00
|
|
|
sdata->local->hw.wiphy->debugfsdir);
|
2019-06-14 14:59:34 +08:00
|
|
|
sdata->debugfs.subdir_stations = debugfs_create_dir("stations",
|
|
|
|
sdata->vif.debugfs_dir);
|
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)
|
|
|
|
{
|
2013-03-08 21:46:14 +08:00
|
|
|
if (!sdata->vif.debugfs_dir)
|
2009-10-27 19:59:03 +08:00
|
|
|
return;
|
|
|
|
|
2013-03-08 21:46:14 +08:00
|
|
|
debugfs_remove_recursive(sdata->vif.debugfs_dir);
|
|
|
|
sdata->vif.debugfs_dir = NULL;
|
2015-06-30 02:41:49 +08:00
|
|
|
sdata->debugfs.subdir_stations = 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
|
|
|
|
2013-03-08 21:46:14 +08:00
|
|
|
dir = sdata->vif.debugfs_dir;
|
2008-10-08 16:18:36 +08:00
|
|
|
|
2019-04-15 17:39:33 +08:00
|
|
|
if (IS_ERR_OR_NULL(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);
|
2019-06-14 14:59:34 +08:00
|
|
|
debugfs_rename(dir->d_parent, dir, dir->d_parent, buf);
|
2007-05-06 02:46:38 +08:00
|
|
|
}
|