43 DMESG(
"Enabling beacon TX");
68 switch (priv->
rtllib->iw_mode) {
93 if (priv->
rtllib->LedControlHandler)
94 priv->
rtllib->LedControlHandler(dev, LedAction);
144 Type = ((
u8 *)(val))[0];
150 else if (Type ==
false)
183 u8 pAcParam = *((
u8 *)val);
189 &priv->
rtllib->current_network.qos_data.parameters;
191 u1bAIFS = qos_parameters->
aifs[pAcParam] *
198 (((
u32)(qos_parameters->
cw_max[pAcParam])) <<
200 (((
u32)(qos_parameters->
cw_min[pAcParam])) <<
205 __func__, eACI, u4bAcParam);
236 &priv->
rtllib->current_network.qos_data.parameters;
237 u8 pAcParam = *((
u8 *)val);
240 (qos_parameters->
aifs[0]);
241 u8 acm = pAciAifsn->
f.acm;
246 AcmCtrl = AcmCtrl | ((priv->
AcmMethod == 2) ? 0x0 : 0x1);
264 "ACM_CTRL] acm set failed: eACI is "
300 u8 Rf_Timing = *((
u8 *)val);
311 static void rtl8192_read_eeprom_info(
struct net_device *dev)
316 u8 ICVer8192, ICVer8256;
317 u16 i, usValue, IC_Version;
319 u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01};
339 IC_Version = ((usValue&0xff00)>>8);
341 ICVer8192 = (IC_Version&0xf);
342 ICVer8256 = ((IC_Version&0xf0)>>4);
345 if (ICVer8192 == 0x2) {
346 if (ICVer8256 == 0x5)
374 for (i = 0; i < 6; i += 2) {
437 for (i = 0; i < 14; i += 2) {
450 " %d = 0x%02x\n", i+1,
453 for (i = 0; i < 14; i += 2) {
463 " Index %d = 0x%02x\n", i,
466 " Index %d = 0x%02x\n", i + 1,
471 for (i = 0; i < 14; i++) {
492 for (i = 0; i < 3; i++) {
502 for (i = 3; i < 9; i++) {
512 for (i = 9; i < 14; i++) {
522 for (i = 0; i < 14; i++)
526 for (i = 0; i < 14; i++)
528 "24G_A[%d] = 0x%x\n", i,
530 for (i = 0; i < 14; i++)
534 for (i = 0; i < 14; i++)
536 "24G_C[%d] = 0x%x\n", i,
614 priv->
rtllib->bSupportRemoteWakeUp =
true;
616 priv->
rtllib->bSupportRemoteWakeUp =
false;
636 rtl8192_read_eeprom_info(dev);
641 u32 regRATR = 0, regRRSR = 0;
642 u8 regBwOpMode = 0, regTmp = 0;
645 switch (priv->
rtllib->mode) {
684 ratr_value = regRATR;
691 regRRSR = ((regTmp) << 24) | (regRRSR & 0x00ffffff);
703 bool rtStatus =
true;
705 u8 ICVersion, SwitchingRegulatorOutput;
706 bool bfirmwareok =
true;
707 u32 tmpRegA, tmpRegC, TempCCk;
733 "\n", __func__, priv->
pFirmware->firmware_status);
738 if (ICVersion >= 0x4) {
740 if (SwitchingRegulatorOutput != 0xb8) {
748 if (rtStatus !=
true) {
847 if (retry_times < 10) {
859 if (rtStatus !=
true) {
874 "%s(): Turn off RF for RegRfOff ----------\n",
879 " RfOffReason(%d) ----------\n", __func__,
880 priv->
rtllib->RfOffReason);
885 " RfOffReason(%d) ----------\n", __func__,
886 priv->
rtllib->RfOffReason);
893 priv->
rtllib->RfOffReason = 0;
935 "trackingindex_initial = %d\n",
938 "trackingindex_real__initial = %d\n",
941 "Attentuation_difference_initial = %d\n",
944 "Attentuation_initial = %d\n",
960 u16 BcnTimeCfg = 0, BcnCW = 6, BcnIFS = 0xf;
963 net = &priv->
rtllib->current_network;
994 priv->
ops->update_ratr_table(dev);
1001 rtl8192e_update_msr(dev);
1019 bool bAllowAllDA,
bool WriteIntoReg)
1130 static u8 rtl8192_MapHwQueueToFirmwareQueue(
u8 QueueID,
u8 priority)
1132 u8 QueueSelect = 0x0;
1192 pTxFwInfo->
RxMF = 0;
1193 pTxFwInfo->
RxAMD = 0;
1237 switch (priv->
rtllib->pairwise_key_type) {
1260 pdesc->
QueueSelect = rtl8192_MapHwQueueToFirmwareQueue(
1349 "Rate [%x], bIsHT = %d!!!\n", rate, bIsHT);
1404 ret_rate = (0x80|0x20);
1409 "Rate [%x], bIsHT = %d!!!\n", rate, bIsHT);
1417 static long rtl8192_signal_scale_mapping(
struct r8192_priv *priv,
long currsig)
1421 if (currsig >= 61 && currsig <= 100)
1422 retsig = 90 + ((currsig - 60) / 4);
1423 else if (currsig >= 41 && currsig <= 60)
1424 retsig = 78 + ((currsig - 40) / 2);
1425 else if (currsig >= 31 && currsig <= 40)
1426 retsig = 66 + (currsig - 30);
1427 else if (currsig >= 21 && currsig <= 30)
1428 retsig = 54 + (currsig - 20);
1429 else if (currsig >= 5 && currsig <= 20)
1430 retsig = 42 + (((currsig - 5) * 2) / 3);
1431 else if (currsig == 4)
1433 else if (currsig == 3)
1435 else if (currsig == 2)
1437 else if (currsig == 1)
1446 #define rx_hal_is_cck_rate(_pdrvinfo)\
1447 ((_pdrvinfo->RxRate == DESC90_RATE1M ||\
1448 _pdrvinfo->RxRate == DESC90_RATE2M ||\
1449 _pdrvinfo->RxRate == DESC90_RATE5_5M ||\
1450 _pdrvinfo->RxRate == DESC90_RATE11M) &&\
1453 static void rtl8192_query_rxphystatus(
1459 bool bpacket_match_bssid,
1460 bool bpacket_toself,
1469 u8 i, max_spatial_stream, tmp_rxsnr, tmp_rxevm, rxsc_sgien_exflg;
1470 char rx_pwr[4], rx_pwr_all = 0;
1471 char rx_snrX, rx_evmX;
1473 u32 RSSI, total_rssi = 0;
1476 static u8 check_reg824;
1477 static u32 reg824_bit9;
1479 priv->
stats.numqry_phystatus++;
1484 bpacket_match_bssid;
1489 if (check_reg824 == 0) {
1496 prxpkt = (
u8 *)pdrvinfo;
1511 priv->
stats.numqry_phystatusCCK++;
1563 if (bpacket_match_bssid) {
1571 if (pcck_buf->
sq_rpt > 64)
1573 else if (pcck_buf->
sq_rpt < 20)
1576 sq = ((64-sq) * 100) / 44;
1586 priv->
stats.numqry_phystatusHT++;
1595 rx_snrX = (
char)(tmp_rxsnr);
1603 if (bpacket_match_bssid) {
1611 rx_pwr_all = (((pofdm_buf->
pwdb_all) >> 1) & 0x7f) - 106;
1619 max_spatial_stream = 2;
1621 max_spatial_stream = 1;
1623 for (i = 0; i < max_spatial_stream; i++) {
1625 rx_evmX = (
char)(tmp_rxevm);
1630 if (bpacket_match_bssid) {
1649 priv->
stats.received_bwtype[1+prxsc->
rxsc]++;
1651 priv->
stats.received_bwtype[0]++;
1656 (
u8)(rtl8192_signal_scale_mapping(priv,
1662 (
u8)(rtl8192_signal_scale_mapping(priv,
1663 (
long)(total_rssi /= rf_rx_num)));
1671 bool bcheck =
false;
1674 static u32 slide_rssi_index, slide_rssi_statistics;
1675 static u32 slide_evm_index, slide_evm_statistics;
1676 static u32 last_rssi, last_evm;
1677 static u32 slide_beacon_adc_pwdb_index;
1678 static u32 slide_beacon_adc_pwdb_statistics;
1679 static u32 last_beacon_adc_pwdb;
1694 last_rssi = priv->
stats.slide_signal_strength[slide_rssi_index];
1695 priv->
stats.slide_rssi_total -= last_rssi;
1699 priv->
stats.slide_signal_strength[slide_rssi_index++] =
1702 slide_rssi_index = 0;
1704 tmp_val = priv->
stats.slide_rssi_total/slide_rssi_statistics;
1707 curr_st->
rssi = priv->
stats.signal_strength;
1718 priv->
stats.num_process_phyinfo++;
1725 "SignalStrength[rfpath] = %d\n",
1727 if (priv->
stats.rx_rssi_percentage[rfpath] == 0) {
1728 priv->
stats.rx_rssi_percentage[rfpath] =
1732 priv->
stats.rx_rssi_percentage[rfpath]) {
1733 priv->
stats.rx_rssi_percentage[rfpath] =
1734 ((priv->
stats.rx_rssi_percentage[rfpath]
1738 priv->
stats.rx_rssi_percentage[rfpath] =
1739 priv->
stats.rx_rssi_percentage[rfpath]
1742 priv->
stats.rx_rssi_percentage[rfpath] =
1743 ((priv->
stats.rx_rssi_percentage[rfpath] *
1749 "Percentage[rfPath] = %d\n",
1750 priv->
stats.rx_rssi_percentage[rfpath]);
1756 if (slide_beacon_adc_pwdb_statistics++ >=
1758 slide_beacon_adc_pwdb_statistics =
1760 last_beacon_adc_pwdb = priv->
stats.Slide_Beacon_pwdb
1761 [slide_beacon_adc_pwdb_index];
1762 priv->
stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
1765 priv->
stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] =
1767 slide_beacon_adc_pwdb_index++;
1769 slide_beacon_adc_pwdb_index = 0;
1771 slide_beacon_adc_pwdb_statistics;
1777 prev_st->
bIsCCK ?
"CCK" :
"OFDM",
1806 priv->
stats.slide_evm[slide_evm_index];
1807 priv->
stats.slide_evm_total -= last_evm;
1812 priv->
stats.slide_evm[slide_evm_index++] =
1815 slide_evm_index = 0;
1817 tmp_val = priv->
stats.slide_evm_total /
1818 slide_evm_statistics;
1819 priv->
stats.signal_quality = tmp_val;
1820 priv->
stats.last_signal_strength_inpercent = tmp_val;
1826 for (ij = 0; ij < 2; ij++) {
1828 if (priv->
stats.rx_evm_percentage[ij] == 0)
1829 priv->
stats.rx_evm_percentage[ij] =
1831 priv->
stats.rx_evm_percentage[ij] =
1832 ((priv->
stats.rx_evm_percentage[ij] *
1842 static void rtl8192_TranslateRxSignalStuff(
struct net_device *dev,
1849 bool bpacket_match_bssid, bpacket_toself;
1850 bool bPacketBeacon =
false;
1852 bool bToSelfBA =
false;
1863 praddr = hdr->
addr1;
1866 (!compare_ether_addr(priv->
rtllib->
1867 current_network.bssid,
1871 bpacket_toself = bpacket_match_bssid &&
1872 (!compare_ether_addr(praddr,
1873 priv->
rtllib->dev->dev_addr));
1875 bPacketBeacon =
true;
1876 if (bpacket_match_bssid)
1877 priv->
stats.numpacket_matchbssid++;
1879 priv->
stats.numpacket_toself++;
1881 rtl8192_query_rxphystatus(priv, pstats, pdesc, pdrvinfo,
1882 &previous_stats, bpacket_match_bssid,
1883 bpacket_toself, bPacketBeacon, bToSelfBA);
1887 static void rtl8192_UpdateReceivedRateHistogramStatistics(
1894 u32 preamble_guardinterval;
1898 else if (pstats->
bICV)
1902 preamble_guardinterval = 1;
1904 preamble_guardinterval = 0;
1906 switch (pstats->
rate) {
1995 priv->
stats.received_preamble_GI[preamble_guardinterval][rateIndex]++;
1996 priv->
stats.received_rate_histogram[0][rateIndex]++;
1997 priv->
stats.received_rate_histogram[rcvType][rateIndex]++;
2020 priv->
stats.rxcrcerrmin++;
2021 else if (pdesc->
Length > 1000)
2022 priv->
stats.rxcrcerrmax++;
2024 priv->
stats.rxcrcerrmid++;
2039 rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats);
2055 rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc,
2060 " pDrvInfo->PartAggr = %d\n",
2084 if (!priv->
rtllib->bSupportRemoteWakeUp) {
2096 if (!priv->
rtllib->bSupportRemoteWakeUp) {
2130 ratr_value |= (*(
u16 *)(pMcsRate)) << 12;
2131 switch (ieee->
mode) {
2133 ratr_value &= 0x00000FF0;
2136 ratr_value &= 0x0000000F;
2140 ratr_value &= 0x00000FF7;
2144 if (ieee->
pHTInfo->PeerMimoPs == 0) {
2145 ratr_value &= 0x0007F007;
2148 ratr_value &= 0x000FF007;
2150 ratr_value &= 0x0F81F007;
2156 ratr_value &= 0x0FFFFFFF;
2157 if (ieee->
pHTInfo->bCurTxBW40MHz &&
2158 ieee->
pHTInfo->bCurShortGI40MHz)
2159 ratr_value |= 0x80000000;
2160 else if (!ieee->
pHTInfo->bCurTxBW40MHz &&
2161 ieee->
pHTInfo->bCurShortGI20MHz)
2162 ratr_value |= 0x80000000;
2271 bool bStuck =
false;
2272 static u8 rx_chk_cnt;
2273 u32 SlotIndex = 0, TotalRxStuckCount = 0;
2278 __func__, RegRxCounter, priv->
RxCounter);
2317 if (TotalRxStuckCount == SilentResetRxSoltNum) {
2320 TotalRxStuckCount +=
2337 bool bStuck =
false;
2341 __func__, RegTxCounter, priv->
TxCounter);
2382 tmp_Short = (TxHT == 1) ? ((tcb_desc->
bUseShortGI) ? 1 : 0) :