diff options
Diffstat (limited to 'drivers/staging/rtl8192e')
37 files changed, 1721 insertions, 2141 deletions
diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index eeea50260f1d..aad3394392fe 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -74,16 +74,11 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \ - eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) + ether_addr_equal_unaligned(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, \ + __pTa) #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ - (((__Ie).Length == 0 || (__Ie).Length != \ - GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ - false : (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, \ - (__Ie).Octet, (__Ie).Length))) - #define CIE_WATCHDOG_TH 1 #define GET_CIE_WATCHDOG(__pIeeeDev) \ (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 0e6bdd222e75..01d2201afc94 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -47,8 +47,8 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, 0x0e, bMask12Bits, 0x021); } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): " - "unknown hardware version\n"); + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); } break; @@ -66,15 +66,16 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, 0x0e, bMask12Bits, 0x0e1); } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): " - "unknown hardware version\n"); + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); } break; default: - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown " - "Bandwidth: %#X\n", Bandwidth); + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n", + Bandwidth); break; } @@ -138,8 +139,9 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) rtStatus = rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF, (enum rf90_radio_path)eRFPath); if (!rtStatus) { - RT_TRACE(COMP_ERR, "PHY_RF8256_Config():Check " - "Radio[%d] Fail!!\n", eRFPath); + RT_TRACE(COMP_ERR, + "PHY_RF8256_Config():Check Radio[%d] Fail!!\n", + eRFPath); goto phy_RF8256_Config_ParaFile_Fail; } @@ -155,9 +157,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -170,9 +173,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -185,9 +189,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -199,9 +204,10 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final " - "value: %x\n", eRFPath, - RegOffSetToBeCheck, RF3_Final_Value); + RT_TRACE(COMP_RF, + "RF %d %d register final value: %x\n", + eRFPath, RegOffSetToBeCheck, + RF3_Final_Value); RetryTimes--; } break; @@ -221,8 +227,9 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) } if (ret) { - RT_TRACE(COMP_ERR, "phy_RF8256_Config_ParaFile():" - "Radio[%d] Fail!!", eRFPath); + RT_TRACE(COMP_ERR, + "phy_RF8256_Config_ParaFile():Radio[%d] Fail!!", + eRFPath); goto phy_RF8256_Config_ParaFile_Fail; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index 2b1430d66adb..ecdd2e5c6bac 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -46,7 +46,7 @@ bool cmpk_message_handle_tx( do { if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold ; + frag_length = frag_threshold; bLastIniPkt = 0; } else { @@ -165,7 +165,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) { - struct cmpk_intr_sta rx_intr_status; /* */ + struct cmpk_intr_sta rx_intr_status; struct r8192_priv *priv = rtllib_priv(dev); DMESG("---> cmpk_Handle_Interrupt_Status()\n"); @@ -332,44 +332,44 @@ u32 cmpk_message_handle_rx(struct net_device *dev, switch (element_id) { case RX_TX_FEEDBACK: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_FEEDBACK\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_FEEDBACK\n"); cmpk_handle_tx_feedback(dev, pcmd_buff); cmd_length = CMPK_RX_TX_FB_SIZE; break; case RX_INTERRUPT_STATUS: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_INTERRUPT_STATUS\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_INTERRUPT_STATUS\n"); cmpk_handle_interrupt_status(dev, pcmd_buff); cmd_length = sizeof(struct cmpk_intr_sta); break; case BOTH_QUERY_CONFIG: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "BOTH_QUERY_CONFIG\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():BOTH_QUERY_CONFIG\n"); cmpk_handle_query_config_rx(dev, pcmd_buff); cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE; break; case RX_TX_STATUS: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_STATUS\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_STATUS\n"); cmpk_handle_tx_status(dev, pcmd_buff); cmd_length = CMPK_RX_TX_STS_SIZE; break; case RX_TX_PER_PKT_FEEDBACK: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_PER_PKT_FEEDBACK\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_PER_PKT_FEEDBACK\n"); cmd_length = CMPK_RX_TX_FB_SIZE; break; case RX_TX_RATE_HISTORY: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "RX_TX_HISTORY\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():RX_TX_HISTORY\n"); cmpk_handle_tx_rate_history(dev, pcmd_buff); cmd_length = CMPK_TX_RAHIS_SIZE; break; default: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" - "unknown CMD Element\n"); + RT_TRACE(COMP_CMDPKT, + "---->cmpk_message_handle_rx():unknown CMD Element\n"); return 1; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h index 23219e17e5a1..2693682644df 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h @@ -33,28 +33,28 @@ struct cmpk_txfb { u8 element_id; u8 length; - u8 TID:4; /* */ - u8 fail_reason:3; /* */ + u8 TID:4; + u8 fail_reason:3; u8 tok:1; - u8 reserve1:4; /* */ - u8 pkt_type:2; /* */ - u8 bandwidth:1; /* */ - u8 qos_pkt:1; /* */ + u8 reserve1:4; + u8 pkt_type:2; + u8 bandwidth:1; + u8 qos_pkt:1; - u8 reserve2; /* */ - u8 retry_cnt; /* */ - u16 pkt_id; /* */ + u8 reserve2; + u8 retry_cnt; + u16 pkt_id; - u16 seq_num; /* */ + u16 seq_num; u8 s_rate; u8 f_rate; - u8 s_rts_rate; /* */ - u8 f_rts_rate; /* */ - u16 pkt_length; /* */ + u8 s_rts_rate; + u8 f_rts_rate; + u16 pkt_length; - u16 reserve3; /* */ - u16 duration; /* */ + u16 reserve3; + u16 duration; }; struct cmpk_intr_sta { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 552d943b1761..2869602436ef 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -224,8 +224,8 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) break; default: - printk(KERN_INFO "SetHwReg8185(): invalid ACI: %d !\n", - eACI); + netdev_info(dev, "SetHwReg8185(): invalid ACI: %d !\n", + eACI); break; } priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACM_CTRL, @@ -263,9 +263,9 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) break; default: - RT_TRACE(COMP_QOS, "SetHwReg8185(): [HW_VAR_" - "ACM_CTRL] acm set failed: eACI is " - "%d\n", eACI); + RT_TRACE(COMP_QOS, + "SetHwReg8185(): [HW_VAR_ACM_CTRL] acm set failed: eACI is %d\n", + eACI); break; } } else { @@ -287,8 +287,9 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) } } - RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write" - " 0x%X\n", AcmCtrl); + RT_TRACE(COMP_QOS, + "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", + AcmCtrl); write_nic_byte(dev, AcmHwCtrl, AcmCtrl); break; } @@ -334,17 +335,17 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } if (!priv->AutoloadFailFlag) { - priv->eeprom_vid = eprom_read(dev, (EEPROM_VID >> 1)); - priv->eeprom_did = eprom_read(dev, (EEPROM_DID >> 1)); + priv->eeprom_vid = eprom_read(dev, EEPROM_VID >> 1); + priv->eeprom_did = eprom_read(dev, EEPROM_DID >> 1); usValue = eprom_read(dev, (u16)(EEPROM_Customer_ID>>1)) >> 8; priv->eeprom_CustomerID = (u8)(usValue & 0xff); - usValue = eprom_read(dev, (EEPROM_ICVersion_ChannelPlan>>1)); + usValue = eprom_read(dev, EEPROM_ICVersion_ChannelPlan>>1); priv->eeprom_ChannelPlan = usValue&0xff; - IC_Version = ((usValue&0xff00)>>8); + IC_Version = (usValue & 0xff00)>>8; ICVer8192 = (IC_Version&0xf); - ICVer8256 = ((IC_Version&0xf0)>>4); + ICVer8256 = (IC_Version & 0xf0)>>4; RT_TRACE(COMP_INIT, "\nICVer8192 = 0x%x\n", ICVer8192); RT_TRACE(COMP_INIT, "\nICVer8256 = 0x%x\n", ICVer8256); if (ICVer8192 == 0x2) { @@ -424,7 +425,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) if (priv->epromtype == EEPROM_93C46) { if (!priv->AutoloadFailFlag) { usValue = eprom_read(dev, - (EEPROM_TxPwDiff_CrystalCap >> 1)); + EEPROM_TxPwDiff_CrystalCap >> 1); priv->EEPROMAntPwDiff = (usValue&0x0fff); priv->EEPROMCrystalCap = (u8)((usValue & 0xf000) >> 12); @@ -448,12 +449,12 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) usValue = EEPROM_Default_TxPower; *((u16 *)(&priv->EEPROMTxPowerLevelCCK[i])) = usValue; - RT_TRACE(COMP_INIT, "CCK Tx Power Level, Index" - " %d = 0x%02x\n", i, - priv->EEPROMTxPowerLevelCCK[i]); - RT_TRACE(COMP_INIT, "CCK Tx Power Level, Index" - " %d = 0x%02x\n", i+1, - priv->EEPROMTxPowerLevelCCK[i+1]); + RT_TRACE(COMP_INIT, + "CCK Tx Power Level, Index %d = 0x%02x\n", + i, priv->EEPROMTxPowerLevelCCK[i]); + RT_TRACE(COMP_INIT, + "CCK Tx Power Level, Index %d = 0x%02x\n", + i+1, priv->EEPROMTxPowerLevelCCK[i+1]); } for (i = 0; i < 14; i += 2) { if (!priv->AutoloadFailFlag) @@ -464,11 +465,12 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) usValue = EEPROM_Default_TxPower; *((u16 *)(&priv->EEPROMTxPowerLevelOFDM24G[i])) = usValue; - RT_TRACE(COMP_INIT, "OFDM 2.4G Tx Power Level," - " Index %d = 0x%02x\n", i, - priv->EEPROMTxPowerLevelOFDM24G[i]); - RT_TRACE(COMP_INIT, "OFDM 2.4G Tx Power Level," - " Index %d = 0x%02x\n", i + 1, + RT_TRACE(COMP_INIT, + "OFDM 2.4G Tx Power Level, Index %d = 0x%02x\n", + i, priv->EEPROMTxPowerLevelOFDM24G[i]); + RT_TRACE(COMP_INIT, + "OFDM 2.4G Tx Power Level, Index %d = 0x%02x\n", + i + 1, priv->EEPROMTxPowerLevelOFDM24G[i+1]); } } @@ -483,15 +485,15 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->EEPROMLegacyHTTxPowerDiff; priv->AntennaTxPwDiff[0] = (priv->EEPROMAntPwDiff & 0xf); - priv->AntennaTxPwDiff[1] = ((priv->EEPROMAntPwDiff & - 0xf0)>>4); - priv->AntennaTxPwDiff[2] = ((priv->EEPROMAntPwDiff & - 0xf00)>>8); + priv->AntennaTxPwDiff[1] = (priv->EEPROMAntPwDiff & + 0xf0) >> 4; + priv->AntennaTxPwDiff[2] = (priv->EEPROMAntPwDiff & + 0xf00) >> 8; priv->CrystalCap = priv->EEPROMCrystalCap; priv->ThermalMeter[0] = (priv->EEPROMThermalMeter & 0xf); - priv->ThermalMeter[1] = ((priv->EEPROMThermalMeter & - 0xf0)>>4); + priv->ThermalMeter[1] = (priv->EEPROMThermalMeter & + 0xf0) >> 4; } else if (priv->epromtype == EEPROM_93C56) { for (i = 0; i < 3; i++) { @@ -525,21 +527,21 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->EEPROMRfCOfdmChnlTxPwLevel[2]; } for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelCCK_A" - "[%d] = 0x%x\n", i, - priv->TxPowerLevelCCK_A[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelCCK_A[%d] = 0x%x\n", + i, priv->TxPowerLevelCCK_A[i]); for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelOFDM" - "24G_A[%d] = 0x%x\n", i, - priv->TxPowerLevelOFDM24G_A[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelOFDM24G_A[%d] = 0x%x\n", + i, priv->TxPowerLevelOFDM24G_A[i]); for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelCCK_C" - "[%d] = 0x%x\n", i, - priv->TxPowerLevelCCK_C[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelCCK_C[%d] = 0x%x\n", + i, priv->TxPowerLevelCCK_C[i]); for (i = 0; i < 14; i++) - RT_TRACE(COMP_INIT, "priv->TxPowerLevelOFDM" - "24G_C[%d] = 0x%x\n", i, - priv->TxPowerLevelOFDM24G_C[i]); + RT_TRACE(COMP_INIT, + "priv->TxPowerLevelOFDM24G_C[%d] = 0x%x\n", + i, priv->TxPowerLevelOFDM24G_C[i]); priv->LegacyHTTxPowerDiff = priv->EEPROMLegacyHTTxPowerDiff; priv->AntennaTxPwDiff[0] = 0; @@ -548,8 +550,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->CrystalCap = priv->EEPROMCrystalCap; priv->ThermalMeter[0] = (priv->EEPROMThermalMeter & 0xf); - priv->ThermalMeter[1] = ((priv->EEPROMThermalMeter & - 0xf0)>>4); + priv->ThermalMeter[1] = (priv->EEPROMThermalMeter & + 0xf0) >> 4; } } @@ -735,8 +737,9 @@ start: else if (priv->pFirmware->firmware_status == FW_STATUS_5_READY) ulRegRead |= CPU_GEN_FIRMWARE_RESET; else - RT_TRACE(COMP_ERR, "ERROR in %s(): undefined firmware state(%d)" - "\n", __func__, priv->pFirmware->firmware_status); + RT_TRACE(COMP_ERR, + "ERROR in %s(): undefined firmware state(%d)\n", + __func__, priv->pFirmware->firmware_status); write_nic_dword(dev, CPU_GEN, ulRegRead); @@ -766,8 +769,8 @@ start: else if (priv->LoopbackMode == RTL819X_MAC_LOOPBACK) ulRegRead |= CPU_CCK_LOOPBACK; else - RT_TRACE(COMP_ERR, "Serious error: wrong loopback" - " mode setting\n"); + RT_TRACE(COMP_ERR, + "Serious error: wrong loopback mode setting\n"); write_nic_dword(dev, CPU_GEN, ulRegRead); @@ -883,15 +886,15 @@ start: __func__); MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_SW, true); } else if (priv->rtllib->RfOffReason > RF_CHANGE_BY_PS) { - RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for" - " RfOffReason(%d) ----------\n", __func__, - priv->rtllib->RfOffReason); + RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), + "%s(): Turn off RF for RfOffReason(%d) ----------\n", + __func__, priv->rtllib->RfOffReason); MgntActSet_RF_State(dev, eRfOff, priv->rtllib->RfOffReason, true); } else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) { - RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for" - " RfOffReason(%d) ----------\n", __func__, - priv->rtllib->RfOffReason); + RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), + "%s(): Turn off RF for RfOffReason(%d) ----------\n", + __func__, priv->rtllib->RfOffReason); MgntActSet_RF_State(dev, eRfOff, priv->rtllib->RfOffReason, true); } else { @@ -939,17 +942,17 @@ start: priv->CCKPresentAttentuation_difference = 0; priv->CCKPresentAttentuation = priv->CCKPresentAttentuation_20Mdefault; - RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpower" - "trackingindex_initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_initial = %d\n", priv->rfa_txpowertrackingindex); - RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpower" - "trackingindex_real__initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_real__initial = %d\n", priv->rfa_txpowertrackingindex_real); - RT_TRACE(COMP_POWER_TRACKING, "priv->CCKPresent" - "Attentuation_difference_initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_difference_initial = %d\n", priv->CCKPresentAttentuation_difference); - RT_TRACE(COMP_POWER_TRACKING, "priv->CCKPresent" - "Attentuation_initial = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_initial = %d\n", priv->CCKPresentAttentuation); priv->btxpower_tracking = false; } @@ -1169,8 +1172,9 @@ static u8 rtl8192_MapHwQueueToFirmwareQueue(u8 QueueID, u8 priority) QueueSelect = QSLT_HIGH; break; default: - RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection:" - " %d\n", QueueID); + RT_TRACE(COMP_ERR, + "TransmitTCB(): Impossible Queue Selection: %d\n", + QueueID); break; } return QueueSelect; @@ -1361,9 +1365,10 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) break; default: - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported" - "Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); - break; + RT_TRACE(COMP_RECV, + "HwRateToMRate90(): Non supportedRate [%x], bIsHT = %d!!!\n", + rate, bIsHT); + break; } } else { @@ -1421,8 +1426,9 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) break; default: - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported " - "Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); + RT_TRACE(COMP_RECV, + "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", + rate, bIsHT); break; } } @@ -1527,7 +1533,7 @@ static void rtl8192_query_rxphystatus( priv->stats.numqry_phystatusCCK++; if (!reg824_bit9) { report = pcck_buf->cck_agc_rpt & 0xc0; - report = report>>6; + report >>= 6; switch (report) { case 0x3: rx_pwr_all = -35 - (pcck_buf->cck_agc_rpt & @@ -1547,7 +1553,7 @@ static void rtl8192_query_rxphystatus( } } else { report = pcck_buf->cck_agc_rpt & 0x60; - report = report>>5; + report >>= 5; switch (report) { case 0x3: rx_pwr_all = -35 - @@ -1737,8 +1743,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (!rtl8192_phy_CheckIsLegalRFPath(priv->rtllib->dev, rfpath)) continue; - RT_TRACE(COMP_DBG, "Jacken -> pPreviousstats->RxMIMO" - "SignalStrength[rfpath] = %d\n", + RT_TRACE(COMP_DBG, + "Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d\n", prev_st->RxMIMOSignalStrength[rfpath]); if (priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = @@ -1761,8 +1767,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, (prev_st->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH); } - RT_TRACE(COMP_DBG, "Jacken -> priv->RxStats.RxRSSI" - "Percentage[rfPath] = %d\n", + RT_TRACE(COMP_DBG, + "Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } @@ -2019,6 +2025,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); + struct rx_fwinfo *pDrvInfo = NULL; stats->bICV = pdesc->ICV; stats->bCRC = pdesc->CRC32; @@ -2040,51 +2047,49 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, priv->stats.rxcrcerrmid++; } return false; - } else { - struct rx_fwinfo *pDrvInfo = NULL; + } - stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; - stats->RxBufShift = ((pdesc->Shift)&0x03); - stats->Decrypted = !pdesc->SWDec; + stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; + stats->RxBufShift = ((pdesc->Shift)&0x03); + stats->Decrypted = !pdesc->SWDec; - pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); + pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); - stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT, - (u8)pDrvInfo->RxRate); - stats->bShortPreamble = pDrvInfo->SPLCP; + stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT, + (u8)pDrvInfo->RxRate); + stats->bShortPreamble = pDrvInfo->SPLCP; - rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats); + rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats); - stats->bIsAMPDU = (pDrvInfo->PartAggr == 1); - stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) && - (pDrvInfo->FirstAGGR == 1); + stats->bIsAMPDU = (pDrvInfo->PartAggr == 1); + stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) && + (pDrvInfo->FirstAGGR == 1); - stats->TimeStampLow = pDrvInfo->TSFL; - stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); + stats->TimeStampLow = pDrvInfo->TSFL; + stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); - rtl819x_UpdateRxPktTimeStamp(dev, stats); + rtl819x_UpdateRxPktTimeStamp(dev, stats); - if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) - stats->bShift = 1; + if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) + stats->bShift = 1; - stats->RxIs40MHzPacket = pDrvInfo->BW; + stats->RxIs40MHzPacket = pDrvInfo->BW; - rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc, - pDrvInfo); + rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc, + pDrvInfo); - if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) - RT_TRACE(COMP_RXDESC, "pDrvInfo->FirstAGGR = %d," - " pDrvInfo->PartAggr = %d\n", - pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); - skb_trim(skb, skb->len - 4/*sCrcLng*/); + if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) + RT_TRACE(COMP_RXDESC, + "pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n", + pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); + skb_trim(skb, skb->len - 4/*sCrcLng*/); - stats->packetlength = stats->Length-4; - stats->fraglength = stats->packetlength; - stats->fragoffset = 0; - stats->ntotalfrag = 1; - return true; - } + stats->packetlength = stats->Length-4; + stats->fraglength = stats->packetlength; + stats->fragoffset = 0; + stats->ntotalfrag = 1; + return true; } void rtl8192_halt_adapter(struct net_device *dev, bool reset) @@ -2132,7 +2137,6 @@ void rtl8192_halt_adapter(struct net_device *dev, bool reset) skb_queue_purge(&priv->rtllib->skb_aggQ[i]); skb_queue_purge(&priv->skb_queue); - return; } void rtl8192_update_ratr_table(struct net_device *dev) @@ -2191,8 +2195,7 @@ rtl8192_InitializeVariables(struct net_device *dev) priv->rtllib->softmac_features = IEEE_SOFTMAC_SCAN | IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | - IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE /* | - IEEE_SOFTMAC_BEACONS*/; + IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE; priv->rtllib->tx_headroom = sizeof(struct tx_fwinfo_8190pci); @@ -2308,8 +2311,7 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev) (priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M)))) { if (rx_chk_cnt < 2) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } else if ((((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) && (priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M)) || ((priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) && @@ -2317,13 +2319,11 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev) priv->undecorated_smoothed_pwdb >= VeryLowRSSI) { if (rx_chk_cnt < 4) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } else { if (rx_chk_cnt < 8) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } @@ -2413,5 +2413,4 @@ void ActUpdateChannelAccessSetting(struct net_device *dev, enum wireless_mode WirelessMode, struct channel_access_setting *ChnlAccessSetting) { - return; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 2e28744b9aab..c465f8749acd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -36,7 +36,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) { struct r8192_priv *priv = rtllib_priv(dev); - bool rt_status = true; u16 frag_threshold; u16 frag_length, frag_offset = 0; int i; @@ -51,7 +50,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold ; + frag_length = frag_threshold; bLastIniPkt = 0; } else { @@ -84,8 +83,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, if (!priv->rtllib->check_nic_enough_desc(dev, tcb_desc->queue_index) || (!skb_queue_empty(&priv->rtllib->skb_waitQ[tcb_desc->queue_index])) || (priv->rtllib->queue_stop)) { - RT_TRACE(COMP_FIRMWARE, "===================> tx " - "full!\n"); + RT_TRACE(COMP_FIRMWARE, + "===================> tx full!\n"); skb_queue_tail(&priv->rtllib->skb_waitQ [tcb_desc->queue_index], skb); } else { @@ -99,7 +98,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, write_nic_byte(dev, TPPoll, TPPoll_CQ); - return rt_status; + return true; } static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) @@ -108,7 +107,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) u32 CPU_status = 0; unsigned long timeout; - timeout = jiffies + MSECS(200); + timeout = jiffies + msecs_to_jiffies(200); while (time_before(jiffies, timeout)) { CPU_status = read_nic_dword(dev, CPU_GEN); if (CPU_status & CPU_GEN_PUT_CODE_OK) @@ -128,7 +127,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); mdelay(1); - timeout = jiffies + MSECS(200); + timeout = jiffies + msecs_to_jiffies(200); while (time_before(jiffies, timeout)) { CPU_status = read_nic_dword(dev, CPU_GEN); if (CPU_status&CPU_GEN_BOOT_RDY) @@ -156,7 +155,7 @@ static bool CPUcheck_firmware_ready(struct net_device *dev) u32 CPU_status = 0; unsigned long timeout; - timeout = jiffies + MSECS(20); + timeout = jiffies + msecs_to_jiffies(20); while (time_before(jiffies, timeout)) { CPU_status = read_nic_dword(dev, CPU_GEN); if (CPU_status&CPU_GEN_FIRM_RDY) @@ -197,8 +196,8 @@ static bool firmware_check_ready(struct net_device *dev, if (rt_status) pfirmware->firmware_status = FW_STATUS_3_TURNON_CPU; else - RT_TRACE(COMP_FIRMWARE, "CPUcheck_maincodeok_turnon" - "CPU fail!\n"); + RT_TRACE(COMP_FIRMWARE, + "CPUcheck_maincodeok_turnonCPU fail!\n"); break; @@ -210,8 +209,9 @@ static bool firmware_check_ready(struct net_device *dev, if (rt_status) pfirmware->firmware_status = FW_STATUS_5_READY; else - RT_TRACE(COMP_FIRMWARE, "CPUcheck_firmware_ready fail" - "(%d)!\n", rt_status); + RT_TRACE(COMP_FIRMWARE, + "CPUcheck_firmware_ready fail(%d)!\n", + rt_status); break; default: @@ -246,8 +246,8 @@ bool init_firmware(struct net_device *dev) rst_opt = OPT_FIRMWARE_RESET; starting_state = FW_INIT_STEP2_DATA; } else { - RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined" - " firmware state\n"); + RT_TRACE(COMP_FIRMWARE, + "PlatformInitFirmware: undefined firmware state\n"); } for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; @@ -266,14 +266,14 @@ bool init_firmware(struct net_device *dev) fw_name[init_step], &priv->pdev->dev); if (rc < 0) { - RT_TRACE(COMP_FIRMWARE, "request firmware fail!\n"); + RT_TRACE(COMP_FIRMWARE, + "request firmware fail!\n"); goto download_firmware_fail; } if (fw_entry->size > sizeof(pfirmware->firmware_buf[init_step])) { - RT_TRACE(COMP_FIRMWARE, "img file size " - "exceed the container struct " - "buffer fail!\n"); + RT_TRACE(COMP_FIRMWARE, + "img file size exceed the container struct buffer fail!\n"); goto download_firmware_fail; } @@ -301,13 +301,11 @@ bool init_firmware(struct net_device *dev) file_length = pfirmware->firmware_buf_size[init_step]; rt_status = fw_download_code(dev, mapped_file, file_length); - if (!rt_status) { + if (!rt_status) goto download_firmware_fail; - } - if (!firmware_check_ready(dev, init_step)) { + if (!firmware_check_ready(dev, init_step)) goto download_firmware_fail; - } } RT_TRACE(COMP_FIRMWARE, "Firmware Download Success\n"); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h index 019836bb36c2..d804876dd92f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h @@ -34,18 +34,18 @@ extern u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE]; #define PHY_REG_1T2RArrayLengthPciE 296 extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; #define RadioA_ArrayLengthPciE 246 -extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE]; #define RadioB_ArrayLengthPciE 78 -extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; #define RadioC_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE]; #define RadioD_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE] ; +extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE]; #define MACPHY_ArrayLengthPciE 18 -extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE] ; +extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE]; #define MACPHY_Array_PGLengthPciE 30 -extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE] ; +extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE]; #define AGCTAB_ArrayLengthPciE 384 -extern u32 Rtl8192PciEAGCTAB_Array[AGCTAB_ArrayLengthPciE] ; +extern u32 Rtl8192PciEAGCTAB_Array[AGCTAB_ArrayLengthPciE]; #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 8c08ef6a40a4..4664a4fd1e48 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -94,7 +94,6 @@ void rtl8192_setBBreg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, write_nic_dword(dev, dwRegAddr, NewValue); } else write_nic_dword(dev, dwRegAddr, dwData); - return; } u32 rtl8192_QueryBBReg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) @@ -136,8 +135,8 @@ static u32 rtl8192_phy_RFSerialRead(struct net_device *dev, } else NewOffset = Offset; } else { - RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need" - " to be 8256\n"); + RT_TRACE((COMP_PHY|COMP_ERR), + "check RF type here, need to be 8256\n"); NewOffset = Offset; } rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, @@ -192,8 +191,8 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, } else NewOffset = Offset; } else { - RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be" - " 8256\n"); + RT_TRACE((COMP_PHY|COMP_ERR), + "check RF type here, need to be 8256\n"); NewOffset = Offset; } @@ -215,7 +214,6 @@ static void rtl8192_phy_RFSerialWrite(struct net_device *dev, } rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); } - return; } void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, @@ -256,7 +254,6 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, } else rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, Data); } - return; } u32 rtl8192_phy_QueryRFReg(struct net_device *dev, enum rf90_radio_path eRFPath, @@ -307,7 +304,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, } return read_nic_dword(dev, RF_DATA); -} /* phy_FwRFSerialRead */ +} static void phy_FwRFSerialWrite(struct net_device *dev, enum rf90_radio_path eRFPath, @@ -328,7 +325,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, } write_nic_dword(dev, QPNR, Data); -} /* phy_FwRFSerialWrite */ +} void rtl8192_phy_configmac(struct net_device *dev) @@ -348,8 +345,8 @@ void rtl8192_phy_configmac(struct net_device *dev) pdwArray = Rtl819XMACPHY_Array; } for (i = 0; i < dwArrayLen; i += 3) { - RT_TRACE(COMP_DBG, "The Rtl8190MACPHY_Array[0] is %x Rtl8190MAC" - "PHY_Array[1] is %x Rtl8190MACPHY_Array[2] is %x\n", + RT_TRACE(COMP_DBG, + "The Rtl8190MACPHY_Array[0] is %x Rtl8190MACPHY_Array[1] is %x Rtl8190MACPHY_Array[2] is %x\n", pdwArray[i], pdwArray[i+1], pdwArray[i+2]); if (pdwArray[i] == 0x318) pdwArray[i+2] = 0x00000800; @@ -383,8 +380,8 @@ void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) rtl8192_setBBreg(dev, Rtl819XPHY_REGArray_Table[i], bMaskDWord, Rtl819XPHY_REGArray_Table[i+1]); - RT_TRACE(COMP_DBG, "i: %x, The Rtl819xUsbPHY_REGArray" - "[0] is %x Rtl819xUsbPHY_REGArray[1] is %x\n", + RT_TRACE(COMP_DBG, + "i: %x, The Rtl819xUsbPHY_REGArray[0] is %x Rtl819xUsbPHY_REGArray[1] is %x\n", i, Rtl819XPHY_REGArray_Table[i], Rtl819XPHY_REGArray_Table[i+1]); } @@ -393,13 +390,12 @@ void rtl8192_phyConfigBB(struct net_device *dev, u8 ConfigType) rtl8192_setBBreg(dev, Rtl819XAGCTAB_Array_Table[i], bMaskDWord, Rtl819XAGCTAB_Array_Table[i+1]); - RT_TRACE(COMP_DBG, "i:%x, The rtl819XAGCTAB_Array[0] " - "is %x rtl819XAGCTAB_Array[1] is %x\n", i, - Rtl819XAGCTAB_Array_Table[i], + RT_TRACE(COMP_DBG, + "i:%x, The rtl819XAGCTAB_Array[0] is %x rtl819XAGCTAB_Array[1] is %x\n", + i, Rtl819XAGCTAB_Array_Table[i], Rtl819XAGCTAB_Array_Table[i+1]); } } - return; } static void rtl8192_InitBBRFRegDef(struct net_device *dev) @@ -511,8 +507,8 @@ bool rtl8192_phy_checkBBAndRF(struct net_device *dev, for (i = 0; i < CheckTimes; i++) { switch (CheckBlock) { case HW90_BLOCK_MAC: - RT_TRACE(COMP_ERR, "PHY_CheckBBRFOK(): Never Write " - "0x100 here!"); + RT_TRACE(COMP_ERR, + "PHY_CheckBBRFOK(): Never Write 0x100 here!"); break; case HW90_BLOCK_PHY0: @@ -541,8 +537,9 @@ bool rtl8192_phy_checkBBAndRF(struct net_device *dev, if (dwRegRead != WriteData[i]) { - RT_TRACE(COMP_ERR, "====>error=====dwRegRead: %x, " - "WriteData: %x\n", dwRegRead, WriteData[i]); + RT_TRACE(COMP_ERR, + "====>error=====dwRegRead: %x, WriteData: %x\n", + dwRegRead, WriteData[i]); ret = false; break; } @@ -570,8 +567,9 @@ static bool rtl8192_BB_Config_ParaFile(struct net_device *dev) (enum hw90_block)eCheckItem, (enum rf90_radio_path)0); if (!rtStatus) { - RT_TRACE((COMP_ERR | COMP_PHY), "PHY_RF8256_Config():" - "Check PHY%d Fail!!\n", eCheckItem-1); + RT_TRACE((COMP_ERR | COMP_PHY), + "PHY_RF8256_Config():Check PHY%d Fail!!\n", + eCheckItem-1); return rtStatus; } } @@ -628,8 +626,8 @@ void rtl8192_phy_getTxPower(struct net_device *dev) priv->DefaultInitialGain[1] = read_nic_byte(dev, rOFDM0_XBAGCCore1); priv->DefaultInitialGain[2] = read_nic_byte(dev, rOFDM0_XCAGCCore1); priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1); - RT_TRACE(COMP_INIT, "Default initial gain (c50=0x%x, c58=0x%x, " - "c60=0x%x, c68=0x%x)\n", + RT_TRACE(COMP_INIT, + "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n", priv->DefaultInitialGain[0], priv->DefaultInitialGain[1], priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]); @@ -638,7 +636,6 @@ void rtl8192_phy_getTxPower(struct net_device *dev) RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); priv->SifsTime = read_nic_word(dev, SIFS); - return; } void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) @@ -692,7 +689,6 @@ void rtl8192_phy_setTxPower(struct net_device *dev, u8 channel) __func__); break; } - return; } bool rtl8192_phy_RFConfig(struct net_device *dev) @@ -721,7 +717,6 @@ bool rtl8192_phy_RFConfig(struct net_device *dev) void rtl8192_phy_updateInitGain(struct net_device *dev) { - return; } u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device *dev, @@ -807,11 +802,10 @@ static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) case RF_8258: break; default: - RT_TRACE(COMP_ERR, "unknown rf chip ID in rtl8192_SetTxPower" - "Level()\n"); + RT_TRACE(COMP_ERR, + "unknown rf chip ID in rtl8192_SetTxPowerLevel()\n"); break; } - return; } static u8 rtl8192_phy_SetSwChnlCmdArray(struct sw_chnl_cmd *CmdTable, @@ -822,15 +816,14 @@ static u8 rtl8192_phy_SetSwChnlCmdArray(struct sw_chnl_cmd *CmdTable, struct sw_chnl_cmd *pCmd; if (CmdTable == NULL) { - RT_TRACE(COMP_ERR, "phy_SetSwChnlCmdArray(): CmdTable cannot " - "be NULL.\n"); + RT_TRACE(COMP_ERR, + "phy_SetSwChnlCmdArray(): CmdTable cannot be NULL.\n"); return false; } if (CmdTableIdx >= CmdTableSz) { - RT_TRACE(COMP_ERR, "phy_SetSwChnlCmdArray(): Access invalid" - " index, please check size of the table, CmdTableIdx:" - "%d, CmdTableSz:%d\n", - CmdTableIdx, CmdTableSz); + RT_TRACE(COMP_ERR, + "phy_SetSwChnlCmdArray(): Access invalid index, please check size of the table, CmdTableIdx:%d, CmdTableSz:%d\n", + CmdTableIdx, CmdTableSz); return false; } @@ -883,8 +876,9 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, switch (priv->rf_chip) { case RF_8225: if (!(channel >= 1 && channel <= 14)) { - RT_TRACE(COMP_ERR, "illegal channel for Zebra " - "8225: %d\n", channel); + RT_TRACE(COMP_ERR, + "illegal channel for Zebra 8225: %d\n", + channel); return false; } rtl8192_phy_SetSwChnlCmdArray(ieee->RfDependCmd, @@ -898,8 +892,9 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, case RF_8256: if (!(channel >= 1 && channel <= 14)) { - RT_TRACE(COMP_ERR, "illegal channel for Zebra" - " 8256: %d\n", channel); + RT_TRACE(COMP_ERR, + "illegal channel for Zebra 8256: %d\n", + channel); return false; } rtl8192_phy_SetSwChnlCmdArray(ieee->RfDependCmd, @@ -920,7 +915,6 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); return false; - break; } @@ -938,13 +932,11 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, } if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) { - if ((*stage) == 2) { + if ((*stage) == 2) return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } + (*stage)++; + (*step) = 0; + continue; } if (!CurrentCmd) @@ -996,7 +988,7 @@ static void rtl8192_phy_FinishSwChnlNow(struct net_device *dev, u8 channel) &priv->SwChnlStep, &delay)) { if (delay > 0) msleep(delay); - if (IS_NIC_DOWN(priv)) + if (!priv->up) break; } } @@ -1020,7 +1012,7 @@ u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_PHY, "=====>%s()\n", __func__); - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_ERR, "%s(): ERR !! driver is not up\n", __func__); return false; } @@ -1060,7 +1052,7 @@ u8 rtl8192_phy_SwChnl(struct net_device *dev, u8 channel) priv->SwChnlStage = 0; priv->SwChnlStep = 0; - if (!IS_NIC_DOWN(priv)) + if (priv->up) rtl8192_SwChnl_WorkItem(dev); priv->SwChnlInProgress = false; return true; @@ -1083,8 +1075,8 @@ static void CCK_Tx_Power_Track_BW_Switch_TSSI(struct net_device *dev) if (priv->CCKPresentAttentuation < 0) priv->CCKPresentAttentuation = 0; - RT_TRACE(COMP_POWER_TRACKING, "20M, priv->CCKPresent" - "Attentuation = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "20M, priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); if (priv->rtllib->current_network.channel == 14 && @@ -1105,8 +1097,8 @@ static void CCK_Tx_Power_Track_BW_Switch_TSSI(struct net_device *dev) priv->CCKPresentAttentuation_40Mdefault + priv->CCKPresentAttentuation_difference; - RT_TRACE(COMP_POWER_TRACKING, "40M, priv->CCKPresent" - "Attentuation = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "40M, priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength - 1)) @@ -1146,15 +1138,15 @@ static void CCK_Tx_Power_Track_BW_Switch_ThermalMeter(struct net_device *dev) if (priv->Record_CCK_20Mindex == 0) priv->Record_CCK_20Mindex = 6; priv->CCK_index = priv->Record_CCK_20Mindex; - RT_TRACE(COMP_POWER_TRACKING, "20MHz, CCK_Tx_Power_Track_BW_" - "Switch_ThermalMeter(),CCK_index = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "20MHz, CCK_Tx_Power_Track_BW_Switch_ThermalMeter(),CCK_index = %d\n", priv->CCK_index); break; case HT_CHANNEL_WIDTH_20_40: priv->CCK_index = priv->Record_CCK_40Mindex; - RT_TRACE(COMP_POWER_TRACKING, "40MHz, CCK_Tx_Power_Track_BW_" - "Switch_ThermalMeter(), CCK_index = %d\n", + RT_TRACE(COMP_POWER_TRACKING, + "40MHz, CCK_Tx_Power_Track_BW_Switch_ThermalMeter(), CCK_index = %d\n", priv->CCK_index); break; } @@ -1177,16 +1169,17 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); u8 regBwOpMode; - RT_TRACE(COMP_SWBW, "==>rtl8192_SetBWModeWorkItem() Switch to %s " - "bandwidth\n", priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); + RT_TRACE(COMP_SWBW, + "==>rtl8192_SetBWModeWorkItem() Switch to %s bandwidth\n", + priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ? + "20MHz" : "40MHz"); if (priv->rf_chip == RF_PSEUDO_11N) { priv->SetBWModeInProgress = false; return; } - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_ERR, "%s(): ERR!! driver is not up\n", __func__); return; } @@ -1204,8 +1197,9 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) break; default: - RT_TRACE(COMP_ERR, "SetChannelBandwidth819xUsb(): unknown " - "Bandwidth: %#X\n", priv->CurrentChannelBW); + RT_TRACE(COMP_ERR, + "SetChannelBandwidth819xUsb(): unknown Bandwidth: %#X\n", + priv->CurrentChannelBW); break; } @@ -1245,8 +1239,9 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); break; default: - RT_TRACE(COMP_ERR, "SetChannelBandwidth819xUsb(): unknown " - "Bandwidth: %#X\n", priv->CurrentChannelBW); + RT_TRACE(COMP_ERR, + "SetChannelBandwidth819xUsb(): unknown Bandwidth: %#X\n", + priv->CurrentChannelBW); break; } @@ -1309,11 +1304,11 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) u32 BitMask; u8 initial_gain; - if (!IS_NIC_DOWN(priv)) { + if (priv->up) { switch (Operation) { case IG_Backup: - RT_TRACE(COMP_SCAN, "IG_Backup, backup the initial" - " gain.\n"); + RT_TRACE(COMP_SCAN, + "IG_Backup, backup the initial gain.\n"); initial_gain = SCAN_RX_INITIAL_GAIN; BitMask = bMaskByte0; if (dm_digtable.dig_algorithm == @@ -1335,16 +1330,21 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, BitMask); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc50 is" - " %x\n", priv->initgain_backup.xaagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc58 is" - " %x\n", priv->initgain_backup.xbagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc60 is" - " %x\n", priv->initgain_backup.xcagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc68 is" - " %x\n", priv->initgain_backup.xdagccore1); - RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xa0a is" - " %x\n", priv->initgain_backup.cca); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc50 is %x\n", + priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc58 is %x\n", + priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc60 is %x\n", + priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xc68 is %x\n", + priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_SCAN, + "Scan InitialGainBackup 0xa0a is %x\n", + priv->initgain_backup.cca); RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x\n", initial_gain); @@ -1357,8 +1357,8 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH); break; case IG_Restore: - RT_TRACE(COMP_SCAN, "IG_Restore, restore the initial " - "gain.\n"); + RT_TRACE(COMP_SCAN, + "IG_Restore, restore the initial gain.\n"); BitMask = 0x7f; if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) @@ -1376,16 +1376,21 @@ void InitialGain819xPci(struct net_device *dev, u8 Operation) rtl8192_setBBreg(dev, rCCK0_CCA, BitMask, (u32)priv->initgain_backup.cca); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc50" - " is %x\n", priv->initgain_backup.xaagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc58" - " is %x\n", priv->initgain_backup.xbagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc60" - " is %x\n", priv->initgain_backup.xcagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc68" - " is %x\n", priv->initgain_backup.xdagccore1); - RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xa0a" - " is %x\n", priv->initgain_backup.cca); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc50 is %x\n", + priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc58 is %x\n", + priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc60 is %x\n", + priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xc68 is %x\n", + priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_SCAN, + "Scan BBInitialGainRestore 0xa0a is %x\n", + priv->initgain_backup.cca); rtl8192_phy_setTxPower(dev, priv->rtllib->current_network.channel); @@ -1447,8 +1452,8 @@ static bool SetRFPowerState8190(struct net_device *dev, } while (!rtstatus && (InitilizeCount > 0)); if (!rtstatus) { - RT_TRACE(COMP_ERR, "%s():Initialize Ada" - "pter fail,return\n", + RT_TRACE(COMP_ERR, + "%s():Initialize Adapter fail,return\n", __func__); priv->SetRFPowerStateInProgress = false; return false; @@ -1492,19 +1497,16 @@ static bool SetRFPowerState8190(struct net_device *dev, QueueID++; continue; } else { - RT_TRACE((COMP_POWER|COMP_RF), "eRf Off" - "/Sleep: %d times TcbBusyQueue" - "[%d] !=0 before doze!\n", + RT_TRACE((COMP_POWER|COMP_RF), + "eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", (i+1), QueueID); udelay(10); i++; } if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(COMP_POWER, "\n\n\n TimeOut!! " - "SetRFPowerState8190(): eRfOff" - ": %d times TcbBusyQueue[%d] " - "!= 0 !!!\n", + RT_TRACE(COMP_POWER, + "\n\n\n TimeOut!! SetRFPowerState8190(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n", MAX_DOZE_WAITING_TIMES_9x, QueueID); break; @@ -1514,8 +1516,8 @@ static bool SetRFPowerState8190(struct net_device *dev, break; case eRfOff: - RT_TRACE(COMP_PS, "SetRFPowerState8190() eRfOff/" - "Sleep !\n"); + RT_TRACE(COMP_PS, + "SetRFPowerState8190() eRfOff/Sleep !\n"); for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { ring = &priv->tx_ring[QueueID]; @@ -1524,19 +1526,16 @@ static bool SetRFPowerState8190(struct net_device *dev, QueueID++; continue; } else { - RT_TRACE(COMP_POWER, "eRf Off/Sleep: %d" - " times TcbBusyQueue[%d] !=0 b" - "efore doze!\n", (i+1), - QueueID); + RT_TRACE(COMP_POWER, + "eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", + (i+1), QueueID); udelay(10); i++; } if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(COMP_POWER, "\n\n\n SetZebra: " - "RFPowerState8185B(): eRfOff:" - " %d times TcbBusyQueue[%d] " - "!= 0 !!!\n", + RT_TRACE(COMP_POWER, + "\n\n\n SetZebra: RFPowerState8185B(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n", MAX_DOZE_WAITING_TIMES_9x, QueueID); break; @@ -1556,8 +1555,9 @@ static bool SetRFPowerState8190(struct net_device *dev, default: bResult = false; - RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknown state" - " to set: 0x%X!!!\n", eRFPowerState); + RT_TRACE(COMP_ERR, + "SetRFPowerState8190(): unknown state to set: 0x%X!!!\n", + eRFPowerState); break; } @@ -1576,8 +1576,8 @@ static bool SetRFPowerState8190(struct net_device *dev, break; default: - RT_TRACE(COMP_ERR, "SetRFPowerState8190(): Unknown " - "RF type\n"); + RT_TRACE(COMP_ERR, + "SetRFPowerState8190(): Unknown RF type\n"); break; } } @@ -1599,8 +1599,8 @@ bool SetRFPowerState(struct net_device *dev, eRFPowerState); if (eRFPowerState == priv->rtllib->eRFPowerState && priv->bHwRfOffAction == 0) { - RT_TRACE(COMP_PS, "<--------- SetRFPowerState(): discard the " - "request for eRFPowerState(%d) is the same.\n", + RT_TRACE(COMP_PS, + "<--------- SetRFPowerState(): discard the request for eRFPowerState(%d) is the same.\n", eRFPowerState); return bResult; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h index 970298b07af7..03eee3d059c6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h @@ -888,13 +888,6 @@ #define bOFDMPHY0_End 0xcff #define bOFDMPHY1_End 0xdff -/*#define max debug item in each debug page -#define bMaxItem_FPGA_PHY0 0x9 -#define bMaxItem_FPGA_PHY1 0x3 -#define bMaxItem_PHY_11B 0x16 -#define bMaxItem_OFDM_PHY0 0x29 -#define bMaxItem_OFDM_PHY1 0x0 */ - #define bPMACControl 0x0 #define bWMACControl 0x1 #define bWNICControl 0x2 diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 89ea70b0d3aa..41b025e250fe 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -86,9 +86,9 @@ void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - RT_TRACE(COMP_DBG, "===========>%s():EntryNo is %d,KeyIndex is " - "%d,KeyType is %d,is_mesh is %d\n", __func__, EntryNo, - KeyIndex, KeyType, is_mesh); + RT_TRACE(COMP_DBG, + "===========>%s():EntryNo is %d,KeyIndex is %d,KeyType is %d,is_mesh is %d\n", + __func__, EntryNo, KeyIndex, KeyType, is_mesh); if (!is_mesh) { ieee->swcamtable[EntryNo].bused = true; ieee->swcamtable[EntryNo].key_index = KeyIndex; @@ -115,21 +115,20 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) { RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); - return ; - } else { - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); + return; } + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } priv->rtllib->is_set_key = true; if (EntryNo >= TOTAL_CAM_ENTRY) RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n"); - RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d," - "KeyType:%d, MacAddr %pM\n", dev, EntryNo, KeyIndex, - KeyType, MacAddr); + RT_TRACE(COMP_SEC, + "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n", + dev, EntryNo, KeyIndex, KeyType, MacAddr); if (DefaultKey) usConfig |= BIT15 | (KeyType<<2); @@ -192,7 +191,7 @@ void CamRestoreAllEntry(struct net_device *dev) for (EntryId = 0; EntryId < 4; EntryId++) { MacAddr = CAM_CONST_ADDR[EntryId]; if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId , EntryId, + setKey(dev, EntryId, EntryId, priv->rtllib->pairwise_key_type, MacAddr, 0, (u32 *)(&priv->rtllib->swcamtable [EntryId].key_buf[0])); @@ -244,8 +243,8 @@ void CamRestoreAllEntry(struct net_device *dev) (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]) ); } else { - RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC TKIP " - ",but 0 entry is have no data\n", + RT_TRACE(COMP_ERR, + "===>%s():ERR!! ADHOC TKIP ,but 0 entry is have no data\n", __func__); return; } @@ -254,7 +253,7 @@ void CamRestoreAllEntry(struct net_device *dev) MacAddr = CAM_CONST_BROAD; for (EntryId = 1; EntryId < 4; EntryId++) { if (priv->rtllib->swcamtable[EntryId].bused) { - setKey(dev, EntryId , EntryId, + setKey(dev, EntryId, EntryId, priv->rtllib->group_key_type, MacAddr, 0, (u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])); @@ -263,13 +262,13 @@ void CamRestoreAllEntry(struct net_device *dev) if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { if (priv->rtllib->swcamtable[0].bused) { - setKey(dev, 0 , 0, + setKey(dev, 0, 0, priv->rtllib->group_key_type, CAM_CONST_ADDR[0], 0, (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); } else { - RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC CCMP ," - "but 0 entry is have no data\n", + RT_TRACE(COMP_ERR, + "===>%s():ERR!! ADHOC CCMP ,but 0 entry is have no data\n", __func__); return; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5615c80f614c..352d381b7c4a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -131,7 +131,7 @@ static bool PlatformIOCheckPageLegalAndGetRegMask(u32 u4bPage, u8 *pu1bPageMask) void write_nic_io_byte(struct net_device *dev, int x, u8 y) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; @@ -154,7 +154,7 @@ void write_nic_io_byte(struct net_device *dev, int x, u8 y) void write_nic_io_word(struct net_device *dev, int x, u16 y) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; @@ -177,7 +177,7 @@ void write_nic_io_word(struct net_device *dev, int x, u16 y) void write_nic_io_dword(struct net_device *dev, int x, u32 y) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; @@ -199,24 +199,23 @@ void write_nic_io_dword(struct net_device *dev, int x, u32 y) u8 read_nic_io_byte(struct net_device *dev, int x) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; u8 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return 0xff&inb(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_byte(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); + + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_byte(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -224,25 +223,22 @@ u8 read_nic_io_byte(struct net_device *dev, int x) u16 read_nic_io_word(struct net_device *dev, int x) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; u16 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return inw(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_word(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - - } + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_word(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -250,25 +246,22 @@ u16 read_nic_io_word(struct net_device *dev, int x) u32 read_nic_io_dword(struct net_device *dev, int x) { - u32 u4bPage = (x >> 8); + u32 u4bPage = x >> 8; u8 u1PageMask = 0; bool bIsLegalPage = false; u32 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return inl(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_dword(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); - } + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_dword(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -326,8 +319,8 @@ bool MgntActSet_RF_State(struct net_device *dev, u16 RFWaitCounter = 0; unsigned long flag; - RT_TRACE((COMP_PS | COMP_RF), "===>MgntActSet_RF_State(): " - "StateToSet(%d)\n", StateToSet); + RT_TRACE((COMP_PS | COMP_RF), + "===>MgntActSet_RF_State(): StateToSet(%d)\n", StateToSet); ProtectOrNot = false; @@ -338,22 +331,19 @@ bool MgntActSet_RF_State(struct net_device *dev, if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flag); RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): RF Change in " - "progress! Wait to set..StateToSet" - "(%d).\n", StateToSet); + "MgntActSet_RF_State(): RF Change in progress! Wait to set..StateToSet(%d).\n", + StateToSet); while (priv->RFChangeInProgress) { RFWaitCounter++; RT_TRACE((COMP_PS | COMP_RF), - "MgntActSet_RF_State(): Wait 1" - " ms (%d times)...\n", + "MgntActSet_RF_State(): Wait 1 ms (%d times)...\n", RFWaitCounter); mdelay(1); if (RFWaitCounter > 100) { - RT_TRACE(COMP_ERR, "MgntActSet_" - "RF_State(): Wait too " - "logn to set RF\n"); + RT_TRACE(COMP_ERR, + "MgntActSet_RF_State(): Wait too logn to set RF\n"); return false; } } @@ -383,9 +373,8 @@ bool MgntActSet_RF_State(struct net_device *dev, ChangeSource >= RF_CHANGE_BY_HW) bConnectBySSID = true; } else { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State - " - "eRfon reject pMgntInfo->RfOffReason= 0x%x," - " ChangeSource=0x%X\n", + RT_TRACE((COMP_PS | COMP_RF), + "MgntActSet_RF_State - eRfon reject pMgntInfo->RfOffReason= 0x%x, ChangeSource=0x%X\n", priv->rtllib->RfOffReason, ChangeSource); } @@ -421,8 +410,8 @@ bool MgntActSet_RF_State(struct net_device *dev, } if (bActionAllowed) { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State(): Action is" - " allowed.... StateToSet(%d), RfOffReason(%#X)\n", + RT_TRACE((COMP_PS | COMP_RF), + "MgntActSet_RF_State(): Action is allowed.... StateToSet(%d), RfOffReason(%#X)\n", StateToSet, priv->rtllib->RfOffReason); PHY_SetRFPowerState(dev, StateToSet); if (StateToSet == eRfOn) { @@ -434,10 +423,9 @@ bool MgntActSet_RF_State(struct net_device *dev, } } } else { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State(): " - "Action is rejected.... StateToSet(%d), ChangeSource" - "(%#X), RfOffReason(%#X)\n", StateToSet, ChangeSource, - priv->rtllib->RfOffReason); + RT_TRACE((COMP_PS | COMP_RF), + "MgntActSet_RF_State(): Action is rejected.... StateToSet(%d), ChangeSource(%#X), RfOffReason(%#X)\n", + StateToSet, ChangeSource, priv->rtllib->RfOffReason); } if (!ProtectOrNot) { @@ -460,9 +448,9 @@ static short rtl8192_get_nic_desc_num(struct net_device *dev, int prio) * between the tail and the head */ if ((prio == MGNT_QUEUE) && (skb_queue_len(&ring->queue) > 10)) - RT_TRACE(COMP_DBG, "-----[%d]---------ring->idx=%d " - "queue_len=%d---------\n", prio, ring->idx, - skb_queue_len(&ring->queue)); + RT_TRACE(COMP_DBG, + "-----[%d]---------ring->idx=%d queue_len=%d---------\n", + prio, ring->idx, skb_queue_len(&ring->queue)); return skb_queue_len(&ring->queue); } @@ -481,7 +469,7 @@ void rtl8192_tx_timeout(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); schedule_work(&priv->reset_wq); - printk(KERN_INFO "TXTIMEOUT"); + netdev_info(dev, "TXTIMEOUT"); } void rtl8192_irq_enable(struct net_device *dev) @@ -526,8 +514,9 @@ void rtl8192_update_cap(struct net_device *dev, u16 cap) if (priv->dot11CurrentPreambleMode != PREAMBLE_SHORT) { ShortPreamble = true; priv->dot11CurrentPreambleMode = PREAMBLE_SHORT; - RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_SHORT_" - "PREAMBLE\n", __func__); + RT_TRACE(COMP_DBG, + "%s(): WLAN_CAPABILITY_SHORT_PREAMBLE\n", + __func__); priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble); } @@ -535,8 +524,9 @@ void rtl8192_update_cap(struct net_device *dev, u16 cap) if (priv->dot11CurrentPreambleMode != PREAMBLE_LONG) { ShortPreamble = false; priv->dot11CurrentPreambleMode = PREAMBLE_LONG; - RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_LONG_" - "PREAMBLE\n", __func__); + RT_TRACE(COMP_DBG, + "%s(): WLAN_CAPABILITY_LONG_PREAMBLE\n", + __func__); priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble); } @@ -597,8 +587,8 @@ static void rtl8192_qos_activate(void *data) mutex_lock(&priv->mutex); if (priv->rtllib->state != RTLLIB_LINKED) goto success; - RT_TRACE(COMP_QOS, "qos active process with associate response " - "received\n"); + RT_TRACE(COMP_QOS, + "qos active process with associate response received\n"); for (i = 0; i < QOS_QUEUE_NUM; i++) priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); @@ -618,7 +608,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if (priv->rtllib->state != RTLLIB_LINKED) return ret; - if ((priv->rtllib->iw_mode != IW_MODE_INFRA)) + if (priv->rtllib->iw_mode != IW_MODE_INFRA) return ret; if (network->flags & NETWORK_HAS_QOS_MASK) { @@ -634,8 +624,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, network->qos_data.param_count; priv->rtllib->wmm_acm = network->qos_data.wmm_acm; queue_work_rsl(priv->priv_wq, &priv->qos_activate); - RT_TRACE(COMP_QOS, "QoS parameters change call " - "qos_activate\n"); + RT_TRACE(COMP_QOS, + "QoS parameters change call qos_activate\n"); } } else { memcpy(&priv->rtllib->current_network.qos_data.parameters, @@ -643,8 +633,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if ((network->qos_data.active == 1) && (active_network == 1)) { queue_work_rsl(priv->priv_wq, &priv->qos_activate); - RT_TRACE(COMP_QOS, "QoS was disabled call qos_" - "activate\n"); + RT_TRACE(COMP_QOS, + "QoS was disabled call qos_activate\n"); } network->qos_data.active = 0; network->qos_data.supported = 0; @@ -679,7 +669,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, if (priv->rtllib->state != RTLLIB_LINKED) return 0; - if ((priv->rtllib->iw_mode != IW_MODE_INFRA)) + if (priv->rtllib->iw_mode != IW_MODE_INFRA) return 0; spin_lock_irqsave(&priv->rtllib->lock, flags); @@ -751,8 +741,6 @@ static void rtl8192_prepare_beacon(struct r8192_priv *priv) priv->ops->tx_fill_descriptor(dev, pdesc, tcb_desc, pnewskb); __skb_queue_tail(&ring->queue, pnewskb); pdesc->OWN = 1; - - return; } static void rtl8192_stop_beacon(struct net_device *dev) @@ -866,7 +854,6 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv) } else { memset(ieee->Regdot11HTOperationalRateSet, 0, 16); } - return; } static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) @@ -909,8 +896,9 @@ void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) } else if ((bSupportMode & WIRELESS_MODE_B)) { wireless_mode = WIRELESS_MODE_B; } else { - RT_TRACE(COMP_ERR, "%s(), No valid wireless mode " - "supported (%x)!!!\n", __func__, bSupportMode); + RT_TRACE(COMP_ERR, + "%s(), No valid wireless mode supported (%x)!!!\n", + __func__, bSupportMode); wireless_mode = WIRELESS_MODE_B; } } @@ -1025,8 +1013,9 @@ static int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) spin_lock_irqsave(&priv->rf_ps_lock, flags); break; } - RT_TRACE(COMP_DBG, "===>%s():RF is in progress, need to wait " - "until rf change is done.\n", __func__); + RT_TRACE(COMP_DBG, + "===>%s():RF is in progress, need to wait until rf change is done.\n", + __func__); mdelay(1); RFInProgressTimeOut++; spin_lock_irqsave(&priv->rf_ps_lock, flags); @@ -1212,8 +1201,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev) priv->AcmControl = 0; priv->pFirmware = vzalloc(sizeof(struct rt_firmware)); if (!priv->pFirmware) - printk(KERN_ERR "rtl8192e: Unable to allocate space " - "for firmware\n"); + netdev_err(dev, + "rtl8192e: Unable to allocate space for firmware\n"); skb_queue_head_init(&priv->rx_queue); skb_queue_head_init(&priv->skb_queue); @@ -1278,14 +1267,15 @@ static short rtl8192_get_channel_map(struct net_device *dev) if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) && (priv->rf_chip != RF_6052)) { - RT_TRACE(COMP_ERR, "%s: unknown rf chip, can't set channel " - "map\n", __func__); + RT_TRACE(COMP_ERR, + "%s: unknown rf chip, can't set channel map\n", + __func__); return -1; } if (priv->ChannelPlan >= COUNTRY_CODE_MAX) { - printk(KERN_INFO "rtl819x_init:Error channel plan! Set to " - "default.\n"); + netdev_info(dev, + "rtl819x_init:Error channel plan! Set to default.\n"); priv->ChannelPlan = COUNTRY_CODE_FCC; } RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); @@ -1329,15 +1319,15 @@ static short rtl8192_init(struct net_device *dev) rtl8192_irq_disable(dev); if (request_irq(dev->irq, rtl8192_interrupt, IRQF_SHARED, dev->name, dev)) { - printk(KERN_ERR "Error allocating IRQ %d", dev->irq); + netdev_err(dev, "Error allocating IRQ %d", dev->irq); return -1; - } else { - priv->irq = dev->irq; - RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq); } + priv->irq = dev->irq; + RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq); + if (rtl8192_pci_initdescring(dev) != 0) { - printk(KERN_ERR "Endopoints initialization failed"); + netdev_err(dev, "Endopoints initialization failed"); free_irq(dev->irq, dev); return -1; } @@ -1357,7 +1347,7 @@ short rtl8192_is_tx_queue_empty(struct net_device *dev) if ((i == TXCMD_QUEUE) || (i == HCCA_QUEUE)) continue; if (skb_queue_len(&(&priv->tx_ring[i])->queue) > 0) { - printk(KERN_INFO "===>tx queue is not empty:%d, %d\n", + netdev_info(dev, "===>tx queue is not empty:%d, %d\n", i, skb_queue_len(&(&priv->tx_ring[i])->queue)); return 0; } @@ -1406,17 +1396,18 @@ static enum reset_type rtl819x_TxCheckStuck(struct net_device *dev) tcb_desc->nStuckCount++; bCheckFwTxCnt = true; if (tcb_desc->nStuckCount > 1) - printk(KERN_INFO "%s: QueueID=%d tcb_desc->n" - "StuckCount=%d\n", __func__, QueueID, - tcb_desc->nStuckCount); + netdev_info(dev, + "%s: QueueID=%d tcb_desc->nStuckCount=%d\n", + __func__, QueueID, + tcb_desc->nStuckCount); } } spin_unlock_irqrestore(&priv->irq_th_lock, flags); if (bCheckFwTxCnt) { if (priv->ops->TxCheckStuckHandler(dev)) { - RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no" - " Tx condition!\n"); + RT_TRACE(COMP_RESET, + "TxCheckStuck(): Fw indicates no Tx condition!\n"); return RESET_TYPE_SILENT; } } @@ -1455,13 +1446,13 @@ static enum reset_type rtl819x_ifcheck_resetornot(struct net_device *dev) if (TxResetType == RESET_TYPE_NORMAL || RxResetType == RESET_TYPE_NORMAL) { - printk(KERN_INFO "%s(): TxResetType is %d, RxResetType is %d\n", - __func__, TxResetType, RxResetType); + netdev_info(dev, "%s(): TxResetType is %d, RxResetType is %d\n", + __func__, TxResetType, RxResetType); return RESET_TYPE_NORMAL; } else if (TxResetType == RESET_TYPE_SILENT || RxResetType == RESET_TYPE_SILENT) { - printk(KERN_INFO "%s(): TxResetType is %d, RxResetType is %d\n", - __func__, TxResetType, RxResetType); + netdev_info(dev, "%s(): TxResetType is %d, RxResetType is %d\n", + __func__, TxResetType, RxResetType); return RESET_TYPE_SILENT; } else { return RESET_TYPE_NORESET; @@ -1506,9 +1497,10 @@ RESET_START: if (priv->rtllib->state == RTLLIB_LINKED) LeisurePSLeave(dev); - if (IS_NIC_DOWN(priv)) { - RT_TRACE(COMP_ERR, "%s():the driver is not up! " - "return\n", __func__); + if (priv->up) { + RT_TRACE(COMP_ERR, + "%s():the driver is not up! return\n", + __func__); up(&priv->wx_sem); return; } @@ -1517,8 +1509,9 @@ RESET_START: RT_TRACE(COMP_RESET, "%s():======>start to down the driver\n", __func__); mdelay(1000); - RT_TRACE(COMP_RESET, "%s():111111111111111111111111======>start" - " to down the driver\n", __func__); + RT_TRACE(COMP_RESET, + "%s():111111111111111111111111======>start to down the driver\n", + __func__); if (!netif_queue_stopped(dev)) netif_stop_queue(dev); @@ -1531,7 +1524,7 @@ RESET_START: if (ieee->state == RTLLIB_LINKED) { SEM_DOWN_IEEE_WX(&ieee->wx_sem); - printk(KERN_INFO "ieee->state is RTLLIB_LINKED\n"); + netdev_info(dev, "ieee->state is RTLLIB_LINKED\n"); rtllib_stop_send_beacons(priv->rtllib); del_timer_sync(&ieee->associate_timer); cancel_delayed_work(&ieee->associate_retry_wq); @@ -1539,29 +1532,31 @@ RESET_START: netif_carrier_off(dev); SEM_UP_IEEE_WX(&ieee->wx_sem); } else { - printk(KERN_INFO "ieee->state is NOT LINKED\n"); + netdev_info(dev, "ieee->state is NOT LINKED\n"); rtllib_softmac_stop_protocol(priv->rtllib, 0 , true); } dm_backup_dynamic_mechanism_state(dev); up(&priv->wx_sem); - RT_TRACE(COMP_RESET, "%s():<==========down process is " - "finished\n", __func__); + RT_TRACE(COMP_RESET, + "%s():<==========down process is finished\n", + __func__); RT_TRACE(COMP_RESET, "%s():<===========up process start\n", __func__); reset_status = _rtl8192_up(dev, true); - RT_TRACE(COMP_RESET, "%s():<===========up process is " - "finished\n", __func__); + RT_TRACE(COMP_RESET, + "%s():<===========up process is finished\n", __func__); if (reset_status == -1) { if (reset_times < 3) { reset_times++; goto RESET_START; } else { - RT_TRACE(COMP_ERR, " ERR!!! %s(): Reset " - "Failed!!\n", __func__); + RT_TRACE(COMP_ERR, + " ERR!!! %s(): Reset Failed!!\n", + __func__); } } @@ -1650,7 +1645,7 @@ void rtl819x_watchdog_wqcallback(void *data) bool bHigherBusyRxTraffic = false; bool bEnterPS = false; - if (IS_NIC_DOWN(priv) || priv->bHwRadioOff) + if (!priv->up || priv->bHwRadioOff) return; if (priv->rtllib->state >= RTLLIB_LINKED) { @@ -1670,8 +1665,8 @@ void rtl819x_watchdog_wqcallback(void *data) if ((ieee->PowerSaveControl.ReturnPoint == IPS_CALLBACK_NONE) && (!ieee->bNetPromiscuousMode)) { - RT_TRACE(COMP_PS, "====================>haha: " - "IPSEnter()\n"); + RT_TRACE(COMP_PS, + "====================>haha: IPSEnter()\n"); IPSEnter(dev); } } @@ -1736,8 +1731,9 @@ void rtl819x_watchdog_wqcallback(void *data) if (ieee->eRFPowerState == eRfOff) RT_TRACE(COMP_ERR, "========>%s()\n", __func__); - printk(KERN_INFO "===>%s(): AP is power off, chan:%d," - " connect another one\n", __func__, priv->chan); + netdev_info(dev, + "===>%s(): AP is power off, chan:%d, connect another one\n", + __func__, priv->chan); ieee->state = RTLLIB_ASSOCIATING; @@ -1793,7 +1789,7 @@ void watch_dog_timer_callback(unsigned long data) queue_delayed_work_rsl(priv->priv_wq, &priv->watch_dog_wq, 0); mod_timer(&priv->watch_dog_timer, jiffies + - MSECS(RTLLIB_WATCH_DOG_TIME)); + msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME)); } /**************************************************************************** @@ -1882,7 +1878,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; - if ((priv->rtllib->eRFPowerState == eRfOff) || IS_NIC_DOWN(priv) || + if ((priv->rtllib->eRFPowerState == eRfOff) || !priv->up || priv->bResetInProgress) { kfree_skb(skb); return; @@ -1902,8 +1898,6 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, priv->rtllib->tx_headroom); priv->rtllib->stats.tx_packets++; } - - return; } int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) @@ -1916,7 +1910,7 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (queue_index != TXCMD_QUEUE) { if ((priv->rtllib->eRFPowerState == eRfOff) || - IS_NIC_DOWN(priv) || priv->bResetInProgress) { + !priv->up || priv->bResetInProgress) { kfree_skb(skb); return 0; } @@ -1926,17 +1920,16 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (queue_index == TXCMD_QUEUE) { rtl8192_tx_cmd(dev, skb); return 0; - } else { - tcb_desc->RATRIndex = 7; - tcb_desc->bTxDisableRateFallBack = 1; - tcb_desc->bTxUseDriverAssingedRate = 1; - tcb_desc->bTxEnableFwCalcDur = 1; - skb_push(skb, priv->rtllib->tx_headroom); - ret = rtl8192_tx(dev, skb); - if (ret != 0) - kfree_skb(skb); } + tcb_desc->RATRIndex = 7; + tcb_desc->bTxDisableRateFallBack = 1; + tcb_desc->bTxUseDriverAssingedRate = 1; + tcb_desc->bTxEnableFwCalcDur = 1; + skb_push(skb, priv->rtllib->tx_headroom); + ret = rtl8192_tx(dev, skb); + if (ret != 0) + kfree_skb(skb); return ret; } @@ -1987,8 +1980,6 @@ void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb) __skb_queue_tail(&ring->queue, skb); spin_unlock_irqrestore(&priv->irq_th_lock, flags); - - return; } short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) @@ -2007,9 +1998,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) u32 fwinfo_size = 0; if (priv->bdisable_nic) { - RT_TRACE(COMP_ERR, "%s: ERR!! Nic is disabled! Can't tx packet" - " len=%d qidx=%d!!!\n", __func__, skb->len, - tcb_desc->queue_index); + RT_TRACE(COMP_ERR, + "%s: ERR!! Nic is disabled! Can't tx packet len=%d qidx=%d!!!\n", + __func__, skb->len, tcb_desc->queue_index); return skb->len; } @@ -2046,8 +2037,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) pdesc = &ring->desc[idx]; if ((pdesc->OWN == 1) && (tcb_desc->queue_index != BEACON_QUEUE)) { - RT_TRACE(COMP_ERR, "No more TX desc@%d, ring->idx = %d, idx = " - "%d, skblen = 0x%x queuelen=%d", + RT_TRACE(COMP_ERR, + "No more TX desc@%d, ring->idx = %d, idx = %d, skblen = 0x%x queuelen=%d", tcb_desc->queue_index, ring->idx, idx, skb->len, skb_queue_len(&ring->queue)); spin_unlock_irqrestore(&priv->irq_th_lock, flags); @@ -2332,76 +2323,74 @@ static void rtl8192_rx_normal(struct net_device *dev) [priv->rx_idx[rx_queue_idx]]; struct sk_buff *skb = priv->rx_buf[rx_queue_idx] [priv->rx_idx[rx_queue_idx]]; + struct sk_buff *new_skb; - if (pdesc->OWN) { + if (pdesc->OWN) return; - } else { - struct sk_buff *new_skb; - - if (!priv->ops->rx_query_status_descriptor(dev, &stats, - pdesc, skb)) - goto done; - new_skb = dev_alloc_skb(priv->rxbuffersize); - /* if allocation of new skb failed - drop current packet - * and reuse skb */ - if (unlikely(!new_skb)) - goto done; - - pci_unmap_single(priv->pdev, - *((dma_addr_t *)skb->cb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); - - skb_put(skb, pdesc->Length); - skb_reserve(skb, stats.RxDrvInfoSize + - stats.RxBufShift); - skb_trim(skb, skb->len - 4/*sCrcLng*/); - rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; - if (!is_multicast_ether_addr(rtllib_hdr->addr1)) { - /* unicast packet */ - unicast_packet = true; - } - fc = le16_to_cpu(rtllib_hdr->frame_ctl); - type = WLAN_FC_GET_TYPE(fc); - if (type == RTLLIB_FTYPE_MGMT) - bLedBlinking = false; - - if (bLedBlinking) - if (priv->rtllib->LedControlHandler) - priv->rtllib->LedControlHandler(dev, - LED_CTL_RX); - - if (stats.bCRC) { - if (type != RTLLIB_FTYPE_MGMT) - priv->stats.rxdatacrcerr++; - else - priv->stats.rxmgmtcrcerr++; - } - - skb_len = skb->len; + if (!priv->ops->rx_query_status_descriptor(dev, &stats, + pdesc, skb)) + goto done; + new_skb = dev_alloc_skb(priv->rxbuffersize); + /* if allocation of new skb failed - drop current packet + * and reuse skb + */ + if (unlikely(!new_skb)) + goto done; + + pci_unmap_single(priv->pdev, + *((dma_addr_t *)skb->cb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); + + skb_put(skb, pdesc->Length); + skb_reserve(skb, stats.RxDrvInfoSize + + stats.RxBufShift); + skb_trim(skb, skb->len - 4/*sCrcLng*/); + rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; + if (!is_multicast_ether_addr(rtllib_hdr->addr1)) { + /* unicast packet */ + unicast_packet = true; + } + fc = le16_to_cpu(rtllib_hdr->frame_ctl); + type = WLAN_FC_GET_TYPE(fc); + if (type == RTLLIB_FTYPE_MGMT) + bLedBlinking = false; + + if (bLedBlinking) + if (priv->rtllib->LedControlHandler) + priv->rtllib->LedControlHandler(dev, + LED_CTL_RX); + + if (stats.bCRC) { + if (type != RTLLIB_FTYPE_MGMT) + priv->stats.rxdatacrcerr++; + else + priv->stats.rxmgmtcrcerr++; + } - if (!rtllib_rx(priv->rtllib, skb, &stats)) { - dev_kfree_skb_any(skb); - } else { - priv->stats.rxok++; - if (unicast_packet) - priv->stats.rxbytesunicast += skb_len; - } + skb_len = skb->len; - skb = new_skb; - skb->dev = dev; + if (!rtllib_rx(priv->rtllib, skb, &stats)) { + dev_kfree_skb_any(skb); + } else { + priv->stats.rxok++; + if (unicast_packet) + priv->stats.rxbytesunicast += skb_len; + } - priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = - skb; - *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, - skb_tail_pointer_rsl(skb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(priv->pdev, - *((dma_addr_t *)skb->cb))) { - dev_kfree_skb_any(skb); - return; - } + skb = new_skb; + skb->dev = dev; + + priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = + skb; + *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, + skb_tail_pointer_rsl(skb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); + if (pci_dma_mapping_error(priv->pdev, + *((dma_addr_t *)skb->cb))) { + dev_kfree_skb_any(skb); + return; } done: pdesc->BufferAddress = *((dma_addr_t *)skb->cb); @@ -2567,7 +2556,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac) down(&priv->wx_sem); - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + ether_addr_copy(dev->dev_addr, addr->sa_data); schedule_work(&priv->reset_wq); up(&priv->wx_sem); @@ -2869,7 +2858,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk(KERN_INFO "Unable to obtain 32bit DMA for consistent allocations\n"); + dev_info(&pdev->dev, + "Unable to obtain 32bit DMA for consistent allocations\n"); goto err_pci_disable; } } @@ -2902,7 +2892,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, goto err_rel_rtllib; } - printk(KERN_INFO "Memory mapped space start: 0x%08lx\n", pmem_start); + dev_info(&pdev->dev, "Memory mapped space start: 0x%08lx\n", + pmem_start); if (!request_mem_region(pmem_start, pmem_len, DRV_NAME)) { RT_TRACE(COMP_ERR, "request_mem_region failed!"); goto err_rel_rtllib; @@ -2940,8 +2931,8 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, dev->watchdog_timeo = HZ * 3; if (dev_alloc_name(dev, ifname) < 0) { - RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying " - "wlan%%d...\n"); + RT_TRACE(COMP_INIT, + "Oops: devname already taken! Trying wlan%%d...\n"); dev_alloc_name(dev, ifname); } @@ -2981,7 +2972,7 @@ err_pci_disable: static void rtl8192_pci_disconnect(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); - struct r8192_priv *priv ; + struct r8192_priv *priv; u32 i; if (dev) { @@ -3004,7 +2995,7 @@ static void rtl8192_pci_disconnect(struct pci_dev *pdev) rtl8192_free_tx_ring(dev, i); if (priv->irq) { - printk(KERN_INFO "Freeing irq %d\n", dev->irq); + dev_info(&pdev->dev, "Freeing irq %d\n", dev->irq); free_irq(dev->irq, dev); priv->irq = 0; } @@ -3032,7 +3023,7 @@ bool NicIFEnableNIC(struct net_device *dev) struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) (&(priv->rtllib->PowerSaveControl)); - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_ERR, "ERR!!! %s(): Driver is already down!\n", __func__); priv->bdisable_nic = false; @@ -3059,7 +3050,6 @@ bool NicIFEnableNIC(struct net_device *dev) } bool NicIFDisableNIC(struct net_device *dev) { - bool status = true; struct r8192_priv *priv = rtllib_priv(dev); u8 tmp_state = 0; @@ -3074,13 +3064,13 @@ bool NicIFDisableNIC(struct net_device *dev) priv->ops->stop_adapter(dev, false); RT_TRACE(COMP_PS, "<=========%s()\n", __func__); - return status; + return true; } static int __init rtl8192_pci_module_init(void) { - printk(KERN_INFO "\nLinux kernel driver for RTL8192E WLAN cards\n"); - printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan Driver\n"); + pr_info("\nLinux kernel driver for RTL8192E WLAN cards\n"); + pr_info("Copyright (c) 2007-2008, Realsil Wlan Driver\n"); if (0 != pci_register_driver(&rtl8192_pci_driver)) { DMESG("No device found"); @@ -3106,7 +3096,7 @@ void check_rfctrl_gpio_timer(unsigned long data) queue_delayed_work_rsl(priv->priv_wq, &priv->gpio_change_rf_wq, 0); mod_timer(&priv->gpio_polling_timer, jiffies + - MSECS(RTLLIB_WATCH_DOG_TIME)); + msecs_to_jiffies(RTLLIB_WATCH_DOG_TIME)); } /*************************************************************************** diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index d1438c2f8980..d365af6ebdc7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -98,14 +98,8 @@ #define BIT(_i) (1<<(_i)) #endif -#define IS_NIC_DOWN(priv) (!(priv)->up) - #define IS_ADAPTER_SENDS_BEACON(dev) 0 -#define IS_UNDER_11N_AES_MODE(_rtllib) \ - ((_rtllib->pHTInfo->bCurrentHTSupport == true) && \ - (_rtllib->pairwise_key_type == KEY_TYPE_CCMP)) - #define HAL_MEMORY_MAPPED_IO_RANGE_8190PCI 0x1000 #define HAL_HW_PCI_REVISION_ID_8190PCI 0x00 #define HAL_MEMORY_MAPPED_IO_RANGE_8192PCIE 0x4000 @@ -1004,14 +998,14 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); u8 read_nic_io_byte(struct net_device *dev, int x); u32 read_nic_io_dword(struct net_device *dev, int x); -u16 read_nic_io_word(struct net_device *dev, int x) ; +u16 read_nic_io_word(struct net_device *dev, int x); void write_nic_io_byte(struct net_device *dev, int x, u8 y); void write_nic_io_word(struct net_device *dev, int x, u16 y); void write_nic_io_dword(struct net_device *dev, int x, u32 y); u8 read_nic_byte(struct net_device *dev, int x); u32 read_nic_dword(struct net_device *dev, int x); -u16 read_nic_word(struct net_device *dev, int x) ; +u16 read_nic_word(struct net_device *dev, int x); void write_nic_byte(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index b8891c62af3e..df4bbcf38bae 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -267,7 +267,7 @@ static void dm_check_rate_adaptive(struct net_device *dev) bool bshort_gi_enabled = false; static u8 ping_rssi_state; - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_RATE, "<---- dm_check_rate_adaptive(): driver is going to unload\n"); return; } @@ -378,19 +378,16 @@ static void dm_bandwidth_autoswitch(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || - !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) { + !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) return; + if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) { + if (priv->undecorated_smoothed_pwdb <= + priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true; } else { - if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) { - if (priv->undecorated_smoothed_pwdb <= - priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true; - } else { - if (priv->undecorated_smoothed_pwdb >= - priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false; - - } + if (priv->undecorated_smoothed_pwdb >= + priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false; } } @@ -501,7 +498,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) write_nic_byte(dev, FW_Busy_Flag, 0); return; } - if ((priv->rtllib->eRFPowerState != eRfOn)) { + if (priv->rtllib->eRFPowerState != eRfOn) { RT_TRACE(COMP_POWER_TRACKING, "we are in power save, so return\n"); write_nic_byte(dev, Pw_Track_Flag, 0); @@ -581,148 +578,148 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) "priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); return; - } else { - if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { - if (RF_Type == RF_2T4R) { - - if ((priv->rfa_txpowertrackingindex > 0) && - (priv->rfc_txpowertrackingindex > 0)) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } - - priv->rfc_txpowertrackingindex--; - if (priv->rfc_txpowertrackingindex_real > 4) { - priv->rfc_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); - } - } else { - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[4].txbbgain_value); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, priv->txbbgain_table[4].txbbgain_value); - } - } else { - if (priv->rfa_txpowertrackingindex > 0) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { + if (RF_Type == RF_2T4R) { - } - } else { - if (RF_Type == RF_2T4R) { - if ((priv->rfa_txpowertrackingindex < - TxBBGainTableLength - 1) && - (priv->rfc_txpowertrackingindex < - TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; + if ((priv->rfa_txpowertrackingindex > 0) && + (priv->rfc_txpowertrackingindex > 0)) { + priv->rfa_txpowertrackingindex--; + if (priv->rfa_txpowertrackingindex_real > 4) { + priv->rfa_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, - priv->txbbgain_table - [priv->rfa_txpowertrackingindex_real].txbbgain_value); - priv->rfc_txpowertrackingindex++; - priv->rfc_txpowertrackingindex_real++; + priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); + } + + priv->rfc_txpowertrackingindex--; + if (priv->rfc_txpowertrackingindex_real > 4) { + priv->rfc_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); - } else { - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); } } else { - if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[4].txbbgain_value); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + } else { + if (priv->rfa_txpowertrackingindex > 0) { + priv->rfa_txpowertrackingindex--; + if (priv->rfa_txpowertrackingindex_real > 4) { + priv->rfa_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); - } + } + } else + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + } else { if (RF_Type == RF_2T4R) { - priv->CCKPresentAttentuation_difference - = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + if ((priv->rfa_txpowertrackingindex < + TxBBGainTableLength - 1) && + (priv->rfc_txpowertrackingindex < + TxBBGainTableLength - 1)) { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table + [priv->rfa_txpowertrackingindex_real].txbbgain_value); + priv->rfc_txpowertrackingindex++; + priv->rfc_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, + priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); + } else { + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); + } } else { - priv->CCKPresentAttentuation_difference - = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; - } - - if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - priv->CCKPresentAttentuation = - priv->CCKPresentAttentuation_20Mdefault + - priv->CCKPresentAttentuation_difference; - else - priv->CCKPresentAttentuation = - priv->CCKPresentAttentuation_40Mdefault + - priv->CCKPresentAttentuation_difference; - - if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1)) - priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1; - if (priv->CCKPresentAttentuation < 0) - priv->CCKPresentAttentuation = 0; - - if (priv->CCKPresentAttentuation > -1 && - priv->CCKPresentAttentuation < CCKTxBBGainTableLength) { - if (priv->rtllib->current_network.channel == 14 && - !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = true; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); - } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = false; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); } else - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); } - RT_TRACE(COMP_POWER_TRACKING, - "priv->rfa_txpowertrackingindex = %d\n", - priv->rfa_txpowertrackingindex); - RT_TRACE(COMP_POWER_TRACKING, - "priv->rfa_txpowertrackingindex_real = %d\n", - priv->rfa_txpowertrackingindex_real); - RT_TRACE(COMP_POWER_TRACKING, - "priv->CCKPresentAttentuation_difference = %d\n", - priv->CCKPresentAttentuation_difference); - RT_TRACE(COMP_POWER_TRACKING, - "priv->CCKPresentAttentuation = %d\n", - priv->CCKPresentAttentuation); + } + if (RF_Type == RF_2T4R) { + priv->CCKPresentAttentuation_difference + = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + } else { + priv->CCKPresentAttentuation_difference + = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; + } - if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { - priv->rtllib->bdynamic_txpower_enable = true; - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); - RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); - return; - } + if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + priv->CCKPresentAttentuation = + priv->CCKPresentAttentuation_20Mdefault + + priv->CCKPresentAttentuation_difference; + else + priv->CCKPresentAttentuation = + priv->CCKPresentAttentuation_40Mdefault + + priv->CCKPresentAttentuation_difference; + + if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1)) + priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1; + if (priv->CCKPresentAttentuation < 0) + priv->CCKPresentAttentuation = 0; + + if (priv->CCKPresentAttentuation > -1 && + priv->CCKPresentAttentuation < CCKTxBBGainTableLength) { + if (priv->rtllib->current_network.channel == 14 && + !priv->bcck_in_ch14) { + priv->bcck_in_ch14 = true; + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { + priv->bcck_in_ch14 = false; + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } else + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex = %d\n", + priv->rfa_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_real = %d\n", + priv->rfa_txpowertrackingindex_real); + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_difference = %d\n", + priv->CCKPresentAttentuation_difference); + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation = %d\n", + priv->CCKPresentAttentuation); + + if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { + priv->rtllib->bdynamic_txpower_enable = true; + write_nic_byte(dev, Pw_Track_Flag, 0); + write_nic_byte(dev, FW_Busy_Flag, 0); + RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); + return; } + write_nic_byte(dev, Pw_Track_Flag, 0); Avg_TSSI_Meas_from_driver = 0; for (k = 0; k < 5; k++) @@ -757,8 +754,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) for (i = 0; i < CCK_Table_length; i++) { if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) { priv->CCK_index = (u8) i; - RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x" - " = 0x%x, CCK_index = 0x%x\n", + RT_TRACE(COMP_POWER_TRACKING, + "Initial reg0x%x = 0x%x, CCK_index = 0x%x\n", rCCK0_TxFilter1, TempCCk, priv->CCK_index); break; @@ -803,8 +800,8 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) priv->Record_CCK_20Mindex = tmpCCK20Mindex; priv->Record_CCK_40Mindex = tmpCCK40Mindex; - RT_TRACE(COMP_POWER_TRACKING, "Record_CCK_20Mindex / Record_CCK_40" - "Mindex = %d / %d.\n", + RT_TRACE(COMP_POWER_TRACKING, + "Record_CCK_20Mindex / Record_CCK_40Mindex = %d / %d.\n", priv->Record_CCK_20Mindex, priv->Record_CCK_40Mindex); if (priv->rtllib->current_network.channel == 14 && @@ -1401,13 +1398,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) TxPowerCheckCnt = 5; else TxPowerCheckCnt = 2; - if (!priv->btxpower_tracking) { + if (!priv->btxpower_tracking) + return; + + if (priv->txpower_count <= TxPowerCheckCnt) { + priv->txpower_count++; return; - } else { - if (priv->txpower_count <= TxPowerCheckCnt) { - priv->txpower_count++; - return; - } } if (!TM_Trigger) { @@ -1419,14 +1415,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) } TM_Trigger = 1; return; - } else { - printk(KERN_INFO "===============>Schedule TxPowerTrackingWorkItem\n"); - - queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); - TM_Trigger = 0; - } - } + netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n"); + queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); + TM_Trigger = 0; + +} static void dm_check_txpower_tracking(struct net_device *dev) { @@ -1446,7 +1440,7 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) TempVal = 0; if (!bInCH14) { TempVal = (u32)(priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[0] + - (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)) ; + (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[2] + @@ -1455,12 +1449,12 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[5]<<24)); rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[6] + - (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)) ; + (priv->cck_txbbgain_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); } else { TempVal = (u32)(priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[0] + - (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)) ; + (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[1]<<8)); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[2] + @@ -1469,7 +1463,7 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[5]<<24)); rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); TempVal = (u32)(priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[6] + - (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)) ; + (priv->cck_txbbgain_ch14_table[(u8)(priv->CCKPresentAttentuation)].ccktxbb_valuearray[7]<<8)); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); } @@ -1485,7 +1479,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH TempVal = 0; if (!bInCH14) { TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] + - (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ; + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter1, TempVal); @@ -1497,14 +1491,14 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2, TempVal); TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] + - (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ; + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_DebugPort, TempVal); } else { TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + - (CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ; + (CCKSwingTable_Ch14[priv->CCK_index][1]<<8); rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", @@ -1517,7 +1511,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2, TempVal); TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + - (CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ; + (CCKSwingTable_Ch14[priv->CCK_index][7]<<8); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", @@ -1569,7 +1563,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) u32 reg_ratr = priv->rate_adaptive.last_ratr; u32 ratr_value; - if (IS_NIC_DOWN(priv)) { + if (!priv->up) { RT_TRACE(COMP_RATE, "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n"); return; } @@ -1830,12 +1824,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) && (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh)) return; - if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh)) { + if (priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh) { if (dm_digtable.dig_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt)) return; - else - reset_cnt = priv->reset_count; + reset_cnt = priv->reset_count; dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; dm_digtable.dig_state = DM_STA_DIG_OFF; @@ -1857,19 +1850,18 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( return; } - if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)) { + if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) { u8 reset_flag = 0; if (dm_digtable.dig_state == DM_STA_DIG_ON && (priv->reset_count == reset_cnt)) { dm_ctrl_initgain_byrssi_highpwr(dev); return; - } else { - if (priv->reset_count != reset_cnt) - reset_flag = 1; - - reset_cnt = priv->reset_count; } + if (priv->reset_count != reset_cnt) + reset_flag = 1; + + reset_cnt = priv->reset_count; dm_digtable.dig_state = DM_STA_DIG_ON; @@ -1911,8 +1903,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON && (priv->reset_count == reset_cnt_highpwr)) return; - else - dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; + dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); @@ -1922,8 +1913,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt_highpwr)) return; - else - dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; + dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh && priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) { @@ -2008,7 +1998,7 @@ static void dm_pd_th(struct net_device *dev) if (dm_digtable.CurSTAConnectState == DIG_STA_CONNECT) { if (dm_digtable.rssi_val >= dm_digtable.rssi_high_power_highthresh) dm_digtable.curpd_thstate = DIG_PD_AT_HIGH_POWER; - else if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)) + else if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh) dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER; else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) && (dm_digtable.rssi_val < dm_digtable.rssi_high_power_lowthresh)) @@ -2065,9 +2055,9 @@ static void dm_cs_ratio(struct net_device *dev) if (dm_digtable.PreSTAConnectState == dm_digtable.CurSTAConnectState) { if (dm_digtable.CurSTAConnectState == DIG_STA_CONNECT) { - if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)) + if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh) dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER; - else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh)) + else if (dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) dm_digtable.curcs_ratio_state = DIG_CS_RATIO_HIGHER; else dm_digtable.curcs_ratio_state = dm_digtable.precs_ratio_state; @@ -2131,10 +2121,10 @@ static void dm_check_edca_turbo(struct net_device *dev) static int wb_tmp; if (wb_tmp == 0) { - printk(KERN_INFO "%s():iot peer is %s, bssid:" - " %pM\n", __func__, - peername[pHTInfo->IOTPeer], - priv->rtllib->current_network.bssid); + netdev_info(dev, + "%s():iot peer is %s, bssid: %pM\n", + __func__, peername[pHTInfo->IOTPeer], + priv->rtllib->current_network.bssid); wb_tmp = 1; } } @@ -2638,9 +2628,10 @@ void dm_fsync_timer_callback(unsigned long data) } priv->rate_record = rate_count; priv->rateCountDiffRecord = rate_count_diff; - RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rate" - "Countdiff %d bSwitchFsync %d\n", priv->rate_record, - rate_count, rate_count_diff, priv->bswitch_fsync); + RT_TRACE(COMP_HALDM, + "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", + priv->rate_record, rate_count, rate_count_diff, + priv->bswitch_fsync); if (priv->undecorated_smoothed_pwdb > priv->rtllib->fsync_rssi_threshold && bSwitchFromCountDiff) { @@ -2665,14 +2656,14 @@ void dm_fsync_timer_callback(unsigned long data) if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); priv->fsync_timer.expires = jiffies + - MSECS(priv->rtllib->fsync_time_interval * + msecs_to_jiffies(priv->rtllib->fsync_time_interval * priv->rtllib->fsync_multiple_timeinterval); add_timer(&priv->fsync_timer); } else { if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); priv->fsync_timer.expires = jiffies + - MSECS(priv->rtllib->fsync_time_interval); + msecs_to_jiffies(priv->rtllib->fsync_time_interval); add_timer(&priv->fsync_timer); } } else { @@ -2685,9 +2676,10 @@ void dm_fsync_timer_callback(unsigned long data) write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); } RT_TRACE(COMP_HALDM, "ContinueDiffCount %d\n", priv->ContinueDiffCount); - RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d " - "bSwitchFsync %d\n", priv->rate_record, rate_count, - rate_count_diff, priv->bswitch_fsync); + RT_TRACE(COMP_HALDM, + "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", + priv->rate_record, rate_count, rate_count_diff, + priv->bswitch_fsync); } static void dm_StartHWFsync(struct net_device *dev) @@ -2762,7 +2754,7 @@ static void dm_StartSWFsync(struct net_device *dev) if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); priv->fsync_timer.expires = jiffies + - MSECS(priv->rtllib->fsync_time_interval); + msecs_to_jiffies(priv->rtllib->fsync_time_interval); add_timer(&priv->fsync_timer); write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); @@ -2778,12 +2770,14 @@ void dm_check_fsync(struct net_device *dev) static u8 reg_c38_State = RegC38_Default; static u32 reset_cnt; - RT_TRACE(COMP_HALDM, "RSSI %d TimeInterval %d MultipleTimeInterval " - "%d\n", priv->rtllib->fsync_rssi_threshold, + RT_TRACE(COMP_HALDM, + "RSSI %d TimeInterval %d MultipleTimeInterval %d\n", + priv->rtllib->fsync_rssi_threshold, priv->rtllib->fsync_time_interval, priv->rtllib->fsync_multiple_timeinterval); - RT_TRACE(COMP_HALDM, "RateBitmap 0x%x FirstDiffRateThreshold %d Second" - "DiffRateThreshold %d\n", priv->rtllib->fsync_rate_bitmap, + RT_TRACE(COMP_HALDM, + "RateBitmap 0x%x FirstDiffRateThreshold %d SecondDiffRateThreshold %d\n", + priv->rtllib->fsync_rate_bitmap, priv->rtllib->fsync_firstdiff_ratethreshold, priv->rtllib->fsync_seconddiff_ratethreshold); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index ab44a9a6927c..3f02e11cfc57 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h @@ -255,14 +255,6 @@ extern u8 test_flag; /*------------------------Export global variable----------------------------*/ -/*------------------------Export Marco Definition---------------------------*/ -#define DM_APInitGainChangeNotify(Event) \ - { \ - dm_digtable.CurAPConnectState = Event; \ - } -/*------------------------Export Marco Definition---------------------------*/ - - /*--------------------------Exported Function prototype---------------------*/ /*--------------------------Exported Function prototype---------------------*/ extern void init_hal_dm(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index 2ad92eee50c2..51f53be2de17 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c @@ -65,27 +65,32 @@ bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev) if (DeviceID == 0x8172) { switch (RevisionID) { case HAL_HW_PCI_REVISION_ID_8192PCIE: - printk(KERN_INFO "Adapter(8192 PCI-E) is found - " - "DeviceID=%x\n", DeviceID); + dev_info(&pdev->dev, + "Adapter(8192 PCI-E) is found - DeviceID=%x\n", + DeviceID); priv->card_8192 = NIC_8192E; break; case HAL_HW_PCI_REVISION_ID_8192SE: - printk(KERN_INFO "Adapter(8192SE) is found - " - "DeviceID=%x\n", DeviceID); + dev_info(&pdev->dev, + "Adapter(8192SE) is found - DeviceID=%x\n", + DeviceID); priv->card_8192 = NIC_8192SE; break; default: - printk(KERN_INFO "UNKNOWN nic type(%4x:%4x)\n", - pdev->vendor, pdev->device); + dev_info(&pdev->dev, + "UNKNOWN nic type(%4x:%4x)\n", + pdev->vendor, pdev->device); priv->card_8192 = NIC_UNKNOWN; return false; } } if (priv->ops->nic_type != priv->card_8192) { - printk(KERN_INFO "Detect info(%x) and hardware info(%x) not match!\n", - priv->ops->nic_type, priv->card_8192); - printk(KERN_INFO "Please select proper driver before install!!!!\n"); + dev_info(&pdev->dev, + "Detect info(%x) and hardware info(%x) not match!\n", + priv->ops->nic_type, priv->card_8192); + dev_info(&pdev->dev, + "Please select proper driver before install!!!!\n"); return false; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index 0b4f76481bf4..ca6ecfc8299e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -29,14 +29,14 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) struct r8192_priv *priv = rtllib_priv(dev); u32 ulRegRead; - printk(KERN_INFO "============> r8192E suspend call.\n"); + netdev_info(dev, "============> r8192E suspend call.\n"); del_timer_sync(&priv->gpio_polling_timer); cancel_delayed_work(&priv->gpio_change_rf_wq); priv->polling_timer_on = 0; if (!netif_running(dev)) { - printk(KERN_INFO "RTL819XE:UI is open out of suspend " - "function\n"); + netdev_info(dev, + "RTL819XE:UI is open out of suspend function\n"); goto out_pci_suspend; } @@ -57,10 +57,10 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) write_nic_byte(dev, MacBlkCtrl, 0xa); } out_pci_suspend: - printk("r8192E support WOL call??????????????????????\n"); + netdev_info(dev, "r8192E support WOL call??????????????????????\n"); if (priv->rtllib->bSupportRemoteWakeUp) - RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!" - "!!!!!!!!!!!.\n"); + RT_TRACE(COMP_POWER, + "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n"); pci_save_state(pdev); pci_disable_device(pdev); pci_enable_wake(pdev, pci_choose_state(pdev, state), @@ -79,14 +79,13 @@ int rtl8192E_resume(struct pci_dev *pdev) int err; u32 val; - printk(KERN_INFO "================>r8192E resume call.\n"); + netdev_info(dev, "================>r8192E resume call.\n"); pci_set_power_state(pdev, PCI_D0); err = pci_enable_device(pdev); if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); + netdev_err(dev, "pci_enable_device failed on resume\n"); return err; } pci_restore_state(pdev); @@ -101,8 +100,8 @@ int rtl8192E_resume(struct pci_dev *pdev) check_rfctrl_gpio_timer((unsigned long)dev); if (!netif_running(dev)) { - printk(KERN_INFO "RTL819XE:UI is open out of resume " - "function\n"); + netdev_info(dev, + "RTL819XE:UI is open out of resume function\n"); goto out; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 4856b76292f9..0bbffec0c2ae 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -37,8 +37,8 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) spin_lock_irqsave(&priv->rf_ps_lock, flags); if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flags); - RT_TRACE(COMP_DBG, "rtl8192_hw_sleep_down(): RF Change in " - "progress!\n"); + RT_TRACE(COMP_DBG, + "rtl8192_hw_sleep_down(): RF Change in progress!\n"); return; } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); @@ -64,10 +64,11 @@ void rtl8192_hw_wakeup(struct net_device *dev) spin_lock_irqsave(&priv->rf_ps_lock, flags); if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock, flags); - RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in " - "progress!\n"); + RT_TRACE(COMP_DBG, + "rtl8192_hw_wakeup(): RF Change in progress!\n"); queue_delayed_work_rsl(priv->rtllib->wq, - &priv->rtllib->hw_wakeup_wq, MSECS(10)); + &priv->rtllib->hw_wakeup_wq, + msecs_to_jiffies(10)); return; } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); @@ -95,18 +96,18 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) spin_lock_irqsave(&priv->ps_lock, flags); - time -= MSECS(8+16+7); + time -= msecs_to_jiffies(8 + 16 + 7); - if ((time - jiffies) <= MSECS(MIN_SLEEP_TIME)) { + if ((time - jiffies) <= msecs_to_jiffies(MIN_SLEEP_TIME)) { spin_unlock_irqrestore(&priv->ps_lock, flags); - printk(KERN_INFO "too short to sleep::%lld < %ld\n", - time - jiffies, MSECS(MIN_SLEEP_TIME)); + netdev_info(dev, "too short to sleep::%lld < %ld\n", + time - jiffies, msecs_to_jiffies(MIN_SLEEP_TIME)); return; } - if ((time - jiffies) > MSECS(MAX_SLEEP_TIME)) { - printk(KERN_INFO "========>too long to sleep:%lld > %ld\n", - time - jiffies, MSECS(MAX_SLEEP_TIME)); + if ((time - jiffies) > msecs_to_jiffies(MAX_SLEEP_TIME)) { + netdev_info(dev, "========>too long to sleep:%lld > %ld\n", + time - jiffies, msecs_to_jiffies(MAX_SLEEP_TIME)); spin_unlock_irqrestore(&priv->ps_lock, flags); return; } @@ -201,12 +202,11 @@ void rtllib_ips_leave_wq(struct net_device *dev) RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); return; - } else { - printk(KERN_INFO "=========>%s(): IPSLeave\n", - __func__); - queue_work_rsl(priv->rtllib->wq, - &priv->rtllib->ips_leave_wq); } + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); + queue_work_rsl(priv->rtllib->wq, + &priv->rtllib->ips_leave_wq); } } } @@ -239,8 +239,8 @@ static bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, priv->rtllib->sta_sleep = LPS_IS_WAKE; spin_lock_irqsave(&(priv->rtllib->mgmt_tx_lock), flags); - RT_TRACE(COMP_DBG, "LPS leave: notify AP we are awaked" - " ++++++++++ SendNullFunctionData\n"); + RT_TRACE(COMP_DBG, + "LPS leave: notify AP we are awaked ++++++++++ SendNullFunctionData\n"); rtllib_sta_ps_send_null_frame(priv->rtllib, 0); spin_unlock_irqrestore(&(priv->rtllib->mgmt_tx_lock), flags); } @@ -255,8 +255,8 @@ void LeisurePSEnter(struct net_device *dev) &(priv->rtllib->PowerSaveControl); RT_TRACE(COMP_PS, "LeisurePSEnter()...\n"); - RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdle" - "Count is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", + RT_TRACE(COMP_PS, + "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdleCount is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", pPSC->bLeisurePs, priv->rtllib->ps, pPSC->LpsIdleCount, RT_CHECK_FOR_HANG_PERIOD); @@ -271,8 +271,8 @@ void LeisurePSEnter(struct net_device *dev) if (priv->rtllib->ps == RTLLIB_PS_DISABLED) { - RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter " - "802.11 power save mode...\n"); + RT_TRACE(COMP_LPS, + "LeisurePSEnter(): Enter 802.11 power save mode...\n"); if (!pPSC->bFwCtrlLPS) { if (priv->rtllib->SetFwCmdHandler) @@ -301,8 +301,8 @@ void LeisurePSLeave(struct net_device *dev) if (pPSC->bLeisurePs) { if (priv->rtllib->ps != RTLLIB_PS_DISABLED) { - RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , " - "Leave 802.11 power save..\n"); + RT_TRACE(COMP_LPS, + "LeisurePSLeave(): Busy Traffic , Leave 802.11 power save..\n"); MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_DISABLED); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index df0323f00f69..8d6a109e023b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -67,7 +67,7 @@ static int r8192_wx_set_rate(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -87,7 +87,7 @@ static int r8192_wx_set_rts(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -115,9 +115,10 @@ static int r8192_wx_set_power(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) { - RT_TRACE(COMP_ERR, "%s():Hw is Radio Off, we can't set " - "Power,return\n", __func__); + if (priv->bHwRadioOff) { + RT_TRACE(COMP_ERR, + "%s():Hw is Radio Off, we can't set Power,return\n", + __func__); return 0; } down(&priv->wx_sem); @@ -145,7 +146,7 @@ static int r8192_wx_set_rawtx(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int ret; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -254,10 +255,11 @@ static int r8192se_wx_set_radio(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO "%s(): set radio ! extra is %d\n", __func__, *extra); + netdev_info(dev, "%s(): set radio ! extra is %d\n", __func__, *extra); if ((*extra != 0) && (*extra != 1)) { - RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio " - "off) or 1(radio on)\n", __func__); + RT_TRACE(COMP_ERR, + "%s(): set radio an err value,must 0(radio off) or 1(radio on)\n", + __func__); up(&priv->wx_sem); return -1; } @@ -277,8 +279,8 @@ static int r8192se_wx_set_lps_awake_interval(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO "%s(): set lps awake interval ! extra is %d\n", - __func__, *extra); + netdev_info(dev, "%s(): set lps awake interval ! extra is %d\n", + __func__, *extra); pPSC->RegMaxLPSAwakeIntvl = *extra; up(&priv->wx_sem); @@ -293,8 +295,9 @@ static int r8192se_wx_set_force_lps(struct net_device *dev, down(&priv->wx_sem); - printk(KERN_INFO "%s(): force LPS ! extra is %d (1 is open 0 is " - "close)\n", __func__, *extra); + netdev_info(dev, + "%s(): force LPS ! extra is %d (1 is open 0 is close)\n", + __func__, *extra); priv->force_lps = *extra; up(&priv->wx_sem); return 0; @@ -308,11 +311,11 @@ static int r8192_wx_set_debugflag(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); u8 c = *extra; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; - printk(KERN_INFO "=====>%s(), *extra:%x, debugflag:%x\n", __func__, - *extra, rt_global_debug_component); + netdev_info(dev, "=====>%s(), *extra:%x, debugflag:%x\n", __func__, + *extra, rt_global_debug_component); if (c > 0) rt_global_debug_component |= (1<<c); else @@ -329,7 +332,7 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, enum rt_rf_power_state rtState; int ret; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; rtState = priv->rtllib->eRFPowerState; down(&priv->wx_sem); @@ -343,13 +346,12 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, __func__); up(&priv->wx_sem); return -1; - } else { - printk(KERN_INFO "=========>%s(): " - "IPSLeave\n", __func__); - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } } @@ -470,9 +472,9 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, return 0; } - if (priv->bHwRadioOff == true) { - printk(KERN_INFO "================>%s(): hwradio off\n", - __func__); + if (priv->bHwRadioOff) { + netdev_info(dev, "================>%s(): hwradio off\n", + __func__); return 0; } rtState = priv->rtllib->eRFPowerState; @@ -500,17 +502,17 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, if (rtState == eRfOff) { if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) { - RT_TRACE(COMP_ERR, "%s(): RF is " - "OFF.\n", __func__); + RT_TRACE(COMP_ERR, + "%s(): RF is OFF.\n", + __func__); up(&priv->wx_sem); return -1; - } else { - RT_TRACE(COMP_PS, "=========>%s(): " - "IPSLeave\n", __func__); - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n", + __func__); + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } rtllib_stop_scan(priv->rtllib); @@ -552,7 +554,7 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, if (!priv->up) return -ENETDOWN; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; @@ -572,13 +574,10 @@ static int r8192_wx_set_essid(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int ret; - if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { - ; /* TODO - get rid of if */ - } - if (priv->bHwRadioOff == true) { - printk(KERN_INFO "=========>%s():hw radio off,or Rf state is " - "eRfOff, return\n", __func__); + if (priv->bHwRadioOff) { + netdev_info(dev, + "=========>%s():hw radio off,or Rf state is eRfOff, return\n", + __func__); return 0; } down(&priv->wx_sem); @@ -642,7 +641,7 @@ static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -669,7 +668,7 @@ static int r8192_wx_set_frag(struct net_device *dev, { struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; if (wrqu->frag.disabled) @@ -708,12 +707,7 @@ static int r8192_wx_set_wap(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { - ; /* TODO - get rid of if */ - } - - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -763,10 +757,7 @@ static int r8192_wx_set_enc(struct net_device *dev, {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} }; int i; - if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) - ; /* TODO - get rid of if */ - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; if (!priv->up) @@ -838,7 +829,8 @@ static int r8192_wx_set_enc(struct net_device *dev, set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, zero_addr[key_idx], 0, hwkey, 0); } else { - printk(KERN_INFO "wrong type in WEP, not WEP40 and WEP104\n"); + netdev_info(dev, + "wrong type in WEP, not WEP40 and WEP104\n"); } } @@ -855,7 +847,7 @@ static int r8192_wx_set_scan_type(struct net_device *dev, int *parms = (int *)p; int mode = parms[0]; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; priv->rtllib->active_scan = mode; @@ -873,7 +865,7 @@ static int r8192_wx_set_retry(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int err = 0; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -956,7 +948,7 @@ static int r8192_wx_set_sens(struct net_device *dev, short err = 0; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -983,7 +975,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1064,7 +1056,7 @@ static int r8192_wx_set_auth(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1082,7 +1074,7 @@ static int r8192_wx_set_mlme(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1099,7 +1091,7 @@ static int r8192_wx_set_gen_ie(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true) + if (priv->bHwRadioOff) return 0; down(&priv->wx_sem); @@ -1160,8 +1152,10 @@ static int r8192_wx_set_PromiscuousMode(struct net_device *dev, (rtllib_EnableIntelPromiscuousMode(dev, false)) : (rtllib_DisableIntelPromiscuousMode(dev, false)); - printk(KERN_INFO "=======>%s(), on = %d, filter src sta = %d\n", - __func__, bPromiscuousOn, bFilterSourceStationFrame); + netdev_info(dev, + "=======>%s(), on = %d, filter src sta = %d\n", + __func__, bPromiscuousOn, + bFilterSourceStationFrame); } else { return -1; } @@ -1227,11 +1221,10 @@ static iw_handler r8192_wx_handlers[] = { IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext, }; -/* - * the following rule need to be following, +/* the following rule need to be following, * Odd : get (world access), * even : set (root access) - * */ + */ static const struct iw_priv_args r8192_private_args[] = { { SIOCIWFIRSTPRIV + 0x0, diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 0415e02b4eff..26258ea8de4a 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -26,7 +26,7 @@ static void ActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA, { pBA->bValid = true; if (Time != 0) - mod_timer(&pBA->Timer, jiffies + MSECS(Time)); + mod_timer(&pBA->Timer, jiffies + msecs_to_jiffies(Time)); } static void DeActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA) @@ -83,9 +83,9 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, u8 *tag = NULL; u16 len = ieee->tx_headroom + 9; - RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "========>%s(), frame(%d)" - " sentd to: %pM, ieee->dev:%p\n", __func__, - type, Dst, ieee->dev); + RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, + "========>%s(), frame(%d) sentd to: %pM, ieee->dev:%p\n", + __func__, type, Dst, ieee->dev); if (pBA == NULL) { RTLLIB_DEBUG(RTLLIB_DL_ERR, "pBA is NULL\n"); return NULL; @@ -148,9 +148,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, if (net_ratelimit()) RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, - "========>%s(), Reason" - "Code(%d) sentd to: %pM\n", __func__, - ReasonCode, dst); + "========>%s(), ReasonCode(%d) sentd to: %pM\n", + __func__, ReasonCode, dst); memset(&DelbaParamSet, 0, 2); @@ -203,8 +202,8 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, RT_TRACE(COMP_DBG, "====>to send ADDBAREQ!!!!!\n"); softmac_mgmt_xmit(skb, ieee); } else { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function" - " %s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "alloc skb error in function %s()\n", __func__); } } @@ -217,8 +216,8 @@ static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst, if (skb) softmac_mgmt_xmit(skb, ieee); else - RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function" - " %s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "alloc skb error in function %s()\n", __func__); } static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst, @@ -231,8 +230,8 @@ static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst, if (skb) softmac_mgmt_xmit(skb, ieee); else - RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function" - " %s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "alloc skb error in function %s()\n", __func__); } int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) @@ -247,8 +246,9 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) struct rx_ts_record *pTS = NULL; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BAREQ(%d / " - "%d)\n", (int)skb->len, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + " Invalid skb len in BAREQ(%d / %d)\n", + (int)skb->len, (int)(sizeof(struct rtllib_hdr_3addr) + 9)); return -1; } @@ -269,8 +269,8 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) (ieee->pHTInfo->bCurrentHTSupport == false) || (ieee->pHTInfo->IOTAction & HT_IOT_ACT_REJECT_ADDBA_REQ)) { rc = ADDBA_STATUS_REFUSED; - RTLLIB_DEBUG(RTLLIB_DL_ERR, "Failed to reply on ADDBA_REQ as " - "some capability is not ready(%d, %d)\n", + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); goto OnADDBAReq_Fail; @@ -285,8 +285,8 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { rc = ADDBA_STATUS_INVALID_PARAM; - RTLLIB_DEBUG(RTLLIB_DL_ERR, "BA Policy is not correct in " - "%s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "BA Policy is not correct in %s()\n", __func__); goto OnADDBAReq_Fail; } @@ -333,8 +333,9 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) u16 ReasonCode; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BARSP(%d / " - "%d)\n", (int)skb->len, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "Invalid skb len in BARSP(%d / %d)\n", + (int)skb->len, (int)(sizeof(struct rtllib_hdr_3addr) + 9)); return -1; } @@ -351,8 +352,8 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) if (ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false || ieee->pHTInfo->bCurrentAMPDUEnable == false) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "reject to ADDBA_RSP as some capab" - "ility is not ready(%d, %d, %d)\n", + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); @@ -374,18 +375,19 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) if (pAdmittedBA->bValid == true) { - RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp." - " Drop because already admit it!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it!\n"); return -1; } else if ((pPendingBA->bValid == false) || (*pDialogToken != pPendingBA->DialogToken)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. " - "BA invalid, DELBA!\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA!\n"); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; } else { - RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA " - "is admitted! Status code:%X\n", *pStatusCode); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", + *pStatusCode); DeActivateBAEntry(ieee, pPendingBA); } @@ -432,16 +434,17 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) u8 *dst = NULL; if (skb->len < sizeof(struct rtllib_hdr_3addr) + 6) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in DELBA(%d /" - " %d)\n", (int)skb->len, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "Invalid skb len in DELBA(%d / %d)\n", + (int)skb->len, (int)(sizeof(struct rtllib_hdr_3addr) + 6)); return -1; } if (ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "received DELBA while QOS or HT " - "is not supported(%d, %d)\n", + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "received DELBA while QOS or HT is not supported(%d, %d)\n", ieee->current_network. qos_data.active, ieee->pHTInfo->bCurrentHTSupport); return -1; @@ -459,8 +462,9 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) if (!GetTs(ieee, (struct ts_common_info **)&pRxTs, dst, (u8)pDelBaParamSet->field.TID, RX_DIR, false)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for RXTS in " - "%s().dst: %pM TID:%d\n", __func__, dst, + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "can't get TS for RXTS in %s().dst: %pM TID:%d\n", + __func__, dst, (u8)pDelBaParamSet->field.TID); return -1; } @@ -471,8 +475,9 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) if (!GetTs(ieee, (struct ts_common_info **)&pTxTs, dst, (u8)pDelBaParamSet->field.TID, TX_DIR, false)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for TXTS in " - "%s()\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "can't get TS for TXTS in %s()\n", + __func__); return -1; } diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index 13f41057461a..f7076d7ddc53 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -77,43 +77,6 @@ enum chnl_op { CHNLOP_SWCHNL = 3, }; -#define CHHLOP_IN_PROGRESS(_pHTInfo) \ - ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false - -/* -union ht_capability { - u16 ShortData; - u8 CharData[2]; - struct - { - u16 AdvCoding:1; - u16 ChlWidth:1; - u16 MimoPwrSave:2; - u16 GreenField:1; - u16 ShortGI20Mhz:1; - u16 ShortGI40Mhz:1; - u16 STBC:1; - u16 BeamForm:1; - u16 DelayBA:1; - u16 MaxAMSDUSize:1; - u16 DssCCk:1; - u16 PSMP:1; - u16 Rsvd:3; - }Field; -}; - -union ht_capability_macpara { - u8 ShortData; - u8 CharData[1]; - struct - { - u8 MaxRxAMPDU:2; - u8 MPDUDensity:2; - u8 Rsvd:4; - }Field; -}; -*/ - enum ht_action { ACT_RECOMMAND_WIDTH = 0, ACT_MIMO_PWR_SAVE = 1, @@ -380,16 +343,6 @@ struct false_alarm_stats { extern u8 MCS_FILTER_ALL[16]; extern u8 MCS_FILTER_1SS[16]; -#define PICK_RATE(_nLegacyRate, _nMcsRate) \ - ((_nMcsRate == 0) ? (_nLegacyRate&0x7f) : (_nMcsRate)) -#define LEGACY_WIRELESS_MODE IEEE_MODE_MASK - -#define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ - ((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \ - (LegacyRate) : (PICK_RATE(LegacyRate, HTRate)) - - - #define RATE_ADPT_1SS_MASK 0xFF #define RATE_ADPT_2SS_MASK 0xF0 #define RATE_ADPT_MCS32_MASK 0x01 diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 1ea426b7b7ac..7f103114d5d2 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -117,160 +117,6 @@ void HTUpdateDefaultSetting(struct rtllib_device *ieee) pHTInfo->RxReorderPendingTime = 30; } -void HTDebugHTCapability(u8 *CapIE, u8 *TitleString) -{ - - static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; - struct ht_capab_ele *pCapELE; - - if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) { - RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__); - pCapELE = (struct ht_capab_ele *)(&CapIE[4]); - } else - pCapELE = (struct ht_capab_ele *)(&CapIE[0]); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "<Log HT Capability>. Called by %s\n", - TitleString); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupported Channel Width = %s\n", - (pCapELE->ChlWidth) ? "20MHz" : "20/40MHz"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 20M = %s\n", - (pCapELE->ShortGI20Mhz) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 40M = %s\n", - (pCapELE->ShortGI40Mhz) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport TX STBC = %s\n", - (pCapELE->TxSTBC) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMSDU Size = %s\n", - (pCapELE->MaxAMSDUSize) ? "3839" : "7935"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport CCK in 20/40 mode = %s\n", - (pCapELE->DssCCk) ? "YES" : "NO"); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMPDU Factor = %d\n", - pCapELE->MaxRxAMPDUFactor); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMPDU Density = %d\n", - pCapELE->MPDUDensity); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", - pCapELE->MCS[0], pCapELE->MCS[1], pCapELE->MCS[2], - pCapELE->MCS[3], pCapELE->MCS[4]); - return; - -} - -void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString) -{ - - static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; - struct ht_info_ele *pHTInfoEle; - - if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) { - RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__); - pHTInfoEle = (struct ht_info_ele *)(&InfoIE[4]); - } else - pHTInfoEle = (struct ht_info_ele *)(&InfoIE[0]); - - - RTLLIB_DEBUG(RTLLIB_DL_HT, "<Log HT Information Element>. " - "Called by %s\n", TitleString); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tPrimary channel = %d\n", - pHTInfoEle->ControlChl); - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSenondary channel ="); - switch (pHTInfoEle->ExtChlOffset) { - case 0: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Not Present\n"); - break; - case 1: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Upper channel\n"); - break; - case 2: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Reserved. Eooro!!!\n"); - break; - case 3: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Lower Channel\n"); - break; - } - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tRecommended channel width = %s\n", - (pHTInfoEle->RecommemdedTxWidth) ? "20Mhz" : "40Mhz"); - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tOperation mode for protection = "); - switch (pHTInfoEle->OptMode) { - case 0: - RTLLIB_DEBUG(RTLLIB_DL_HT, "No Protection\n"); - break; - case 1: - RTLLIB_DEBUG(RTLLIB_DL_HT, "HT non-member protection mode\n"); - break; - case 2: - RTLLIB_DEBUG(RTLLIB_DL_HT, "Suggest to open protection\n"); - break; - case 3: - RTLLIB_DEBUG(RTLLIB_DL_HT, "HT mixed mode\n"); - break; - } - - RTLLIB_DEBUG(RTLLIB_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x]" - "[%x]\n", pHTInfoEle->BasicMSC[0], pHTInfoEle->BasicMSC[1], - pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], - pHTInfoEle->BasicMSC[4]); -} - -static bool IsHTHalfNmode40Bandwidth(struct rtllib_device *ieee) -{ - bool retValue = false; - struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; - - if (pHTInfo->bCurrentHTSupport == false) - retValue = false; - else if (pHTInfo->bRegBW40MHz == false) - retValue = false; - else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) - retValue = false; - else if (((struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf))->ChlWidth) - retValue = true; - else - retValue = false; - - return retValue; -} - -static bool IsHTHalfNmodeSGI(struct rtllib_device *ieee, bool is40MHz) -{ - bool retValue = false; - struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; - - if (pHTInfo->bCurrentHTSupport == false) - retValue = false; - else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) - retValue = false; - else if (is40MHz) { - if (((struct ht_capab_ele *) - (pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) - retValue = true; - else - retValue = false; - } else { - if (((struct ht_capab_ele *) - (pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) - retValue = true; - else - retValue = false; - } - - return retValue; -} - -u16 HTHalfMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate) -{ - - u8 is40MHz; - u8 isShortGI; - - is40MHz = (IsHTHalfNmode40Bandwidth(ieee)) ? 1 : 0; - isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1 : 0; - - return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)]; -} - - u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate) { struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; @@ -289,25 +135,22 @@ u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate) u8 is40MHz = 0; u8 isShortGI = 0; - if (nDataRate < 12) { + if (nDataRate < 12) return CCKOFDMRate[nDataRate]; - } else { - if (nDataRate >= 0x10 && nDataRate <= 0x1f) { - is40MHz = 0; - isShortGI = 0; - } else if (nDataRate >= 0x20 && nDataRate <= 0x2f) { - is40MHz = 1; - isShortGI = 0; - - } else if (nDataRate >= 0x30 && nDataRate <= 0x3f) { - is40MHz = 0; - isShortGI = 1; - } else if (nDataRate >= 0x40 && nDataRate <= 0x4f) { - is40MHz = 1; - isShortGI = 1; - } - return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf]; + if (nDataRate >= 0x10 && nDataRate <= 0x1f) { + is40MHz = 0; + isShortGI = 0; + } else if (nDataRate >= 0x20 && nDataRate <= 0x2f) { + is40MHz = 1; + isShortGI = 0; + } else if (nDataRate >= 0x30 && nDataRate <= 0x3f) { + is40MHz = 0; + isShortGI = 1; + } else if (nDataRate >= 0x40 && nDataRate <= 0x4f) { + is40MHz = 1; + isShortGI = 1; } + return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf]; } bool IsHTHalfNmodeAPs(struct rtllib_device *ieee) @@ -386,9 +229,7 @@ static u8 HTIOTActIsDisableMCS14(struct rtllib_device *ieee, u8 *PeerMacAddr) static bool HTIOTActIsDisableMCS15(struct rtllib_device *ieee) { - bool retValue = false; - - return retValue; + return false; } static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee) @@ -450,8 +291,8 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap, struct ht_capab_ele *pCapELE = NULL; if ((posHTCap == NULL) || (pHT == NULL)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTCap or pHTInfo can't be " - "null in HTConstructCapabilityElement()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n"); return; } memset(posHTCap, 0, *len); @@ -487,9 +328,9 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap, pCapELE->LSigTxopProtect = 0; - RTLLIB_DEBUG(RTLLIB_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d " - "DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, - pCapELE->DssCCk); + RTLLIB_DEBUG(RTLLIB_DL_HT, + "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", + pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk); if (IsEncrypt) { pCapELE->MPDUDensity = 7; @@ -532,8 +373,8 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo, struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo; if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTInfo or pHTInfoEle can't be " - "null in HTConstructInfoElement()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n"); return; } @@ -572,8 +413,8 @@ void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg, u8 *len) { if (posRT2RTAgg == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "posRT2RTAgg can't be null in " - "HTConstructRT2RTAggElement()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n"); return; } memset(posRT2RTAgg, 0, *len); @@ -596,8 +437,8 @@ static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS) u8 i; if (pOperateMCS == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "pOperateMCS can't be null" - " in HT_PickMCSRate()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "pOperateMCS can't be null in HT_PickMCSRate()\n"); return false; } @@ -631,8 +472,8 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, u8 availableMcsRate[16]; if (pMCSRateSet == NULL || pMCSFilter == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "pMCSRateSet or pMCSFilter can't " - "be null in HTGetHighestMCSRate()\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n"); return false; } for (i = 0; i < 16; i++) @@ -654,7 +495,7 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, HTMcsToDataRate(ieee, mcsRate)) mcsRate = (8*i+j); } - bitMap = bitMap>>1; + bitMap >>= 1; } } } @@ -697,8 +538,8 @@ void HTOnAssocRsp(struct rtllib_device *ieee) static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; if (pHTInfo->bCurrentHTSupport == false) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "<=== HTOnAssocRsp(): " - "HT_DISABLE\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "<=== HTOnAssocRsp(): HT_DISABLE\n"); return; } RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n"); @@ -878,7 +719,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__); /* unmark bEnableHT flag here is the same reason why unmarked in - * function rtllib_softmac_new_net. WB 2008.09.10*/ + * function rtllib_softmac_new_net. WB 2008.09.10 + */ if (pNetwork->bssht.bdSupportHT) { pHTInfo->bCurrentHTSupport = true; pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; @@ -999,8 +841,8 @@ u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame) { if (ieee->pHTInfo->bCurrentHTSupport) { if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) { - RTLLIB_DEBUG(RTLLIB_DL_HT, "HT CONTROL FILED " - "EXIST!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_HT, + "HT CONTROL FILED EXIST!!\n"); return true; } } diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h index 973342b8a06d..55ef7ec33f65 100644 --- a/drivers/staging/rtl8192e/rtl819x_Qos.h +++ b/drivers/staging/rtl8192e/rtl819x_Qos.h @@ -19,8 +19,6 @@ #ifndef __INC_QOS_TYPE_H #define __INC_QOS_TYPE_H -#include "rtllib_endianfree.h" - #define BIT0 0x00000001 #define BIT1 0x00000002 #define BIT2 0x00000004 @@ -340,18 +338,6 @@ struct sta_qos { }; #define QBSS_LOAD_SIZE 5 -#define GET_QBSS_LOAD_STA_COUNT(__pStart) \ - ReadEF2Byte(__pStart) -#define SET_QBSS_LOAD_STA_COUNT(__pStart, __Value) \ - WriteEF2Byte(__pStart, __Value) -#define GET_QBSS_LOAD_CHNL_UTILIZATION(__pStart) \ - ReadEF1Byte((u8 *)(__pStart) + 2) -#define SET_QBSS_LOAD_CHNL_UTILIZATION(__pStart, __Value) \ - WriteEF1Byte((u8 *)(__pStart) + 2, __Value) -#define GET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart) \ - ReadEF2Byte((u8 *)(__pStart) + 3) -#define SET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart, __Value) \ - WriteEF2Byte((u8 *)(__pStart) + 3, __Value) struct bss_qos { QOS_MODE bdQoSMode; @@ -367,10 +353,6 @@ struct bss_qos { bool bQBssLoadValid; }; -#define sQoSCtlLng 2 -#define QOS_CTRL_LEN(_QosMode) ((_QosMode > QOS_DISABLE) ? sQoSCtlLng : 0) - - #define IsACValid(ac) ((ac >= 0 && ac <= 7) ? true : false) diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 294847d1a903..7d77d056228d 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -58,9 +58,9 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxIndicateSeq = (pRxTs->RxIndicateSeq + 1) % 4096; - RTLLIB_DEBUG(RTLLIB_DL_REORDER, "%s(): Indicate" - " SeqNum: %d\n", __func__, - pReorderEntry->SeqNum); + RTLLIB_DEBUG(RTLLIB_DL_REORDER, + "%s(): Indicate SeqNum: %d\n", + __func__, pReorderEntry->SeqNum); ieee->stats_IndicateArray[index] = pReorderEntry->prxb; index++; @@ -78,8 +78,8 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxTimeoutIndicateSeq = 0xffff; if (index > REORDER_WIN_SIZE) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "RxReorderIndicatePacket():" - " Rx Reorder struct buffer full!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "RxReorderIndicatePacket(): Rx Reorder struct buffer full!!\n"); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; @@ -91,7 +91,7 @@ static void RxPktPendingTimeout(unsigned long data) if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) { pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; mod_timer(&pRxTs->RxPktPendingTimer, jiffies + - MSECS(ieee->pHTInfo->RxReorderPendingTime)); + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } @@ -104,8 +104,8 @@ static void TsAddBaProcess(unsigned long data) TxTsRecord[num]); TsInitAddBA(ieee, pTxTs, BA_POLICY_IMMEDIATE, false); - RTLLIB_DEBUG(RTLLIB_DL_BA, "TsAddBaProcess(): ADDBA Req is " - "started!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "TsAddBaProcess(): ADDBA Req is started!!\n"); } static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo) @@ -223,7 +223,7 @@ static void AdmitTS(struct rtllib_device *ieee, if (InactTime != 0) mod_timer(&pTsCommonInfo->InactTimer, jiffies + - MSECS(InactTime)); + msecs_to_jiffies(InactTime)); } static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee, @@ -311,18 +311,24 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) { u8 UP = 0; + union tspec_body TSpec; + union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo; + struct list_head *pUnusedList; + struct list_head *pAddmitList; + enum direction_value Dir; if (is_multicast_ether_addr(Addr)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR! get TS for Broadcast or " - "Multicast\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR! get TS for Broadcast or Multicast\n"); return false; } if (ieee->current_network.qos_data.supported == 0) { UP = 0; } else { if (!IsACValid(TID)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR! in %s(), TID(%d) is " - "not valid\n", __func__, TID); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR! in %s(), TID(%d) is not valid\n", + __func__, TID); return false; } @@ -347,77 +353,70 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, } *ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect); - if (*ppTS != NULL) { + if (*ppTS != NULL) return true; - } else { - if (!bAddNewTs) { - RTLLIB_DEBUG(RTLLIB_DL_TS, "add new TS failed" - "(tid:%d)\n", UP); - return false; - } else { - union tspec_body TSpec; - union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo; - struct list_head *pUnusedList = - (TxRxSelect == TX_DIR) ? + + if (!bAddNewTs) { + RTLLIB_DEBUG(RTLLIB_DL_TS, + "add new TS failed(tid:%d)\n", UP); + return false; + } + + pUnusedList = (TxRxSelect == TX_DIR) ? (&ieee->Tx_TS_Unused_List) : (&ieee->Rx_TS_Unused_List); - struct list_head *pAddmitList = - (TxRxSelect == TX_DIR) ? + pAddmitList = (TxRxSelect == TX_DIR) ? (&ieee->Tx_TS_Admit_List) : (&ieee->Rx_TS_Admit_List); - enum direction_value Dir = - (ieee->iw_mode == IW_MODE_MASTER) ? - ((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) : - ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); - RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n"); - if (!list_empty(pUnusedList)) { - (*ppTS) = list_entry(pUnusedList->next, - struct ts_common_info, List); - list_del_init(&(*ppTS)->List); - if (TxRxSelect == TX_DIR) { - struct tx_ts_record *tmp = - container_of(*ppTS, - struct tx_ts_record, - TsCommonInfo); - ResetTxTsEntry(tmp); - } else { - struct rx_ts_record *tmp = - container_of(*ppTS, - struct rx_ts_record, - TsCommonInfo); - ResetRxTsEntry(tmp); - } - - RTLLIB_DEBUG(RTLLIB_DL_TS, "to init current TS" - ", UP:%d, Dir:%d, addr: %pM" - " ppTs=%p\n", UP, Dir, - Addr, *ppTS); - pTSInfo->field.ucTrafficType = 0; - pTSInfo->field.ucTSID = UP; - pTSInfo->field.ucDirection = Dir; - pTSInfo->field.ucAccessPolicy = 1; - pTSInfo->field.ucAggregation = 0; - pTSInfo->field.ucPSB = 0; - pTSInfo->field.ucUP = UP; - pTSInfo->field.ucTSInfoAckPolicy = 0; - pTSInfo->field.ucSchedule = 0; - - MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0); - AdmitTS(ieee, *ppTS, 0); - list_add_tail(&((*ppTS)->List), pAddmitList); - - return true; - } else { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR!!in function " - "%s() There is not enough dir=%d" - "(0=up down=1) TS record to be " - "used!!", __func__, Dir); - return false; - } + Dir = (ieee->iw_mode == IW_MODE_MASTER) ? + ((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) : + ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); + + RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n"); + if (!list_empty(pUnusedList)) { + (*ppTS) = list_entry(pUnusedList->next, + struct ts_common_info, List); + list_del_init(&(*ppTS)->List); + if (TxRxSelect == TX_DIR) { + struct tx_ts_record *tmp = + container_of(*ppTS, + struct tx_ts_record, + TsCommonInfo); + ResetTxTsEntry(tmp); + } else { + struct rx_ts_record *tmp = + container_of(*ppTS, + struct rx_ts_record, + TsCommonInfo); + ResetRxTsEntry(tmp); } + + RTLLIB_DEBUG(RTLLIB_DL_TS, + "to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n", + UP, Dir, Addr, *ppTS); + pTSInfo->field.ucTrafficType = 0; + pTSInfo->field.ucTSID = UP; + pTSInfo->field.ucDirection = Dir; + pTSInfo->field.ucAccessPolicy = 1; + pTSInfo->field.ucAggregation = 0; + pTSInfo->field.ucPSB = 0; + pTSInfo->field.ucUP = UP; + pTSInfo->field.ucTSInfoAckPolicy = 0; + pTSInfo->field.ucSchedule = 0; + + MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0); + AdmitTS(ieee, *ppTS, 0); + list_add_tail(&((*ppTS)->List), pAddmitList); + + return true; } + + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!", + __func__, Dir); + return false; } static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs, @@ -438,8 +437,8 @@ static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs pRxReorderEntry = (struct rx_reorder_entry *) list_entry(pRxTS->RxPendingPktList.prev, struct rx_reorder_entry, List); - RTLLIB_DEBUG(RTLLIB_DL_REORDER, "%s(): Delete SeqNum " - "%d!\n", __func__, + RTLLIB_DEBUG(RTLLIB_DL_REORDER, + "%s(): Delete SeqNum %d!\n", __func__, pRxReorderEntry->SeqNum); list_del_init(&pRxReorderEntry->List); { @@ -467,7 +466,7 @@ void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr) { struct ts_common_info *pTS, *pTmpTS; - printk(KERN_INFO "===========>RemovePeerTS, %pM\n", Addr); + netdev_info(ieee->dev, "===========>RemovePeerTS, %pM\n", Addr); list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { if (memcmp(pTS->Addr, Addr, 6) == 0) { @@ -479,7 +478,8 @@ void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr) list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) { if (memcmp(pTS->Addr, Addr, 6) == 0) { - printk(KERN_INFO "====>remove Tx_TS_admin_list\n"); + netdev_info(ieee->dev, + "====>remove Tx_TS_admin_list\n"); RemoveTsEntry(ieee, pTS, TX_DIR); list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); @@ -539,13 +539,13 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS) pTxTS->bAddBaReqInProgress = true; if (pTxTS->bAddBaReqDelayed) { - RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): " - "Delayed Start ADDBA after 60 sec!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies + - MSECS(TS_ADDBA_DELAY)); + msecs_to_jiffies(TS_ADDBA_DELAY)); } else { - RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): " - "Immediately Start ADDBA now!!\n"); + RTLLIB_DEBUG(RTLLIB_DL_BA, + "TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); } } else diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index cef2dc27103f..3c8b708df5c3 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -66,25 +66,8 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#ifndef container_of -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof(((type *)0)->member)*__mptr = (ptr); \ - (type *)((char *)__mptr - offsetof(type, member)); }) -#endif - #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb) -#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x) - - #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z) #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y) @@ -482,9 +465,6 @@ enum rt_op_mode { #define IEEE_CRYPT_ALG_NAME_LEN 16 #define MAX_IE_LEN 0xff -#define RT_ASSERT_RET(_Exp) do {} while (0) -#define RT_ASSERT_RET_VALUE(_Exp, Ret) \ - do {} while (0) struct ieee_param { u32 cmd; @@ -525,17 +505,17 @@ struct ieee_param { #define IW_QUAL_NOISE_UPDATED 0x4 #endif -#define MSECS(t) msecs_to_jiffies(t) #define msleep_interruptible_rsl msleep_interruptible #define RTLLIB_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section - 6.2.1.1.2. - - The figure in section 7.1.2 suggests a body size of up to 2312 - bytes is allowed, which is a bit confusing, I suspect this - represents the 2304 bytes of real data, plus a possible 8 bytes of - WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ + * 6.2.1.1.2. + * + * The figure in section 7.1.2 suggests a body size of up to 2312 + * bytes is allowed, which is a bit confusing, I suspect this + * represents the 2304 bytes of real data, plus a possible 8 bytes of + * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) + */ #define RTLLIB_1ADDR_LEN 10 #define RTLLIB_2ADDR_LEN 16 #define RTLLIB_3ADDR_LEN 24 @@ -711,20 +691,13 @@ do { \ #define RTLLIB_DEBUG_DATA(level, data, datalen) \ do { \ if ((rtllib_debug_level & (level)) == (level)) { \ - int i; \ - u8 *pdata = (u8 *)data; \ printk(KERN_DEBUG "rtllib: %s()\n", __func__); \ - for (i = 0; i < (int)(datalen); i++) { \ - printk("%2.2x ", pdata[i]); \ - if ((i+1)%16 == 0) \ - printk("\n"); \ - } \ - printk("\n"); \ + print_hex_dump_bytes(KERN_DEBUG, DUMP_PREFIX_NONE, \ + data, datalen); \ } \ } while (0) -/* - * To use the debug system; +/* To use the debug system; * * If you are defining a new debug classification, simply add it to the #define * list here in the form of: @@ -743,8 +716,6 @@ do { \ * % cat /proc/net/ipw/debug_level * * you simply need to add your entry to the ipw_debug_levels array. - * - * */ #define RTLLIB_DL_INFO (1<<0) @@ -769,8 +740,8 @@ do { \ #define RTLLIB_DL_TRACE (1<<29) #define RTLLIB_DL_DATA (1<<30) #define RTLLIB_DL_ERR (1<<31) -#define RTLLIB_ERROR(f, a...) printk(KERN_ERR "rtllib: " f, ## a) -#define RTLLIB_WARNING(f, a...) printk(KERN_WARNING "rtllib: " f, ## a) +#define RTLLIB_ERROR(f, a...) pr_err("rtllib: " f, ## a) +#define RTLLIB_WARNING(f, a...) pr_warn("rtllib: " f, ## a) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) #define RTLLIB_DEBUG_WX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a) @@ -784,26 +755,6 @@ do { \ #define RTLLIB_DEBUG_RX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_RX, f, ## a) #define RTLLIB_DEBUG_QOS(f, a...) RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a) -/* Added by Annie, 2005-11-22. */ -#define MAX_STR_LEN 64 -/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. */ -#define PRINTABLE(_ch) (_ch > '!' && _ch < '~') -#define RTLLIB_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if ((_Comp) & level) { \ - int __i; \ - u8 struct buffer[MAX_STR_LEN]; \ - int length = (_Len < MAX_STR_LEN) ? _Len : (MAX_STR_LEN-1) ;\ - memset(struct buffer, 0, MAX_STR_LEN); \ - memcpy(struct buffer, (u8 *)_Ptr, length); \ - for (__i = 0; __i < MAX_STR_LEN; __i++) { \ - if (!PRINTABLE(struct buffer[__i])) \ - struct buffer[__i] = '?'; \ - } \ - struct buffer[length] = '\0'; \ - printk(KERN_INFO "Rtl819x: "); \ - printk(_TitleString); \ - printk(": %d, <%s>\n", _Len, struct buffer); \ - } #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ @@ -1022,7 +973,8 @@ struct rtllib_rx_stats { /* IEEE 802.11 requires that STA supports concurrent reception of at least * three fragmented frames. This define can be increased to support more * concurrent frames, but it should be noted that each entry can consume about - * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ + * 2 kB of RAM and increasing cache size will slow down frame reassembly. + */ #define RTLLIB_FRAG_CACHE_LEN 4 struct rtllib_frag_entry { @@ -1100,16 +1052,15 @@ struct rtllib_security { } __packed; -/* - 802.11 data frame from AP - ,-------------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `-------------------------------------------------------------------' -Total: 28-2340 bytes -*/ +/* 802.11 data frame from AP + * ,-------------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `-------------------------------------------------------------------' + * Total: 28-2340 bytes + */ /* Management Frame Information Element Types */ enum rtllib_mfie { @@ -1147,7 +1098,8 @@ enum rtllib_mfie { /* Minimal header; can be used for passing 802.11 frames with sufficient * information to determine what type of underlying data type is actually - * stored in the data. */ + * stored in the data. + */ struct rtllib_pspoll_hdr { __le16 frame_ctl; __le16 aid; @@ -1257,7 +1209,8 @@ struct rtllib_probe_response { __le16 beacon_interval; __le16 capability; /* SSID, supported rates, FH params, DS params, - * CF params, IBSS params, TIM (if beacon), RSN */ + * CF params, IBSS params, TIM (if beacon), RSN + */ struct rtllib_info_element info_element[0]; } __packed; @@ -1332,7 +1285,8 @@ union frameqos { /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs * only use 8, and then use extended rates for the remaining supported * rates. Other APs, however, stick all of their supported rates on the - * main rates information element... */ + * main rates information element... + */ #define MAX_RATES_LENGTH ((u8)12) #define MAX_RATES_EX_LENGTH ((u8)16) #define MAX_NETWORK_COUNT 96 @@ -1519,22 +1473,21 @@ struct rtllib_info_element_hdr { u8 len; } __packed; -/* - * These are the data types that can make up management packets +/* These are the data types that can make up management packets * - u16 auth_algorithm; - u16 auth_sequence; - u16 beacon_interval; - u16 capability; - u8 current_ap[ETH_ALEN]; - u16 listen_interval; - struct { - u16 association_id:14, reserved:2; - } __packed; - u32 time_stamp[2]; - u16 reason; - u16 status; -*/ + * u16 auth_algorithm; + * u16 auth_sequence; + * u16 beacon_interval; + * u16 capability; + * u8 current_ap[ETH_ALEN]; + * u16 listen_interval; + * struct { + * u16 association_id:14, reserved:2; + * } __packed; + * u32 time_stamp[2]; + * u16 reason; + * u16 status; + */ #define RTLLIB_DEFAULT_TX_ESSID "Penguin" #define RTLLIB_DEFAULT_BASIC_RATE 2 @@ -1670,7 +1623,6 @@ struct rtllib_network { struct list_head list; }; -#if 1 enum rtllib_state { /* the card is not linked at all */ @@ -1708,17 +1660,6 @@ enum rtllib_state { */ RTLLIB_LINKED_SCANNING, }; -#else -enum rtllib_state { - RTLLIB_UNINITIALIZED = 0, - RTLLIB_INITIALIZED, - RTLLIB_ASSOCIATING, - RTLLIB_ASSOCIATED, - RTLLIB_AUTHENTICATING, - RTLLIB_AUTHENTICATED, - RTLLIB_SHUTDOWN -}; -#endif #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 @@ -1736,11 +1677,6 @@ enum rtllib_state { #define RTLLIB_52GHZ_MAX_CHANNEL 165 #define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \ RTLLIB_52GHZ_MIN_CHANNEL + 1) -#ifndef eqMacAddr -#define eqMacAddr(a, b) \ - (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && \ - (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#endif struct tx_pending { int frag; struct rtllib_txb *txb; @@ -2149,14 +2085,16 @@ struct rtllib_device { spinlock_t wpax_suitlist_lock; int tx_headroom; /* Set to size of any additional room needed at front - * of allocated Tx SKBs */ + * of allocated Tx SKBs + */ u32 config; /* WEP and other encryption related settings at the device level */ int open_wep; /* Set to 1 to allow unencrypted frames */ int auth_mode; int reset_on_keychange; /* Set to 1 if the HW needs to be reset on - * WEP key changes */ + * WEP key changes + */ /* If the host performs {en,de}cryption, then set to 1 */ int host_encrypt; @@ -2276,7 +2214,7 @@ struct rtllib_device { short raw_tx; /* used if IEEE_SOFTMAC_TX_QUEUE is set */ short queue_stop; - short scanning_continue ; + short scanning_continue; short proto_started; short proto_stoppping; @@ -2426,7 +2364,7 @@ struct rtllib_device { /* OK this is complementing to data_poll_hard_stop */ void (*data_hard_resume)(struct net_device *dev); - /* ask to the driver to retune the radio . + /* ask to the driver to retune the radio. * This function can sleep. the driver should ensure * the radio has been switched before return. */ @@ -2520,7 +2458,8 @@ struct rtllib_device { void (*rtllib_rfkill_poll)(struct net_device *dev); /* This must be the last item so that it points to the data - * allocated beyond this structure by alloc_rtllib */ + * allocated beyond this structure by alloc_rtllib + */ u8 priv[0]; }; @@ -2549,7 +2488,8 @@ struct rtllib_device { /* The ieee802.11 stack will manage the netif queue * wake/stop for the driver, taking care of 802.11 - * fragmentation. See softmac.c for details. */ + * fragmentation. See softmac.c for details. + */ #define IEEE_SOFTMAC_TX_QUEUE (1<<7) /* Uses only the softmac_data_hard_start_xmit @@ -2586,11 +2526,9 @@ static inline int rtllib_is_empty_essid(const char *essid, int essid_len) static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode) { - /* - * It is possible for both access points and our device to support + /* It is possible for both access points and our device to support * combinations of modes, so as long as there is one valid combination * of ap/device supported modes, then return success - * */ if ((mode & IEEE_A) && (ieee->modulation & RTLLIB_OFDM_MODULATION) && @@ -2882,8 +2820,6 @@ extern int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); #define MAX_RECEIVE_BUFFER_SIZE 9100 -extern void HTDebugHTCapability(u8 *CapIE, u8 *TitleString); -extern void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString); void HTSetConnectBwMode(struct rtllib_device *ieee, enum ht_channel_width Bandwidth, @@ -2906,11 +2842,10 @@ extern void HT_update_self_and_peer_setting(struct rtllib_device *ieee, extern u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter); extern u8 MCS_FILTER_ALL[]; -extern u16 MCS_DATA_RATE[2][2][77] ; +extern u16 MCS_DATA_RATE[2][2][77]; extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame); extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo); extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee); -extern u16 HTHalfMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate); extern u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate); extern u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate); extern int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c index 60c0cedefb86..1e6ae9bead23 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.c +++ b/drivers/staging/rtl8192e/rtllib_crypt.c @@ -62,8 +62,9 @@ void rtllib_crypt_deinit_handler(unsigned long data) spin_lock_irqsave(info->lock, flags); rtllib_crypt_deinit_entries(info, 0); if (!list_empty(&info->crypt_deinit_list)) { - printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", info->name); + printk(KERN_DEBUG + "%s: entries remaining in delayed crypt deletion list\n", + info->name); info->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&info->crypt_deinit_timer); } @@ -86,7 +87,8 @@ void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, /* must not run ops->deinit() while there may be pending encrypt or * decrypt operations. Use a list of delayed deinits to avoid needing - * locking. */ + * locking. + */ spin_lock_irqsave(info->lock, flags); list_add(&tmp->list, &info->crypt_deinit_list); @@ -145,8 +147,8 @@ int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops) spin_unlock_irqrestore(&hcrypt->lock, flags); if (del_alg) { - printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm " - "'%s'\n", ops->name); + printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm '%s'\n", + ops->name); kfree(del_alg); } @@ -237,8 +239,9 @@ void __exit rtllib_crypto_deinit(void) struct rtllib_crypto_alg *alg = (struct rtllib_crypto_alg *) ptr; list_del(ptr); - printk(KERN_DEBUG "rtllib_crypt: unregistered algorithm " - "'%s' (deinit)\n", alg->ops->name); + printk(KERN_DEBUG + "rtllib_crypt: unregistered algorithm '%s' (deinit)\n", + alg->ops->name); kfree(alg); } diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h index e177c9287b44..b8cf59f39a60 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.h +++ b/drivers/staging/rtl8192e/rtllib_crypt.h @@ -17,8 +17,7 @@ * more details. */ -/* - * This file defines the interface to the rtllib crypto module. +/* This file defines the interface to the rtllib crypto module. */ #ifndef RTLLIB_CRYPT_H #define RTLLIB_CRYPT_H diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 01f85db98e0d..7d486e8887f8 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -69,8 +69,7 @@ static void *rtllib_ccmp_init(int key_idx) priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tfm)) { - pr_debug("rtllib_crypt_ccmp: could not allocate " - "crypto API aes\n"); + pr_debug("rtllib_crypt_ccmp: could not allocate crypto API aes\n"); priv->tfm = NULL; goto fail; } @@ -121,10 +120,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, fc = le16_to_cpu(hdr->frame_ctl); a4_included = ((fc & (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)) == (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)); - /* - qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) && - (WLAN_FC_GET_STYPE(fc) & 0x08)); - */ + qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80)); aad_len = 22; @@ -141,7 +137,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, * Flag (Include authentication header, M=3 (8-octet MIC), * L=1 (2-octet Dlen)) * Nonce: 0x00 | A2 | PN - * Dlen */ + * Dlen + */ b0[0] = 0x59; b0[1] = qc; memcpy(b0 + 2, hdr->addr2, ETH_ALEN); @@ -278,23 +275,22 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - pr_debug("CCMP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); + pr_debug("CCMP: received packet without ExtIV flag from %pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPFormatErrors++; return -2; } keyidx >>= 6; if (key->key_idx != keyidx) { - pr_debug("CCMP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); + pr_debug("CCMP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + key->key_idx, keyidx, priv); return -6; } if (!key->key_set) { if (net_ratelimit()) { - pr_debug("CCMP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); + pr_debug("CCMP: received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -341,8 +337,8 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { if (net_ratelimit()) { - pr_debug("CCMP: decrypt failed: STA=" - " %pM\n", hdr->addr2); + pr_debug("CCMP: decrypt failed: STA= %pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPDecryptErrors++; return -5; @@ -419,9 +415,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) struct rtllib_ccmp_data *ccmp = priv; seq_printf(m, - "key[%d] alg=CCMP key_set=%d " - "tx_pn=%pM rx_pn=%pM " - "format_errors=%d replays=%d decrypt_errors=%d\n", + "key[%d] alg=CCMP key_set=%d tx_pn=%pM rx_pn=%pM format_errors=%d replays=%d decrypt_errors=%d\n", ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, ccmp->dot11RSNAStatsCCMPFormatErrors, diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 78db2b6826f7..656b4b359c50 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -66,8 +66,8 @@ static void *rtllib_tkip_init(int key_idx) priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_arc4)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API arc4\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API arc4\n"); priv->tx_tfm_arc4 = NULL; goto fail; } @@ -75,8 +75,8 @@ static void *rtllib_tkip_init(int key_idx) priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_michael)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API michael_mic\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API michael_mic\n"); priv->tx_tfm_michael = NULL; goto fail; } @@ -84,8 +84,8 @@ static void *rtllib_tkip_init(int key_idx) priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_arc4)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API arc4\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API arc4\n"); priv->rx_tfm_arc4 = NULL; goto fail; } @@ -93,8 +93,8 @@ static void *rtllib_tkip_init(int key_idx) priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_michael)) { - printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate " - "crypto API michael_mic\n"); + printk(KERN_DEBUG + "rtllib_crypt_tkip: could not allocate crypto API michael_mic\n"); priv->rx_tfm_michael = NULL; goto fail; } @@ -249,7 +249,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, u16 IV16) { /* Make temporary area overlap WEP seed so that the final copy can be - * avoided on little endian hosts. */ + * avoided on little endian hosts. + */ u16 *PPK = (u16 *) &WEPSeed[4]; /* Step 1 - make copy of TTAK and bring in TSC */ @@ -276,7 +277,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, PPK[5] += RotR1(PPK[4]); /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value - * WEPSeed[0..2] is transmitted as WEP IV */ + * WEPSeed[0..2] is transmitted as WEP IV + */ WEPSeed[0] = Hi8(IV16); WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[2] = Lo8(IV16); @@ -399,22 +401,24 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); + printk(KERN_DEBUG + "TKIP: received packet without ExtIV flag from %pM\n", + hdr->addr2); } return -2; } keyidx >>= 6; if (tkey->key_idx != keyidx) { - printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv); + printk(KERN_DEBUG + "TKIP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + tkey->key_idx, keyidx, priv); return -6; } if (!tkey->key_set) { if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); + printk(KERN_DEBUG + "TKIP: received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -427,10 +431,10 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) && tkey->initialized) { if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: replay detected: STA=" - " %pM previous TSC %08x%04x received " - "TSC %08x%04x\n", hdr->addr2, - tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); + printk(KERN_DEBUG + "TKIP: replay detected: STA= %pM previous TSC %08x%04x received TSC %08x%04x\n", + hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, + iv32, iv16); } tkey->dot11RSNAStatsTKIPReplays++; return -4; @@ -451,8 +455,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { if (net_ratelimit()) { - printk(KERN_DEBUG ": TKIP: failed to decrypt " - "received packet from %pM\n", + printk(KERN_DEBUG + ": TKIP: failed to decrypt received packet from %pM\n", hdr->addr2); } return -7; @@ -468,12 +472,14 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (iv32 != tkey->rx_iv32) { /* Previously cached Phase1 result was already * lost, so it needs to be recalculated for the - * next packet. */ + * next packet. + */ tkey->rx_phase1_done = 0; } if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: ICV error detected: STA=" - " %pM\n", hdr->addr2); + printk(KERN_DEBUG + "TKIP: ICV error detected: STA= %pM\n", + hdr->addr2); } tkey->dot11RSNAStatsTKIPICVErrors++; return -5; @@ -482,7 +488,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } /* Update real counters only after Michael MIC verification has - * completed */ + * completed + */ tkey->rx_iv32_new = iv32; tkey->rx_iv16_new = iv16; @@ -502,7 +509,7 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, struct scatterlist sg[2]; if (tfm_michael == NULL) { - printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); + pr_warn("michael_mic: tfm_michael == NULL\n"); return -1; } sg_init_table(sg, 2); @@ -557,8 +564,8 @@ static int rtllib_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct rtllib_hdr_4addr *) skb->data; if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { - printk(KERN_DEBUG "Invalid packet for Michael MIC add " - "(tailroom=%d hdr_len=%d skb->len=%d)\n", + printk(KERN_DEBUG + "Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n", skb_tailroom(skb), hdr_len, skb->len); return -1; } @@ -621,14 +628,14 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, struct rtllib_hdr_4addr *hdr; hdr = (struct rtllib_hdr_4addr *) skb->data; - printk(KERN_DEBUG "%s: Michael MIC verification failed for " - "MSDU from %pM keyidx=%d\n", + printk(KERN_DEBUG + "%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n", skb->dev ? skb->dev->name : "N/A", hdr->addr2, keyidx); printk(KERN_DEBUG "%d\n", memcmp(mic, skb->data + skb->len - 8, 8) != 0); if (skb->dev) { - printk(KERN_INFO "skb->dev != NULL\n"); + pr_info("skb->dev != NULL\n"); rtllib_michael_mic_failure(skb->dev, hdr, keyidx); } tkey->dot11RSNAStatsTKIPLocalMICFailures++; @@ -636,7 +643,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, } /* Update TSC counters for RX now that the packet verification has - * completed. */ + * completed. + */ tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new; @@ -717,10 +725,7 @@ static void rtllib_tkip_print_stats(struct seq_file *m, void *priv) struct rtllib_tkip_data *tkip = priv; seq_printf(m, - "key[%d] alg=TKIP key_set=%d " - "tx_pn=%02x%02x%02x%02x%02x%02x " - "rx_pn=%02x%02x%02x%02x%02x%02x " - "replays=%d icv_errors=%d local_mic_failures=%d\n", + "key[%d] alg=TKIP key_set=%d tx_pn=%02x%02x%02x%02x%02x%02x rx_pn=%02x%02x%02x%02x%02x%02x replays=%d icv_errors=%d local_mic_failures=%d\n", tkip->key_idx, tkip->key_set, (tkip->tx_iv32 >> 24) & 0xff, (tkip->tx_iv32 >> 16) & 0xff, diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 75e7b02a144a..21d7eee4c9a9 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -44,15 +44,13 @@ static void *prism2_wep_init(int keyidx) priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) { - pr_debug("rtllib_crypt_wep: could not allocate " - "crypto API arc4\n"); + pr_debug("rtllib_crypt_wep: could not allocate crypto API arc4\n"); priv->tx_tfm = NULL; goto fail; } priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm)) { - pr_debug("rtllib_crypt_wep: could not allocate " - "crypto API arc4\n"); + pr_debug("rtllib_crypt_wep: could not allocate crypto API arc4\n"); priv->rx_tfm = NULL; goto fail; } @@ -108,9 +106,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || skb->len < hdr_len){ - printk(KERN_ERR "Error!!! headroom=%d tailroom=%d skblen=%d" - " hdr_len=%d\n", skb_headroom(skb), skb_tailroom(skb), - skb->len, hdr_len); + pr_err("Error!!! headroom=%d tailroom=%d skblen=%d hdr_len=%d\n", + skb_headroom(skb), skb_tailroom(skb), skb->len, hdr_len); return -1; } len = skb->len - hdr_len; @@ -124,7 +121,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) - * can be used to speedup attacks, so avoid using them. */ + * can be used to speedup attacks, so avoid using them. + */ if ((wep->iv & 0xff00) == 0xff00) { u8 B = (wep->iv >> 16) & 0xff; diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h index 7537dae89a75..119729d31c74 100644 --- a/drivers/staging/rtl8192e/rtllib_debug.h +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -80,9 +80,9 @@ do { \ #define assert(expr) \ do { \ if (!(expr)) { \ - printk(KERN_INFO "Assertion failed! %s,%s,%s,line=%d\n", \ + pr_info("Assertion failed! %s,%s,%s,line=%d\n", \ #expr, __FILE__, __func__, __LINE__); \ } \ -} while (0); +} while (0) #endif diff --git a/drivers/staging/rtl8192e/rtllib_endianfree.h b/drivers/staging/rtl8192e/rtllib_endianfree.h deleted file mode 100644 index b189fa5a45e4..000000000000 --- a/drivers/staging/rtl8192e/rtllib_endianfree.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef __INC_ENDIANFREE_H -#define __INC_ENDIANFREE_H - -/* - * Call endian free function when - * 1. Read/write packet content. - * 2. Before write integer to IO. - * 3. After read integer from IO. - */ - -#define __MACHINE_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define __MACHINE_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net, ppc */ - -#define BYTE_ORDER __MACHINE_LITTLE_ENDIAN - -#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN -#define EF1Byte(_val) ((u8)(_val)) -#define EF2Byte(_val) ((u16)(_val)) -#define EF4Byte(_val) ((u32)(_val)) - -#else -#define EF1Byte(_val) ((u8)(_val)) -#define EF2Byte(_val) \ - (((((u16)(_val))&0x00ff)<<8)|((((u16)(_val))&0xff00)>>8)) -#define EF4Byte(_val) \ - (((((u32)(_val))&0x000000ff)<<24)|\ - ((((u32)(_val))&0x0000ff00)<<8)|\ - ((((u32)(_val))&0x00ff0000)>>8)|\ - ((((u32)(_val))&0xff000000)>>24)) -#endif - -#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr))) -#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr))) -#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr))) - -#define WriteEF1Byte(_ptr, _val) ((*((u8 *)(_ptr))) = EF1Byte(_val)) -#define WriteEF2Byte(_ptr, _val) ((*((u16 *)(_ptr))) = EF2Byte(_val)) -#define WriteEF4Byte(_ptr, _val) ((*((u32 *)(_ptr))) = EF4Byte(_val)) -#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN -#define H2N1BYTE(_val) ((u8)(_val)) -#define H2N2BYTE(_val) (((((u16)(_val))&0x00ff)<<8)|\ - ((((u16)(_val))&0xff00)>>8)) -#define H2N4BYTE(_val) (((((u32)(_val))&0x000000ff)<<24)|\ - ((((u32)(_val))&0x0000ff00)<<8) |\ - ((((u32)(_val))&0x00ff0000)>>8) |\ - ((((u32)(_val))&0xff000000)>>24)) -#else -#define H2N1BYTE(_val) ((u8)(_val)) -#define H2N2BYTE(_val) ((u16)(_val)) -#define H2N4BYTE(_val) ((u32)(_val)) -#endif - -#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN -#define N2H1BYTE(_val) ((u8)(_val)) -#define N2H2BYTE(_val) (((((u16)(_val))&0x00ff)<<8)|\ - ((((u16)(_val))&0xff00)>>8)) -#define N2H4BYTE(_val) (((((u32)(_val))&0x000000ff)<<24)|\ - ((((u32)(_val))&0x0000ff00)<<8) |\ - ((((u32)(_val))&0x00ff0000)>>8) |\ - ((((u32)(_val))&0xff000000)>>24)) -#else -#define N2H1BYTE(_val) ((u8)(_val)) -#define N2H2BYTE(_val) ((u16)(_val)) -#define N2H4BYTE(_val) ((u32)(_val)) -#endif - -#define BIT_LEN_MASK_32(__BitLen) (0xFFFFFFFF >> (32 - (__BitLen))) -#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_32(__BitLen) << (__BitOffset)) - -#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) (EF4Byte(*((u32 *)(__pStart)))) - -#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - (LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset)) \ - & \ - BIT_LEN_MASK_32(__BitLen) \ - ) - -#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - LE_P4BYTE_TO_HOST_4BYTE(__pStart) \ - & \ - (~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen)) \ - ) - -#define BIT_LEN_MASK_16(__BitLen) \ - (0xFFFF >> (16 - (__BitLen))) - -#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_16(__BitLen) << (__BitOffset)) - -#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \ - (EF2Byte(*((u16 *)(__pStart)))) - -#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - (LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset)) \ - & \ - BIT_LEN_MASK_16(__BitLen) \ - ) - -#define BIT_LEN_MASK_8(__BitLen) \ - (0xFF >> (8 - (__BitLen))) - -#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \ - (BIT_LEN_MASK_8(__BitLen) << (__BitOffset)) - -#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \ - (EF1Byte(*((u8 *)(__pStart)))) - -#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \ - ( \ - (LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset)) \ - & \ - BIT_LEN_MASK_8(__BitLen) \ - ) - -#define N_BYTE_ALIGMENT(__Value, __Aligment) \ - ((__Aligment == 1) ? (__Value) : (((__Value + __Aligment - 1) / \ - __Aligment) * __Aligment)) -#endif diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index 0cf38091f8c5..32cc8df9d3a7 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -72,11 +72,8 @@ static inline int rtllib_networks_allocate(struct rtllib_device *ieee) ieee->networks = kzalloc( MAX_NETWORK_COUNT * sizeof(struct rtllib_network), GFP_KERNEL); - if (!ieee->networks) { - printk(KERN_WARNING "%s: Out of memory allocating beacons\n", - ieee->dev->name); + if (!ieee->networks) return -ENOMEM; - } return 0; } @@ -161,10 +158,9 @@ struct net_device *alloc_rtllib(int sizeof_priv) rtllib_softmac_init(ieee); ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); - if (ieee->pHTInfo == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc memory for HTInfo\n"); + if (ieee->pHTInfo == NULL) return NULL; - } + HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); TSInitialize(ieee); @@ -207,7 +203,9 @@ static struct proc_dir_entry *rtllib_proc; static int show_debug_level(struct seq_file *m, void *v) { - return seq_printf(m, "0x%08X\n", rtllib_debug_level); + seq_printf(m, "0x%08X\n", rtllib_debug_level); + + return 0; } static ssize_t write_debug_level(struct file *file, const char __user *buffer, diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 1664040efdab..fe3e7e1273ff 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -143,7 +143,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); } else { /* received a fragment of a frame for which the head fragment - * should have already been received */ + * should have already been received + */ entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, hdr->addr1); if (entry != NULL) { @@ -199,7 +200,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee, * * Responsible for handling management control frames * - * Called by rtllib_rx */ + * Called by rtllib_rx + */ static inline int rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, u16 type, @@ -224,8 +226,9 @@ rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ +/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation + * Ethernet-II snap header (RFC1042 for most EtherTypes) + */ static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; @@ -394,10 +397,9 @@ static int is_duplicate_packet(struct rtllib_device *ieee, } if (p == &ieee->ibss_mac_hash[index]) { entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); - if (!entry) { - printk(KERN_WARNING "Cannot malloc new mac entry\n"); + if (!entry) return 0; - } + memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num[tid] = seq; entry->frag_num[tid] = frag; @@ -483,7 +485,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { /* remove RFC1042 or Bridge-Tunnel encapsulation - * and replace EtherType */ + * and replace EtherType + */ skb_pull(sub_skb, SNAP_SIZE); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); @@ -524,7 +527,9 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, struct rx_ts_record del_timer_sync(&pTS->RxPktPendingTimer); while (!list_empty(&pTS->RxPendingPktList)) { if (RfdCnt >= REORDER_WIN_SIZE) { - printk(KERN_INFO "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", __func__); + netdev_info(ieee->dev, + "-------------->%s() error! RfdCnt >= REORDER_WIN_SIZE\n", + __func__); break; } @@ -581,8 +586,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, return; } - /* - * Sliding window manipulation. Conditions includes: + /* Sliding window manipulation. Conditions includes: * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 * 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ @@ -597,13 +601,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); } - /* - * Indication process. + /* Indication process. * After Packet dropping and Sliding Window shifting as above, we can * now just indicate the packets with the SeqNum smaller than latest * WinStart and struct buffer other packets. - */ - /* For Rx Reorder condition: + * + * For Rx Reorder condition: * 1. All packets with SeqNum smaller than WinStart => Indicate * 2. All packets with SeqNum larger than or equal to * WinStart => Buffer it. @@ -646,8 +649,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, pTS->RxIndicateSeq, SeqNum); } } else { - /* - * Packets are dropped if there are not enough reorder + /* Packets are dropped if there are not enough reorder * entries. This part should be modified!! We can just * indicate all the packets in struct buffer and get * reorder entries. @@ -697,7 +699,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, } /* Handling pending timer. Set this timer to prevent from long time - * Rx buffering.*/ + * Rx buffering. + */ if (index > 0) { if (timer_pending(&pTS->RxPktPendingTimer)) del_timer_sync(&pTS->RxPktPendingTimer); @@ -718,7 +721,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, __func__); pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; mod_timer(&pTS->RxPktPendingTimer, jiffies + - MSECS(pHTInfo->RxReorderPendingTime)); + msecs_to_jiffies(pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } @@ -782,69 +785,74 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(rxb->dst, dst, ETH_ALEN); rxb->subframes[0]->dev = ieee->dev; return 1; - } else { - rxb->nr_subframes = 0; - memcpy(rxb->src, src, ETH_ALEN); - memcpy(rxb->dst, dst, ETH_ALEN); - while (skb->len > ETHERNET_HEADER_SIZE) { - /* Offset 12 denote 2 mac address */ - nSubframe_Length = *((u16 *)(skb->data + 12)); - nSubframe_Length = (nSubframe_Length >> 8) + - (nSubframe_Length << 8); - - if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { - printk(KERN_INFO "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ - __func__, rxb->nr_subframes); - printk(KERN_INFO "%s: A-MSDU parse error!! Subframe Length: %d\n", __func__, - nSubframe_Length); - printk(KERN_INFO "nRemain_Length is %d and nSubframe_Length is : %d\n", skb->len, - nSubframe_Length); - printk(KERN_INFO "The Packet SeqNum is %d\n", SeqNum); - return 0; - } + } - /* move the data point to data content */ - skb_pull(skb, ETHERNET_HEADER_SIZE); + rxb->nr_subframes = 0; + memcpy(rxb->src, src, ETH_ALEN); + memcpy(rxb->dst, dst, ETH_ALEN); + while (skb->len > ETHERNET_HEADER_SIZE) { + /* Offset 12 denote 2 mac address */ + nSubframe_Length = *((u16 *)(skb->data + 12)); + nSubframe_Length = (nSubframe_Length >> 8) + + (nSubframe_Length << 8); + + if (skb->len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n", + __func__, rxb->nr_subframes); + netdev_info(ieee->dev, + "%s: A-MSDU parse error!! Subframe Length: %d\n", + __func__, nSubframe_Length); + netdev_info(ieee->dev, + "nRemain_Length is %d and nSubframe_Length is : %d\n", + skb->len, nSubframe_Length); + netdev_info(ieee->dev, + "The Packet SeqNum is %d\n", + SeqNum); + return 0; + } - /* altered by clark 3/30/2010 - * The struct buffer size of the skb indicated to upper layer - * must be less than 5000, or the defraged IP datagram - * in the IP layer will exceed "ipfrag_high_tresh" and be - * discarded. so there must not use the function - * "skb_copy" and "skb_clone" for "skb". - */ + /* move the data point to data content */ + skb_pull(skb, ETHERNET_HEADER_SIZE); - /* Allocate new skb for releasing to upper layer */ - sub_skb = dev_alloc_skb(nSubframe_Length + 12); - if (!sub_skb) - return 0; - skb_reserve(sub_skb, 12); - data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); - memcpy(data_ptr, skb->data, nSubframe_Length); - - sub_skb->dev = ieee->dev; - rxb->subframes[rxb->nr_subframes++] = sub_skb; - if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { - RTLLIB_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); - break; - } - skb_pull(skb, nSubframe_Length); - - if (skb->len != 0) { - nPadding_Length = 4 - ((nSubframe_Length + - ETHERNET_HEADER_SIZE) % 4); - if (nPadding_Length == 4) - nPadding_Length = 0; + /* altered by clark 3/30/2010 + * The struct buffer size of the skb indicated to upper layer + * must be less than 5000, or the defraged IP datagram + * in the IP layer will exceed "ipfrag_high_tresh" and be + * discarded. so there must not use the function + * "skb_copy" and "skb_clone" for "skb". + */ - if (skb->len < nPadding_Length) - return 0; + /* Allocate new skb for releasing to upper layer */ + sub_skb = dev_alloc_skb(nSubframe_Length + 12); + if (!sub_skb) + return 0; + skb_reserve(sub_skb, 12); + data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); + memcpy(data_ptr, skb->data, nSubframe_Length); - skb_pull(skb, nPadding_Length); - } + sub_skb->dev = ieee->dev; + rxb->subframes[rxb->nr_subframes++] = sub_skb; + if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { + RTLLIB_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); + break; } + skb_pull(skb, nSubframe_Length); - return rxb->nr_subframes; + if (skb->len != 0) { + nPadding_Length = 4 - ((nSubframe_Length + + ETHERNET_HEADER_SIZE) % 4); + if (nPadding_Length == 4) + nPadding_Length = 0; + + if (skb->len < nPadding_Length) + return 0; + + skb_pull(skb, nPadding_Length); + } } + + return rxb->nr_subframes; } @@ -859,7 +867,8 @@ static size_t rtllib_rx_get_hdrlen(struct rtllib_device *ieee, hdrlen = rtllib_get_hdrlen(fc); if (HTCCheck(ieee, skb->data)) { if (net_ratelimit()) - printk(KERN_INFO "%s: find HTCControl!\n", __func__); + netdev_info(ieee->dev, "%s: find HTCControl!\n", + __func__); hdrlen += 4; rx_stats->bContainHTC = true; } @@ -966,7 +975,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc, } /* Nullfunc frames may have PS-bit set, so they must be passed to - * hostap_handle_sta_rx() before being dropped here. */ + * hostap_handle_sta_rx() before being dropped here. + */ if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) { if (stype != RTLLIB_STYPE_DATA && stype != RTLLIB_STYPE_DATA_CFACK && @@ -1008,7 +1018,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, *crypt = ieee->crypt_info.crypt[idx]; /* allow NULL decrypt to indicate an station specific override - * for default encryption */ + * for default encryption + */ if (*crypt && ((*crypt)->ops == NULL || (*crypt)->ops->decrypt_mpdu == NULL)) *crypt = NULL; @@ -1017,7 +1028,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, /* This seems to be triggered by some (multicast?) * frames from other than current BSS, so just drop the * frames silently instead of filling system log with - * these reports. */ + * these reports. + */ RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n", hdr->addr2); ieee->ieee_stats.rx_discards_undecryptable++; @@ -1049,7 +1061,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, keyidx = rtllib_rx_frame_decrypt(ieee, skb, crypt); if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && (keyidx < 0)) { - printk(KERN_INFO "%s: decrypt frame error\n", __func__); + netdev_info(ieee->dev, "%s: decrypt frame error\n", __func__); return -1; } @@ -1072,19 +1084,22 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, flen -= hdrlen; if (frag_skb->tail + flen > frag_skb->end) { - printk(KERN_WARNING "%s: host decrypted and reassembled frame did not fit skb\n", - __func__); + netdev_warn(ieee->dev, + "%s: host decrypted and reassembled frame did not fit skb\n", + __func__); rtllib_frag_cache_invalidate(ieee, hdr); return -1; } if (frag == 0) { /* copy first fragment (including full headers) into - * beginning of the fragment cache skb */ + * beginning of the fragment cache skb + */ memcpy(skb_put(frag_skb, flen), skb->data, flen); } else { /* append frame payload to the end of the fragment - * cache skb */ + * cache skb + */ memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, flen); } @@ -1094,22 +1109,25 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, if (fc & RTLLIB_FCTL_MOREFRAGS) { /* more fragments expected - leave the skb in fragment * cache for now; it will be delivered to upper layers - * after all fragments have been received */ + * after all fragments have been received + */ return -2; } /* this was the last fragment and the frame will be - * delivered, so remove skb from fragment cache */ + * delivered, so remove skb from fragment cache + */ skb = frag_skb; hdr = (struct rtllib_hdr_4addr *) skb->data; rtllib_frag_cache_invalidate(ieee, hdr); } /* skb: hdr + (possible reassembled) full MSDU payload; possibly still - * encrypted/authenticated */ + * encrypted/authenticated + */ if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { - printk(KERN_INFO "%s: ==>decrypt msdu error\n", __func__); + netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__); return -1; } @@ -1119,7 +1137,8 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, rtllib_is_eapol_frame(ieee, skb, hdrlen)) { /* pass unencrypted EAPOL frames even if encryption is - * configured */ + * configured + */ struct eapol *eap = (struct eapol *)(skb->data + 24); RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", @@ -1149,7 +1168,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, } if (rtllib_is_eapol_frame(ieee, skb, hdrlen)) - printk(KERN_WARNING "RX: IEEE802.1X EAPOL frame!\n"); + netdev_warn(ieee->dev, "RX: IEEE802.1X EAPOL frame!\n"); return 0; } @@ -1158,7 +1177,7 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, u8 { if (unicast) { - if ((ieee->state == RTLLIB_LINKED)) { + if (ieee->state == RTLLIB_LINKED) { if (((ieee->LinkDetectInfo.NumRxUnicastOkInPeriod + ieee->LinkDetectInfo.NumTxOkInPeriod) > 8) || (ieee->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { @@ -1181,8 +1200,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, int i = 0; if (rxb == NULL) { - printk(KERN_INFO "%s: rxb is NULL!!\n", __func__); - return ; + netdev_info(dev, "%s: rxb is NULL!!\n", __func__); + return; } for (i = 0; i < rxb->nr_subframes; i++) { @@ -1196,7 +1215,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ + * replace EtherType + */ skb_pull(sub_skb, SNAP_SIZE); memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); @@ -1226,7 +1246,6 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, } } kfree(rxb); - rxb = NULL; } static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, @@ -1263,7 +1282,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /*Filter pkt has too small length */ hdrlen = rtllib_rx_get_hdrlen(ieee, skb, rx_stats); if (skb->len < hdrlen) { - printk(KERN_INFO "%s():ERR!!! skb->len is smaller than hdrlen\n", __func__); + netdev_info(dev, "%s():ERR!!! skb->len is smaller than hdrlen\n", + __func__); goto rx_dropped; } @@ -1345,11 +1365,9 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* skb: hdr + (possible reassembled) full plaintext payload */ payload = skb->data + hdrlen; rxb = kmalloc(sizeof(struct rtllib_rxb), GFP_ATOMIC); - if (rxb == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, - "%s(): kmalloc rxb error\n", __func__); + if (rxb == NULL) goto rx_dropped; - } + /* to parse amsdu packets */ /* qos data packets & reserved bit is 1 */ if (parse_subframe(ieee, skb, rx_stats, rxb, src, dst) == 0) { @@ -1390,7 +1408,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* Returning 0 indicates to caller that we have not handled the SKB-- * so it is still allocated and can be used again by underlying - * hardware as a DMA target */ + * hardware as a DMA target + */ return 0; } @@ -1408,13 +1427,16 @@ static int rtllib_rx_Monitor(struct rtllib_device *ieee, struct sk_buff *skb, size_t hdrlen = rtllib_get_hdrlen(fc); if (skb->len < hdrlen) { - printk(KERN_INFO "%s():ERR!!! skb->len is smaller than hdrlen\n", __func__); + netdev_info(ieee->dev, + "%s():ERR!!! skb->len is smaller than hdrlen\n", + __func__); return 0; } if (HTCCheck(ieee, skb->data)) { if (net_ratelimit()) - printk(KERN_INFO "%s: Find HTCControl!\n", __func__); + netdev_info(ieee->dev, "%s: Find HTCControl!\n", + __func__); hdrlen += 4; } @@ -1433,18 +1455,19 @@ static int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb, /* All received frames are sent to this function. @skb contains the frame in * IEEE 802.11 format, i.e., in the format it was sent over air. - * This function is called only as a tasklet (software IRQ). */ + * This function is called only as a tasklet (software IRQ). + */ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats) { int ret = 0; if ((NULL == ieee) || (NULL == skb) || (NULL == rx_stats)) { - printk(KERN_INFO "%s: Input parameters NULL!\n", __func__); + pr_info("%s: Input parameters NULL!\n", __func__); goto rx_dropped; } if (skb->len < 10) { - printk(KERN_INFO "%s: SKB length < 10\n", __func__); + netdev_info(ieee->dev, "%s: SKB length < 10\n", __func__); goto rx_dropped; } @@ -1464,7 +1487,7 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, ret = rtllib_rx_Mesh(ieee, skb, rx_stats); break; default: - printk(KERN_INFO"%s: ERR iw mode!!!\n", __func__); + netdev_info(ieee->dev, "%s: ERR iw mode!!!\n", __func__); break; } @@ -1479,10 +1502,7 @@ EXPORT_SYMBOL(rtllib_rx); static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; -/* -* Make ther structure we read from the beacon packet has -* the right values -*/ +/* Make ther structure we read from the beacon packet has the right values */ static int rtllib_verify_qos_info(struct rtllib_qos_information_element *info_element, int sub_type) { @@ -1500,9 +1520,7 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element } -/* - * Parse a QoS parameter element - */ +/* Parse a QoS parameter element */ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info *element_param, struct rtllib_info_element *info_element) @@ -1526,9 +1544,7 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info return ret; } -/* - * Parse a QoS information element - */ +/* Parse a QoS information element */ static int rtllib_read_qos_info_element(struct rtllib_qos_information_element *element_info, struct rtllib_info_element @@ -1557,9 +1573,7 @@ static int rtllib_read_qos_info_element(struct } -/* - * Write QoS parameters from the ac parameters. - */ +/* Write QoS parameters from the ac parameters. */ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm, struct rtllib_qos_data *qos_data) { @@ -1618,8 +1632,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info return 0; } -/* - * we have a generic data element which it may contain QoS information or +/* we have a generic data element which it may contain QoS information or * parameters element. check the information element length to decide * which type to read */ @@ -1705,7 +1718,9 @@ static inline void rtllib_extract_country_ie( if (!IS_COUNTRY_IE_VALID(ieee)) { if (rtllib_act_scanning(ieee, false) && ieee->FirstIe_InScan) - printk(KERN_INFO "Received beacon ContryIE, SSID: <%s>\n", network->ssid); + netdev_info(ieee->dev, + "Received beacon ContryIE, SSID: <%s>\n", + network->ssid); Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); } } @@ -1739,7 +1754,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, length, info_element->id); /* We stop processing but don't return an error here * because some misbehaviour APs break this rule. ie. - * Orinoco AP1000. */ + * Orinoco AP1000. + */ break; } @@ -1908,7 +1924,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[2] == 0x4c && info_element->data[3] == 0x033) { - tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htcap_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ? @@ -1932,7 +1948,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[1] == 0x90 && info_element->data[2] == 0x4c && info_element->data[3] == 0x034) { - tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htinfo_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; if (tmp_htinfo_len) { @@ -1953,7 +1969,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, info_element->data[1] == 0xe0 && info_element->data[2] == 0x4c && info_element->data[3] == 0x02) { - ht_realtek_agg_len = min(info_element->len, (u8)MAX_IE_LEN); + ht_realtek_agg_len = min_t(u8, info_element->len, MAX_IE_LEN); memcpy(ht_realtek_agg_buf, info_element->data, info_element->len); } if (ht_realtek_agg_len >= 5) { @@ -2083,7 +2099,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_HT_CAP: RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n", info_element->len); - tmp_htcap_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htcap_len != 0) { network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ? @@ -2110,7 +2126,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, case MFIE_TYPE_HT_INFO: RTLLIB_DEBUG_SCAN("MFIE_TYPE_HT_INFO: %d bytes\n", info_element->len); - tmp_htinfo_len = min(info_element->len, (u8)MAX_IE_LEN); + tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN); if (tmp_htinfo_len) { network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE; network->bssht.bdHTInfoLen = tmp_htinfo_len > @@ -2142,8 +2158,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, } break; case MFIE_TYPE_QOS_PARAMETER: - printk(KERN_ERR - "QoS Error need to parse QOS_PARAMETER IE\n"); + netdev_err(ieee->dev, + "QoS Error need to parse QOS_PARAMETER IE\n"); break; case MFIE_TYPE_COUNTRY: @@ -2192,13 +2208,6 @@ static inline int rtllib_network_init( struct rtllib_network *network, struct rtllib_rx_stats *stats) { - - /* - network->qos_data.active = 0; - network->qos_data.supported = 0; - network->qos_data.param_count = 0; - network->qos_data.old_param_count = 0; - */ memset(&network->qos_data, 0, sizeof(struct rtllib_qos_data)); /* Pull out fixed field data */ @@ -2291,7 +2300,8 @@ static inline int is_same_network(struct rtllib_network *src, /* A network is only a duplicate if the channel, BSSID, ESSID * and the capability field (in particular IBSS and BSS) all match. * We treat all <hidden> with the same BSSID and channel - * as one network */ + * as one network + */ return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) && (src->channel == dst->channel) && !memcmp(src->bssid, dst->bssid, ETH_ALEN) && @@ -2422,7 +2432,7 @@ static inline int is_beacon(__le16 fc) static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { - printk(KERN_INFO "%s(): Invalid Channel\n", __func__); + netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); return 0; } @@ -2435,7 +2445,7 @@ static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { - printk(KERN_INFO "%s(): Invalid Channel\n", __func__); + netdev_info(rtllib->dev, "%s(): Invalid Channel\n", __func__); return 0; } if (rtllib->active_channel_map[channel] > 0) @@ -2501,8 +2511,9 @@ static inline void rtllib_process_probe_response( if (WLAN_FC_GET_STYPE(le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP) { if (IsPassiveChannel(ieee, network->channel)) { - printk(KERN_INFO "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", - network->channel); + netdev_info(ieee->dev, + "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", + network->channel); goto free_network; } } @@ -2512,10 +2523,12 @@ static inline void rtllib_process_probe_response( * * NOTE: This search is definitely not optimized. Once its doing * the "right thing" we'll optimize it for efficiency if - * necessary */ + * necessary + */ /* Search for this entry in the list and update it if it is - * already there. */ + * already there. + */ spin_lock_irqsave(&ieee->lock, flags); if (is_same_network(&ieee->current_network, network, @@ -2544,7 +2557,8 @@ static inline void rtllib_process_probe_response( } /* If we didn't find a match, then get a new network slot to initialize - * with this beacon's information */ + * with this beacon's information + */ if (&target->list == &ieee->network_list) { if (list_empty(&ieee->network_free_list)) { /* If there are no more slots, expire the oldest */ @@ -2611,7 +2625,6 @@ static inline void rtllib_process_probe_response( } free_network: kfree(network); - return; } void rtllib_rx_mgt(struct rtllib_device *ieee, diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index d992a754e72d..23b7a4c3b699 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -68,7 +68,8 @@ static void rtllib_MFIE_Brate(struct rtllib_device *ieee, u8 **tag_p) } /* We may add an option for custom rates that specific HW - * might support */ + * might support + */ *tag_p = tag; } @@ -89,7 +90,8 @@ static void rtllib_MFIE_Grate(struct rtllib_device *ieee, u8 **tag_p) *tag++ = RTLLIB_BASIC_RATE_MASK | RTLLIB_OFDM_RATE_54MB; } /* We may add an option for custom rates that specific HW might - * support */ + * support + */ *tag_p = tag; } @@ -124,7 +126,7 @@ void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p) *tag++ = 0x00; *tag_p = tag; - printk(KERN_ALERT "This is enable turbo mode IE process\n"); + netdev_alert(ieee->dev, "This is enable turbo mode IE process\n"); } static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb) @@ -133,8 +135,7 @@ static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb) nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM; -/* - * if the queue is full but we have newer frames then +/* if the queue is full but we have newer frames then * just overwrites the oldest. * * if (nh == ieee->mgmt_queue_tail) @@ -188,7 +189,7 @@ MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee) if (QueryRate == 0) { QueryRate = 12; - printk(KERN_INFO "No BasicRate found!!\n"); + netdev_info(ieee->dev, "No BasicRate found!!\n"); } return QueryRate; } @@ -273,12 +274,14 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) || (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) || (ieee->queue_stop)) { - /* insert the skb packet to the management queue */ - /* as for the completion function, it does not need + /* insert the skb packet to the management queue + * + * as for the completion function, it does not need * to check it any more. - * */ - printk(KERN_INFO "%s():insert to waitqueue, queue_index" - ":%d!\n", __func__, tcb_desc->queue_index); + */ + netdev_info(ieee->dev, + "%s():insert to waitqueue, queue_index:%d!\n", + __func__, tcb_desc->queue_index); skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb); } else { @@ -401,7 +404,7 @@ static void rtllib_send_beacon(struct rtllib_device *ieee) if (ieee->beacon_txing && ieee->ieee_up) mod_timer(&ieee->beacon_timer, jiffies + - (MSECS(ieee->current_network.beacon_interval - 5))); + (msecs_to_jiffies(ieee->current_network.beacon_interval - 5))); } @@ -416,40 +419,33 @@ static void rtllib_send_beacon_cb(unsigned long _ieee) spin_unlock_irqrestore(&ieee->beacon_lock, flags); } -/* - * Description: - * Enable network monitor mode, all rx packets will be received. - */ +/* Enables network monitor mode, all rx packets will be received. */ void rtllib_EnableNetMonitorMode(struct net_device *dev, bool bInitState) { struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Enter Monitor Mode\n"); + netdev_info(dev, "========>Enter Monitor Mode\n"); ieee->AllowAllDestAddrHandler(dev, true, !bInitState); } -/* - * Description: - * Disable network network monitor mode, only packets destinated to - * us will be received. +/* Disables network monitor mode. Only packets destinated to + * us will be received. */ void rtllib_DisableNetMonitorMode(struct net_device *dev, bool bInitState) { struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Exit Monitor Mode\n"); + netdev_info(dev, "========>Exit Monitor Mode\n"); ieee->AllowAllDestAddrHandler(dev, false, !bInitState); } -/* - * Description: - * This enables the specialized promiscuous mode required by Intel. +/* Enables the specialized promiscuous mode required by Intel. * In this mode, Intel intends to hear traffics from/to other STAs in the * same BSS. Therefore we don't have to disable checking BSSID and we only need * to allow all dest. BUT: if we enable checking BSSID then we can't recv @@ -462,7 +458,7 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Enter Intel Promiscuous Mode\n"); + netdev_info(dev, "========>Enter Intel Promiscuous Mode\n"); ieee->AllowAllDestAddrHandler(dev, true, !bInitState); ieee->SetHwRegHandler(dev, HW_VAR_CECHK_BSSID, @@ -473,10 +469,8 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode); -/* - * Description: - * This disables the specialized promiscuous mode required by Intel. - * See MgntEnableIntelPromiscuousMode for detail. +/* Disables the specialized promiscuous mode required by Intel. + * See MgntEnableIntelPromiscuousMode for detail. */ void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, bool bInitState) @@ -485,7 +479,7 @@ void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, struct rtllib_device *ieee = netdev_priv_rsl(dev); - printk(KERN_INFO "========>Exit Intel Promiscuous Mode\n"); + netdev_info(dev, "========>Exit Intel Promiscuous Mode\n"); ieee->AllowAllDestAddrHandler(dev, false, !bInitState); ieee->SetHwRegHandler(dev, HW_VAR_CECHK_BSSID, @@ -569,7 +563,8 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh) if (ieee->state == RTLLIB_LINKED) goto out; if (ieee->sync_scan_hurryup) { - printk(KERN_INFO "============>sync_scan_hurryup out\n"); + netdev_info(ieee->dev, + "============>sync_scan_hurryup out\n"); goto out; } @@ -614,8 +609,9 @@ static void rtllib_softmac_scan_wq(void *data) down(&ieee->scan_sem); if (ieee->eRFPowerState == eRfOff) { - printk(KERN_INFO "======>%s():rf state is eRfOff, return\n", - __func__); + netdev_info(ieee->dev, + "======>%s():rf state is eRfOff, return\n", + __func__); goto out1; } @@ -639,7 +635,7 @@ static void rtllib_softmac_scan_wq(void *data) rtllib_send_probe_requests(ieee, 0); queue_delayed_work_rsl(ieee->wq, &ieee->softmac_scan_wq, - MSECS(RTLLIB_SOFTMAC_SCAN_TIME)); + msecs_to_jiffies(RTLLIB_SOFTMAC_SCAN_TIME)); up(&ieee->scan_sem); return; @@ -1238,8 +1234,8 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, PMKCacheIdx = SecIsInPMKIDList(ieee, ieee->current_network.bssid); if (PMKCacheIdx >= 0) { wpa_ie_len += 18; - printk(KERN_INFO "[PMK cache]: WPA2 IE length: %x\n", - wpa_ie_len); + netdev_info(ieee->dev, "[PMK cache]: WPA2 IE length: %x\n", + wpa_ie_len); } len = sizeof(struct rtllib_assoc_request_frame) + 2 + beacon->ssid_len @@ -1418,8 +1414,9 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, if (ieee->assocreq_ies) memcpy(ieee->assocreq_ies, ies, ieee->assocreq_ies_len); else { - printk(KERN_INFO "%s()Warning: can't alloc memory for assocreq" - "_ies\n", __func__); + netdev_info(ieee->dev, + "%s()Warning: can't alloc memory for assocreq_ies\n", + __func__); ieee->assocreq_ies_len = 0; } return skb; @@ -1474,7 +1471,7 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr) if (!skb) rtllib_associate_abort(ieee); else { - ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATING ; + ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATING; RTLLIB_DEBUG_MGMT("Sending authentication request\n"); softmac_mgmt_xmit(skb, ieee); if (!timer_pending(&ieee->associate_timer)) { @@ -1503,8 +1500,7 @@ static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge, int *(c++) = chlen; memcpy(c, challenge, chlen); - RTLLIB_DEBUG_MGMT("Sending authentication challenge " - "response\n"); + RTLLIB_DEBUG_MGMT("Sending authentication challenge response\n"); rtllib_encrypt_fragment(ieee, skb, sizeof(struct rtllib_hdr_3addr)); @@ -1543,9 +1539,9 @@ static void rtllib_associate_complete_wq(void *data) associate_complete_wq); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) (&(ieee->PowerSaveControl)); - printk(KERN_INFO "Associated successfully\n"); + netdev_info(ieee->dev, "Associated successfully\n"); if (!ieee->is_silent_reset) { - printk(KERN_INFO "normal associate\n"); + netdev_info(ieee->dev, "normal associate\n"); notify_wx_assoc_event(ieee); } @@ -1554,20 +1550,20 @@ static void rtllib_associate_complete_wq(void *data) if (rtllib_is_54g(&ieee->current_network) && (ieee->modulation & RTLLIB_OFDM_MODULATION)) { ieee->rate = 108; - printk(KERN_INFO"Using G rates:%d\n", ieee->rate); + netdev_info(ieee->dev, "Using G rates:%d\n", ieee->rate); } else { ieee->rate = 22; ieee->SetWirelessMode(ieee->dev, IEEE_B); - printk(KERN_INFO"Using B rates:%d\n", ieee->rate); + netdev_info(ieee->dev, "Using B rates:%d\n", ieee->rate); } if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { - printk(KERN_INFO "Successfully associated, ht enabled\n"); + netdev_info(ieee->dev, "Successfully associated, ht enabled\n"); HTOnAssocRsp(ieee); } else { - printk(KERN_INFO "Successfully associated, ht not " - "enabled(%d, %d)\n", - ieee->pHTInfo->bCurrentHTSupport, - ieee->pHTInfo->bEnableHT); + netdev_info(ieee->dev, + "Successfully associated, ht not enabled(%d, %d)\n", + ieee->pHTInfo->bCurrentHTSupport, + ieee->pHTInfo->bEnableHT); memset(ieee->dot11HTOperationalRateSet, 0, 16); } ieee->LinkDetectInfo.SlotNum = 2 * (1 + @@ -1582,7 +1578,7 @@ static void rtllib_associate_complete_wq(void *data) ieee->link_change(ieee->dev); if (ieee->is_silent_reset) { - printk(KERN_INFO "silent reset associate\n"); + netdev_info(ieee->dev, "silent reset associate\n"); ieee->is_silent_reset = false; } @@ -1623,8 +1619,9 @@ static void rtllib_associate_procedure_wq(void *data) ieee->current_network.channel); HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); if (ieee->eRFPowerState == eRfOff) { - RT_TRACE(COMP_DBG, "=============>%s():Rf state is eRfOff," - " schedule ipsleave wq again,return\n", __func__); + RT_TRACE(COMP_DBG, + "=============>%s():Rf state is eRfOff, schedule ipsleave wq again,return\n", + __func__); if (ieee->rtllib_ips_leave_wq != NULL) ieee->rtllib_ips_leave_wq(ieee->dev); up(&ieee->wx_sem); @@ -1705,8 +1702,8 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, (!apset && ssidset && ssidbroad && ssidmatch) || (ieee->is_roaming && ssidset && ssidbroad && ssidmatch)) { /* if the essid is hidden replace it with the - * essid provided by the user. - */ + * essid provided by the user. + */ if (!ssidbroad) { strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); @@ -1719,15 +1716,15 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, IW_ESSID_MAX_SIZE); ieee->current_network.ssid_len = tmp_ssid_len; } - printk(KERN_INFO"Linking with %s,channel:%d, qos:%d, " - "myHT:%d, networkHT:%d, mode:%x cur_net.flags" - ":0x%x\n", ieee->current_network.ssid, - ieee->current_network.channel, - ieee->current_network.qos_data.supported, - ieee->pHTInfo->bEnableHT, - ieee->current_network.bssht.bdSupportHT, - ieee->current_network.mode, - ieee->current_network.flags); + netdev_info(ieee->dev, + "Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d, mode:%x cur_net.flags:0x%x\n", + ieee->current_network.ssid, + ieee->current_network.channel, + ieee->current_network.qos_data.supported, + ieee->pHTInfo->bEnableHT, + ieee->current_network.bssht.bdSupportHT, + ieee->current_network.mode, + ieee->current_network.flags); if ((rtllib_act_scanning(ieee, false)) && !(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) @@ -1758,11 +1755,11 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, (ieee->modulation & RTLLIB_OFDM_MODULATION)) { ieee->rate = 108; ieee->SetWirelessMode(ieee->dev, IEEE_G); - printk(KERN_INFO"Using G rates\n"); + netdev_info(ieee->dev, "Using G rates\n"); } else { ieee->rate = 22; ieee->SetWirelessMode(ieee->dev, IEEE_B); - printk(KERN_INFO"Using B rates\n"); + netdev_info(ieee->dev, "Using B rates\n"); } memset(ieee->dot11HTOperationalRateSet, 0, 16); ieee->state = RTLLIB_LINKED; @@ -1965,7 +1962,7 @@ static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee, if (assoc_rq_parse(skb, dest) != -1) rtllib_resp_to_assoc_rq(ieee, dest); - printk(KERN_INFO"New client associated: %pM\n", dest); + netdev_info(ieee->dev, "New client associated: %pM\n", dest); } void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr) @@ -2004,13 +2001,16 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) timeout = ieee->current_network.beacon_interval; ieee->current_network.dtim_data = RTLLIB_DTIM_INVALID; /* there's no need to nofity AP that I find you buffered - * with broadcast packet */ + * with broadcast packet + */ if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps)) return 2; - if (!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) + if (!time_after(jiffies, + ieee->dev->trans_start + msecs_to_jiffies(timeout))) return 0; - if (!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) + if (!time_after(jiffies, + ieee->last_rx_ps_time + msecs_to_jiffies(timeout))) return 0; if ((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) && (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) @@ -2060,7 +2060,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) } *time = ieee->current_network.last_dtim_sta_time - + MSECS(ieee->current_network.beacon_interval * + + msecs_to_jiffies(ieee->current_network.beacon_interval * LPSAwakeIntvl_tmp); } } @@ -2081,10 +2081,9 @@ static inline void rtllib_sta_ps(struct rtllib_device *ieee) if ((ieee->ps == RTLLIB_PS_DISABLED || ieee->iw_mode != IW_MODE_INFRA || ieee->state != RTLLIB_LINKED)) { - RT_TRACE(COMP_DBG, "=====>%s(): no need to ps,wake up!! " - "ieee->ps is %d, ieee->iw_mode is %d, ieee->state" - " is %d\n", __func__, ieee->ps, ieee->iw_mode, - ieee->state); + RT_TRACE(COMP_DBG, + "=====>%s(): no need to ps,wake up!! ieee->ps is %d, ieee->iw_mode is %d, ieee->state is %d\n", + __func__, ieee->ps, ieee->iw_mode, ieee->state); spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); rtllib_sta_wakeup(ieee, 1); @@ -2199,8 +2198,8 @@ static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *sk u8 category = 0; if (act == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "error to get payload of " - "action frame\n"); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "error to get payload of action frame\n"); return; } @@ -2223,7 +2222,6 @@ static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *sk default: break; } - return; } inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, @@ -2285,16 +2283,18 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(ieee->assocresp_ies, ies, ieee->assocresp_ies_len); else { - printk(KERN_INFO "%s()Warning: can't alloc " - "memory for assocresp_ies\n", __func__); + netdev_info(ieee->dev, + "%s()Warning: can't alloc memory for assocresp_ies\n", + __func__); ieee->assocresp_ies_len = 0; } rtllib_associate_complete(ieee); } else { /* aid could not been allocated */ ieee->softmac_stats.rx_ass_err++; - printk(KERN_INFO "Association response status code 0x%x\n", - errcode); + netdev_info(ieee->dev, + "Association response status code 0x%x\n", + errcode); RTLLIB_DEBUG_MGMT( "Association response status code 0x%x\n", errcode); @@ -2308,72 +2308,71 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } -inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, - struct rtllib_rx_stats *rx_stats) +static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) { u16 errcode; u8 *challenge; int chlen = 0; bool bSupportNmode = true, bHalfSupportNmode = false; - if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { - if (ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATING && - (ieee->iw_mode == IW_MODE_INFRA)) { - RTLLIB_DEBUG_MGMT("Received authentication response"); + errcode = auth_parse(skb, &challenge, &chlen); - errcode = auth_parse(skb, &challenge, &chlen); - if (0 == errcode) { - if (ieee->open_wep || !challenge) { - ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; - ieee->softmac_stats.rx_auth_rs_ok++; - if (!(ieee->pHTInfo->IOTAction & - HT_IOT_ACT_PURE_N_MODE)) { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { - if (IsHTHalfNmodeAPs(ieee)) { - bSupportNmode = true; - bHalfSupportNmode = true; - } else { - bSupportNmode = false; - bHalfSupportNmode = false; - } - } - } - /* Dummy wirless mode setting to avoid - * encryption issue */ - if (bSupportNmode) { - ieee->SetWirelessMode(ieee->dev, - ieee->current_network.mode); - } else { - /*TODO*/ - ieee->SetWirelessMode(ieee->dev, - IEEE_G); - } - - if (ieee->current_network.mode == - IEEE_N_24G && bHalfSupportNmode) { - printk(KERN_INFO "======>enter " - "half N mode\n"); - ieee->bHalfWirelessN24GMode = - true; - } else - ieee->bHalfWirelessN24GMode = - false; - - rtllib_associate_step2(ieee); + if (errcode) { + ieee->softmac_stats.rx_auth_rs_err++; + RTLLIB_DEBUG_MGMT("Authentication respose status code 0x%x", + errcode); + + netdev_info(ieee->dev, + "Authentication respose status code 0x%x", errcode); + rtllib_associate_abort(ieee); + return; + } + + if (ieee->open_wep || !challenge) { + ieee->state = RTLLIB_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + if (!(ieee->pHTInfo->IOTAction & HT_IOT_ACT_PURE_N_MODE)) { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + if (IsHTHalfNmodeAPs(ieee)) { + bSupportNmode = true; + bHalfSupportNmode = true; } else { - rtllib_auth_challenge(ieee, challenge, - chlen); + bSupportNmode = false; + bHalfSupportNmode = false; } - } else { - ieee->softmac_stats.rx_auth_rs_err++; - RTLLIB_DEBUG_MGMT("Authentication respose" - " status code 0x%x", errcode); - - printk(KERN_INFO "Authentication respose " - "status code 0x%x", errcode); - rtllib_associate_abort(ieee); } + } + /* Dummy wirless mode setting to avoid encryption issue */ + if (bSupportNmode) { + ieee->SetWirelessMode(ieee->dev, + ieee->current_network.mode); + } else { + /*TODO*/ + ieee->SetWirelessMode(ieee->dev, IEEE_G); + } + if ((ieee->current_network.mode == IEEE_N_24G) && + bHalfSupportNmode) { + netdev_info(ieee->dev, "======>enter half N mode\n"); + ieee->bHalfWirelessN24GMode = true; + } else { + ieee->bHalfWirelessN24GMode = false; + } + rtllib_associate_step2(ieee); + } else { + rtllib_auth_challenge(ieee, challenge, chlen); + } +} + +inline int rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, + struct rtllib_rx_stats *rx_stats) +{ + + if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { + if (ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATING && + (ieee->iw_mode == IW_MODE_INFRA)) { + RTLLIB_DEBUG_MGMT("Received authentication response"); + rtllib_rx_auth_resp(ieee, skb); } else if (ieee->iw_mode == IW_MODE_MASTER) { rtllib_rx_auth_rq(ieee, skb); } @@ -2389,15 +2388,15 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb) return 0; /* FIXME for now repeat all the association procedure - * both for disassociation and deauthentication - */ + * both for disassociation and deauthentication + */ if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && ieee->state == RTLLIB_LINKED && (ieee->iw_mode == IW_MODE_INFRA)) { - printk(KERN_INFO "==========>received disassoc/deauth(%x) " - "frame, reason code:%x\n", - WLAN_FC_GET_STYPE(header->frame_ctl), - ((struct rtllib_disassoc *)skb->data)->reason); + netdev_info(ieee->dev, + "==========>received disassoc/deauth(%x) frame, reason code:%x\n", + WLAN_FC_GET_STYPE(header->frame_ctl), + ((struct rtllib_disassoc *)skb->data)->reason); ieee->state = RTLLIB_ASSOCIATING; ieee->softmac_stats.reassoc++; ieee->is_roaming = true; @@ -2450,7 +2449,6 @@ inline int rtllib_rx_frame_softmac(struct rtllib_device *ieee, break; default: return -1; - break; } return 0; } @@ -2494,16 +2492,17 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) ieee->stats.multicast++; /* if xmit available, just xmit it immediately, else just insert it to - * the wait queue */ + * the wait queue + */ for (i = 0; i < txb->nr_frags; i++) { queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]); - if ((queue_len != 0) ||\ + if ((queue_len != 0) || (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || (ieee->queue_stop)) { - /* insert the skb packet to the wait queue */ - /* as for the completion function, it does not need + /* insert the skb packet to the wait queue + * as for the completion function, it does not need * to check it any more. - * */ + */ if (queue_len < 200) skb_queue_tail(&ieee->skb_waitQ[queue_index], txb->fragments[i]); @@ -2533,13 +2532,12 @@ static void rtllib_resume_tx(struct rtllib_device *ieee) if (ieee->queue_stop) { ieee->tx_pending.frag = i; return; - } else { - - ieee->softmac_data_hard_start_xmit( - ieee->tx_pending.txb->fragments[i], - ieee->dev, ieee->rate); - ieee->stats.tx_packets++; } + + ieee->softmac_data_hard_start_xmit( + ieee->tx_pending.txb->fragments[i], + ieee->dev, ieee->rate); + ieee->stats.tx_packets++; } rtllib_txb_free(ieee->tx_pending.txb); @@ -2688,7 +2686,7 @@ static void rtllib_start_ibss_wq(void *data) * on the semaphore */ if (!ieee->proto_started) { - printk(KERN_INFO "==========oh driver down return\n"); + netdev_info(ieee->dev, "==========oh driver down return\n"); return; } down(&ieee->wx_sem); @@ -2724,7 +2722,7 @@ static void rtllib_start_ibss_wq(void *data) /* the network definitively is not here.. create a new cell */ if (ieee->state == RTLLIB_NOLINK) { - printk(KERN_INFO "creating new IBSS cell\n"); + netdev_info(ieee->dev, "creating new IBSS cell\n"); ieee->current_network.channel = ieee->IbssStartChnl; if (!ieee->wap_set) rtllib_randomize_cell(ieee); @@ -2778,7 +2776,7 @@ static void rtllib_start_ibss_wq(void *data) ieee->current_network.capability = WLAN_CAPABILITY_IBSS; } - printk(KERN_INFO "%s(): ieee->mode = %d\n", __func__, ieee->mode); + netdev_info(ieee->dev, "%s(): ieee->mode = %d\n", __func__, ieee->mode); if ((ieee->mode == IEEE_N_24G) || (ieee->mode == IEEE_N_5G)) HTUseDefaultSetting(ieee); else @@ -2808,7 +2806,8 @@ static void rtllib_start_ibss_wq(void *data) inline void rtllib_start_ibss(struct rtllib_device *ieee) { - queue_delayed_work_rsl(ieee->wq, &ieee->start_ibss_wq, MSECS(150)); + queue_delayed_work_rsl(ieee->wq, &ieee->start_ibss_wq, + msecs_to_jiffies(150)); } /* this is called only in user context, with wx_sem held */ @@ -2881,18 +2880,18 @@ static void rtllib_associate_retry_wq(void *data) goto exit; /* until we do not set the state to RTLLIB_NOLINK - * there are no possibility to have someone else trying - * to start an association procedure (we get here with - * ieee->state = RTLLIB_ASSOCIATING). - * When we set the state to RTLLIB_NOLINK it is possible - * that the RX path run an attempt to associate, but - * both rtllib_softmac_check_all_nets and the - * RX path works with ieee->lock held so there are no - * problems. If we are still disassociated then start a scan. - * the lock here is necessary to ensure no one try to start - * an association procedure when we have just checked the - * state and we are going to start the scan. - */ + * there are no possibility to have someone else trying + * to start an association procedure (we get here with + * ieee->state = RTLLIB_ASSOCIATING). + * When we set the state to RTLLIB_NOLINK it is possible + * that the RX path run an attempt to associate, but + * both rtllib_softmac_check_all_nets and the + * RX path works with ieee->lock held so there are no + * problems. If we are still disassociated then start a scan. + * the lock here is necessary to ensure no one try to start + * an association procedure when we have just checked the + * state and we are going to start the scan. + */ ieee->beinretry = true; ieee->state = RTLLIB_NOLINK; @@ -3180,8 +3179,9 @@ void rtllib_softmac_free(struct rtllib_device *ieee) static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) { /* This is called when wpa_supplicant loads and closes the driver - * interface. */ - printk(KERN_INFO "%s WPA\n", value ? "enabling" : "disabling"); + * interface. + */ + netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); ieee->wpa_enabled = value; memset(ieee->ap_mac_addr, 0, 6); return 0; @@ -3212,7 +3212,7 @@ static int rtllib_wpa_mlme(struct rtllib_device *ieee, int command, int reason) break; default: - printk(KERN_INFO "Unknown MLME request: %d\n", command); + netdev_info(ieee->dev, "Unknown MLME request: %d\n", command); ret = -EOPNOTSUPP; } @@ -3343,7 +3343,7 @@ static int rtllib_wpa_set_param(struct rtllib_device *ieee, u8 name, u32 value) break; default: - printk(KERN_INFO "Unknown WPA param: %d\n", name); + netdev_info(ieee->dev, "Unknown WPA param: %d\n", name); ret = -EOPNOTSUPP; } @@ -3369,8 +3369,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, if (param_len != (int) ((char *) param->u.crypt.key - (char *) param) + param->u.crypt.key_len) { - printk(KERN_INFO "Len mismatch %d, %d\n", param_len, - param->u.crypt.key_len); + netdev_info(ieee->dev, "Len mismatch %d, %d\n", param_len, + param->u.crypt.key_len); return -EINVAL; } if (is_broadcast_ether_addr(param->sta_addr)) { @@ -3410,8 +3410,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, ops = lib80211_get_crypto_ops(param->u.crypt.alg); } if (ops == NULL) { - printk(KERN_INFO "unknown crypto alg '%s'\n", - param->u.crypt.alg); + netdev_info(ieee->dev, "unknown crypto alg '%s'\n", + param->u.crypt.alg); param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; ret = -EINVAL; goto done; @@ -3421,12 +3421,11 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct lib80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops) new_crypt->priv = @@ -3446,7 +3445,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, (*crypt)->ops->set_key(param->u.crypt.key, param->u.crypt.key_len, param->u.crypt.seq, (*crypt)->priv) < 0) { - printk(KERN_INFO "key setting failed\n"); + netdev_info(ieee->dev, "key setting failed\n"); param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; ret = -EINVAL; goto done; @@ -3486,12 +3485,13 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, * generate new IEEE 802.11 authentication which may end up in looping * with IEEE 802.1X. If your hardware requires a reset after WEP * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. */ + * the callbacks structures used to initialize the 802.11 stack. + */ if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(ieee->dev)) { - printk(KERN_INFO "reset_port failed\n"); + netdev_info(ieee->dev, "reset_port failed\n"); param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; return -EINVAL; } @@ -3634,8 +3634,8 @@ int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, struct iw_point *p, break; default: - printk(KERN_INFO "Unknown WPA supplicant request: %d\n", - param->cmd); + netdev_info(ieee->dev, "Unknown WPA supplicant request: %d\n", + param->cmd); ret = -EOPNOTSUPP; break; } @@ -3749,9 +3749,9 @@ void notify_wx_assoc_event(struct rtllib_device *ieee) ETH_ALEN); else { - printk(KERN_INFO "%s(): Tell user space disconnected\n", - __func__); - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + netdev_info(ieee->dev, "%s(): Tell user space disconnected\n", + __func__); + eth_zero_addr(wrqu.ap_addr.sa_data); } wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); } diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 835f3d78a16f..9715a793fd37 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -120,7 +120,7 @@ int rtllib_wx_get_wap(struct rtllib_device *ieee, ieee->state != RTLLIB_LINKED_SCANNING && ieee->wap_set == 0) - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); else memcpy(wrqu->ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); @@ -527,8 +527,8 @@ int rtllib_wx_set_rawtx(struct rtllib_device *ieee, else ieee->raw_tx = 0; - printk(KERN_INFO"raw TX is %s\n", - ieee->raw_tx ? "enabled" : "disabled"); + netdev_info(ieee->dev, "raw TX is %s\n", + ieee->raw_tx ? "enabled" : "disabled"); if (ieee->iw_mode == IW_MODE_MONITOR) { if (prev == 0 && ieee->raw_tx) { @@ -575,8 +575,9 @@ int rtllib_wx_set_power(struct rtllib_device *ieee, if ((!ieee->sta_wake_up) || (!ieee->enter_sleep_state) || (!ieee->ps_is_queue_empty)) { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "%s(): PS mode is tried to be use " - "but driver missed a callback\n\n", __func__); + RTLLIB_DEBUG(RTLLIB_DL_ERR, + "%s(): PS mode is tried to be use but driver missed a callback\n\n", + __func__); return -1; } diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 4f68ffe41475..3b159638bba2 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -53,102 +53,99 @@ #include "rtllib.h" -/* - - -802.11 Data Frame - - -802.11 frame_control for data frames - 2 bytes - ,-----------------------------------------------------------------------------------------. -bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | - | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | - '-----------------------------------------------------------------------------------------' - /\ - | -802.11 Data Frame | - ,--------- 'ctrl' expands to >-----------' - | - ,--'---,-------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `--------------------------------------------------| |------' -Total: 28 non-data bytes `----.----' - | - .- 'Frame data' expands to <---------------------------' - | - V - ,---------------------------------------------------. -Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | - |------|------|---------|----------|------|---------| -Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | - | DSAP | SSAP | | | | Packet | - | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | - `-----------------------------------------| | -Total: 8 non-data bytes `----.----' - | - .- 'IP Packet' expands, if WEP enabled, to <--' - | - V - ,-----------------------. -Bytes | 4 | 0-2296 | 4 | - |-----|-----------|-----| -Desc. | IV | Encrypted | ICV | - | | IP Packet | | - `-----------------------' -Total: 8 non-data bytes - - -802.3 Ethernet Data Frame - - ,-----------------------------------------. -Bytes | 6 | 6 | 2 | Variable | 4 | - |-------|-------|------|-----------|------| -Desc. | Dest. | Source| Type | IP Packet | fcs | - | MAC | MAC | | | | - `-----------------------------------------' -Total: 18 non-data bytes - -In the event that fragmentation is required, the incoming payload is split into -N parts of size ieee->fts. The first fragment contains the SNAP header and the -remaining packets are just data. - -If encryption is enabled, each fragment payload size is reduced by enough space -to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) -So if you have 1500 bytes of payload with ieee->fts set to 500 without -encryption it will take 3 frames. With WEP it will take 4 frames as the -payload of each frame is reduced to 492 bytes. - -* SKB visualization -* -* ,- skb->data -* | -* | ETHERNET HEADER ,-<-- PAYLOAD -* | | 14 bytes from skb->data -* | 2 bytes for Type --> ,T. | (sizeof ethhdr) -* | | | | -* |,-Dest.--. ,--Src.---. | | | -* | 6 bytes| | 6 bytes | | | | -* v | | | | | | -* 0 | v 1 | v | v 2 -* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -* ^ | ^ | ^ | -* | | | | | | -* | | | | `T' <---- 2 bytes for Type -* | | | | -* | | '---SNAP--' <-------- 6 bytes for SNAP -* | | -* `-IV--' <-------------------- 4 bytes for IV (WEP) -* -* SNAP HEADER -* -*/ +/* 802.11 Data Frame + * + * + * 802.11 frame_control for data frames - 2 bytes + * ,-----------------------------------------------------------------------------------------. + * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | + * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | + * '-----------------------------------------------------------------------------------------' + * /\ + * | + * 802.11 Data Frame | + * ,--------- 'ctrl' expands to >-----------' + * | + * ,--'---,-------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `--------------------------------------------------| |------' + * Total: 28 non-data bytes `----.----' + * | + * .- 'Frame data' expands to <---------------------------' + * | + * V + * ,---------------------------------------------------. + * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | + * |------|------|---------|----------|------|---------| + * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | + * | DSAP | SSAP | | | | Packet | + * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | + * `-----------------------------------------| | + * Total: 8 non-data bytes `----.----' + * | + * .- 'IP Packet' expands, if WEP enabled, to <--' + * | + * V + * ,-----------------------. + * Bytes | 4 | 0-2296 | 4 | + * |-----|-----------|-----| + * Desc. | IV | Encrypted | ICV | + * | | IP Packet | | + * `-----------------------' + * Total: 8 non-data bytes + * + * + * 802.3 Ethernet Data Frame + * + * ,-----------------------------------------. + * Bytes | 6 | 6 | 2 | Variable | 4 | + * |-------|-------|------|-----------|------| + * Desc. | Dest. | Source| Type | IP Packet | fcs | + * | MAC | MAC | | | | + * `-----------------------------------------' + * Total: 18 non-data bytes + * + * In the event that fragmentation is required, the incoming payload is split into + * N parts of size ieee->fts. The first fragment contains the SNAP header and the + * remaining packets are just data. + * + * If encryption is enabled, each fragment payload size is reduced by enough space + * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) + * So if you have 1500 bytes of payload with ieee->fts set to 500 without + * encryption it will take 3 frames. With WEP it will take 4 frames as the + * payload of each frame is reduced to 492 bytes. + * + * SKB visualization + * + * ,- skb->data + * | + * | ETHERNET HEADER ,-<-- PAYLOAD + * | | 14 bytes from skb->data + * | 2 bytes for Type --> ,T. | (sizeof ethhdr) + * | | | | + * |,-Dest.--. ,--Src.---. | | | + * | 6 bytes| | 6 bytes | | | | + * v | | | | | | + * 0 | v 1 | v | v 2 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * ^ | ^ | ^ | + * | | | | | | + * | | | | `T' <---- 2 bytes for Type + * | | | | + * | | '---SNAP--' <-------- 6 bytes for SNAP + * | | + * `-IV--' <-------------------- 4 bytes for IV (WEP) + * + * SNAP HEADER + * + */ static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; @@ -185,14 +182,17 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (!(crypt && crypt->ops)) { - printk(KERN_INFO "=========>%s(), crypt is null\n", __func__); + netdev_info(ieee->dev, "=========>%s(), crypt is null\n", + __func__); return -1; } /* To encrypt, frame format is: - * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) + */ /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so - * call both MSDU and MPDU encryption functions from here. */ + * call both MSDU and MPDU encryption functions from here. + */ atomic_inc(&crypt->refcnt); res = 0; if (crypt->ops->encrypt_msdu) @@ -202,8 +202,8 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, atomic_dec(&crypt->refcnt); if (res < 0) { - printk(KERN_INFO "%s: Encryption failed: len=%d.\n", - ieee->dev->name, frag->len); + netdev_info(ieee->dev, "%s: Encryption failed: len=%d.\n", + ieee->dev->name, frag->len); ieee->ieee_stats.tx_discards++; return -1; } @@ -311,7 +311,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee, if (pHTInfo->bCurrentAMPDUEnable) { if (!GetTs(ieee, (struct ts_common_info **)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) { - printk(KERN_INFO "%s: can't get TS\n", __func__); + netdev_info(ieee->dev, "%s: can't get TS\n", __func__); return; } if (pTxTs->TxAdmittedBARecord.bValid == false) { @@ -412,6 +412,8 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee, struct cb_desc *tcb_desc, struct sk_buff *skb) { + struct rt_hi_throughput *pHTInfo; + tcb_desc->bRTSSTBC = false; tcb_desc->bRTSUseShortGI = false; tcb_desc->bCTSEnable = false; @@ -434,50 +436,50 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee, tcb_desc->rts_rate = MGN_24M; } return; - } else { - struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; + } - while (true) { - if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) { - tcb_desc->bCTSEnable = true; - tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = true; - break; - } else if (pHTInfo->IOTAction & (HT_IOT_ACT_FORCED_RTS | - HT_IOT_ACT_PURE_N_MODE)) { - tcb_desc->bRTSEnable = true; - tcb_desc->rts_rate = MGN_24M; - break; - } - if (ieee->current_network.buseprotection) { - tcb_desc->bRTSEnable = true; - tcb_desc->bCTSEnable = true; - tcb_desc->rts_rate = MGN_24M; - break; - } - if (pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) { - u8 HTOpMode = pHTInfo->CurrentOpMode; - - if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 || - HTOpMode == 3)) || - (!pHTInfo->bCurBW40MHz && HTOpMode == 3)) { - tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = true; - break; - } - } - if (skb->len > ieee->rts) { + pHTInfo = ieee->pHTInfo; + + while (true) { + if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) { + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = true; + break; + } else if (pHTInfo->IOTAction & (HT_IOT_ACT_FORCED_RTS | + HT_IOT_ACT_PURE_N_MODE)) { + tcb_desc->bRTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + break; + } + if (ieee->current_network.buseprotection) { + tcb_desc->bRTSEnable = true; + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + break; + } + if (pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) { + u8 HTOpMode = pHTInfo->CurrentOpMode; + + if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 || + HTOpMode == 3)) || + (!pHTInfo->bCurBW40MHz && HTOpMode == 3)) { tcb_desc->rts_rate = MGN_24M; tcb_desc->bRTSEnable = true; break; } - if (tcb_desc->bAMPDUEnable) { - tcb_desc->rts_rate = MGN_24M; - tcb_desc->bRTSEnable = false; - break; - } - goto NO_PROTECTION; } + if (skb->len > ieee->rts) { + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = true; + break; + } + if (tcb_desc->bAMPDUEnable) { + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = false; + break; + } + goto NO_PROTECTION; } if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE) tcb_desc->bUseShortPreamble = true; @@ -549,6 +551,17 @@ static int wme_downgrade_ac(struct sk_buff *skb) } } +static u8 rtllib_current_rate(struct rtllib_device *ieee) +{ + if (ieee->mode & IEEE_MODE_MASK) + return ieee->rate; + + if (ieee->HTCurrentOperaRate) + return ieee->HTCurrentOperaRate; + else + return ieee->rate & 0x7F; +} + int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) { struct rtllib_device *ieee = (struct rtllib_device *) @@ -577,21 +590,21 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(&ieee->lock, flags); /* If there is no driver handler to take the TXB, don't bother - * creating it... */ + * creating it... + */ if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)) || ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { - printk(KERN_WARNING "%s: No xmit handler.\n", - ieee->dev->name); + netdev_warn(ieee->dev, "No xmit handler.\n"); goto success; } if (likely(ieee->raw_tx == 0)) { if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { - printk(KERN_WARNING "%s: skb too small (%d).\n", - ieee->dev->name, skb->len); + netdev_warn(ieee->dev, "skb too small (%d).\n", + skb->len); goto success; } /* Save source and destination addresses */ @@ -604,9 +617,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_MONITOR) { txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC); if (unlikely(!txb)) { - printk(KERN_WARNING "%s: Could not allocate " - "TXB\n", - ieee->dev->name); + netdev_warn(ieee->dev, + "Could not allocate TXB\n"); goto failed; } @@ -636,8 +648,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } } } else if (ETH_P_ARP == ether_type) { - printk(KERN_INFO "=================>DHCP " - "Protocol start tx ARP pkt!!\n"); + netdev_info(ieee->dev, + "=================>DHCP Protocol start tx ARP pkt!!\n"); bdhcp = true; ieee->LPSDelayCnt = ieee->current_network.tim.tim_count; @@ -680,7 +692,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_INFRA) { fc |= RTLLIB_FCTL_TODS; /* To DS: Addr1 = BSSID, Addr2 = SA, - Addr3 = DA */ + * Addr3 = DA + */ memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(&header.addr2, &src, ETH_ALEN); @@ -691,7 +704,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) memcpy(&header.addr3, &dest, ETH_ALEN); } else if (ieee->iw_mode == IW_MODE_ADHOC) { /* not From/To DS: Addr1 = DA, Addr2 = SA, - Addr3 = BSSID */ + * Addr3 = BSSID + */ memcpy(&header.addr1, dest, ETH_ALEN); memcpy(&header.addr2, src, ETH_ALEN); memcpy(&header.addr3, ieee->current_network.bssid, @@ -703,7 +717,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) header.frame_ctl = cpu_to_le16(fc); /* Determine fragmentation size based on destination (multicast - * and broadcast are not fragmented) */ + * and broadcast are not fragmented) + */ if (bIsMulticast) { frag_size = MAX_FRAG_THRESHOLD; qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; @@ -717,10 +732,11 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* in case we are a client verify acm is not set for this ac */ while (unlikely(ieee->wmm_acm & (0x01 << skb->priority))) { - printk(KERN_INFO "skb->priority = %x\n", skb->priority); + netdev_info(ieee->dev, "skb->priority = %x\n", + skb->priority); if (wme_downgrade_ac(skb)) break; - printk(KERN_INFO "converted skb->priority = %x\n", + netdev_info(ieee->dev, "converted skb->priority = %x\n", skb->priority); } qos_ctl |= skb->priority; @@ -731,14 +747,16 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* Determine amount of payload per fragment. Regardless of if * this stack is providing the full 802.11 header, one will * eventually be affixed to this fragment -- so we must account - * for it when determining the amount of payload space. */ + * for it when determining the amount of payload space. + */ bytes_per_frag = frag_size - hdr_len; if (ieee->config & (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS)) bytes_per_frag -= RTLLIB_FCS_LEN; /* Each fragment may need to have room for encrypting - * pre/postfix */ + * pre/postfix + */ if (encrypt) { bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + crypt->ops->extra_mpdu_postfix_len + @@ -746,7 +764,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) crypt->ops->extra_msdu_postfix_len; } /* Number of fragments is the total bytes_per_frag / - * payload_per_fragment */ + * payload_per_fragment + */ nr_frags = bytes / bytes_per_frag; bytes_last_frag = bytes % bytes_per_frag; if (bytes_last_frag) @@ -756,12 +775,12 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* When we allocate the TXB we allocate enough space for the * reserve and full fragment bytes (bytes_per_frag doesn't - * include prefix, postfix, header, FCS, etc.) */ + * include prefix, postfix, header, FCS, etc.) + */ txb = rtllib_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); if (unlikely(!txb)) { - printk(KERN_WARNING "%s: Could not allocate TXB\n", - ieee->dev->name); + netdev_warn(ieee->dev, "Could not allocate TXB\n"); goto failed; } txb->encrypted = encrypt; @@ -801,7 +820,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) memcpy(frag_hdr, &header, hdr_len); /* If this is not the last fragment, then add the - * MOREFRAGS bit to the frame control */ + * MOREFRAGS bit to the frame control + */ if (i != nr_frags - 1) { frag_hdr->frame_ctl = cpu_to_le16( fc | RTLLIB_FCTL_MOREFRAGS); @@ -836,7 +856,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* Encryption routine will move the header forward in * order to insert the IV between the header and the - * payload */ + * payload + */ if (encrypt) rtllib_encrypt_fragment(ieee, skb_frag, hdr_len); @@ -858,15 +879,14 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } } else { if (unlikely(skb->len < sizeof(struct rtllib_hdr_3addr))) { - printk(KERN_WARNING "%s: skb too small (%d).\n", - ieee->dev->name, skb->len); + netdev_warn(ieee->dev, "skb too small (%d).\n", + skb->len); goto success; } txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC); if (!txb) { - printk(KERN_WARNING "%s: Could not allocate TXB\n", - ieee->dev->name); + netdev_warn(ieee->dev, "Could not allocate TXB\n"); goto failed; } @@ -906,8 +926,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (tcb_desc->bMulticast || tcb_desc->bBroadcast) tcb_desc->data_rate = ieee->basic_rate; else - tcb_desc->data_rate = CURRENT_RATE(ieee->mode, - ieee->rate, ieee->HTCurrentOperaRate); + tcb_desc->data_rate = rtllib_current_rate(ieee); if (bdhcp) { if (ieee->pHTInfo->IOTAction & diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 9e0f975c152f..6234aae5b069 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -32,7 +32,7 @@ #include <linux/wireless.h> #include <linux/kmod.h> #include <linux/module.h> - +#include <linux/etherdevice.h> #include "rtllib.h" struct modes_unit { char *mode_string; @@ -65,7 +65,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, /* First entry *MUST* be the AP MAC address */ iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); + ether_addr_copy(iwe.u.ap_addr.sa_data, network->bssid); start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN); /* Remaining entries will be displayed in the order we provide them */ @@ -74,7 +74,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.cmd = SIOCGIWESSID; iwe.u.data.flags = 1; if (network->ssid_len > 0) { - iwe.u.data.length = min(network->ssid_len, (u8)32); + iwe.u.data.length = min_t(u8, network->ssid_len, 32); start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->ssid); } else if (network->hidden_ssid_len == 0) { @@ -82,7 +82,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, start = iwe_stream_add_point_rsl(info, start, stop, &iwe, "<hidden>"); } else { - iwe.u.data.length = min(network->hidden_ssid_len, (u8)32); + iwe.u.data.length = min_t(u8, network->hidden_ssid_len, 32); start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->hidden_ssid); } @@ -113,8 +113,6 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, /* Add frequency/channel */ iwe.cmd = SIOCGIWFREQ; -/* iwe.u.freq.m = rtllib_frequency(network->channel, network->mode); - iwe.u.freq.e = 3; */ iwe.u.freq.m = network->channel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; @@ -241,7 +239,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, } /* Add EXTRA: Age to display seconds since last beacon/probe response - * for given network. */ + * for given network. + */ iwe.cmd = IWEVCUSTOM; p = custom; p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), @@ -282,8 +281,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee, ev = rtl819x_translate_scan(ieee, ev, stop, network, info); else - RTLLIB_DEBUG_SCAN("Not showing network '%s (" - " %pM)' due to age (%lums).\n", + RTLLIB_DEBUG_SCAN("Not showing network '%s ( %pM)' due to age (%lums).\n", escape_essid(network->ssid, network->ssid_len), network->bssid, @@ -338,13 +336,14 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, RTLLIB_DEBUG_WX("Disabling encryption.\n"); /* Check all the keys to see if any are still configured, - * and if no key index was provided, de-init them all */ + * and if no key index was provided, de-init them all + */ for (i = 0; i < NUM_WEP_KEYS; i++) { if (ieee->crypt_info.crypt[i] != NULL) { if (key_provided) break; lib80211_crypt_delayed_deinit(&ieee->crypt_info, - &ieee->crypt_info.crypt[i]); + &ieee->crypt_info.crypt[i]); } } @@ -365,7 +364,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (*crypt != NULL && (*crypt)->ops != NULL && strcmp((*crypt)->ops->name, "R-WEP") != 0) { /* changing to use WEP; deinit previously used algorithm - * on this key */ + * on this key + */ lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } @@ -390,9 +390,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, kfree(new_crypt); new_crypt = NULL; - printk(KERN_WARNING "%s: could not initialize WEP: " - "load module rtllib_crypt_wep\n", - dev->name); + netdev_warn(dev, + "%s: could not initialize WEP: load module rtllib_crypt_wep\n", + dev->name); return -EOPNOTSUPP; } *crypt = new_crypt; @@ -413,7 +413,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, (*crypt)->priv); sec.flags |= (1 << key); /* This ensures a key will be activated if no key is - * explicitly set */ + * explicitly set + */ if (key == sec.active_key) sec.flags |= SEC_ACTIVE_KEY; ieee->crypt_info.tx_keyidx = key; @@ -423,11 +424,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, NULL, (*crypt)->priv); if (len == 0) { /* Set a default key of all 0 */ - printk(KERN_INFO "Setting key %d to all zero.\n", + netdev_info(ieee->dev, "Setting key %d to all zero.\n", key); - RTLLIB_DEBUG_WX("Setting key %d to all zero.\n", - key); memset(sec.keys[key], 0, 13); (*crypt)->ops->set_key(sec.keys[key], 13, NULL, (*crypt)->priv); @@ -437,8 +436,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, /* No key data - just set the default TX key index */ if (key_provided) { - RTLLIB_DEBUG_WX( - "Setting key %d to default Tx key.\n", key); + RTLLIB_DEBUG_WX("Setting key %d to default Tx key.\n", + key); ieee->crypt_info.tx_keyidx = key; sec.active_key = key; sec.flags |= SEC_ACTIVE_KEY; @@ -454,7 +453,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, "OPEN" : "SHARED KEY"); /* For now we just support WEP, so only set that security level... - * TODO: When WPA is added this is one place that needs to change */ + * TODO: When WPA is added this is one place that needs to change + */ sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ @@ -465,11 +465,12 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, * generate new IEEE 802.11 authentication which may end up in looping * with IEEE 802.1X. If your hardware requires a reset after WEP * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. */ + * the callbacks structures used to initialize the 802.11 stack. + */ if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(dev)) { - printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); + netdev_dbg(dev, "%s: reset_port failed\n", dev->name); return -EINVAL; } return 0; @@ -596,7 +597,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ret = -EINVAL; goto done; } - printk(KERN_INFO "alg name:%s\n", alg); + netdev_info(dev, "alg name:%s\n", alg); ops = lib80211_get_crypto_ops(alg); if (ops == NULL) { @@ -608,9 +609,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, ops = lib80211_get_crypto_ops(alg); } if (ops == NULL) { - RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); - printk(KERN_INFO "========>unknown crypto alg %d\n", ext->alg); + netdev_info(dev, "========>unknown crypto alg %d\n", ext->alg); ret = -EINVAL; goto done; } @@ -641,8 +640,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if (ext->key_len > 0 && (*crypt)->ops->set_key && (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, (*crypt)->priv) < 0) { - RTLLIB_DEBUG_WX("%s: key setting failed\n", dev->name); - printk(KERN_INFO "key setting failed\n"); + netdev_info(dev, "key setting failed\n"); ret = -EINVAL; goto done; } @@ -759,9 +757,9 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee, case IW_MLME_DISASSOC: if (deauth) - printk(KERN_INFO "disauth packet !\n"); + netdev_info(ieee->dev, "disauth packet !\n"); else - printk(KERN_INFO "dis associate packet!\n"); + netdev_info(ieee->dev, "dis associate packet!\n"); ieee->cannot_notify = true; @@ -797,8 +795,7 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee, case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_GROUP: case IW_AUTH_KEY_MGMT: - /* - * Host AP driver does not use these parameters and allows + /* Host AP driver does not use these parameters and allows * wpa_supplicant to control them internally. */ break; |