Merge branch '00.00-inst' of git://github.com/skeggsb/linux into drm-fixes
[linux-2.6-microblaze.git] / net / mac80211 / debugfs.c
index 9e723d9..5296898 100644 (file)
@@ -281,6 +281,56 @@ static const struct file_operations aql_txq_limit_ops = {
        .llseek = default_llseek,
 };
 
+static ssize_t aql_enable_read(struct file *file, char __user *user_buf,
+                              size_t count, loff_t *ppos)
+{
+       char buf[3];
+       int len;
+
+       len = scnprintf(buf, sizeof(buf), "%d\n",
+                       !static_key_false(&aql_disable.key));
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t aql_enable_write(struct file *file, const char __user *user_buf,
+                               size_t count, loff_t *ppos)
+{
+       bool aql_disabled = static_key_false(&aql_disable.key);
+       char buf[3];
+       size_t len;
+
+       if (count > sizeof(buf))
+               return -EINVAL;
+
+       if (copy_from_user(buf, user_buf, count))
+               return -EFAULT;
+
+       buf[sizeof(buf) - 1] = '\0';
+       len = strlen(buf);
+       if (len > 0 && buf[len - 1] == '\n')
+               buf[len - 1] = 0;
+
+       if (buf[0] == '0' && buf[1] == '\0') {
+               if (!aql_disabled)
+                       static_branch_inc(&aql_disable);
+       } else if (buf[0] == '1' && buf[1] == '\0') {
+               if (aql_disabled)
+                       static_branch_dec(&aql_disable);
+       } else {
+               return -EINVAL;
+       }
+
+       return count;
+}
+
+static const struct file_operations aql_enable_ops = {
+       .write = aql_enable_write,
+       .read = aql_enable_read,
+       .open = simple_open,
+       .llseek = default_llseek,
+};
+
 static ssize_t force_tx_status_read(struct file *file,
                                    char __user *user_buf,
                                    size_t count,
@@ -405,6 +455,7 @@ static const char *hw_flag_names[] = {
        FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
        FLAG(AMPDU_KEYBORDER_SUPPORT),
        FLAG(SUPPORTS_TX_ENCAP_OFFLOAD),
+       FLAG(SUPPORTS_RX_DECAP_OFFLOAD),
 #undef FLAG
 };
 
@@ -568,6 +619,7 @@ void debugfs_hw_add(struct ieee80211_local *local)
        DEBUGFS_ADD(power);
        DEBUGFS_ADD(hw_conf);
        DEBUGFS_ADD_MODE(force_tx_status, 0600);
+       DEBUGFS_ADD_MODE(aql_enable, 0600);
 
        if (local->ops->wake_tx_queue)
                DEBUGFS_ADD_MODE(aqm, 0600);