mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-28 15:13:39 +00:00
rtl8188eu: Fix reporting of signal strength and quality
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
3291571570
commit
295bb23ffe
6 changed files with 33 additions and 25 deletions
|
@ -548,20 +548,20 @@ _func_enter_;
|
||||||
sq_final = padapter->recvpriv.signal_qual;
|
sq_final = padapter->recvpriv.signal_qual;
|
||||||
/* the rssi value here is undecorated, and will be used for antenna diversity */
|
/* the rssi value here is undecorated, and will be used for antenna diversity */
|
||||||
if (sq_smp != 101) /* from the right channel */
|
if (sq_smp != 101) /* from the right channel */
|
||||||
rssi_final = (src->Rssi+dst->Rssi*4)/5;
|
rssi_final = dst->Rssi; //(src->Rssi+dst->Rssi*4)/5;
|
||||||
else
|
else
|
||||||
rssi_final = rssi_ori;
|
rssi_final = rssi_ori;
|
||||||
} else {
|
} else {
|
||||||
if (sq_smp != 101) { /* from the right channel */
|
// if (sq_smp != 101) { /* from the right channel */
|
||||||
ss_final = ((u32)(src->PhyInfo.SignalStrength)+(u32)(dst->PhyInfo.SignalStrength)*4)/5;
|
ss_final = (u32)dst->PhyInfo.SignalStrength; //((u32)(src->PhyInfo.SignalStrength)+(u32)(dst->PhyInfo.SignalStrength)*4)/5;
|
||||||
sq_final = ((u32)(src->PhyInfo.SignalQuality)+(u32)(dst->PhyInfo.SignalQuality)*4)/5;
|
sq_final = (u32)dst->PhyInfo.SignalQuality; //((u32)(src->PhyInfo.SignalQuality)+(u32)(dst->PhyInfo.SignalQuality)*4)/5;
|
||||||
rssi_final = (src->Rssi+dst->Rssi*4)/5;
|
rssi_final = dst->Rssi; //(src->Rssi+dst->Rssi*4)/5;
|
||||||
} else {
|
// } else {
|
||||||
/* bss info not receiving from the right channel, use the original RX signal infos */
|
// /* bss info not receiving from the right channel, use the original RX signal infos */
|
||||||
ss_final = dst->PhyInfo.SignalStrength;
|
// ss_final = dst->PhyInfo.SignalStrength;
|
||||||
sq_final = dst->PhyInfo.SignalQuality;
|
// sq_final = dst->PhyInfo.SignalQuality;
|
||||||
rssi_final = dst->Rssi;
|
// rssi_final = dst->Rssi;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
if (update_ie)
|
if (update_ie)
|
||||||
memcpy((u8 *)dst, (u8 *)src, get_wlan_bssid_ex_sz(src));
|
memcpy((u8 *)dst, (u8 *)src, get_wlan_bssid_ex_sz(src));
|
||||||
|
|
|
@ -119,7 +119,8 @@ static u8 odm_EVMdbToPercentage(s8 Value)
|
||||||
static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
|
static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
|
||||||
struct odm_phy_status_info *pPhyInfo,
|
struct odm_phy_status_info *pPhyInfo,
|
||||||
u8 *pPhyStatus,
|
u8 *pPhyStatus,
|
||||||
struct odm_per_pkt_info *pPktinfo)
|
struct odm_per_pkt_info *pPktinfo,
|
||||||
|
struct adapter *adapt)
|
||||||
{
|
{
|
||||||
struct sw_ant_switch *pDM_SWAT_Table = &dm_odm->DM_SWAT_Table;
|
struct sw_ant_switch *pDM_SWAT_Table = &dm_odm->DM_SWAT_Table;
|
||||||
u8 i, Max_spatial_stream;
|
u8 i, Max_spatial_stream;
|
||||||
|
@ -298,6 +299,8 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
|
||||||
rf_rx_num++;
|
rf_rx_num++;
|
||||||
|
|
||||||
rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain & 0x3F)*2) - 110;
|
rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain & 0x3F)*2) - 110;
|
||||||
|
if (i == RF_PATH_A)
|
||||||
|
adapt->signal_strength = rx_pwr[i];
|
||||||
|
|
||||||
pPhyInfo->RxPwr[i] = rx_pwr[i];
|
pPhyInfo->RxPwr[i] = rx_pwr[i];
|
||||||
|
|
||||||
|
@ -526,10 +529,11 @@ static void odm_Process_RSSIForDM(struct odm_dm_struct *dm_odm,
|
||||||
static void ODM_PhyStatusQuery_92CSeries(struct odm_dm_struct *dm_odm,
|
static void ODM_PhyStatusQuery_92CSeries(struct odm_dm_struct *dm_odm,
|
||||||
struct odm_phy_status_info *pPhyInfo,
|
struct odm_phy_status_info *pPhyInfo,
|
||||||
u8 *pPhyStatus,
|
u8 *pPhyStatus,
|
||||||
struct odm_per_pkt_info *pPktinfo)
|
struct odm_per_pkt_info *pPktinfo,
|
||||||
|
struct adapter *adapt)
|
||||||
{
|
{
|
||||||
odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
|
odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
|
||||||
pPktinfo);
|
pPktinfo, adapt);
|
||||||
if (dm_odm->RSSI_test) {
|
if (dm_odm->RSSI_test) {
|
||||||
/* Select the packets to do RSSI checking for antenna switching. */
|
/* Select the packets to do RSSI checking for antenna switching. */
|
||||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
|
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
|
||||||
|
@ -541,9 +545,10 @@ static void ODM_PhyStatusQuery_92CSeries(struct odm_dm_struct *dm_odm,
|
||||||
|
|
||||||
void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
|
void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
|
||||||
struct odm_phy_status_info *pPhyInfo,
|
struct odm_phy_status_info *pPhyInfo,
|
||||||
u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo)
|
u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo,
|
||||||
|
struct adapter *adapt)
|
||||||
{
|
{
|
||||||
ODM_PhyStatusQuery_92CSeries(dm_odm, pPhyInfo, pPhyStatus, pPktinfo);
|
ODM_PhyStatusQuery_92CSeries(dm_odm, pPhyInfo, pPhyStatus, pPktinfo, adapt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For future use. */
|
/* For future use. */
|
||||||
|
|
|
@ -183,7 +183,7 @@ void update_recvframe_phyinfo_88e(union recv_frame *precvframe, struct phy_stat
|
||||||
pkt_info.StationID = psta->mac_id;
|
pkt_info.StationID = psta->mac_id;
|
||||||
pkt_info.Rate = pattrib->mcs_rate;
|
pkt_info.Rate = pattrib->mcs_rate;
|
||||||
|
|
||||||
ODM_PhyStatusQuery(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status, &(pkt_info));
|
ODM_PhyStatusQuery(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status, &(pkt_info), padapter);
|
||||||
|
|
||||||
precvframe->u.hdr.psta = NULL;
|
precvframe->u.hdr.psta = NULL;
|
||||||
if (pkt_info.bPacketMatchBSSID &&
|
if (pkt_info.bPacketMatchBSSID &&
|
||||||
|
|
|
@ -192,6 +192,7 @@ struct dvobj_priv {
|
||||||
struct usb_device *pusbdev;
|
struct usb_device *pusbdev;
|
||||||
|
|
||||||
ATOMIC_T continual_urb_error;
|
ATOMIC_T continual_urb_error;
|
||||||
|
u8 signal_strength;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
|
static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
|
||||||
|
@ -266,6 +267,7 @@ struct adapter {
|
||||||
u8 bDriverIsGoingToUnload;
|
u8 bDriverIsGoingToUnload;
|
||||||
u8 init_adpt_in_progress;
|
u8 init_adpt_in_progress;
|
||||||
u8 bHaltInProgress;
|
u8 bHaltInProgress;
|
||||||
|
s8 signal_strength;
|
||||||
|
|
||||||
void *cmdThread;
|
void *cmdThread;
|
||||||
void *evtThread;
|
void *evtThread;
|
||||||
|
|
|
@ -111,7 +111,8 @@ void odm_Init_RSSIForDM(struct odm_dm_struct *pDM_Odm);
|
||||||
void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm,
|
void ODM_PhyStatusQuery(struct odm_dm_struct *pDM_Odm,
|
||||||
struct odm_phy_status_info *pPhyInfo,
|
struct odm_phy_status_info *pPhyInfo,
|
||||||
u8 *pPhyStatus,
|
u8 *pPhyStatus,
|
||||||
struct odm_per_pkt_info *pPktinfo);
|
struct odm_per_pkt_info *pPktinfo,
|
||||||
|
struct adapter *adapt);
|
||||||
|
|
||||||
void ODM_MacStatusQuery(struct odm_dm_struct *pDM_Odm,
|
void ODM_MacStatusQuery(struct odm_dm_struct *pDM_Odm,
|
||||||
u8 *pMacStatus,
|
u8 *pMacStatus,
|
||||||
|
|
|
@ -7832,24 +7832,24 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||||
struct iw_statistics *piwstats = &padapter->iwstats;
|
struct iw_statistics *piwstats = &padapter->iwstats;
|
||||||
int tmp_level = 0;
|
|
||||||
int tmp_qual = 0;
|
|
||||||
int tmp_noise = 0;
|
int tmp_noise = 0;
|
||||||
|
int tmp;
|
||||||
|
|
||||||
if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
|
if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
|
||||||
piwstats->qual.qual = 0;
|
piwstats->qual.qual = 0;
|
||||||
piwstats->qual.level = 0;
|
piwstats->qual.level = 0;
|
||||||
piwstats->qual.noise = 0;
|
piwstats->qual.noise = 0;
|
||||||
} else {
|
} else {
|
||||||
tmp_level = padapter->recvpriv.signal_strength;
|
|
||||||
tmp_qual = padapter->recvpriv.signal_qual;
|
|
||||||
tmp_noise = padapter->recvpriv.noise;
|
tmp_noise = padapter->recvpriv.noise;
|
||||||
|
|
||||||
piwstats->qual.level = tmp_level;
|
piwstats->qual.level = padapter->signal_strength;
|
||||||
piwstats->qual.qual = tmp_qual;
|
tmp = 219 + 3 * padapter->signal_strength;
|
||||||
|
tmp = min(100, tmp);
|
||||||
|
tmp = max(0, tmp);
|
||||||
|
piwstats->qual.qual = tmp;
|
||||||
piwstats->qual.noise = tmp_noise;
|
piwstats->qual.noise = tmp_noise;
|
||||||
}
|
}
|
||||||
piwstats->qual.updated = IW_QUAL_ALL_UPDATED;/* IW_QUAL_DBM; */
|
piwstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
|
||||||
return &padapter->iwstats;
|
return &padapter->iwstats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue