Changes in 4.9.328 fbdev: fb_pm2fb: Avoid potential divide by zero error platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() serial: fsl_lpuart: RS485 RTS polariy is inverse staging: rtl8712: fix use after free bugs vt: Clear selection before changing the font USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id hwmon: (gpio-fan) Fix array out of bounds access xhci: Add grace period after xHC start to prevent premature runtime suspend. USB: serial: cp210x: add Decagon UCA device id USB: serial: option: add support for OPPO R11 diag port USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) usb-storage: Add ignore-residue quirk for NXP PN7462AU s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages s390: fix nospec table alignments USB: core: Prevent nested device-reset calls usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS wifi: mac80211: Don't finalize CSA in IBSS mode if state is disconnected net: mac802154: Fix a condition in the receive path ALSA: seq: oss: Fix data-race for max_midi_devs access ALSA: seq: Fix data-race at module auto-loading fs: only do a memory barrier for the first set_buffer_uptodate() Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" drm/radeon: add a force flush to delay work when radeon parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources() parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init() ALSA: emu10k1: Fix out of bounds access in snd_emu10k1_pcm_channel_alloc() ALSA: aloop: Fix random zeros in capture data when using jiffies timer ALSA: usb-audio: Fix an out-of-bounds bug in __snd_usb_parse_audio_interface() scsi: mpt3sas: Fix use-after-free warning driver core: Don't probe devices after bus_type.match() probe deferral netfilter: br_netfilter: Drop dst references before setting. netfilter: nf_conntrack_irc: Fix forged IP logic sch_sfb: Don't assume the skb is still around after enqueueing to child tipc: fix shift wrapping bug in map_get() tcp: fix early ETIMEDOUT after spurious non-SACK RTO sch_sfb: Also store skb len before calling child enqueue usb: dwc3: fix PHY disable sequence MIPS: loongson32: ls1c: Fix hang during startup SUNRPC: use _bh spinlocking on ->transport_lock Linux 4.9.328 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Iee010f5cbfe25dd4503d7f395508fb20a2fc2934
119 lines
3.0 KiB
C
119 lines
3.0 KiB
C
/*
|
|
* cfg80211 debugfs
|
|
*
|
|
* Copyright 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/slab.h>
|
|
#include "core.h"
|
|
#include "debugfs.h"
|
|
|
|
#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \
|
|
static ssize_t name## _read(struct file *file, char __user *userbuf, \
|
|
size_t count, loff_t *ppos) \
|
|
{ \
|
|
struct wiphy *wiphy= file->private_data; \
|
|
char buf[buflen]; \
|
|
int res; \
|
|
\
|
|
res = scnprintf(buf, buflen, fmt "\n", ##value); \
|
|
return simple_read_from_buffer(userbuf, count, ppos, buf, res); \
|
|
} \
|
|
\
|
|
static const struct file_operations name## _ops = { \
|
|
.read = name## _read, \
|
|
.open = simple_open, \
|
|
.llseek = generic_file_llseek, \
|
|
};
|
|
|
|
DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
|
|
wiphy->rts_threshold)
|
|
DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
|
|
wiphy->frag_threshold);
|
|
DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
|
|
wiphy->retry_short)
|
|
DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
|
|
wiphy->retry_long);
|
|
|
|
static int ht_print_chan(struct ieee80211_channel *chan,
|
|
char *buf, int buf_size, int offset)
|
|
{
|
|
if (WARN_ON(offset > buf_size))
|
|
return 0;
|
|
|
|
if (chan->flags & IEEE80211_CHAN_DISABLED)
|
|
return scnprintf(buf + offset,
|
|
buf_size - offset,
|
|
"%d Disabled\n",
|
|
chan->center_freq);
|
|
|
|
return scnprintf(buf + offset,
|
|
buf_size - offset,
|
|
"%d HT40 %c%c\n",
|
|
chan->center_freq,
|
|
(chan->flags & IEEE80211_CHAN_NO_HT40MINUS) ?
|
|
' ' : '-',
|
|
(chan->flags & IEEE80211_CHAN_NO_HT40PLUS) ?
|
|
' ' : '+');
|
|
}
|
|
|
|
static ssize_t ht40allow_map_read(struct file *file,
|
|
char __user *user_buf,
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct wiphy *wiphy = file->private_data;
|
|
char *buf;
|
|
unsigned int offset = 0, buf_size = PAGE_SIZE, i;
|
|
enum nl80211_band band;
|
|
struct ieee80211_supported_band *sband;
|
|
ssize_t r;
|
|
|
|
buf = kzalloc(buf_size, GFP_KERNEL);
|
|
if (!buf)
|
|
return -ENOMEM;
|
|
|
|
rtnl_lock();
|
|
|
|
for (band = 0; band < NUM_NL80211_BANDS; band++) {
|
|
sband = wiphy->bands[band];
|
|
if (!sband)
|
|
continue;
|
|
for (i = 0; i < sband->n_channels; i++)
|
|
offset += ht_print_chan(&sband->channels[i],
|
|
buf, buf_size, offset);
|
|
}
|
|
|
|
rtnl_unlock();
|
|
|
|
r = simple_read_from_buffer(user_buf, count, ppos, buf, offset);
|
|
|
|
kfree(buf);
|
|
|
|
return r;
|
|
}
|
|
|
|
static const struct file_operations ht40allow_map_ops = {
|
|
.read = ht40allow_map_read,
|
|
.open = simple_open,
|
|
.llseek = default_llseek,
|
|
};
|
|
|
|
#define DEBUGFS_ADD(name) \
|
|
debugfs_create_file(#name, S_IRUGO, phyd, &rdev->wiphy, &name## _ops);
|
|
|
|
void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)
|
|
{
|
|
struct dentry *phyd = rdev->wiphy.debugfsdir;
|
|
|
|
DEBUGFS_ADD(rts_threshold);
|
|
DEBUGFS_ADD(fragmentation_threshold);
|
|
DEBUGFS_ADD(short_retry_limit);
|
|
DEBUGFS_ADD(long_retry_limit);
|
|
DEBUGFS_ADD(ht40allow_map);
|
|
}
|