[NOUPSTREAM] iwlwifi: mvm: 11ax softap test mode debugfs entries and FW APIs

New debugfs for softap per station connected to
the softap.
The entries allow us to start 3 test modes that
send the relevant station trigger frames based
on the debugfs configuration and the FW API.

type=feature
ticket=none

Change-Id: Id3d68542f03a71c9415d149b0dad6f8e9ab2a052
Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/132040
Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Reviewed-by: Coelho, Luciano <luciano.coelho@intel.com>
x-iwlwifi-stack-dev: e6373ca89c64b0070f778bded7dce2bcb14ab953
diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream b/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream
index 1a99ca3..61d432b 100644
--- a/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream
+++ b/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream
@@ -23,6 +23,16 @@
 	default 2
 	depends on IWLMVM
 
+config IWLMVM_AX_SOFTAP_TESTMODE
+	bool "enable 11ax softap testmode debugfs configuration files"
+	depends on IWLMVM
+	depends on MAC80211_DEBUGFS
+	default y
+	help
+	  Enable 11ax softap testmode debugfs entries that can be used to
+	  enable/disable test modes for trigger frame sending to an 11ax
+	  testmode client.
+
 config IWLWIFI_THERMAL_DEBUGFS
 	bool "enable thermal debug write and read support"
 	depends on IWLWIFI_DEBUGFS
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/ax-softap-testmode.h b/drivers/net/wireless/intel/iwlwifi/fw/api/ax-softap-testmode.h
new file mode 100644
index 0000000..4e1be93
--- /dev/null
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/ax-softap-testmode.h
@@ -0,0 +1,329 @@
+/******************************************************************************
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2017 Intel Deutschland GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <linuxwifi@intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Deutschland GmbH
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name Intel Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *****************************************************************************/
+
+#ifndef __fw_api_ax_softap_testmode_h__
+#define __fw_api_ax_softap_testmode_h__
+
+#include "mac.h"
+
+/**
+ * struct trig_frame_common_softap_testmode
+ *
+ * all the configurable common trigger frame fields that can be set
+ * for this mode.
+ *
+ * @cmn_lsig_len: L-SIG Length
+ * @cmn_cascade_indication: Cascade Indication
+ * @cmn_carrier_sense_req: CS Required
+ * @cmn_gi_ltf: GI And LTF
+ * @cmn_mu_mimo_ltf: MU-MIMO LTF Mode
+ * @cmn_he_ltf_num: Number Of HE-LTF Symbols
+ * @cmn_ldpc_ext_sym: LDPC Extra Symbol Segment
+ * @cmn_packet_extension: Packet Extension
+ * @cmn_spatial_reuse: Spatial Reuse
+ * @cmn_doppler: Doppler
+ * @cmn_res_he_sig_a: HE-SIG-A Reserved
+ * @reserved: reserved for DW alignment
+ */
+struct trig_frame_common_softap_testmode {
+	__le16 cmn_lsig_len;
+	u8 cmn_cascade_indication;
+	u8 cmn_carrier_sense_req;
+	u8 cmn_gi_ltf;
+	u8 cmn_mu_mimo_ltf;
+	u8 cmn_he_ltf_num;
+	u8 cmn_ldpc_ext_sym;
+	u8 cmn_packet_extension;
+	__le16 cmn_spatial_reuse;
+	u8 cmn_doppler;
+	__le16 cmn_res_he_sig_a;
+	__le16 reserved;
+} __packed; /* TRIG_FRAME_COMMON_SOFTAP_TESTMODE_API_S_VER_1 */
+
+/**
+ * struct trig_frame_user_softap_testmode
+ *
+ * The struct contains all the common configurable per user trigger frame
+ * fields that can be set for this mode.
+ *
+ * @usr_assoc_id: AID12
+ * @usr_rsrc_unit_alloc: RU Allocation
+ * @usr_coding_type: Coding Type
+ * @usr_mcs: MCS
+ * @usr_dcm: DCM
+ * @usr_ss_allocation: SS Allocation
+ * @usr_target_rssi: Target RSSI
+ */
+struct trig_frame_user_softap_testmode {
+	__le16 usr_assoc_id;
+	u8 usr_rsrc_unit_alloc;
+	u8 usr_coding_type;
+	u8 usr_mcs;
+	u8 usr_dcm;
+	u8 usr_ss_allocation;
+	u8 usr_target_rssi;
+} __packed; /* TRIG_FRAME_USER_SOFTAP_TESTMODE_API_S_VER_1 */
+
+/**
+ * struct trig_frame_user_basic_softap_testmode
+ *
+ * he struct contains all the basic configurable per user trigger frame
+ * fields that can be set for this mode.
+ *
+ * @usr_space_factor: MPDU MU Spacing Factor
+ * @tid_agg_limit: TID Aggregation Limit
+ * @preferred_ac_enabled: AC Preference Level
+ * @preferred_ac: Preferred AC
+ */
+struct trig_frame_user_basic_softap_testmode {
+	u8 usr_space_factor;
+	u8 tid_agg_limit;
+	u8 preferred_ac_enabled;
+	u8 preferred_ac;
+} __packed; /* TRIG_FRAME_USER_BASIC_SOFTAP_TESTMODE_API_S_VER_1 */
+
+/**
+ * struct trig_frame_softap_testmode
+ *
+ * The struct contains all the common configurable trigger frame params that
+ * can be set for this mode.
+ *
+ * @pad_byte_count: the number of bytes to add in padding for the trigger frame
+ * @per_user_count: the number of per user sections in the configured trig frame
+ * @reserved: reserved for DW alignment
+ * @addr1: addr1 of the mh of the configured trig frame
+ * @reserved_for_addr1: addr data type in FW is aligned to 8 bytes
+ * @addr2: addr2 of the mh of the configured trig frame
+ * @reserved_for_addr2: addr data type in FW is aligned to 8 bytes
+ */
+struct trig_frame_softap_testmode {
+	__le16 pad_byte_count;
+	u8 per_user_count;
+	u8 reserved;
+	u8 addr1[6];
+	__le16 reserved_for_addr1;
+	u8 addr2[6];
+	__le16 reserved_for_addr2;
+} __packed; /* TRIG_FRAME_SOFTAP_TESTMODE_API_S_VER_1 */
+
+/**
+ * struct trig_frame_ax_softap_dl_basic
+ *
+ * command to configure the 11ax softap testmode for basic DL. In this mode
+ * the AP prepends 0-3 trigger frames to each aggregation so that the client
+ * is triggered to send a BA to the aggregation. This mode requires to enable
+ * the softap and connect an AX client to it which has been modified to send
+ * the triggered responses in HE_SU instead of HE_TRIG so that the softap
+ * hardware could receive it.
+ *
+ * @frame_params: general trigger frame params
+ * @common: content of the common trigger frame fields
+ * @per_user: content of the per user trigger frame fields - up to 3 per user
+ *	      sections can be configured in this mode for each trigger frame
+ * @per_user_basic: content of the basic type per user trigger frame fields -
+ *		    up to 3 per user sections can be configured in this mode
+ *		    for each trigger frame
+ */
+struct trig_frame_ax_softap_dl_basic {
+	struct trig_frame_softap_testmode frame_params;
+	struct trig_frame_common_softap_testmode common;
+	struct trig_frame_user_softap_testmode per_user[3];
+	struct trig_frame_user_basic_softap_testmode per_user_basic[3];
+} __packed; /* TRIG_FRAME_SOFTAP_TESTMODE_DL_BASIC_API_S_VER_1 */
+
+/**
+ * struct ax_softap_testmode_dl_basic_cmd
+ *
+ * @enable: enable or disable this test mode
+ * @txop_duration_disable: bool to disable the txop duration in the HE PLCP of
+ *			   the agg carrying the trigger frames for this
+ *			   test mode
+ * @configured_frames_count: number of trigger frames configured for the
+ *			     test mode - max 3 trigger frames
+ * @reserved: reserved for DW alignment
+ * @frames: the trigger frames content - up to 3 trigger frames can
+ *	    be configured
+ */
+struct ax_softap_testmode_dl_basic_cmd {
+	u8 enable;
+	u8 txop_duration_disable;
+	u8 configured_frames_count;
+	u8 reserved;
+	struct trig_frame_ax_softap_dl_basic frames[3];
+} __packed; /* AX_SOFTAP_TESTMODE_DL_BASIC_API_S_VER_1 */
+
+/**
+ * struct trig_frame_bar_tid_ax_softap_testmode_dl_mu_bar
+ *
+ * The struct contains all the configurable bar per tid trigger frame
+ * fields that can be set for this mode.
+ *
+ * @association_id: AID
+ * @ba_ssn_bitmap_size: Fragment Number subfield (bits 1-2)
+ * @reserved: reserved for DW alignment
+ */
+struct trig_frame_bar_tid_ax_softap_testmode_dl_mu_bar {
+	__le16 association_id;
+	u8 ba_ssn_bitmap_size;
+	u8 reserved;
+} __packed; /* TRIG_FRAME_BAR_TID_SOFTAP_TESTMODE_DL_MU_BAR_API_S_VER_1 */
+
+/**
+ * struct trig_frame_bar_ax_softap_testmode_dl_mu_bar
+ *
+ * The struct contains all the configurable bar trigger frame fields that
+ * can be set for this mode.
+ *
+ * @block_ack_policy: BA Ack Policy
+ * @block_ack_type: BA Type
+ * @tid_count: the number of TIDs configured in this mu bar trigger frame
+ *	       per user section
+ * @reserved: reserved for DW alignment
+ */
+struct trig_frame_bar_ax_softap_testmode_dl_mu_bar {
+	u8 block_ack_policy;
+	u8 block_ack_type;
+	u8 tid_count;
+	u8 reserved;
+	struct trig_frame_bar_tid_ax_softap_testmode_dl_mu_bar per_tid[3];
+} __packed; /* TRIG_FRAME_BAR_SOFTAP_TESTMODE_DL_MU_BAR_API_S_VER_1 */
+
+/**
+ * struct trig_frame_ax_softap_dl_mu_bar
+ *
+ * command to configure the 11ax softap testmode for MU Bar DL. In this mode
+ * the AP sends a trigger frame after each aggregation so that the client is
+ * triggered to send a BA to the aggregation.
+ * This mode requires to enable the softap and connect an AX client to it
+ * which has been modified to send the triggered responses in HE_SU
+ * instead of HE_TRIG so that the softap hardware could receive it.
+ *
+ * @frame_params: general trigger frame params
+ * @common: content of the common trigger frame fields
+ * @per_user: content of the per user trigger frame fields - up to 3 per user
+ *	      sections can be configured in this mode for each trigger frame
+ * @bar: content of the mu bar type per user trigger frame fields  - up to 3
+ *	 per user sections can be configured in this mode for each trigger frame
+ */
+struct trig_frame_ax_softap_dl_mu_bar {
+	struct trig_frame_softap_testmode frame_params;
+	struct trig_frame_common_softap_testmode common;
+	struct trig_frame_user_softap_testmode per_user[3];
+	struct trig_frame_bar_ax_softap_testmode_dl_mu_bar bar[3];
+} __packed; /* TRIG_FRAME_SOFTAP_TESTMODE_DL_MU_BAR_API_S_VER_1 */
+
+/**
+ * struct ax_softap_testmode_dl_mu_bar_cmd
+ *
+ * @enable: enable or disable this test mode
+ * @reserved1: reserved for DW alignment
+ * @reserved2: reserved for DW alignment
+ * @rate_n_flags: rate for TX operation of the trigger frame
+ * @frame: the trigger frame content
+ */
+struct ax_softap_testmode_dl_mu_bar_cmd {
+	u8 enable;
+	__le16 reserved1;
+	u8 reserved2;
+	__le32 rate_n_flags;
+	struct trig_frame_ax_softap_dl_mu_bar frame;
+} __packed; /* AX_SOFTAP_TESTMODE_DL_MU_BAR_API_S_VER_1 */
+
+/**
+ * struct trig_frame_ax_softap_ul
+ *
+ * command to configure the 11ax softap testmode for UL In this mode the
+ * AP sends a trigger frame periodically with a timer so that the client
+ * is triggered to send QOS data to the AP.
+ * This mode requires to enable the softap and connect an AX client to it
+ * which has been modified to send the triggered responses in HE_SU
+ * instead of HE_TRIG so that the softap hardware could receive it.
+ *
+ * @frame_params: general trigger frame params
+ * @common: content of the common trigger frame fields
+ * @per_user: content of the per user trigger frame fields  - up to 3 per user
+ *	      sections can be configured in this mode for each trigger frame
+ * @per_user_basic: content of the basic type per user trigger frame fields
+ *		    - up to 3 per user sections can be configured in this
+ *		    mode for each trigger frame
+ */
+struct trig_frame_ax_softap_ul {
+	struct trig_frame_softap_testmode frame_params;
+	struct trig_frame_common_softap_testmode common;
+	struct trig_frame_user_softap_testmode per_user[3];
+	struct trig_frame_user_basic_softap_testmode per_user_basic[3];
+} __packed; /* TRIG_FRAME_SOFTAP_TESTMODE_UL_API_S_VER_1 */
+
+/**
+ * struct ax_softap_testmode_ul_cmd
+ *
+ * @enable: enable or disable this test mode
+ * @trig_frame_periodic_msec: the time timer interval in msecs for sending the
+ *			      trigger frames
+ * @reserved: reserved for DW alignment
+ * @rate_n_flags: rate for TX operation of the trigger frame
+ * @frame: the trigger frame content
+ */
+struct ax_softap_testmode_ul_cmd {
+	u8 enable;
+	u8 trig_frame_periodic_msec;
+	__le16 reserved;
+	__le32 rate_n_flags;
+	struct trig_frame_ax_softap_ul frame;
+} __packed; /* AX_SOFTAP_TESTMODE_UL_API_S_VER_1 */
+
+#endif /* __fw_api_ax_softap_testmode_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h b/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h
index aa76dcc..f6c4899 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h
@@ -83,6 +83,22 @@
 	TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2,
 
 	/**
+	 * @AX_SOFTAP_TESTMODE_DL_BASIC: &struct ax_softap_testmode_dl_basic_cmd
+	 */
+	 AX_SOFTAP_TESTMODE_DL_BASIC = 0x9,
+
+	/**
+	 * @AX_SOFTAP_TESTMODE_DL_MU_BAR:
+	 *  &struct ax_softap_testmode_dl_mu_bar_cmd
+	 */
+	AX_SOFTAP_TESTMODE_DL_MU_BAR = 0xA,
+
+	/**
+	 * @AX_SOFTAP_TESTMODE_UL: &struct ax_softap_testmode_ul_cmd
+	 */
+	AX_SOFTAP_TESTMODE_UL = 0xB,
+
+	/**
 	 * @STA_PM_NOTIF: &struct iwl_mvm_pm_state_notification
 	 */
 	STA_PM_NOTIF = 0xFD,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index 467cd43..7ffe8db 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -346,6 +346,7 @@
  * @IWL_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger
  *	command size (command version 4) that supports toggling ACK TX
  *	power reduction.
+ * @IWL_UCODE_TLV_CAPA_AX_SAP_TM: support 11ax softap testmode APIs
  * @IWL_UCODE_TLV_CAPA_MLME_OFFLOAD: supports MLME offload
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
@@ -397,6 +398,7 @@
 	IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG	= (__force iwl_ucode_tlv_capa_t)80,
 	IWL_UCODE_TLV_CAPA_LQM_SUPPORT			= (__force iwl_ucode_tlv_capa_t)81,
 	IWL_UCODE_TLV_CAPA_TX_POWER_ACK			= (__force iwl_ucode_tlv_capa_t)84,
+	IWL_UCODE_TLV_CAPA_AX_SAP_TM			= (__force iwl_ucode_tlv_capa_t)85,
 	IWL_UCODE_TLV_CAPA_MLME_OFFLOAD			= (__force iwl_ucode_tlv_capa_t)96,
 
 	NUM_IWL_UCODE_TLV_CAPA
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
index aa164bb..001484c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
@@ -16,3 +16,4 @@
 iwlmvm-$(CPTCFG_IWLWIFI_FRQ_MGR) += fm-ops.o
 iwlmvm-$(CPTCFG_IWLWIFI_FRQ_MGR_TEST) += fm-test.o
 iwlmvm-$(CPTCFG_IWLWIFI_DEVICE_TESTMODE) += testmode.o
+iwlmvm-$(CPTCFG_IWLMVM_AX_SOFTAP_TESTMODE) += ax-softap-testmode.o
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ax-softap-testmode.c b/drivers/net/wireless/intel/iwlwifi/mvm/ax-softap-testmode.c
new file mode 100644
index 0000000..f642b07
--- /dev/null
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ax-softap-testmode.c
@@ -0,0 +1,222 @@
+/******************************************************************************
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2017 Intel Deutschland GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <linuxwifi@intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Intel Deutschland GmbH
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name Intel Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+
+#include "debugfs.h"
+#include "mvm.h"
+#include "fw/api/ax-softap-testmode.h"
+#include <net/mac80211.h>
+
+static ssize_t
+iwl_dbgfs_ax_softap_testmode_dl_basic_write(struct iwl_mvm *mvm,
+					    char *buf, size_t count,
+					    loff_t *ppos)
+{
+	struct ax_softap_testmode_dl_basic_cmd *cmd =
+		(struct ax_softap_testmode_dl_basic_cmd *)buf;
+
+	int ret;
+	u32 status;
+
+	if (sizeof(*cmd) != count) {
+		IWL_ERR(mvm,
+			"Bad size for softap dl basic cmd (%zd) should be (%zd)\n",
+			count, sizeof(*cmd));
+		return -EINVAL;
+	}
+
+	status = 0;
+
+	ret = iwl_mvm_send_cmd_pdu_status(mvm,
+					  iwl_cmd_id(AX_SOFTAP_TESTMODE_DL_BASIC,
+						     DATA_PATH_GROUP, 0),
+					  count, cmd, &status);
+	if (ret) {
+		IWL_ERR(mvm, "Failed to send softap dl basic cmd (%d)\n",
+			ret);
+		return ret;
+	}
+
+	if (status) {
+		IWL_ERR(mvm, "softap dl basic cmd failed (%d)\n",
+			status);
+		return -EIO;
+	}
+
+	return count;
+}
+
+static ssize_t
+iwl_dbgfs_ax_softap_testmode_dl_mu_bar_write(struct iwl_mvm *mvm,
+					     char *buf, size_t count,
+					     loff_t *ppos)
+{
+	struct ax_softap_testmode_dl_mu_bar_cmd *cmd =
+		(struct ax_softap_testmode_dl_mu_bar_cmd *)buf;
+
+	int ret;
+	u32 status;
+
+	if (sizeof(*cmd) != count) {
+		IWL_ERR(mvm,
+			"Bad size for softap dl mu bar cmd (%zd) should be (%zd)\n",
+			count, sizeof(*cmd));
+		return -EINVAL;
+	}
+
+	status = 0;
+
+	ret = iwl_mvm_send_cmd_pdu_status(mvm,
+					  iwl_cmd_id(AX_SOFTAP_TESTMODE_DL_MU_BAR,
+						     DATA_PATH_GROUP, 0),
+					  count, cmd, &status);
+	if (ret) {
+		IWL_ERR(mvm, "Failed to send softap dl mu bar cmd (%d)\n",
+			ret);
+		return ret;
+	}
+
+	if (status) {
+		IWL_ERR(mvm, "softap dl mu bar cmd failed (%d)\n",
+			status);
+		return -EIO;
+	}
+
+	return count;
+}
+
+static ssize_t
+iwl_dbgfs_ax_softap_testmode_ul_write(struct iwl_mvm *mvm,
+				      char *buf, size_t count, loff_t *ppos)
+{
+	struct ax_softap_testmode_ul_cmd *cmd =
+		(struct ax_softap_testmode_ul_cmd *)buf;
+
+	int ret;
+	u32 status;
+
+	if (sizeof(*cmd) != count) {
+		IWL_ERR(mvm,
+			"Bad size for softap ul cmd (%zd) should be (%zd)\n",
+			count, sizeof(*cmd));
+		return -EINVAL;
+	}
+
+	status = 0;
+
+	ret = iwl_mvm_send_cmd_pdu_status(mvm,
+					  iwl_cmd_id(AX_SOFTAP_TESTMODE_UL,
+						     DATA_PATH_GROUP, 0),
+					  count, cmd, &status);
+	if (ret) {
+		IWL_ERR(mvm, "Failed to send softap ul cmd (%d)\n",
+			ret);
+		return ret;
+	}
+
+	if (status) {
+		IWL_ERR(mvm, "softap ul cmd failed (%d)\n",
+			status);
+		return -EIO;
+	}
+
+	return count;
+}
+
+#define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz)				\
+	_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct iwl_mvm)
+#define MVM_DEBUGFS_ADD_FILE_AX_SOFTAP_TM(name, parent, mode) do {	\
+		if (!debugfs_create_file(#name, mode, parent, mvm,	\
+					 &iwl_dbgfs_##name##_ops))	\
+			goto err;					\
+	} while (0)
+
+#define DL_BASIC_CMD_SIZE (sizeof(struct ax_softap_testmode_dl_basic_cmd) + 1)
+#define DL_MU_BAR_CMD_SIZE (sizeof(struct ax_softap_testmode_dl_mu_bar_cmd) + 1)
+#define UL_CMD_SIZE (sizeof(struct ax_softap_testmode_ul_cmd) + 1)
+
+MVM_DEBUGFS_WRITE_FILE_OPS(ax_softap_testmode_dl_basic, DL_BASIC_CMD_SIZE);
+MVM_DEBUGFS_WRITE_FILE_OPS(ax_softap_testmode_dl_mu_bar, DL_MU_BAR_CMD_SIZE);
+MVM_DEBUGFS_WRITE_FILE_OPS(ax_softap_testmode_ul, UL_CMD_SIZE);
+
+static void ax_softap_testmode_add_debugfs(struct ieee80211_hw *hw,
+					   struct ieee80211_vif *vif,
+					   struct ieee80211_sta *sta,
+					   struct dentry *dir)
+{
+	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+
+	MVM_DEBUGFS_ADD_FILE_AX_SOFTAP_TM(ax_softap_testmode_dl_basic,
+					  dir, S_IWUSR);
+	MVM_DEBUGFS_ADD_FILE_AX_SOFTAP_TM(ax_softap_testmode_dl_mu_bar,
+					  dir, S_IWUSR);
+	MVM_DEBUGFS_ADD_FILE_AX_SOFTAP_TM(ax_softap_testmode_ul,
+					  dir, S_IWUSR);
+err:
+	IWL_ERR(mvm, "Can't create debugfs entity\n");
+}
+
+void
+iwl_mvm_ax_softap_testmode_sta_add_debugfs(struct ieee80211_hw *hw,
+					   struct ieee80211_vif *vif,
+					   struct ieee80211_sta *sta,
+					   struct dentry *dir)
+{
+	if (fw_has_capa(&IWL_MAC80211_GET_MVM(hw)->fw->ucode_capa,
+			IWL_UCODE_TLV_CAPA_AX_SAP_TM))
+		ax_softap_testmode_add_debugfs(hw, vif, sta, dir);
+}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index e2292d3..a623e81 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -5051,4 +5051,7 @@
 	.stop_nan = iwl_mvm_stop_nan,
 	.add_nan_func = iwl_mvm_add_nan_func,
 	.del_nan_func = iwl_mvm_del_nan_func,
+#ifdef CPTCFG_IWLMVM_AX_SOFTAP_TESTMODE
+	.sta_add_debugfs = iwl_mvm_ax_softap_testmode_sta_add_debugfs,
+#endif
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index ce851e3..2ad6f05 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2128,4 +2128,12 @@
 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b);
 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm);
 
+/* 11ax Softap Test Mode */
+#ifdef CPTCFG_IWLWIFI_DEVICE_TESTMODE
+void
+iwl_mvm_ax_softap_testmode_sta_add_debugfs(struct ieee80211_hw *hw,
+					   struct ieee80211_vif *vif,
+					   struct ieee80211_sta *sta,
+					   struct dentry *dir);
+#endif
 #endif /* __IWL_MVM_H__ */
diff --git a/local-symbols b/local-symbols
index 5e844a9..3d39ad2 100644
--- a/local-symbols
+++ b/local-symbols
@@ -96,6 +96,7 @@
 IWLWIFI_FRQ_MGR=
 IWLWIFI_FRQ_MGR_TEST=
 IWLWIFI_NUM_CHANNELS=
+IWLMVM_AX_SOFTAP_TESTMODE=
 IWLWIFI_SUPPORT_DEBUG_OVERRIDES=
 IWLWIFI_THERMAL_DEBUGFS=
 IWLWIFI_FORCE_OFDM_RATE=
diff --git a/versions b/versions
index c1ee455..f06603a 100644
--- a/versions
+++ b/versions
@@ -2,4 +2,4 @@
 BACKPORTED_KERNEL_VERSION="(see git)"
 BACKPORTED_KERNEL_NAME="iwlwifi"
 BACKPORTS_BUILD_TSTAMP=__DATE__ \" \" __TIME__
-BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:6428:d66e355a"
+BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:6429:e6373ca8"