ath10k: add support to send addba request
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Mon, 12 Jan 2015 12:07:27 +0000 (14:07 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 13 Jan 2015 14:13:21 +0000 (16:13 +0200)
This per-station debugfs entry helps to send addba request in manual
mode. Need to pass two configuration parameters (tid, buffer size)
as input.

To send addba,

echo 1 32 >/sys/kernel/debug/ieee80211/phyX/netdev:wlanX/
   stations/XX:XX:XX:XX:XX:XX/addba

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/debugfs_sta.c

index 5df967387532cee5625ac55674e8445a2e9432bb..23d81a24420173257ffd41b9e88c5d1430a9d401 100644 (file)
@@ -80,9 +80,61 @@ static const struct file_operations fops_aggr_mode = {
        .llseek = default_llseek,
 };
 
+static ssize_t ath10k_dbg_sta_write_addba(struct file *file,
+                                         const char __user *user_buf,
+                                         size_t count, loff_t *ppos)
+{
+       struct ieee80211_sta *sta = file->private_data;
+       struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+       struct ath10k *ar = arsta->arvif->ar;
+       u32 tid, buf_size;
+       int ret;
+       char buf[64];
+
+       simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
+
+       /* make sure that buf is null terminated */
+       buf[sizeof(buf) - 1] = '\0';
+
+       ret = sscanf(buf, "%u %u", &tid, &buf_size);
+       if (ret != 2)
+               return -EINVAL;
+
+       /* Valid TID values are 0 through 15 */
+       if (tid > HTT_DATA_TX_EXT_TID_MGMT - 2)
+               return -EINVAL;
+
+       mutex_lock(&ar->conf_mutex);
+       if ((ar->state != ATH10K_STATE_ON) ||
+           (arsta->aggr_mode != ATH10K_DBG_AGGR_MODE_MANUAL)) {
+               ret = count;
+               goto out;
+       }
+
+       ret = ath10k_wmi_addba_send(ar, arsta->arvif->vdev_id, sta->addr,
+                                   tid, buf_size);
+       if (ret) {
+               ath10k_warn(ar, "failed to send addba request: vdev_id %u peer %pM tid %u buf_size %u\n",
+                           arsta->arvif->vdev_id, sta->addr, tid, buf_size);
+       }
+
+       ret = count;
+out:
+       mutex_unlock(&ar->conf_mutex);
+       return ret;
+}
+
+static const struct file_operations fops_addba = {
+       .write = ath10k_dbg_sta_write_addba,
+       .open = simple_open,
+       .owner = THIS_MODULE,
+       .llseek = default_llseek,
+};
+
 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                            struct ieee80211_sta *sta, struct dentry *dir)
 {
        debugfs_create_file("aggr_mode", S_IRUGO | S_IWUSR, dir, sta,
                            &fops_aggr_mode);
+       debugfs_create_file("addba", S_IWUSR, dir, sta, &fops_addba);
 }