^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2020 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/if.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/if_ether.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/rtnetlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <net/mac80211.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <net/cfg80211.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "ieee80211_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "rate.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include "debugfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "debugfs_netdev.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "driver-ops.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static ssize_t ieee80211_if_read(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) char __user *userbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) size_t count, loff_t *ppos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ssize_t (*format)(const struct ieee80211_sub_if_data *, char *, int))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) char buf[200];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ssize_t ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) read_lock(&dev_base_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) ret = (*format)(sdata, buf, sizeof(buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) read_unlock(&dev_base_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) if (ret >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static ssize_t ieee80211_if_write(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) const char __user *userbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) size_t count, loff_t *ppos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) char buf[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ssize_t ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) if (count >= sizeof(buf))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return -E2BIG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if (copy_from_user(buf, userbuf, count))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) buf[count] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ret = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) rtnl_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ret = (*write)(sdata, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) rtnl_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define IEEE80211_IF_FMT(name, field, format_string) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static ssize_t ieee80211_if_fmt_##name( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) const struct ieee80211_sub_if_data *sdata, char *buf, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int buflen) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) return scnprintf(buf, buflen, format_string, sdata->field); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define IEEE80211_IF_FMT_DEC(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) IEEE80211_IF_FMT(name, field, "%d\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define IEEE80211_IF_FMT_HEX(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) IEEE80211_IF_FMT(name, field, "%#x\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define IEEE80211_IF_FMT_LHEX(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) IEEE80211_IF_FMT(name, field, "%#lx\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define IEEE80211_IF_FMT_SIZE(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) IEEE80211_IF_FMT(name, field, "%zd\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define IEEE80211_IF_FMT_HEXARRAY(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) static ssize_t ieee80211_if_fmt_##name( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) const struct ieee80211_sub_if_data *sdata, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) char *buf, int buflen) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) char *p = buf; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) int i; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) for (i = 0; i < sizeof(sdata->field); i++) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) p += scnprintf(p, buflen + buf - p, "%.2x ", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) sdata->field[i]); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) p += scnprintf(p, buflen + buf - p, "\n"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) return p - buf; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define IEEE80211_IF_FMT_ATOMIC(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) static ssize_t ieee80211_if_fmt_##name( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) const struct ieee80211_sub_if_data *sdata, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) char *buf, int buflen) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) return scnprintf(buf, buflen, "%d\n", atomic_read(&sdata->field));\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define IEEE80211_IF_FMT_MAC(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static ssize_t ieee80211_if_fmt_##name( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) const struct ieee80211_sub_if_data *sdata, char *buf, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) int buflen) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) return scnprintf(buf, buflen, "%pM\n", sdata->field); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define IEEE80211_IF_FMT_JIFFIES_TO_MS(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) static ssize_t ieee80211_if_fmt_##name( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) const struct ieee80211_sub_if_data *sdata, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) char *buf, int buflen) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return scnprintf(buf, buflen, "%d\n", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) jiffies_to_msecs(sdata->field)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define _IEEE80211_IF_FILE_OPS(name, _read, _write) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static const struct file_operations name##_ops = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) .read = (_read), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) .write = (_write), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) .open = simple_open, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) .llseek = generic_file_llseek, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define _IEEE80211_IF_FILE_R_FN(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) static ssize_t ieee80211_if_read_##name(struct file *file, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) char __user *userbuf, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) size_t count, loff_t *ppos) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) return ieee80211_if_read(file->private_data, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) userbuf, count, ppos, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ieee80211_if_fmt_##name); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define _IEEE80211_IF_FILE_W_FN(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static ssize_t ieee80211_if_write_##name(struct file *file, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) const char __user *userbuf, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) size_t count, loff_t *ppos) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return ieee80211_if_write(file->private_data, userbuf, count, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) ppos, ieee80211_if_parse_##name); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define IEEE80211_IF_FILE_R(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) _IEEE80211_IF_FILE_R_FN(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) _IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define IEEE80211_IF_FILE_W(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) _IEEE80211_IF_FILE_W_FN(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) _IEEE80211_IF_FILE_OPS(name, NULL, ieee80211_if_write_##name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #define IEEE80211_IF_FILE_RW(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) _IEEE80211_IF_FILE_R_FN(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) _IEEE80211_IF_FILE_W_FN(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) _IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) ieee80211_if_write_##name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #define IEEE80211_IF_FILE(name, field, format) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) IEEE80211_IF_FMT_##format(name, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) IEEE80211_IF_FILE_R(name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /* common attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[NL80211_BAND_2GHZ],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) HEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[NL80211_BAND_5GHZ],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) HEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) IEEE80211_IF_FILE(rc_rateidx_mcs_mask_2ghz,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) rc_rateidx_mcs_mask[NL80211_BAND_2GHZ], HEXARRAY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) IEEE80211_IF_FILE(rc_rateidx_mcs_mask_5ghz,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) rc_rateidx_mcs_mask[NL80211_BAND_5GHZ], HEXARRAY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) static ssize_t ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_2ghz(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) const struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) int i, len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_2GHZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) len += scnprintf(buf + len, buflen - len, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) IEEE80211_IF_FILE_R(rc_rateidx_vht_mcs_mask_2ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) static ssize_t ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_5ghz(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) const struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) int i, len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_5GHZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) len += scnprintf(buf + len, buflen - len, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) IEEE80211_IF_FILE_R(rc_rateidx_vht_mcs_mask_5ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) IEEE80211_IF_FILE(flags, flags, HEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) IEEE80211_IF_FILE(state, state, LHEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) IEEE80211_IF_FILE(txpower, vif.bss_conf.txpower, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) IEEE80211_IF_FILE(ap_power_level, ap_power_level, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) IEEE80211_IF_FILE(user_power_level, user_power_level, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) len = scnprintf(buf, buflen, "AC queues: VO:%d VI:%d BE:%d BK:%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) sdata->vif.hw_queue[IEEE80211_AC_VO],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) sdata->vif.hw_queue[IEEE80211_AC_VI],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) sdata->vif.hw_queue[IEEE80211_AC_BE],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) sdata->vif.hw_queue[IEEE80211_AC_BK]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) if (sdata->vif.type == NL80211_IFTYPE_AP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) len += scnprintf(buf + len, buflen - len, "cab queue: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) sdata->vif.cab_queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) IEEE80211_IF_FILE_R(hw_queues);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /* STA attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) IEEE80211_IF_FILE(aid, vif.bss_conf.aid, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) enum ieee80211_smps_mode smps_mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) if (!(local->hw.wiphy->features & NL80211_FEATURE_STATIC_SMPS) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) smps_mode == IEEE80211_SMPS_STATIC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /* auto should be dynamic if in PS mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) if (!(local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) (smps_mode == IEEE80211_SMPS_DYNAMIC ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) smps_mode == IEEE80211_SMPS_AUTOMATIC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) if (sdata->vif.type != NL80211_IFTYPE_STATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) sdata_lock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) err = __ieee80211_request_smps_mgd(sdata, smps_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) sdata_unlock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) [IEEE80211_SMPS_AUTOMATIC] = "auto",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) [IEEE80211_SMPS_OFF] = "off",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) [IEEE80211_SMPS_STATIC] = "static",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) [IEEE80211_SMPS_DYNAMIC] = "dynamic",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) if (sdata->vif.type == NL80211_IFTYPE_STATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) return snprintf(buf, buflen, "request: %s\nused: %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) smps_modes[sdata->u.mgd.req_smps],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) smps_modes[sdata->smps_mode]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) enum ieee80211_smps_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) for (mode = 0; mode < IEEE80211_SMPS_NUM_MODES; mode++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) if (strncmp(buf, smps_modes[mode], buflen) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) int err = ieee80211_set_smps(sdata, mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) if (!err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) IEEE80211_IF_FILE_RW(smps);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) static ssize_t ieee80211_if_parse_tkip_mic_test(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) u8 addr[ETH_ALEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) struct ieee80211_hdr *hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) __le16 fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) if (!mac_pton(buf, addr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) if (!ieee80211_sdata_running(sdata))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) return -ENOTCONN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24 + 100);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) if (!skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) skb_reserve(skb, local->hw.extra_tx_headroom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) hdr = skb_put_zero(skb, 24);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) switch (sdata->vif.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) case NL80211_IFTYPE_AP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) /* DA BSSID SA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) memcpy(hdr->addr1, addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) memcpy(hdr->addr3, sdata->vif.addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) case NL80211_IFTYPE_STATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) /* BSSID SA DA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) sdata_lock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) if (!sdata->u.mgd.associated) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) sdata_unlock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) dev_kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) return -ENOTCONN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) memcpy(hdr->addr1, sdata->u.mgd.associated->bssid, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) memcpy(hdr->addr3, addr, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) sdata_unlock(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) dev_kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) hdr->frame_control = fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * Add some length to the test frame to make it look bit more valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) * The exact contents does not matter since the recipient is required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) * to drop this because of the Michael MIC failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) skb_put_zero(skb, 50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_TKIP_MIC_FAILURE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) ieee80211_tx_skb(sdata, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) IEEE80211_IF_FILE_W(tkip_mic_test);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) static ssize_t ieee80211_if_parse_beacon_loss(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) if (!ieee80211_sdata_running(sdata) || !sdata->vif.bss_conf.assoc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) return -ENOTCONN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) ieee80211_beacon_loss(&sdata->vif);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) IEEE80211_IF_FILE_W(beacon_loss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) static ssize_t ieee80211_if_fmt_uapsd_queues(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_queues);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) static ssize_t ieee80211_if_parse_uapsd_queues(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) u8 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) ret = kstrtou8(buf, 0, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) return -ERANGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) ifmgd->uapsd_queues = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) IEEE80211_IF_FILE_RW(uapsd_queues);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) static ssize_t ieee80211_if_fmt_uapsd_max_sp_len(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_max_sp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) static ssize_t ieee80211_if_parse_uapsd_max_sp_len(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) unsigned long val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) ret = kstrtoul(buf, 0, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) return -ERANGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) ifmgd->uapsd_max_sp_len = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) IEEE80211_IF_FILE_RW(uapsd_max_sp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) static ssize_t ieee80211_if_fmt_tdls_wider_bw(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) bool tdls_wider_bw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) tdls_wider_bw = ieee80211_hw_check(&sdata->local->hw, TDLS_WIDER_BW) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) !ifmgd->tdls_wider_bw_prohibited;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) return snprintf(buf, buflen, "%d\n", tdls_wider_bw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) static ssize_t ieee80211_if_parse_tdls_wider_bw(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) u8 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) ret = kstrtou8(buf, 0, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) ifmgd->tdls_wider_bw_prohibited = !val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) IEEE80211_IF_FILE_RW(tdls_wider_bw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) /* AP attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) IEEE80211_IF_FILE(num_sta_ps, u.ap.ps.num_sta_ps, ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) IEEE80211_IF_FILE(dtim_count, u.ap.ps.dtim_count, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) IEEE80211_IF_FILE(num_mcast_sta_vlan, u.vlan.num_mcast_sta, ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) static ssize_t ieee80211_if_fmt_num_buffered_multicast(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) return scnprintf(buf, buflen, "%u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) skb_queue_len(&sdata->u.ap.ps.bc_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) IEEE80211_IF_FILE_R(num_buffered_multicast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) static ssize_t ieee80211_if_fmt_aqm(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) struct txq_info *txqi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) int len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) if (!sdata->vif.txq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) txqi = to_txq_info(sdata->vif.txq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) spin_lock_bh(&local->fq.lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) rcu_read_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) len = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) buflen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) "ac backlog-bytes backlog-packets new-flows drops marks overlimit collisions tx-bytes tx-packets\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) "%u %u %u %u %u %u %u %u %u %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) txqi->txq.ac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) txqi->tin.backlog_bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) txqi->tin.backlog_packets,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) txqi->tin.flows,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) txqi->cstats.drop_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) txqi->cstats.ecn_mark,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) txqi->tin.overlimit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) txqi->tin.collisions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) txqi->tin.tx_bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) txqi->tin.tx_packets);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) spin_unlock_bh(&local->fq.lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) IEEE80211_IF_FILE_R(aqm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) IEEE80211_IF_FILE(multicast_to_unicast, u.ap.multicast_to_unicast, HEX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) /* IBSS attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) static ssize_t ieee80211_if_fmt_tsf(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) u64 tsf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) tsf = drv_get_tsf(local, (struct ieee80211_sub_if_data *)sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) return scnprintf(buf, buflen, "0x%016llx\n", (unsigned long long) tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) static ssize_t ieee80211_if_parse_tsf(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) struct ieee80211_local *local = sdata->local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) unsigned long long tsf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) int tsf_is_delta = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) if (strncmp(buf, "reset", 5) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) if (local->ops->reset_tsf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) drv_reset_tsf(local, sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) if (buflen > 10 && buf[1] == '=') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) if (buf[0] == '+')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) tsf_is_delta = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) else if (buf[0] == '-')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) tsf_is_delta = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) buf += 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) ret = kstrtoull(buf, 10, &tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) if (tsf_is_delta && local->ops->offset_tsf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) drv_offset_tsf(local, sdata, tsf_is_delta * tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) wiphy_info(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) "debugfs offset TSF by %018lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) tsf_is_delta * tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) } else if (local->ops->set_tsf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) if (tsf_is_delta)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) tsf = drv_get_tsf(local, sdata) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) tsf_is_delta * tsf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) drv_set_tsf(local, sdata, tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) wiphy_info(local->hw.wiphy,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) "debugfs set TSF to %#018llx\n", tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) ieee80211_recalc_dtim(local, sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) return buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) IEEE80211_IF_FILE_RW(tsf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) /* WDS attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) #ifdef CONFIG_MAC80211_MESH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) /* Mesh stats attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) IEEE80211_IF_FILE(dropped_frames_congestion,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) u.mesh.mshstats.dropped_frames_congestion, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) IEEE80211_IF_FILE(dropped_frames_no_route,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) u.mesh.mshstats.dropped_frames_no_route, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) /* Mesh parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) IEEE80211_IF_FILE(dot11MeshMaxRetries,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) IEEE80211_IF_FILE(dot11MeshRetryTimeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) IEEE80211_IF_FILE(dot11MeshHWMPperrMinInterval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) u.mesh.mshcfg.dot11MeshHWMPperrMinInterval, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) IEEE80211_IF_FILE(path_refresh_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) u.mesh.mshcfg.path_refresh_time, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) IEEE80211_IF_FILE(min_discovery_timeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) u.mesh.mshcfg.min_discovery_timeout, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) IEEE80211_IF_FILE(dot11MeshHWMPRootMode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) IEEE80211_IF_FILE(dot11MeshHWMPRannInterval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) IEEE80211_IF_FILE(rssi_threshold, u.mesh.mshcfg.rssi_threshold, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) IEEE80211_IF_FILE(ht_opmode, u.mesh.mshcfg.ht_opmode, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) IEEE80211_IF_FILE(dot11MeshHWMPactivePathToRootTimeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) u.mesh.mshcfg.dot11MeshHWMPactivePathToRootTimeout, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) IEEE80211_IF_FILE(dot11MeshHWMProotInterval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) u.mesh.mshcfg.dot11MeshHWMProotInterval, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) IEEE80211_IF_FILE(dot11MeshHWMPconfirmationInterval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) u.mesh.mshcfg.dot11MeshHWMPconfirmationInterval, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) IEEE80211_IF_FILE(power_mode, u.mesh.mshcfg.power_mode, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) u.mesh.mshcfg.dot11MeshAwakeWindowDuration, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) IEEE80211_IF_FILE(dot11MeshConnectedToMeshGate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) u.mesh.mshcfg.dot11MeshConnectedToMeshGate, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) IEEE80211_IF_FILE(dot11MeshNolearn, u.mesh.mshcfg.dot11MeshNolearn, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) IEEE80211_IF_FILE(dot11MeshConnectedToAuthServer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) u.mesh.mshcfg.dot11MeshConnectedToAuthServer, DEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) #define DEBUGFS_ADD_MODE(name, mode) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) debugfs_create_file(#name, mode, sdata->vif.debugfs_dir, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) sdata, &name##_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) #define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) static void add_common_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) DEBUGFS_ADD(rc_rateidx_mask_2ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) DEBUGFS_ADD(rc_rateidx_mask_5ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_2ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) DEBUGFS_ADD(hw_queues);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) if (sdata->local->ops->wake_tx_queue &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) sdata->vif.type != NL80211_IFTYPE_NAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) DEBUGFS_ADD(aqm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) static void add_sta_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) DEBUGFS_ADD(bssid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) DEBUGFS_ADD(aid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) DEBUGFS_ADD(beacon_timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) DEBUGFS_ADD_MODE(smps, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) DEBUGFS_ADD_MODE(beacon_loss, 0200);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) DEBUGFS_ADD_MODE(uapsd_queues, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) DEBUGFS_ADD_MODE(uapsd_max_sp_len, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) DEBUGFS_ADD_MODE(tdls_wider_bw, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) static void add_ap_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) DEBUGFS_ADD(num_mcast_sta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) DEBUGFS_ADD_MODE(smps, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) DEBUGFS_ADD(num_sta_ps);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) DEBUGFS_ADD(dtim_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) DEBUGFS_ADD(num_buffered_multicast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) DEBUGFS_ADD_MODE(multicast_to_unicast, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) /* add num_mcast_sta_vlan using name num_mcast_sta */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) debugfs_create_file("num_mcast_sta", 0400, sdata->vif.debugfs_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) sdata, &num_mcast_sta_vlan_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) DEBUGFS_ADD_MODE(tsf, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) static void add_wds_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) DEBUGFS_ADD(peer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) #ifdef CONFIG_MAC80211_MESH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) static void add_mesh_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) DEBUGFS_ADD_MODE(tsf, 0600);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) DEBUGFS_ADD_MODE(estab_plinks, 0400);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) struct dentry *dir = debugfs_create_dir("mesh_stats",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) sdata->vif.debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) #define MESHSTATS_ADD(name)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) debugfs_create_file(#name, 0400, dir, sdata, &name##_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) MESHSTATS_ADD(fwded_mcast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) MESHSTATS_ADD(fwded_unicast);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) MESHSTATS_ADD(fwded_frames);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) MESHSTATS_ADD(dropped_frames_ttl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) MESHSTATS_ADD(dropped_frames_no_route);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) MESHSTATS_ADD(dropped_frames_congestion);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) #undef MESHSTATS_ADD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) struct dentry *dir = debugfs_create_dir("mesh_config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) sdata->vif.debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) #define MESHPARAMS_ADD(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) debugfs_create_file(#name, 0600, dir, sdata, &name##_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) MESHPARAMS_ADD(dot11MeshMaxRetries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) MESHPARAMS_ADD(dot11MeshRetryTimeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) MESHPARAMS_ADD(dot11MeshConfirmTimeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) MESHPARAMS_ADD(dot11MeshHoldingTimeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) MESHPARAMS_ADD(dot11MeshTTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) MESHPARAMS_ADD(element_ttl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) MESHPARAMS_ADD(auto_open_plinks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) MESHPARAMS_ADD(dot11MeshHWMPperrMinInterval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) MESHPARAMS_ADD(path_refresh_time);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) MESHPARAMS_ADD(min_discovery_timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) MESHPARAMS_ADD(dot11MeshHWMPRootMode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) MESHPARAMS_ADD(dot11MeshHWMPRannInterval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) MESHPARAMS_ADD(dot11MeshForwarding);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) MESHPARAMS_ADD(dot11MeshGateAnnouncementProtocol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) MESHPARAMS_ADD(rssi_threshold);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) MESHPARAMS_ADD(ht_opmode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) MESHPARAMS_ADD(dot11MeshHWMPactivePathToRootTimeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) MESHPARAMS_ADD(dot11MeshHWMProotInterval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) MESHPARAMS_ADD(dot11MeshHWMPconfirmationInterval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) MESHPARAMS_ADD(power_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) MESHPARAMS_ADD(dot11MeshAwakeWindowDuration);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) MESHPARAMS_ADD(dot11MeshConnectedToMeshGate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) MESHPARAMS_ADD(dot11MeshNolearn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) MESHPARAMS_ADD(dot11MeshConnectedToAuthServer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) #undef MESHPARAMS_ADD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) static void add_files(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) if (!sdata->vif.debugfs_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) DEBUGFS_ADD(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) DEBUGFS_ADD(state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) DEBUGFS_ADD(txpower);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) DEBUGFS_ADD(user_power_level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) DEBUGFS_ADD(ap_power_level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) add_common_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) switch (sdata->vif.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) case NL80211_IFTYPE_MESH_POINT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) #ifdef CONFIG_MAC80211_MESH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) add_mesh_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) add_mesh_stats(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) add_mesh_config(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) case NL80211_IFTYPE_STATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) add_sta_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) case NL80211_IFTYPE_ADHOC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) add_ibss_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) case NL80211_IFTYPE_AP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) add_ap_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) case NL80211_IFTYPE_AP_VLAN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) add_vlan_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) case NL80211_IFTYPE_WDS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) add_wds_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) char buf[10+IFNAMSIZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) sprintf(buf, "netdev:%s", sdata->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) sdata->vif.debugfs_dir = debugfs_create_dir(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) sdata->local->hw.wiphy->debugfsdir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) sdata->debugfs.subdir_stations = debugfs_create_dir("stations",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) sdata->vif.debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) add_files(sdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) if (!sdata->vif.debugfs_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) debugfs_remove_recursive(sdata->vif.debugfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) sdata->vif.debugfs_dir = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) sdata->debugfs.subdir_stations = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) struct dentry *dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) char buf[10 + IFNAMSIZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) dir = sdata->vif.debugfs_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) if (IS_ERR_OR_NULL(dir))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) sprintf(buf, "netdev:%s", sdata->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) debugfs_rename(dir->d_parent, dir, dir->d_parent, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) }