b43: N-PHY: save calibration for further restore
[safe/jmp/linux-2.6] / net / mac80211 / debugfs.c
index 82c8077..b3bc32b 100644 (file)
@@ -52,7 +52,7 @@ DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
 DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x",
                      local->wep_iv & 0xffffff);
 DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s",
-                     local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>");
+       local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver");
 
 static ssize_t tsf_read(struct file *file, char __user *user_buf,
                             size_t count, loff_t *ppos)
@@ -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)
 {
@@ -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);