*
  *****************************************************************************/
 #include <linux/vmalloc.h>
+#include <linux/ieee80211.h>
 
 #include "mvm.h"
 #include "fw-dbg.h"
        return count;
 }
 
+static ssize_t iwl_dbgfs_max_amsdu_len_write(struct iwl_mvm *mvm,
+                                            char *buf, size_t count,
+                                            loff_t *ppos)
+{
+       unsigned int max_amsdu_len;
+       int ret;
+
+       ret = kstrtouint(buf, 0, &max_amsdu_len);
+
+       if (max_amsdu_len > IEEE80211_MAX_MPDU_LEN_VHT_11454)
+               return -EINVAL;
+       mvm->max_amsdu_len = max_amsdu_len;
+
+       return count;
+}
+
 #define ADD_TEXT(...) pos += scnprintf(buf + pos, bufsz - pos, __VA_ARGS__)
 #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
 static ssize_t iwl_dbgfs_bcast_filters_read(struct file *file,
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(fw_dbg_conf, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(fw_dbg_collect, 64);
 MVM_DEBUGFS_WRITE_FILE_OPS(cont_recording, 8);
+MVM_DEBUGFS_WRITE_FILE_OPS(max_amsdu_len, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl,
                           (IWL_RSS_INDIRECTION_TABLE_SIZE * 2));
 
        MVM_DEBUGFS_ADD_FILE(d0i3_refs, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_dbg_conf, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_dbg_collect, mvm->debugfs_dir, S_IWUSR);
+       MVM_DEBUGFS_ADD_FILE(max_amsdu_len, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(cont_recording, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, S_IWUSR);
 
        bool ipv4 = (skb->protocol == htons(ETH_P_IP));
        u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0;
        u16 amsdu_add, snap_ip_tcp, pad, i = 0;
+       unsigned int dbg_max_amsdu_len;
        u8 *qc, tid;
 
        snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) +
        }
 
        max_amsdu_len = sta->max_amsdu_len;
+       dbg_max_amsdu_len = ACCESS_ONCE(mvm->max_amsdu_len);
+       if (dbg_max_amsdu_len)
+               max_amsdu_len = min_t(unsigned int, max_amsdu_len,
+                                     dbg_max_amsdu_len);
 
        /*
         * Limit A-MSDU in A-MPDU to 4095 bytes when VHT is not