1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-25 06:34:10 +00:00

Merge pull request #1122 from bwh-mind/rssi-notif

ioctl_cfg80211: Add support for standard RSSI notifications
This commit is contained in:
Christian Bremvåg 2023-11-17 20:11:47 +01:00 committed by GitHub
commit a3e0c0b6d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

View File

@ -1971,6 +1971,12 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame)
#if 0 /* move to validate_recv_mgnt_frame */
psta->sta_stats.rx_mgnt_pkts++;
#endif
#if defined(CONFIG_IOCTL_CFG80211)
rtw_cfg80211_cqm_rssi_update(
padapter,
pmlmepriv->cur_network_scanned->network.Rssi);
#endif
}
} else if ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) {

View File

@ -4476,6 +4476,47 @@ static int cfg80211_rtw_flush_pmksa(struct wiphy *wiphy,
return 0;
}
static int cfg80211_rtw_set_cqm_rssi_config(struct wiphy *wiphy,
struct net_device *ndev,
s32 rssi_thold, u32 rssi_hyst)
{
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
struct rtw_wdev_priv *priv = adapter_wdev_data(padapter);
priv->cqm_rssi_thold = rssi_thold;
priv->cqm_rssi_hyst = rssi_hyst;
priv->cqm_rssi_last = 0;
return 0;
}
void rtw_cfg80211_cqm_rssi_update(_adapter *padapter, s32 rssi)
{
struct rtw_wdev_priv *priv = adapter_wdev_data(padapter);
enum nl80211_cqm_rssi_threshold_event event;
if (priv->cqm_rssi_thold == 0)
return;
if (rssi < priv->cqm_rssi_thold &&
(priv->cqm_rssi_last == 0 ||
rssi < priv->cqm_rssi_last - priv->cqm_rssi_hyst))
event = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW;
else if (rssi > priv->cqm_rssi_thold &&
(priv->cqm_rssi_last == 0 ||
rssi > priv->cqm_rssi_last + priv->cqm_rssi_hyst))
event = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH;
else
return;
priv->cqm_rssi_last = rssi;
cfg80211_cqm_rssi_notify(padapter->pnetdev, event,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
rssi,
#endif
GFP_ATOMIC);
}
#ifdef CONFIG_AP_MODE
void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len)
{
@ -10157,6 +10198,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
.set_pmksa = cfg80211_rtw_set_pmksa,
.del_pmksa = cfg80211_rtw_del_pmksa,
.flush_pmksa = cfg80211_rtw_flush_pmksa,
.set_cqm_rssi_config = cfg80211_rtw_set_cqm_rssi_config,
#ifdef RTW_VIRTUAL_INT
.add_virtual_intf = cfg80211_rtw_add_virtual_intf,

View File

@ -185,6 +185,11 @@ struct rtw_wdev_priv {
u16 pno_scan_seq_num;
#endif
/* Standard RSSI notification parameters */
s32 cqm_rssi_thold;
u32 cqm_rssi_hyst;
s32 cqm_rssi_last;
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR
s8 rssi_monitor_max;
s8 rssi_monitor_min;
@ -351,6 +356,8 @@ void rtw_cfg80211_init_rfkill(struct wiphy *wiphy);
void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy);
#endif
void rtw_cfg80211_cqm_rssi_update(_adapter *padapter, s32 rssi);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) && !defined(COMPAT_KERNEL_RELEASE)
#define rtw_cfg80211_rx_mgmt(wdev, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt(wdev_to_ndev(wdev), freq, buf, len, gfp)
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))