OSDN Git Service

ath10k: implement debugfs interface for sifs burst
authorRakesh Pillai <pillair@codeaurora.org>
Thu, 9 Mar 2017 05:28:03 +0000 (10:58 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Tue, 21 Mar 2017 06:17:31 +0000 (23:17 -0700)
This interface can be used to enable or disable sifs burst
from debugfs.

CRs-Fixed: 2017024
Change-Id: If1ce889c4a829c20e0570a6cf35711f988859b89
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/debug.c
drivers/net/wireless/ath/ath10k/mac.c

index 21c63d5..a20ac68 100644 (file)
@@ -729,7 +729,7 @@ struct ath10k {
        u32 max_spatial_stream;
        /* protected by conf_mutex */
        bool ani_enabled;
-
+       bool sifs_burst_enabled;
        bool p2p;
 
        struct {
index c36c248..8d97822 100644 (file)
@@ -1572,6 +1572,64 @@ static const struct file_operations fops_ani_enable = {
        .llseek = default_llseek,
 };
 
+static ssize_t ath10k_write_sifs_burst_enable(struct file *file,
+                                             const char __user *user_buf,
+                                             size_t count, loff_t *ppos)
+{
+       struct ath10k *ar = file->private_data;
+       int ret;
+       u8 enable;
+
+       if (kstrtou8_from_user(user_buf, count, 0, &enable))
+               return -EINVAL;
+
+       mutex_lock(&ar->conf_mutex);
+
+       if (ar->sifs_burst_enabled == enable) {
+               ret = count;
+               goto exit;
+       }
+
+       ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->burst_enable,
+                                       enable);
+       if (ret) {
+               ath10k_warn(ar, "sifs_burst_enable failed: %d\n", ret);
+               goto exit;
+       }
+       ar->sifs_burst_enabled = enable;
+
+       ret = count;
+
+exit:
+       mutex_unlock(&ar->conf_mutex);
+
+       return ret;
+}
+
+static ssize_t ath10k_read_sifs_burst_enable(struct file *file,
+                                            char __user *user_buf,
+                                            size_t count, loff_t *ppos)
+{
+       struct ath10k *ar = file->private_data;
+       char buf[32];
+       int len;
+       bool ret = false;
+
+       if (ar->sifs_burst_enabled)
+               ret = true;
+
+       len = scnprintf(buf, sizeof(buf), "%d\n", ret);
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_sifs_burst_enable = {
+       .read = ath10k_read_sifs_burst_enable,
+       .write = ath10k_write_sifs_burst_enable,
+       .open = simple_open,
+       .owner = THIS_MODULE,
+       .llseek = default_llseek,
+};
+
 static const struct file_operations fops_cal_data = {
        .open = ath10k_debug_cal_data_open,
        .read = ath10k_debug_cal_data_read,
@@ -2432,6 +2490,9 @@ int ath10k_debug_register(struct ath10k *ar)
        debugfs_create_file("ani_enable", S_IRUSR | S_IWUSR,
                            ar->debug.debugfs_phy, ar, &fops_ani_enable);
 
+       debugfs_create_file("sifs_burst_enable", S_IRUSR | S_IWUSR,
+                           ar->debug.debugfs_phy, ar, &fops_sifs_burst_enable);
+
        if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) {
                debugfs_create_file("dfs_simulate_radar", S_IWUSR,
                                    ar->debug.debugfs_phy, ar,
index 8d49acd..265744c 100644 (file)
@@ -4538,6 +4538,7 @@ static int ath10k_start(struct ieee80211_hw *hw)
                                    ret);
                        goto err_core_stop;
                }
+               ar->sifs_burst_enabled = false;
        }
 
        param = ar->wmi.pdev_param->ani_enable;