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