Commit 8232736d authored by Sujith Manoharan's avatar Sujith Manoharan Committed by Kalle Valo

ath6kl: Fix listen interval handling

This patch addresses a few problems with the commit:

"ath6kl: Implement support for listen interval from userspace"

* The debugfs file required for reading/writing the listen interval
  wasn't created. Fix this.

* The interface index was being hardcoded to zero. Fix this.

* Two separate parameters, "listen_interval_time and listen_interval_beacons"
  were being used. This fails to work as expected because the FW assigns
  higher precedence to "listen_interval_beacons" and "listen_interval_time"
  ends up being never used at all.

  To handle this, fix the host driver to exclusively use listen interval
  based on units of beacon intervals.

To set the listen interval, a user would now do something like this:

echo "10" > /sys/kernel/debug/ieee80211/*/ath6kl/listen_interval

kvalo: fix two checkpatch warnings
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent cbec267a
...@@ -2725,8 +2725,7 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev) ...@@ -2725,8 +2725,7 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)
clear_bit(SKIP_SCAN, &ar->flag); clear_bit(SKIP_SCAN, &ar->flag);
clear_bit(DESTROY_IN_PROGRESS, &ar->flag); clear_bit(DESTROY_IN_PROGRESS, &ar->flag);
ar->listen_intvl_t = A_DEFAULT_LISTEN_INTERVAL; ar->listen_intvl_b = A_DEFAULT_LISTEN_INTERVAL;
ar->listen_intvl_b = 0;
ar->tx_pwr = 0; ar->tx_pwr = 0;
ar->intra_bss = 1; ar->intra_bss = 1;
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#define MAX_DEFAULT_SEND_QUEUE_DEPTH (MAX_DEF_COOKIE_NUM / WMM_NUM_AC) #define MAX_DEFAULT_SEND_QUEUE_DEPTH (MAX_DEF_COOKIE_NUM / WMM_NUM_AC)
#define DISCON_TIMER_INTVAL 10000 /* in msec */ #define DISCON_TIMER_INTVAL 10000 /* in msec */
#define A_DEFAULT_LISTEN_INTERVAL 100 #define A_DEFAULT_LISTEN_INTERVAL 1 /* beacon intervals */
#define A_MAX_WOW_LISTEN_INTERVAL 1000 #define A_MAX_WOW_LISTEN_INTERVAL 1000
/* includes also the null byte */ /* includes also the null byte */
...@@ -534,7 +534,6 @@ struct ath6kl { ...@@ -534,7 +534,6 @@ struct ath6kl {
spinlock_t lock; spinlock_t lock;
struct semaphore sem; struct semaphore sem;
u16 listen_intvl_b; u16 listen_intvl_b;
u16 listen_intvl_t;
u8 lrssi_roam_threshold; u8 lrssi_roam_threshold;
struct ath6kl_version version; struct ath6kl_version version;
u32 target_type; u32 target_type;
......
...@@ -1509,38 +1509,28 @@ static ssize_t ath6kl_listen_int_write(struct file *file, ...@@ -1509,38 +1509,28 @@ static ssize_t ath6kl_listen_int_write(struct file *file,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath6kl *ar = file->private_data; struct ath6kl *ar = file->private_data;
u16 listen_int_t, listen_int_b; struct ath6kl_vif *vif;
u16 listen_interval;
char buf[32]; char buf[32];
char *sptr, *token;
ssize_t len; ssize_t len;
vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;
len = min(count, sizeof(buf) - 1); len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len)) if (copy_from_user(buf, user_buf, len))
return -EFAULT; return -EFAULT;
buf[len] = '\0'; buf[len] = '\0';
sptr = buf; if (kstrtou16(buf, 0, &listen_interval))
token = strsep(&sptr, " ");
if (!token)
return -EINVAL; return -EINVAL;
if (kstrtou16(token, 0, &listen_int_t)) if ((listen_interval < 1) || (listen_interval > 50))
return -EINVAL; return -EINVAL;
if (kstrtou16(sptr, 0, &listen_int_b)) ar->listen_intvl_b = listen_interval;
return -EINVAL; ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, 0,
if ((listen_int_t < 15) || (listen_int_t > 5000))
return -EINVAL;
if ((listen_int_b < 1) || (listen_int_b > 50))
return -EINVAL;
ar->listen_intvl_t = listen_int_t;
ar->listen_intvl_b = listen_int_b;
ath6kl_wmi_listeninterval_cmd(ar->wmi, 0, ar->listen_intvl_t,
ar->listen_intvl_b); ar->listen_intvl_b);
return count; return count;
...@@ -1554,8 +1544,7 @@ static ssize_t ath6kl_listen_int_read(struct file *file, ...@@ -1554,8 +1544,7 @@ static ssize_t ath6kl_listen_int_read(struct file *file,
char buf[32]; char buf[32];
int len; int len;
len = scnprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t, len = scnprintf(buf, sizeof(buf), "%u\n", ar->listen_intvl_b);
ar->listen_intvl_b);
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
...@@ -1710,6 +1699,9 @@ int ath6kl_debug_init(struct ath6kl *ar) ...@@ -1710,6 +1699,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
debugfs_create_file("bgscan_interval", S_IWUSR, debugfs_create_file("bgscan_interval", S_IWUSR,
ar->debugfs_phy, ar, &fops_bgscan_int); ar->debugfs_phy, ar, &fops_bgscan_int);
debugfs_create_file("listen_interval", S_IRUSR | S_IWUSR,
ar->debugfs_phy, ar, &fops_listen_int);
debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar, debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
&fops_power_params); &fops_power_params);
......
...@@ -584,10 +584,11 @@ void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, u8 *bssid, ...@@ -584,10 +584,11 @@ void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, u8 *bssid,
memcpy(vif->bssid, bssid, sizeof(vif->bssid)); memcpy(vif->bssid, bssid, sizeof(vif->bssid));
vif->bss_ch = channel; vif->bss_ch = channel;
if ((vif->nw_type == INFRA_NETWORK)) if ((vif->nw_type == INFRA_NETWORK)) {
ar->listen_intvl_b = listen_int;
ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx,
ar->listen_intvl_t, 0, ar->listen_intvl_b);
ar->listen_intvl_b); }
netif_wake_queue(vif->ndev); netif_wake_queue(vif->ndev);
......
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