Commit 1e0bbeba authored by Sara Sharon's avatar Sara Sharon Committed by Johannes Berg

mac80211: enable starting BA session with custom timeout

Currently the debugfs entry for starting aggregation session
starts it with timeout of 5 seconds. Allow opening a session
with a custom timeout (according to spec 0 is no timeout).
while at it, refactor the function and remove the magic numbers.
Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e0352123
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net> * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright(c) 2016 Intel Deutschland GmbH
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 as
...@@ -151,11 +152,12 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, ...@@ -151,11 +152,12 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
static ssize_t sta_agg_status_write(struct file *file, const char __user *userbuf, static ssize_t sta_agg_status_write(struct file *file, const char __user *userbuf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
char _buf[12] = {}, *buf = _buf; char _buf[25] = {}, *buf = _buf;
struct sta_info *sta = file->private_data; struct sta_info *sta = file->private_data;
bool start, tx; bool start, tx;
unsigned long tid; unsigned long tid;
int ret; char *pos;
int ret, timeout = 5000;
if (count > sizeof(_buf)) if (count > sizeof(_buf))
return -EINVAL; return -EINVAL;
...@@ -164,37 +166,48 @@ static ssize_t sta_agg_status_write(struct file *file, const char __user *userbu ...@@ -164,37 +166,48 @@ static ssize_t sta_agg_status_write(struct file *file, const char __user *userbu
return -EFAULT; return -EFAULT;
buf[sizeof(_buf) - 1] = '\0'; buf[sizeof(_buf) - 1] = '\0';
pos = buf;
buf = strsep(&pos, " ");
if (!buf)
return -EINVAL;
if (strncmp(buf, "tx ", 3) == 0) { if (!strcmp(buf, "tx"))
buf += 3;
tx = true; tx = true;
} else if (strncmp(buf, "rx ", 3) == 0) { else if (!strcmp(buf, "rx"))
buf += 3;
tx = false; tx = false;
} else else
return -EINVAL; return -EINVAL;
if (strncmp(buf, "start ", 6) == 0) { buf = strsep(&pos, " ");
buf += 6; if (!buf)
return -EINVAL;
if (!strcmp(buf, "start")) {
start = true; start = true;
if (!tx) if (!tx)
return -EINVAL; return -EINVAL;
} else if (strncmp(buf, "stop ", 5) == 0) { } else if (!strcmp(buf, "stop")) {
buf += 5;
start = false; start = false;
} else } else {
return -EINVAL;
}
buf = strsep(&pos, " ");
if (!buf)
return -EINVAL; return -EINVAL;
if (sscanf(buf, "timeout=%d", &timeout) == 1) {
buf = strsep(&pos, " ");
if (!buf || !tx || !start)
return -EINVAL;
}
ret = kstrtoul(buf, 0, &tid); ret = kstrtoul(buf, 0, &tid);
if (ret) if (ret || tid >= IEEE80211_NUM_TIDS)
return ret;
if (tid >= IEEE80211_NUM_TIDS)
return -EINVAL; return -EINVAL;
if (tx) { if (tx) {
if (start) if (start)
ret = ieee80211_start_tx_ba_session(&sta->sta, tid, 5000); ret = ieee80211_start_tx_ba_session(&sta->sta, tid,
timeout);
else else
ret = ieee80211_stop_tx_ba_session(&sta->sta, tid); ret = ieee80211_stop_tx_ba_session(&sta->sta, tid);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment