Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183624
b: refs/heads/master
c: 50ae0cf
h: refs/heads/master
v: v3
  • Loading branch information
Kalle Valo authored and John W. Linville committed Jan 12, 2010
1 parent e9da171 commit acaf162
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab13315af97919fae0e014748105fdc2e30afb2d
refs/heads/master: 50ae0cf15c3da2f6a8e4558de5010923e84736b2
94 changes: 94 additions & 0 deletions trunk/net/mac80211/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,98 @@ static const struct file_operations noack_ops = {
.open = mac80211_open_file_generic
};

static ssize_t uapsd_queues_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ieee80211_local *local = file->private_data;
int res;
char buf[10];

res = scnprintf(buf, sizeof(buf), "0x%x\n", local->uapsd_queues);

return simple_read_from_buffer(user_buf, count, ppos, buf, res);
}

static ssize_t uapsd_queues_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ieee80211_local *local = file->private_data;
unsigned long val;
char buf[10];
size_t len;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = strict_strtoul(buf, 0, &val);

if (ret)
return -EINVAL;

if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
return -ERANGE;

local->uapsd_queues = val;

return count;
}

static const struct file_operations uapsd_queues_ops = {
.read = uapsd_queues_read,
.write = uapsd_queues_write,
.open = mac80211_open_file_generic
};

static ssize_t uapsd_max_sp_len_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ieee80211_local *local = file->private_data;
int res;
char buf[10];

res = scnprintf(buf, sizeof(buf), "0x%x\n", local->uapsd_max_sp_len);

return simple_read_from_buffer(user_buf, count, ppos, buf, res);
}

static ssize_t uapsd_max_sp_len_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ieee80211_local *local = file->private_data;
unsigned long val;
char buf[10];
size_t len;
int ret;

len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';

ret = strict_strtoul(buf, 0, &val);

if (ret)
return -EINVAL;

if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK)
return -ERANGE;

local->uapsd_max_sp_len = val;

return count;
}

static const struct file_operations uapsd_max_sp_len_ops = {
.read = uapsd_max_sp_len_read,
.write = uapsd_max_sp_len_write,
.open = mac80211_open_file_generic
};

static ssize_t queues_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
Expand Down Expand Up @@ -314,6 +406,8 @@ void debugfs_hw_add(struct ieee80211_local *local)
DEBUGFS_ADD(queues);
DEBUGFS_ADD_MODE(reset, 0200);
DEBUGFS_ADD(noack);
DEBUGFS_ADD(uapsd_queues);
DEBUGFS_ADD(uapsd_max_sp_len);

statsd = debugfs_create_dir("statistics", phyd);

Expand Down
14 changes: 14 additions & 0 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,20 @@ struct ieee80211_local {
int wifi_wme_noack_test;
unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */

/*
* Bitmask of enabled u-apsd queues,
* IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
* to take effect.
*/
unsigned int uapsd_queues;

/*
* Maximum number of buffered frames AP can deliver during a
* service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
* Needs a new association to take effect.
*/
unsigned int uapsd_max_sp_len;

bool pspolling;
bool offchannel_ps_enabled;
/*
Expand Down
2 changes: 2 additions & 0 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
local->user_power_level = -1;
local->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
local->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;

INIT_LIST_HEAD(&local->interfaces);
mutex_init(&local->iflist_mtx);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
return;

if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED)
uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
uapsd_queues = local->uapsd_queues;

count = wmm_param[6] & 0x0f;
if (count == ifmgd->wmm_last_param_set)
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/mac80211/work.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,

if (wk->assoc.wmm_used && local->hw.queues >= 4) {
if (wk->assoc.uapsd_used) {
qos_info = IEEE80211_DEFAULT_UAPSD_QUEUES;
qos_info |= (IEEE80211_DEFAULT_MAX_SP_LEN <<
qos_info = local->uapsd_queues;
qos_info |= (local->uapsd_max_sp_len <<
IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT);
} else {
qos_info = 0;
Expand Down

0 comments on commit acaf162

Please sign in to comment.