1 // SPDX-License-Identifier: GPL-2.0 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 * 6 ******************************************************************************/ 7 #define _RTL8723B_REDESC_C_ 8 9 #include <rtl8723b_hal.h> 10 11 static void process_rssi(struct adapter *padapter, union recv_frame *prframe) 12 { 13 struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; 14 struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data; 15 16 /* DBG_8192C("process_rssi => pattrib->rssil(%d) signal_strength(%d)\n ", pattrib->RecvSignalPower, pattrib->signal_strength); */ 17 /* if (pRfd->Status.bPacketToSelf || pRfd->Status.bPacketBeacon) */ 18 { 19 if (signal_stat->update_req) { 20 signal_stat->total_num = 0; 21 signal_stat->total_val = 0; 22 signal_stat->update_req = 0; 23 } 24 25 signal_stat->total_num++; 26 signal_stat->total_val += pattrib->phy_info.SignalStrength; 27 signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; 28 } 29 30 } /* Process_UI_RSSI_8192C */ 31 32 static void process_link_qual(struct adapter *padapter, union recv_frame *prframe) 33 { 34 struct rx_pkt_attrib *pattrib; 35 struct signal_stat *signal_stat; 36 37 if (!prframe || !padapter) 38 return; 39 40 pattrib = &prframe->u.hdr.attrib; 41 signal_stat = &padapter->recvpriv.signal_qual_data; 42 43 /* DBG_8192C("process_link_qual => pattrib->signal_qual(%d)\n ", pattrib->signal_qual); */ 44 45 if (signal_stat->update_req) { 46 signal_stat->total_num = 0; 47 signal_stat->total_val = 0; 48 signal_stat->update_req = 0; 49 } 50 51 signal_stat->total_num++; 52 signal_stat->total_val += pattrib->phy_info.SignalQuality; 53 signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; 54 } /* Process_UiLinkQuality8192S */ 55 56 57 void rtl8723b_process_phy_info(struct adapter *padapter, void *prframe) 58 { 59 union recv_frame *precvframe = prframe; 60 /* */ 61 /* Check RSSI */ 62 /* */ 63 process_rssi(padapter, precvframe); 64 /* */ 65 /* Check PWDB. */ 66 /* */ 67 /* process_PWDB(padapter, precvframe); */ 68 69 /* UpdateRxSignalStatistics8192C(Adapter, pRfd); */ 70 /* */ 71 /* Check EVM */ 72 /* */ 73 process_link_qual(padapter, precvframe); 74 #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 75 rtw_store_phy_info(padapter, prframe); 76 #endif 77 78 } 79