Add debugfs support to simulate incumbent signal interference from the
host for testing purposes. The debugfs entry is created only for 6 GHz
radio when firmware advertises the support through
WMI_TLV_SERVICE_DCS_INCUMBENT_SIGNAL_INTERFERENCE_SUPPORT flag.
Debugfs command:
echo <interference_bitmap> > /sys/kernel/debug/ath12k/pci-000X/macX/simulate_incumbent_signal_interference
Each bit in the interference_bitmap represents a 20 MHz segment. Bit 0
corresponds to the primary 20 MHz segment, regardless of its position
within the operating bandwidth. Bit 1 represents the next adjacent 20 MHz
segment, bit 2 the lower 20 MHz segment of the adjacent 40 MHz segment,
and so on-progressing sequentially across the bandwidth..
Example:
echo 0xF0 > /sys/kernel/debug/ath12k/pci-0002:01:00.0/mac0/simulate_incumbent_signal_interference
This indicates that all the subchannels in the secondary 80 MHz segment
were affected.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aishwarya R <aishwarya.r@oss.qualcomm.com>
Signed-off-by: Amith A <amith.a@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20260511040242.1351792-3-amith.a@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
.llseek = default_llseek,
};
+static ssize_t
+ath12k_write_simulate_incumbent_signal_interference(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath12k *ar = file->private_data;
+ struct ath12k_hw *ah = ath12k_ar_to_ah(ar);
+ struct wiphy *wiphy = ath12k_ar_to_hw(ar)->wiphy;
+ u32 chan_bw_interference_bitmap;
+ int ret;
+
+ if (ah->state != ATH12K_HW_STATE_ON)
+ return -ENETDOWN;
+
+ /*
+ * Bitmap uses the firmware primary-based ordering documented in
+ * ath12k_wmi_transform_interference_bitmap() & intf_map_80.
+ */
+ if (kstrtou32_from_user(user_buf, count, 0, &chan_bw_interference_bitmap))
+ return -EINVAL;
+
+ wiphy_lock(wiphy);
+ ret = ath12k_wmi_simulate_incumbent_signal_interference(ar, chan_bw_interference_bitmap);
+ if (ret)
+ goto exit;
+
+ ret = count;
+
+exit:
+ wiphy_unlock(wiphy);
+ return ret;
+}
+
+static const struct file_operations fops_simulate_incumbent_signal_interference = {
+ .write = ath12k_write_simulate_incumbent_signal_interference,
+ .open = simple_open,
+};
+
static
void ath12k_debugfs_fw_stats_register(struct ath12k *ar)
{
ar, &fops_tpc_stats_type);
init_completion(&ar->debug.tpc_complete);
+ if (ar->mac.sbands[NL80211_BAND_6GHZ].channels &&
+ test_bit(WMI_TLV_SERVICE_DCS_INCUMBENT_SIGNAL_INTERFERENCE_SUPPORT,
+ ar->ab->wmi_ab.svc_map)) {
+ debugfs_create_file("simulate_incumbent_signal_interference", 0200,
+ ar->debug.debugfs_pdev, ar,
+ &fops_simulate_incumbent_signal_interference);
+ }
+
ath12k_debugfs_htt_stats_register(ar);
ath12k_debugfs_fw_stats_register(ar);
return ret;
}
+int ath12k_wmi_simulate_incumbent_signal_interference(struct ath12k *ar,
+ u32 chan_bw_interference_bitmap)
+{
+ struct wmi_unit_test_arg wmi_ut = {};
+ struct ath12k_link_vif *arvif;
+ struct ath12k_vif *ahvif;
+ bool arvif_found = false;
+
+ list_for_each_entry(arvif, &ar->arvifs, list) {
+ ahvif = arvif->ahvif;
+ if (arvif->is_started && ahvif->vdev_type == WMI_VDEV_TYPE_AP) {
+ arvif_found = true;
+ break;
+ }
+ }
+
+ if (!arvif_found)
+ return -EINVAL;
+
+ wmi_ut.args[ATH12K_WMI_INCUMBENT_SIGNAL_TEST_INTF] =
+ ATH12K_WMI_UNIT_TEST_INCUMBENT_SIGNAL_INTF_TYPE;
+ wmi_ut.args[ATH12K_WMI_INCUMBENT_SIGNAL_TEST_BITMAP] =
+ chan_bw_interference_bitmap;
+
+ wmi_ut.vdev_id = arvif->vdev_id;
+ wmi_ut.module_id = ATH12K_WMI_INCUMBENT_SIGNAL_UNIT_TEST_MODULE;
+ wmi_ut.num_args = ATH12K_WMI_INCUMBENT_SIGNAL_MAX_TEST_ARGS;
+ wmi_ut.diag_token = ATH12K_WMI_INCUMBENT_SIGNAL_UNIT_TEST_TOKEN;
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
+ "Triggering incumbent signal interference simulation, interference bitmap: 0x%x\n",
+ chan_bw_interference_bitmap);
+
+ return ath12k_wmi_send_unit_test_cmd(ar, &wmi_ut);
+}
+
int ath12k_wmi_connect(struct ath12k_base *ab)
{
u32 i;
WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281,
+ WMI_TLV_SERVICE_DCS_INCUMBENT_SIGNAL_INTERFERENCE_SUPPORT = 286,
+
WMI_TLV_SERVICE_11BE = 289,
WMI_TLV_SERVICE_WMSK_COMPACTION_RX_TLVS = 361,
DFS_MAX_TEST_ARGS,
};
+#define ATH12K_WMI_INCUMBENT_SIGNAL_UNIT_TEST_MODULE 0x18
+#define ATH12K_WMI_INCUMBENT_SIGNAL_UNIT_TEST_TOKEN 0
+#define ATH12K_WMI_UNIT_TEST_INCUMBENT_SIGNAL_INTF_TYPE 1
+
+enum ath12k_wmi_incumbent_signal_test_args_idx {
+ ATH12K_WMI_INCUMBENT_SIGNAL_TEST_INTF,
+ ATH12K_WMI_INCUMBENT_SIGNAL_TEST_BITMAP,
+ ATH12K_WMI_INCUMBENT_SIGNAL_MAX_TEST_ARGS,
+};
+
/* update if another test command requires more */
#define WMI_UNIT_TEST_ARGS_MAX DFS_MAX_TEST_ARGS
struct ath12k_reg_tpc_power_info *param);
int ath12k_wmi_send_mlo_link_set_active_cmd(struct ath12k_base *ab,
struct wmi_mlo_link_set_active_arg *param);
+int ath12k_wmi_simulate_incumbent_signal_interference(struct ath12k *ar,
+ u32 chan_bw_interference_bitmap);
int ath12k_wmi_alloc(void);
void ath12k_wmi_free(void);