Loading drivers/net/wireless/ath/wil6210/main.c +7 −3 Original line number Diff line number Diff line Loading @@ -1617,14 +1617,18 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw) return rc; } if (wil->tt_data_set) wmi_set_tt_cfg(wil, &wil->tt_data); wil_collect_fw_info(wil); if (wil->ps_profile != WMI_PS_PROFILE_TYPE_DEFAULT) wil_ps_update(wil, wil->ps_profile); if (wil->tt_data_set) wmi_set_tt_cfg(wil, &wil->tt_data); if (wil->snr_thresh.enabled) wmi_set_snr_thresh(wil, wil->snr_thresh.omni, wil->snr_thresh.direct); if (wil->platform_ops.notify) { rc = wil->platform_ops.notify(wil->platform_handle, WIL_PLATFORM_EVT_FW_RDY); Loading drivers/net/wireless/ath/wil6210/sysfs.c +37 −0 Original line number Diff line number Diff line Loading @@ -253,10 +253,47 @@ fst_link_loss_store(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR_RW(fst_link_loss); static ssize_t snr_thresh_show(struct device *dev, struct device_attribute *attr, char *buf) { struct wil6210_priv *wil = dev_get_drvdata(dev); ssize_t len = 0; if (wil->snr_thresh.enabled) len = snprintf(buf, PAGE_SIZE, "omni=%d, direct=%d\n", wil->snr_thresh.omni, wil->snr_thresh.direct); return len; } static ssize_t snr_thresh_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct wil6210_priv *wil = dev_get_drvdata(dev); int rc; short omni, direct; /* to disable snr threshold, set both omni and direct to 0 */ if (sscanf(buf, "%hd %hd", &omni, &direct) != 2) return -EINVAL; rc = wmi_set_snr_thresh(wil, omni, direct); if (!rc) rc = count; return rc; } static DEVICE_ATTR_RW(snr_thresh); static struct attribute *wil6210_sysfs_entries[] = { &dev_attr_ftm_txrx_offset.attr, &dev_attr_thermal_throttling.attr, &dev_attr_fst_link_loss.attr, &dev_attr_snr_thresh.attr, NULL }; Loading drivers/net/wireless/ath/wil6210/wil6210.h +7 −0 Original line number Diff line number Diff line Loading @@ -991,6 +991,11 @@ struct wil6210_priv { int fw_calib_result; u8 tt_data_set; struct wmi_tt_data tt_data; struct { u8 enabled; short omni; short direct; } snr_thresh; struct notifier_block pm_notify; Loading Loading @@ -1367,6 +1372,8 @@ int wmi_link_maintain_cfg_write(struct wil6210_priv *wil, const u8 *addr, bool fst_link_loss); int wmi_set_snr_thresh(struct wil6210_priv *wil, short omni, short direct); int wmi_start_sched_scan(struct wil6210_priv *wil, struct cfg80211_sched_scan_request *request); int wmi_stop_sched_scan(struct wil6210_priv *wil); Loading drivers/net/wireless/ath/wil6210/wmi.c +39 −3 Original line number Diff line number Diff line Loading @@ -777,7 +777,7 @@ static void wmi_evt_rx_mgmt(struct wil6210_vif *vif, int id, void *d, int len) s32 signal; __le16 fc; u32 d_len; u16 d_status; s16 snr; if (flen < 0) { wil_err(wil, "MGMT Rx: short event, len %d\n", len); Loading @@ -799,13 +799,13 @@ static void wmi_evt_rx_mgmt(struct wil6210_vif *vif, int id, void *d, int len) signal = 100 * data->info.rssi; else signal = data->info.sqi; d_status = le16_to_cpu(data->info.status); snr = le16_to_cpu(data->info.snr); /* 1/4 dB units */ fc = rx_mgmt_frame->frame_control; wil_dbg_wmi(wil, "MGMT Rx: channel %d MCS %d RSSI %d SQI %d%%\n", data->info.channel, data->info.mcs, data->info.rssi, data->info.sqi); wil_dbg_wmi(wil, "status 0x%04x len %d fc 0x%04x\n", d_status, d_len, wil_dbg_wmi(wil, "snr %ddB len %d fc 0x%04x\n", snr / 4, d_len, le16_to_cpu(fc)); wil_dbg_wmi(wil, "qid %d mid %d cid %d\n", data->info.qid, data->info.mid, data->info.cid); Loading Loading @@ -833,6 +833,11 @@ static void wmi_evt_rx_mgmt(struct wil6210_vif *vif, int id, void *d, int len) wil_dbg_wmi(wil, "Capability info : 0x%04x\n", cap); if (wil->snr_thresh.enabled && snr < wil->snr_thresh.omni) { wil_dbg_wmi(wil, "snr below threshold. dropping\n"); return; } bss = cfg80211_inform_bss_frame(wiphy, channel, rx_mgmt_frame, d_len, signal, GFP_KERNEL); if (bss) { Loading Loading @@ -3054,6 +3059,37 @@ bool wil_is_wmi_idle(struct wil6210_priv *wil) return rc; } int wmi_set_snr_thresh(struct wil6210_priv *wil, short omni, short direct) { struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev); int rc; struct wmi_set_connect_snr_thr_cmd cmd = { .enable = true, .omni_snr_thr = cpu_to_le16(omni), .direct_snr_thr = cpu_to_le16(direct), }; if (!test_bit(WMI_FW_CAPABILITY_CONNECT_SNR_THR, wil->fw_capabilities)) return -ENOTSUPP; if (omni == 0 && direct == 0) cmd.enable = false; wil_dbg_wmi(wil, "%s snr thresh omni=%d, direct=%d (1/4 dB units)\n", cmd.enable ? "enable" : "disable", omni, direct); rc = wmi_send(wil, WMI_SET_CONNECT_SNR_THR_CMDID, vif->mid, &cmd, sizeof(cmd)); if (rc) return rc; wil->snr_thresh.enabled = cmd.enable; wil->snr_thresh.omni = omni; wil->snr_thresh.direct = direct; return 0; } static void wmi_sched_scan_set_ssids(struct wil6210_priv *wil, struct wmi_start_sched_scan_cmd *cmd, Loading drivers/net/wireless/ath/wil6210/wmi.h +4 −14 Original line number Diff line number Diff line /* SPDX-License-Identifier: ISC */ /* * Copyright (c) 2018, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. * Copyright (c) 2006-2012 Wilocity * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Loading Loading @@ -95,6 +84,7 @@ enum wmi_fw_capability { WMI_FW_CAPABILITY_SET_SILENT_RSSI_TABLE = 13, WMI_FW_CAPABILITY_LO_POWER_CALIB_FROM_OTP = 14, WMI_FW_CAPABILITY_PNO = 15, WMI_FW_CAPABILITY_CONNECT_SNR_THR = 16, WMI_FW_CAPABILITY_REF_CLOCK_CONTROL = 18, WMI_FW_CAPABILITY_AP_SME_OFFLOAD_NONE = 19, WMI_FW_CAPABILITY_MULTI_VIFS = 20, Loading Loading @@ -2379,7 +2369,7 @@ struct wmi_rx_mgmt_info { u8 range; u8 sqi; __le16 stype; __le16 status; __le16 snr; __le32 len; /* Not resolved when == 0xFFFFFFFF == > Broadcast to all MIDS */ u8 qid; Loading Loading
drivers/net/wireless/ath/wil6210/main.c +7 −3 Original line number Diff line number Diff line Loading @@ -1617,14 +1617,18 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw) return rc; } if (wil->tt_data_set) wmi_set_tt_cfg(wil, &wil->tt_data); wil_collect_fw_info(wil); if (wil->ps_profile != WMI_PS_PROFILE_TYPE_DEFAULT) wil_ps_update(wil, wil->ps_profile); if (wil->tt_data_set) wmi_set_tt_cfg(wil, &wil->tt_data); if (wil->snr_thresh.enabled) wmi_set_snr_thresh(wil, wil->snr_thresh.omni, wil->snr_thresh.direct); if (wil->platform_ops.notify) { rc = wil->platform_ops.notify(wil->platform_handle, WIL_PLATFORM_EVT_FW_RDY); Loading
drivers/net/wireless/ath/wil6210/sysfs.c +37 −0 Original line number Diff line number Diff line Loading @@ -253,10 +253,47 @@ fst_link_loss_store(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR_RW(fst_link_loss); static ssize_t snr_thresh_show(struct device *dev, struct device_attribute *attr, char *buf) { struct wil6210_priv *wil = dev_get_drvdata(dev); ssize_t len = 0; if (wil->snr_thresh.enabled) len = snprintf(buf, PAGE_SIZE, "omni=%d, direct=%d\n", wil->snr_thresh.omni, wil->snr_thresh.direct); return len; } static ssize_t snr_thresh_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct wil6210_priv *wil = dev_get_drvdata(dev); int rc; short omni, direct; /* to disable snr threshold, set both omni and direct to 0 */ if (sscanf(buf, "%hd %hd", &omni, &direct) != 2) return -EINVAL; rc = wmi_set_snr_thresh(wil, omni, direct); if (!rc) rc = count; return rc; } static DEVICE_ATTR_RW(snr_thresh); static struct attribute *wil6210_sysfs_entries[] = { &dev_attr_ftm_txrx_offset.attr, &dev_attr_thermal_throttling.attr, &dev_attr_fst_link_loss.attr, &dev_attr_snr_thresh.attr, NULL }; Loading
drivers/net/wireless/ath/wil6210/wil6210.h +7 −0 Original line number Diff line number Diff line Loading @@ -991,6 +991,11 @@ struct wil6210_priv { int fw_calib_result; u8 tt_data_set; struct wmi_tt_data tt_data; struct { u8 enabled; short omni; short direct; } snr_thresh; struct notifier_block pm_notify; Loading Loading @@ -1367,6 +1372,8 @@ int wmi_link_maintain_cfg_write(struct wil6210_priv *wil, const u8 *addr, bool fst_link_loss); int wmi_set_snr_thresh(struct wil6210_priv *wil, short omni, short direct); int wmi_start_sched_scan(struct wil6210_priv *wil, struct cfg80211_sched_scan_request *request); int wmi_stop_sched_scan(struct wil6210_priv *wil); Loading
drivers/net/wireless/ath/wil6210/wmi.c +39 −3 Original line number Diff line number Diff line Loading @@ -777,7 +777,7 @@ static void wmi_evt_rx_mgmt(struct wil6210_vif *vif, int id, void *d, int len) s32 signal; __le16 fc; u32 d_len; u16 d_status; s16 snr; if (flen < 0) { wil_err(wil, "MGMT Rx: short event, len %d\n", len); Loading @@ -799,13 +799,13 @@ static void wmi_evt_rx_mgmt(struct wil6210_vif *vif, int id, void *d, int len) signal = 100 * data->info.rssi; else signal = data->info.sqi; d_status = le16_to_cpu(data->info.status); snr = le16_to_cpu(data->info.snr); /* 1/4 dB units */ fc = rx_mgmt_frame->frame_control; wil_dbg_wmi(wil, "MGMT Rx: channel %d MCS %d RSSI %d SQI %d%%\n", data->info.channel, data->info.mcs, data->info.rssi, data->info.sqi); wil_dbg_wmi(wil, "status 0x%04x len %d fc 0x%04x\n", d_status, d_len, wil_dbg_wmi(wil, "snr %ddB len %d fc 0x%04x\n", snr / 4, d_len, le16_to_cpu(fc)); wil_dbg_wmi(wil, "qid %d mid %d cid %d\n", data->info.qid, data->info.mid, data->info.cid); Loading Loading @@ -833,6 +833,11 @@ static void wmi_evt_rx_mgmt(struct wil6210_vif *vif, int id, void *d, int len) wil_dbg_wmi(wil, "Capability info : 0x%04x\n", cap); if (wil->snr_thresh.enabled && snr < wil->snr_thresh.omni) { wil_dbg_wmi(wil, "snr below threshold. dropping\n"); return; } bss = cfg80211_inform_bss_frame(wiphy, channel, rx_mgmt_frame, d_len, signal, GFP_KERNEL); if (bss) { Loading Loading @@ -3054,6 +3059,37 @@ bool wil_is_wmi_idle(struct wil6210_priv *wil) return rc; } int wmi_set_snr_thresh(struct wil6210_priv *wil, short omni, short direct) { struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev); int rc; struct wmi_set_connect_snr_thr_cmd cmd = { .enable = true, .omni_snr_thr = cpu_to_le16(omni), .direct_snr_thr = cpu_to_le16(direct), }; if (!test_bit(WMI_FW_CAPABILITY_CONNECT_SNR_THR, wil->fw_capabilities)) return -ENOTSUPP; if (omni == 0 && direct == 0) cmd.enable = false; wil_dbg_wmi(wil, "%s snr thresh omni=%d, direct=%d (1/4 dB units)\n", cmd.enable ? "enable" : "disable", omni, direct); rc = wmi_send(wil, WMI_SET_CONNECT_SNR_THR_CMDID, vif->mid, &cmd, sizeof(cmd)); if (rc) return rc; wil->snr_thresh.enabled = cmd.enable; wil->snr_thresh.omni = omni; wil->snr_thresh.direct = direct; return 0; } static void wmi_sched_scan_set_ssids(struct wil6210_priv *wil, struct wmi_start_sched_scan_cmd *cmd, Loading
drivers/net/wireless/ath/wil6210/wmi.h +4 −14 Original line number Diff line number Diff line /* SPDX-License-Identifier: ISC */ /* * Copyright (c) 2018, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. * Copyright (c) 2006-2012 Wilocity * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Loading Loading @@ -95,6 +84,7 @@ enum wmi_fw_capability { WMI_FW_CAPABILITY_SET_SILENT_RSSI_TABLE = 13, WMI_FW_CAPABILITY_LO_POWER_CALIB_FROM_OTP = 14, WMI_FW_CAPABILITY_PNO = 15, WMI_FW_CAPABILITY_CONNECT_SNR_THR = 16, WMI_FW_CAPABILITY_REF_CLOCK_CONTROL = 18, WMI_FW_CAPABILITY_AP_SME_OFFLOAD_NONE = 19, WMI_FW_CAPABILITY_MULTI_VIFS = 20, Loading Loading @@ -2379,7 +2369,7 @@ struct wmi_rx_mgmt_info { u8 range; u8 sqi; __le16 stype; __le16 status; __le16 snr; __le32 len; /* Not resolved when == 0xFFFFFFFF == > Broadcast to all MIDS */ u8 qid; Loading