This source file includes following definitions.
- process_rssi
- process_link_qual
- rtl8188e_process_phy_info
- update_recvframe_attrib_88e
- update_recvframe_phyinfo_88e
1
2
3
4
5
6
7 #define _RTL8188E_REDESC_C_
8
9 #include <osdep_service.h>
10 #include <drv_types.h>
11 #include <rtl8188e_hal.h>
12
13 static void process_rssi(struct adapter *padapter, struct recv_frame *prframe)
14 {
15 struct rx_pkt_attrib *pattrib = &prframe->attrib;
16 struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data;
17
18 if (signal_stat->update_req) {
19 signal_stat->total_num = 0;
20 signal_stat->total_val = 0;
21 signal_stat->update_req = 0;
22 }
23
24 signal_stat->total_num++;
25 signal_stat->total_val += pattrib->phy_info.SignalStrength;
26 signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num;
27 }
28
29 static void process_link_qual(struct adapter *padapter,
30 struct 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->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 }
51
52 void rtl8188e_process_phy_info(struct adapter *padapter,
53 struct recv_frame *precvframe)
54 {
55
56 process_rssi(padapter, precvframe);
57
58 process_link_qual(padapter, precvframe);
59 }
60
61 void update_recvframe_attrib_88e(struct recv_frame *precvframe,
62 struct recv_stat *prxstat)
63 {
64 struct rx_pkt_attrib *pattrib;
65 struct recv_stat report;
66
67 report.rxdw0 = prxstat->rxdw0;
68 report.rxdw1 = prxstat->rxdw1;
69 report.rxdw2 = prxstat->rxdw2;
70 report.rxdw3 = prxstat->rxdw3;
71 report.rxdw4 = prxstat->rxdw4;
72 report.rxdw5 = prxstat->rxdw5;
73
74 pattrib = &precvframe->attrib;
75 memset(pattrib, 0, sizeof(struct rx_pkt_attrib));
76
77 pattrib->crc_err = (u8)((le32_to_cpu(report.rxdw0) >> 14) & 0x1);
78
79
80 pattrib->pkt_rpt_type = (u8)((le32_to_cpu(report.rxdw3) >> 14) & 0x3);
81
82 if (pattrib->pkt_rpt_type == NORMAL_RX) {
83 pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);
84 pattrib->drvinfo_sz = (u8)((le32_to_cpu(report.rxdw0) >> 16) & 0xf) * 8;
85
86 pattrib->physt = (u8)((le32_to_cpu(report.rxdw0) >> 26) & 0x1);
87
88 pattrib->bdecrypted = (le32_to_cpu(report.rxdw0) & BIT(27)) ? 0 : 1;
89 pattrib->encrypt = (u8)((le32_to_cpu(report.rxdw0) >> 20) & 0x7);
90
91 pattrib->qos = (u8)((le32_to_cpu(report.rxdw0) >> 23) & 0x1);
92 pattrib->priority = (u8)((le32_to_cpu(report.rxdw1) >> 8) & 0xf);
93
94 pattrib->amsdu = (u8)((le32_to_cpu(report.rxdw1) >> 13) & 0x1);
95
96 pattrib->seq_num = (u16)(le32_to_cpu(report.rxdw2) & 0x00000fff);
97 pattrib->frag_num = (u8)((le32_to_cpu(report.rxdw2) >> 12) & 0xf);
98 pattrib->mfrag = (u8)((le32_to_cpu(report.rxdw1) >> 27) & 0x1);
99 pattrib->mdata = (u8)((le32_to_cpu(report.rxdw1) >> 26) & 0x1);
100
101 pattrib->mcs_rate = (u8)(le32_to_cpu(report.rxdw3) & 0x3f);
102 pattrib->rxht = (u8)((le32_to_cpu(report.rxdw3) >> 6) & 0x1);
103
104 pattrib->icv_err = (u8)((le32_to_cpu(report.rxdw0) >> 15) & 0x1);
105 pattrib->shift_sz = (u8)((le32_to_cpu(report.rxdw0) >> 24) & 0x3);
106 } else if (pattrib->pkt_rpt_type == TX_REPORT1) {
107 pattrib->pkt_len = TX_RPT1_PKT_LEN;
108 pattrib->drvinfo_sz = 0;
109 } else if (pattrib->pkt_rpt_type == TX_REPORT2) {
110 pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x3FF);
111 pattrib->drvinfo_sz = 0;
112
113
114
115
116 pattrib->MacIDValidEntry[0] = le32_to_cpu(report.rxdw4);
117 pattrib->MacIDValidEntry[1] = le32_to_cpu(report.rxdw5);
118
119 } else if (pattrib->pkt_rpt_type == HIS_REPORT) {
120 pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) & 0x00003fff);
121 }
122 }
123
124
125
126
127
128
129 void update_recvframe_phyinfo_88e(struct recv_frame *precvframe,
130 struct phy_stat *pphy_status)
131 {
132 struct adapter *padapter = precvframe->adapter;
133 struct rx_pkt_attrib *pattrib = &precvframe->attrib;
134 struct odm_phy_status_info *pPHYInfo = (struct odm_phy_status_info *)(&pattrib->phy_info);
135 u8 *wlanhdr;
136 struct odm_per_pkt_info pkt_info;
137 u8 *sa = NULL;
138 struct sta_priv *pstapriv;
139 struct sta_info *psta;
140
141 pkt_info.bPacketMatchBSSID = false;
142 pkt_info.bPacketToSelf = false;
143 pkt_info.bPacketBeacon = false;
144
145 wlanhdr = precvframe->pkt->data;
146
147 pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) &&
148 !pattrib->icv_err && !pattrib->crc_err &&
149 !memcmp(get_hdr_bssid(wlanhdr),
150 get_bssid(&padapter->mlmepriv), ETH_ALEN));
151
152 pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID &&
153 (!memcmp(get_da(wlanhdr),
154 myid(&padapter->eeprompriv), ETH_ALEN));
155
156 pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID &&
157 (GetFrameSubType(wlanhdr) == WIFI_BEACON);
158
159 if (pkt_info.bPacketBeacon) {
160 if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
161 sa = padapter->mlmepriv.cur_network.network.MacAddress;
162
163 } else {
164 sa = get_sa(wlanhdr);
165 }
166
167 pstapriv = &padapter->stapriv;
168 pkt_info.StationID = 0xFF;
169 psta = rtw_get_stainfo(pstapriv, sa);
170 if (psta)
171 pkt_info.StationID = psta->mac_id;
172 pkt_info.Rate = pattrib->mcs_rate;
173
174 ODM_PhyStatusQuery(&padapter->HalData->odmpriv, pPHYInfo,
175 (u8 *)pphy_status, &(pkt_info));
176
177 precvframe->psta = NULL;
178 if (pkt_info.bPacketMatchBSSID &&
179 (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE))) {
180 if (psta) {
181 precvframe->psta = psta;
182 rtl8188e_process_phy_info(padapter, precvframe);
183 }
184 } else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) {
185 if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) {
186 if (psta)
187 precvframe->psta = psta;
188 }
189 rtl8188e_process_phy_info(padapter, precvframe);
190 }
191 }