From: Larry Finger Date: Thu, 25 Aug 2011 16:48:20 +0000 (-0500) Subject: staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part VIII X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1344ee25917bdde1a28719db3c07b3ccde3f42e9;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part VIII Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl_core.c index 7d8a15c685da..9554eef1fcb4 100644 --- a/drivers/staging/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl_core.c @@ -41,7 +41,7 @@ #undef DEBUG_TX_ALLOC #undef DEBUG_TX_DESC -#include +#include #include #include #include "rtl_core.h" @@ -59,26 +59,26 @@ int hwwep = 1; static int channels = 0x3fff; -char* ifname = "wlan%d"; +char *ifname = "wlan%d"; struct rtl819x_ops rtl819xp_ops = { - .nic_type = NIC_8192E, - .get_eeprom_size = rtl8192_get_eeprom_size, + .nic_type = NIC_8192E, + .get_eeprom_size = rtl8192_get_eeprom_size, .init_adapter_variable = rtl8192_InitializeVariables, - .initialize_adapter = rtl8192_adapter_start, - .link_change = rtl8192_link_change, - .tx_fill_descriptor = rtl8192_tx_fill_desc, - .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, + .initialize_adapter = rtl8192_adapter_start, + .link_change = rtl8192_link_change, + .tx_fill_descriptor = rtl8192_tx_fill_desc, + .tx_fill_cmd_descriptor = rtl8192_tx_fill_cmd_desc, .rx_query_status_descriptor = rtl8192_rx_query_status_desc, .rx_command_packet_handler = NULL, - .stop_adapter = rtl8192_halt_adapter, - .update_ratr_table = rtl8192_update_ratr_table, - .irq_enable = rtl8192_EnableInterrupt, - .irq_disable = rtl8192_DisableInterrupt, - .irq_clear = rtl8192_ClearInterrupt, - .rx_enable = rtl8192_enable_rx, - .tx_enable = rtl8192_enable_tx, + .stop_adapter = rtl8192_halt_adapter, + .update_ratr_table = rtl8192_update_ratr_table, + .irq_enable = rtl8192_EnableInterrupt, + .irq_disable = rtl8192_DisableInterrupt, + .irq_clear = rtl8192_ClearInterrupt, + .rx_enable = rtl8192_enable_rx, + .tx_enable = rtl8192_enable_tx, .interrupt_recognized = rtl8192_interrupt_recognized, .TxCheckStuckHandler = rtl8192_HalTxCheckStuck, .RxCheckStuckHandler = rtl8192_HalRxCheckStuck, @@ -94,130 +94,110 @@ static struct pci_device_id rtl8192_pci_id_tbl[] __devinitdata = { MODULE_DEVICE_TABLE(pci, rtl8192_pci_id_tbl); static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id); + const struct pci_device_id *id); static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev); static struct pci_driver rtl8192_pci_driver = { - .name = DRV_NAME, /* Driver name */ - .id_table = rtl8192_pci_id_tbl, /* PCI_ID table */ - .probe = rtl8192_pci_probe, /* probe fn */ - .remove = __devexit_p(rtl8192_pci_disconnect), /* remove fn */ - .suspend = rtl8192E_suspend, /* PM suspend fn */ - .resume = rtl8192E_resume, /* PM resume fn */ + .name = DRV_NAME, /* Driver name */ + .id_table = rtl8192_pci_id_tbl, /* PCI_ID table */ + .probe = rtl8192_pci_probe, /* probe fn */ + .remove = __devexit_p(rtl8192_pci_disconnect), /* remove fn */ + .suspend = rtl8192E_suspend, /* PM suspend fn */ + .resume = rtl8192E_resume, /* PM resume fn */ }; /**************************************************************************** -----------------------------IO STUFF------------------------- *****************************************************************************/ -bool -PlatformIOCheckPageLegalAndGetRegMask( - u32 u4bPage, - u8* pu1bPageMask -) +bool PlatformIOCheckPageLegalAndGetRegMask(u32 u4bPage, u8 *pu1bPageMask) { bool bReturn = false; + *pu1bPageMask = 0xfe; - switch (u4bPage) - { - case 1: case 2: case 3: case 4: - case 8: case 9: case 10: case 12: case 13: - bReturn = true; - *pu1bPageMask = 0xf0; - break; + switch (u4bPage) { + case 1: case 2: case 3: case 4: + case 8: case 9: case 10: case 12: case 13: + bReturn = true; + *pu1bPageMask = 0xf0; + break; - default: - bReturn = false; - break; + default: + bReturn = false; + break; } return bReturn; } -void write_nic_io_byte(struct net_device *dev, int x,u8 y) +void write_nic_io_byte(struct net_device *dev, int x, u8 y) { u32 u4bPage = (x >> 8); u8 u1PageMask = 0; bool bIsLegalPage = false; - if (u4bPage == 0) - { - outb(y&0xff,dev->base_addr +x); - }else - { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, &u1PageMask); - if (bIsLegalPage) - { + if (u4bPage == 0) { + outb(y&0xff, 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)); + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); write_nic_io_byte(dev, (x & 0xff), y); write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - - }else - { - ; } } - - } -void write_nic_io_word(struct net_device *dev, int x,u16 y) +void write_nic_io_word(struct net_device *dev, int x, u16 y) { u32 u4bPage = (x >> 8); u8 u1PageMask = 0; bool bIsLegalPage = false; - if (u4bPage == 0) - { - outw(y,dev->base_addr +x); - }else - { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, &u1PageMask); - if (bIsLegalPage) - { + if (u4bPage == 0) { + outw(y, 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)); + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); write_nic_io_word(dev, (x & 0xff), y); write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - }else - { - ; } } - } -void write_nic_io_dword(struct net_device *dev, int x,u32 y) +void write_nic_io_dword(struct net_device *dev, int x, u32 y) { u32 u4bPage = (x >> 8); u8 u1PageMask = 0; bool bIsLegalPage = false; - if (u4bPage == 0) - { - outl(y,dev->base_addr +x); - }else - { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, &u1PageMask); - if (bIsLegalPage) - { + if (u4bPage == 0) { + outl(y, 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)); + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); write_nic_io_dword(dev, (x & 0xff), y); write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - - }else - { - ; } } - } + u8 read_nic_io_byte(struct net_device *dev, int x) { u32 u4bPage = (x >> 8); @@ -225,23 +205,18 @@ u8 read_nic_io_byte(struct net_device *dev, int x) bool bIsLegalPage = false; u8 Data = 0; - if (u4bPage == 0) - { - return 0xff&inb(dev->base_addr +x); - }else - { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, &u1PageMask); - if (bIsLegalPage) - { + 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)); + 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)); - - }else - { - ; } } @@ -255,23 +230,19 @@ u16 read_nic_io_word(struct net_device *dev, int x) bool bIsLegalPage = false; u16 Data = 0; - if (u4bPage == 0) - { - return inw(dev->base_addr +x); - }else - { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, &u1PageMask); - if (bIsLegalPage) - { + if (u4bPage == 0) { + return inw(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)); + 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)); - }else - { - ; } } @@ -285,23 +256,19 @@ u32 read_nic_io_dword(struct net_device *dev, int x) bool bIsLegalPage = false; u32 Data = 0; - if (u4bPage == 0) - { - return inl(dev->base_addr +x); - }else - { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, &u1PageMask); - if (bIsLegalPage) - { + 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)); + 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)); - }else - { - ; } } @@ -310,36 +277,36 @@ u32 read_nic_io_dword(struct net_device *dev, int x) u8 read_nic_byte(struct net_device *dev, int x) { - return 0xff&readb((u8*)dev->mem_start +x); + return 0xff & readb((u8 *)dev->mem_start + x); } u32 read_nic_dword(struct net_device *dev, int x) { - return readl((u8*)dev->mem_start +x); + return readl((u8 *)dev->mem_start + x); } u16 read_nic_word(struct net_device *dev, int x) { - return readw((u8*)dev->mem_start +x); + return readw((u8 *)dev->mem_start + x); } -void write_nic_byte(struct net_device *dev, int x,u8 y) +void write_nic_byte(struct net_device *dev, int x, u8 y) { - writeb(y,(u8*)dev->mem_start +x); + writeb(y, (u8 *)dev->mem_start + x); udelay(20); } -void write_nic_dword(struct net_device *dev, int x,u32 y) +void write_nic_dword(struct net_device *dev, int x, u32 y) { - writel(y,(u8*)dev->mem_start +x); + writel(y, (u8 *)dev->mem_start + x); udelay(20); } -void write_nic_word(struct net_device *dev, int x,u16 y) +void write_nic_word(struct net_device *dev, int x, u16 y) { - writew(y,(u8*)dev->mem_start +x); + writew(y, (u8 *)dev->mem_start + x); udelay(20); } @@ -347,106 +314,101 @@ void write_nic_word(struct net_device *dev, int x,u16 y) /**************************************************************************** -----------------------------GENERAL FUNCTION------------------------- *****************************************************************************/ -bool -MgntActSet_RF_State( - struct net_device* dev, - enum rt_rf_power_state StateToSet, - RT_RF_CHANGE_SOURCE ChangeSource, - bool ProtectOrNot - ) +bool MgntActSet_RF_State(struct net_device *dev, + enum rt_rf_power_state StateToSet, + RT_RF_CHANGE_SOURCE ChangeSource, + bool ProtectOrNot) { struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device * ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; bool bActionAllowed = false; bool bConnectBySSID = false; enum rt_rf_power_state rtState; 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; - if (!ProtectOrNot) - { - while(true) - { - spin_lock_irqsave(&priv->rf_ps_lock,flag); - 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); - - while(priv->RFChangeInProgress) - { - RFWaitCounter ++; - RT_TRACE((COMP_PS | COMP_RF), "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"); - return false; + if (!ProtectOrNot) { + while (true) { + spin_lock_irqsave(&priv->rf_ps_lock, flag); + 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); + + while (priv->RFChangeInProgress) { + RFWaitCounter++; + RT_TRACE((COMP_PS | COMP_RF), + "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"); + return false; + } } + } else { + priv->RFChangeInProgress = true; + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); + break; } } - else - { - priv->RFChangeInProgress = true; - spin_unlock_irqrestore(&priv->rf_ps_lock,flag); - break; - } - } } rtState = priv->rtllib->eRFPowerState; - switch (StateToSet) - { + switch (StateToSet) { case eRfOn: - priv->rtllib->RfOffReason &= (~ChangeSource); - if ((ChangeSource == RF_CHANGE_BY_HW) && (priv->bHwRadioOff == true)){ + if ((ChangeSource == RF_CHANGE_BY_HW) && + (priv->bHwRadioOff == true)) priv->bHwRadioOff = false; - } - if (! priv->rtllib->RfOffReason) - { + if (!priv->rtllib->RfOffReason) { priv->rtllib->RfOffReason = 0; bActionAllowed = true; - if (rtState == eRfOff && ChangeSource >=RF_CHANGE_BY_HW ) - { + if (rtState == eRfOff && + 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", priv->rtllib->RfOffReason, ChangeSource); - } + } else { + RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State - " + "eRfon reject pMgntInfo->RfOffReason= 0x%x," + " ChangeSource=0x%X\n", + priv->rtllib->RfOffReason, ChangeSource); + } break; case eRfOff: - if ((priv->rtllib->iw_mode == IW_MODE_INFRA) || (priv->rtllib->iw_mode == IW_MODE_ADHOC)) - { - if ((priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) || (ChangeSource > RF_CHANGE_BY_IPS)) - { + if ((priv->rtllib->iw_mode == IW_MODE_INFRA) || + (priv->rtllib->iw_mode == IW_MODE_ADHOC)) { + if ((priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) || + (ChangeSource > RF_CHANGE_BY_IPS)) { if (ieee->state == RTLLIB_LINKED) priv->blinked_ingpio = true; else priv->blinked_ingpio = false; - rtllib_MgntDisconnect(priv->rtllib,disas_lv_ss); - - - + rtllib_MgntDisconnect(priv->rtllib, + disas_lv_ss); } } - if ((ChangeSource == RF_CHANGE_BY_HW) && (priv->bHwRadioOff == false)){ + if ((ChangeSource == RF_CHANGE_BY_HW) && + (priv->bHwRadioOff == false)) priv->bHwRadioOff = true; - } priv->rtllib->RfOffReason |= ChangeSource; bActionAllowed = true; break; @@ -460,29 +422,30 @@ MgntActSet_RF_State( break; } - if (bActionAllowed) - { - RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State(): Action is allowed.... StateToSet(%d), RfOffReason(%#X)\n", StateToSet, priv->rtllib->RfOffReason); + if (bActionAllowed) { + 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) - { + if (StateToSet == eRfOn) { - if (bConnectBySSID && (priv->blinked_ingpio == true)) - { - queue_delayed_work_rsl(ieee->wq, &ieee->associate_procedure_wq, 0); + if (bConnectBySSID && (priv->blinked_ingpio == true)) { + queue_delayed_work_rsl(ieee->wq, + &ieee->associate_procedure_wq, 0); priv->blinked_ingpio = false; - } } } 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) - { - spin_lock_irqsave(&priv->rf_ps_lock,flag); - priv->RFChangeInProgress = false; - spin_unlock_irqrestore(&priv->rf_ps_lock,flag); + if (!ProtectOrNot) { + spin_lock_irqsave(&priv->rf_ps_lock, flag); + priv->RFChangeInProgress = false; + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); } RT_TRACE((COMP_PS && COMP_RF), "<===MgntActSet_RF_State()\n"); @@ -492,36 +455,35 @@ MgntActSet_RF_State( short rtl8192_get_nic_desc_num(struct net_device *dev, int prio) { - struct r8192_priv *priv = rtllib_priv(dev); - struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; + struct r8192_priv *priv = rtllib_priv(dev); + struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; - /* For now, we reserved two free descriptor as a safety boundary - * 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)); - return skb_queue_len(&ring->queue); + /* For now, we reserved two free descriptor as a safety boundary + * 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)); + return skb_queue_len(&ring->queue); } short rtl8192_check_nic_enough_desc(struct net_device *dev, int prio) { - struct r8192_priv *priv = rtllib_priv(dev); - struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; + struct r8192_priv *priv = rtllib_priv(dev); + struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; - if (ring->entries - skb_queue_len(&ring->queue) >= 2) { - return 1; - } else { - return 0; - } + if (ring->entries - skb_queue_len(&ring->queue) >= 2) + return 1; + return 0; } void rtl8192_tx_timeout(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); + struct r8192_priv *priv = rtllib_priv(dev); - schedule_work(&priv->reset_wq); - printk("TXTIMEOUT"); + schedule_work(&priv->reset_wq); + printk(KERN_INFO "TXTIMEOUT"); } void rtl8192_irq_enable(struct net_device *dev) @@ -549,136 +511,137 @@ void rtl8192_irq_clear(struct net_device *dev) } -void rtl8192_set_chan(struct net_device *dev,short ch) +void rtl8192_set_chan(struct net_device *dev, short ch) { - struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); + struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __func__, ch); - if (priv->chan_forced) - return; + RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __func__, ch); + if (priv->chan_forced) + return; - priv->chan = ch; + priv->chan = ch; - if (priv->rf_set_chan) - priv->rf_set_chan(dev,priv->chan); + if (priv->rf_set_chan) + priv->rf_set_chan(dev, priv->chan); } -void rtl8192_update_cap(struct net_device* dev, u16 cap) +void rtl8192_update_cap(struct net_device *dev, u16 cap) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_network *net = &priv->rtllib->current_network; - - - { - bool ShortPreamble; - - if (cap & WLAN_CAPABILITY_SHORT_PREAMBLE) - { - if (priv->dot11CurrentPreambleMode != PREAMBLE_SHORT) - { - ShortPreamble = true; - priv->dot11CurrentPreambleMode = PREAMBLE_SHORT; - RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_SHORT_PREAMBLE\n", __func__); - priv->rtllib->SetHwRegHandler( dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble ); - } + bool ShortPreamble; + + if (cap & WLAN_CAPABILITY_SHORT_PREAMBLE) { + if (priv->dot11CurrentPreambleMode != PREAMBLE_SHORT) { + ShortPreamble = true; + priv->dot11CurrentPreambleMode = PREAMBLE_SHORT; + RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_SHORT_" + "PREAMBLE\n", __func__); + priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, + (unsigned char *)&ShortPreamble); } - else - { - if (priv->dot11CurrentPreambleMode != PREAMBLE_LONG) - { - ShortPreamble = false; - priv->dot11CurrentPreambleMode = PREAMBLE_LONG; - RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_LONG_PREAMBLE\n", __func__); - priv->rtllib->SetHwRegHandler( dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble ); - } + } else { + if (priv->dot11CurrentPreambleMode != PREAMBLE_LONG) { + ShortPreamble = false; + priv->dot11CurrentPreambleMode = PREAMBLE_LONG; + RT_TRACE(COMP_DBG, "%s(): WLAN_CAPABILITY_LONG_" + "PREAMBLE\n", __func__); + priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, + (unsigned char *)&ShortPreamble); } } - if (net->mode & (IEEE_G|IEEE_N_24G)) - { + if (net->mode & (IEEE_G|IEEE_N_24G)) { u8 slot_time_val; u8 CurSlotTime = priv->slot_time; - if ((cap & WLAN_CAPABILITY_SHORT_SLOT_TIME) && (!priv->rtllib->pHTInfo->bCurrentRT2RTLongSlotTime)) - { - if (CurSlotTime != SHORT_SLOT_TIME) - { + if ((cap & WLAN_CAPABILITY_SHORT_SLOT_TIME) && + (!priv->rtllib->pHTInfo->bCurrentRT2RTLongSlotTime)) { + if (CurSlotTime != SHORT_SLOT_TIME) { slot_time_val = SHORT_SLOT_TIME; - priv->rtllib->SetHwRegHandler( dev, HW_VAR_SLOT_TIME, &slot_time_val ); + priv->rtllib->SetHwRegHandler(dev, + HW_VAR_SLOT_TIME, &slot_time_val); } - } - else - { - if (CurSlotTime != NON_SHORT_SLOT_TIME) - { + } else { + if (CurSlotTime != NON_SHORT_SLOT_TIME) { slot_time_val = NON_SHORT_SLOT_TIME; - priv->rtllib->SetHwRegHandler( dev, HW_VAR_SLOT_TIME, &slot_time_val ); + priv->rtllib->SetHwRegHandler(dev, + HW_VAR_SLOT_TIME, &slot_time_val); } } } } static struct rtllib_qos_parameters def_qos_parameters = { - {3,3,3,3}, - {7,7,7,7}, - {2,2,2,2}, - {0,0,0,0}, - {0,0,0,0} + {3, 3, 3, 3}, + {7, 7, 7, 7}, + {2, 2, 2, 2}, + {0, 0, 0, 0}, + {0, 0, 0, 0} }; void rtl8192_update_beacon(void *data) { - struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, update_beacon_wq.work); + struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, + update_beacon_wq.work); struct net_device *dev = priv->rtllib->dev; - struct rtllib_device* ieee = priv->rtllib; - struct rtllib_network* net = &ieee->current_network; + struct rtllib_device *ieee = priv->rtllib; + struct rtllib_network *net = &ieee->current_network; if (ieee->pHTInfo->bCurrentHTSupport) HTUpdateSelfAndPeerSetting(ieee, net); - ieee->pHTInfo->bCurrentRT2RTLongSlotTime = net->bssht.bdRT2RTLongSlotTime; + ieee->pHTInfo->bCurrentRT2RTLongSlotTime = + net->bssht.bdRT2RTLongSlotTime; ieee->pHTInfo->RT2RT_HT_Mode = net->bssht.RT2RT_HT_Mode; rtl8192_update_cap(dev, net->capability); } #define MOVE_INTO_HANDLER -int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; +int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO}; void rtl8192_qos_activate(void *data) { - struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, qos_activate); + struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, + qos_activate); struct net_device *dev = priv->rtllib->dev; #ifndef MOVE_INTO_HANDLER - struct rtllib_qos_parameters *qos_parameters = &priv->rtllib->current_network.qos_data.parameters; - u8 mode = priv->rtllib->current_network.mode; + struct rtllib_qos_parameters *qos_parameters = + &priv->rtllib->current_network.qos_data.parameters; + u8 mode = priv->rtllib->current_network.mode; u8 u1bAIFS; u32 u4bAcParam; #endif - int i; + int i; - if (priv == NULL) - return; + if (priv == NULL) + return; - mutex_lock(&priv->mutex); - if (priv->rtllib->state != RTLLIB_LINKED) + 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++) { #ifndef MOVE_INTO_HANDLER - u1bAIFS = qos_parameters->aifs[i] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime; - u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[i]))<< AC_PARAM_TXOP_LIMIT_OFFSET)| - (((u32)(qos_parameters->cw_max[i]))<< AC_PARAM_ECW_MAX_OFFSET)| - (((u32)(qos_parameters->cw_min[i]))<< AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + u1bAIFS = qos_parameters->aifs[i] * + ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; + u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[i])) << + AC_PARAM_TXOP_LIMIT_OFFSET) | + (((u32)(qos_parameters->cw_max[i])) << + AC_PARAM_ECW_MAX_OFFSET) | + (((u32)(qos_parameters->cw_min[i])) << + AC_PARAM_ECW_MIN_OFFSET) | + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); RT_TRACE(COMP_DBG, "===>ACI:%d:u4bAcParam:%x\n", i, u4bAcParam); write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam); #else - priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8*)(&i)); + priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); #endif } success: - mutex_unlock(&priv->mutex); + mutex_unlock(&priv->mutex); } static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, @@ -688,8 +651,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, int ret = 0; u32 size = sizeof(struct rtllib_qos_parameters); - if (priv->rtllib->state !=RTLLIB_LINKED) - return ret; + if (priv->rtllib->state != RTLLIB_LINKED) + return ret; if ((priv->rtllib->iw_mode != IW_MODE_INFRA)) return ret; @@ -702,21 +665,22 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if ((network->qos_data.active == 1) && (active_network == 1) && (network->flags & NETWORK_HAS_QOS_PARAMETERS) && (network->qos_data.old_param_count != - network->qos_data.param_count)) { + network->qos_data.param_count)) { network->qos_data.old_param_count = network->qos_data.param_count; - priv->rtllib->wmm_acm = network->qos_data.wmm_acm; + 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 " + RT_TRACE(COMP_QOS, "QoS parameters change call " "qos_activate\n"); } } else { - memcpy(&priv->rtllib->current_network.qos_data.parameters,\ + memcpy(&priv->rtllib->current_network.qos_data.parameters, &def_qos_parameters, size); 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; @@ -725,13 +689,13 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, return 0; } -static int rtl8192_handle_beacon(struct net_device * dev, - struct rtllib_beacon * beacon, - struct rtllib_network * network) +static int rtl8192_handle_beacon(struct net_device *dev, + struct rtllib_beacon *beacon, + struct rtllib_network *network) { struct r8192_priv *priv = rtllib_priv(dev); - rtl8192_qos_handle_probe_response(priv,1,network); + rtl8192_qos_handle_probe_response(priv, 1, network); queue_delayed_work_rsl(priv->priv_wq, &priv->update_beacon_wq, 0); return 0; @@ -739,60 +703,60 @@ static int rtl8192_handle_beacon(struct net_device * dev, } static int rtl8192_qos_association_resp(struct r8192_priv *priv, - struct rtllib_network *network) + struct rtllib_network *network) { - int ret = 0; - unsigned long flags; - u32 size = sizeof(struct rtllib_qos_parameters); - int set_qos_param = 0; + int ret = 0; + unsigned long flags; + u32 size = sizeof(struct rtllib_qos_parameters); + int set_qos_param = 0; - if ((priv == NULL) || (network == NULL)) - return ret; + if ((priv == NULL) || (network == NULL)) + return ret; - if (priv->rtllib->state !=RTLLIB_LINKED) - return ret; + if (priv->rtllib->state != RTLLIB_LINKED) + return ret; if ((priv->rtllib->iw_mode != IW_MODE_INFRA)) - return ret; + return ret; - spin_lock_irqsave(&priv->rtllib->lock, flags); + spin_lock_irqsave(&priv->rtllib->lock, flags); if (network->flags & NETWORK_HAS_QOS_PARAMETERS) { - memcpy(&priv->rtllib->current_network.qos_data.parameters,\ - &network->qos_data.parameters,\ - sizeof(struct rtllib_qos_parameters)); + memcpy(&priv->rtllib->current_network.qos_data.parameters, + &network->qos_data.parameters, + sizeof(struct rtllib_qos_parameters)); priv->rtllib->current_network.qos_data.active = 1; - priv->rtllib->wmm_acm = network->qos_data.wmm_acm; + priv->rtllib->wmm_acm = network->qos_data.wmm_acm; set_qos_param = 1; priv->rtllib->current_network.qos_data.old_param_count = - priv->rtllib->current_network.qos_data.param_count; + priv->rtllib->current_network.qos_data.param_count; priv->rtllib->current_network.qos_data.param_count = - network->qos_data.param_count; - } else { + network->qos_data.param_count; + } else { memcpy(&priv->rtllib->current_network.qos_data.parameters, - &def_qos_parameters, size); + &def_qos_parameters, size); priv->rtllib->current_network.qos_data.active = 0; priv->rtllib->current_network.qos_data.supported = 0; - set_qos_param = 1; - } + set_qos_param = 1; + } - spin_unlock_irqrestore(&priv->rtllib->lock, flags); + spin_unlock_irqrestore(&priv->rtllib->lock, flags); RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n", __func__, - network->flags ,priv->rtllib->current_network.qos_data.active); + network->flags, priv->rtllib->current_network.qos_data.active); if (set_qos_param == 1) { dm_init_edca_turbo(priv->rtllib->dev); queue_work_rsl(priv->priv_wq, &priv->qos_activate); } - return ret; + return ret; } static int rtl8192_handle_assoc_response(struct net_device *dev, - struct rtllib_assoc_response_frame *resp, - struct rtllib_network *network) + struct rtllib_assoc_response_frame *resp, + struct rtllib_network *network) { - struct r8192_priv *priv = rtllib_priv(dev); - rtl8192_qos_association_resp(priv, network); - return 0; + struct r8192_priv *priv = rtllib_priv(dev); + rtl8192_qos_association_resp(priv, network); + return 0; } void rtl8192_prepare_beacon(struct r8192_priv *priv) @@ -832,104 +796,107 @@ void rtl8192_stop_beacon(struct net_device *dev) { } -void rtl8192_config_rate(struct net_device* dev, u16* rate_config) -{ - struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_network *net; - u8 i=0, basic_rate = 0; - net = & priv->rtllib->current_network; - - for (i = 0; i < net->rates_len; i++) { - basic_rate = net->rates[i] & 0x7f; - switch (basic_rate) { - case MGN_1M: - *rate_config |= RRSR_1M; - break; - case MGN_2M: - *rate_config |= RRSR_2M; - break; - case MGN_5_5M: - *rate_config |= RRSR_5_5M; - break; - case MGN_11M: - *rate_config |= RRSR_11M; - break; - case MGN_6M: - *rate_config |= RRSR_6M; - break; - case MGN_9M: - *rate_config |= RRSR_9M; - break; - case MGN_12M: - *rate_config |= RRSR_12M; - break; - case MGN_18M: - *rate_config |= RRSR_18M; - break; - case MGN_24M: - *rate_config |= RRSR_24M; - break; - case MGN_36M: - *rate_config |= RRSR_36M; - break; - case MGN_48M: - *rate_config |= RRSR_48M; - break; - case MGN_54M: - *rate_config |= RRSR_54M; - break; - } - } - - for (i = 0; i < net->rates_ex_len; i++) { - basic_rate = net->rates_ex[i] & 0x7f; - switch (basic_rate) { - case MGN_1M: - *rate_config |= RRSR_1M; - break; - case MGN_2M: - *rate_config |= RRSR_2M; - break; - case MGN_5_5M: - *rate_config |= RRSR_5_5M; - break; - case MGN_11M: - *rate_config |= RRSR_11M; - break; - case MGN_6M: - *rate_config |= RRSR_6M; - break; - case MGN_9M: - *rate_config |= RRSR_9M; - break; - case MGN_12M: - *rate_config |= RRSR_12M; - break; - case MGN_18M: - *rate_config |= RRSR_18M; - break; - case MGN_24M: - *rate_config |= RRSR_24M; - break; - case MGN_36M: - *rate_config |= RRSR_36M; - break; - case MGN_48M: - *rate_config |= RRSR_48M; - break; - case MGN_54M: - *rate_config |= RRSR_54M; - break; - } - } -} - -void rtl8192_refresh_supportrate(struct r8192_priv * priv) -{ - struct rtllib_device* ieee = priv->rtllib; - if (ieee->mode == WIRELESS_MODE_N_24G || ieee->mode == WIRELESS_MODE_N_5G) { - memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16); - memcpy(ieee->Regdot11TxHTOperationalRateSet, ieee->RegHTSuppRateSet, 16); +void rtl8192_config_rate(struct net_device *dev, u16 *rate_config) +{ + struct r8192_priv *priv = rtllib_priv(dev); + struct rtllib_network *net; + u8 i = 0, basic_rate = 0; + net = &priv->rtllib->current_network; + + for (i = 0; i < net->rates_len; i++) { + basic_rate = net->rates[i] & 0x7f; + switch (basic_rate) { + case MGN_1M: + *rate_config |= RRSR_1M; + break; + case MGN_2M: + *rate_config |= RRSR_2M; + break; + case MGN_5_5M: + *rate_config |= RRSR_5_5M; + break; + case MGN_11M: + *rate_config |= RRSR_11M; + break; + case MGN_6M: + *rate_config |= RRSR_6M; + break; + case MGN_9M: + *rate_config |= RRSR_9M; + break; + case MGN_12M: + *rate_config |= RRSR_12M; + break; + case MGN_18M: + *rate_config |= RRSR_18M; + break; + case MGN_24M: + *rate_config |= RRSR_24M; + break; + case MGN_36M: + *rate_config |= RRSR_36M; + break; + case MGN_48M: + *rate_config |= RRSR_48M; + break; + case MGN_54M: + *rate_config |= RRSR_54M; + break; + } + } + + for (i = 0; i < net->rates_ex_len; i++) { + basic_rate = net->rates_ex[i] & 0x7f; + switch (basic_rate) { + case MGN_1M: + *rate_config |= RRSR_1M; + break; + case MGN_2M: + *rate_config |= RRSR_2M; + break; + case MGN_5_5M: + *rate_config |= RRSR_5_5M; + break; + case MGN_11M: + *rate_config |= RRSR_11M; + break; + case MGN_6M: + *rate_config |= RRSR_6M; + break; + case MGN_9M: + *rate_config |= RRSR_9M; + break; + case MGN_12M: + *rate_config |= RRSR_12M; + break; + case MGN_18M: + *rate_config |= RRSR_18M; + break; + case MGN_24M: + *rate_config |= RRSR_24M; + break; + case MGN_36M: + *rate_config |= RRSR_36M; + break; + case MGN_48M: + *rate_config |= RRSR_48M; + break; + case MGN_54M: + *rate_config |= RRSR_54M; + break; + } + } +} + +void rtl8192_refresh_supportrate(struct r8192_priv *priv) +{ + struct rtllib_device *ieee = priv->rtllib; + if (ieee->mode == WIRELESS_MODE_N_24G || + ieee->mode == WIRELESS_MODE_N_5G) { + memcpy(ieee->Regdot11HTOperationalRateSet, + ieee->RegHTSuppRateSet, 16); + memcpy(ieee->Regdot11TxHTOperationalRateSet, + ieee->RegHTSuppRateSet, 16); } else { memset(ieee->Regdot11HTOperationalRateSet, 0, 16); @@ -937,7 +904,7 @@ void rtl8192_refresh_supportrate(struct r8192_priv * priv) return; } -u8 rtl8192_getSupportedWireleeMode(struct net_device*dev) +u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u8 ret = 0; @@ -959,12 +926,13 @@ u8 rtl8192_getSupportedWireleeMode(struct net_device*dev) return ret; } -void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode) +void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) { struct r8192_priv *priv = rtllib_priv(dev); u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev); - if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode & bSupportMode) == 0)) { + if ((wireless_mode == WIRELESS_MODE_AUTO) || + ((wireless_mode & bSupportMode) == 0)) { if (bSupportMode & WIRELESS_MODE_N_24G) { wireless_mode = WIRELESS_MODE_N_24G; } else if (bSupportMode & WIRELESS_MODE_N_5G) { @@ -976,49 +944,55 @@ 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; } } - if ((wireless_mode & (WIRELESS_MODE_B | WIRELESS_MODE_G)) == (WIRELESS_MODE_G | WIRELESS_MODE_B)) + if ((wireless_mode & (WIRELESS_MODE_B | WIRELESS_MODE_G)) == + (WIRELESS_MODE_G | WIRELESS_MODE_B)) wireless_mode = WIRELESS_MODE_G; priv->rtllib->mode = wireless_mode; - ActUpdateChannelAccessSetting( dev, wireless_mode, &priv->ChannelAccessSetting); + ActUpdateChannelAccessSetting(dev, wireless_mode, + &priv->ChannelAccessSetting); - if ((wireless_mode == WIRELESS_MODE_N_24G) || (wireless_mode == WIRELESS_MODE_N_5G)){ + if ((wireless_mode == WIRELESS_MODE_N_24G) || + (wireless_mode == WIRELESS_MODE_N_5G)) { priv->rtllib->pHTInfo->bEnableHT = 1; - RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 1\n", __func__,wireless_mode); - }else{ + RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 1\n", + __func__, wireless_mode); + } else { priv->rtllib->pHTInfo->bEnableHT = 0; - RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 0\n", __func__,wireless_mode); - } + RT_TRACE(COMP_DBG, "%s(), wireless_mode:%x, bEnableHT = 0\n", + __func__, wireless_mode); + } RT_TRACE(COMP_INIT, "Current Wireless Mode is %x\n", wireless_mode); rtl8192_refresh_supportrate(priv); } -int _rtl8192_sta_up(struct net_device *dev,bool is_silent_reset) +int _rtl8192_sta_up(struct net_device *dev, bool is_silent_reset) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + (&(priv->rtllib->PowerSaveControl)); bool init_status = true; priv->bDriverIsGoingToUnload = false; priv->bdisable_nic = false; - priv->up=1; - priv->rtllib->ieee_up=1; + priv->up = 1; + priv->rtllib->ieee_up = 1; priv->up_first_time = 0; RT_TRACE(COMP_INIT, "Bringing up iface"); priv->bfirst_init = true; init_status = priv->ops->initialize_adapter(dev); - if (init_status != true) - { - RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n",__func__); + if (init_status != true) { + RT_TRACE(COMP_ERR, "ERR!!! %s(): initialization is failed!\n", + __func__); priv->bfirst_init = false; return -1; } @@ -1027,16 +1001,14 @@ int _rtl8192_sta_up(struct net_device *dev,bool is_silent_reset) RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC); priv->bfirst_init = false; - if (priv->polling_timer_on == 0){ + if (priv->polling_timer_on == 0) check_rfctrl_gpio_timer((unsigned long)dev); - } if (priv->rtllib->state != RTLLIB_LINKED) - rtllib_softmac_start_protocol(priv->rtllib, 0); + rtllib_softmac_start_protocol(priv->rtllib, 0); rtllib_reset_queue(priv->rtllib); watch_dog_timer_callback((unsigned long) dev); - if (!netif_queue_stopped(dev)) netif_start_queue(dev); else @@ -1051,7 +1023,8 @@ int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) unsigned long flags = 0; u8 RFInProgressTimeOut = 0; - if (priv->up == 0) return -1; + if (priv->up == 0) + return -1; if (priv->rtllib->rtllib_ips_leave != NULL) priv->rtllib->rtllib_ips_leave(dev); @@ -1060,7 +1033,7 @@ int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) LeisurePSLeave(dev); priv->bDriverIsGoingToUnload = true; - priv->up=0; + priv->up = 0; priv->rtllib->ieee_up = 0; priv->bfirst_after_down = 1; RT_TRACE(COMP_DOWN, "==========>%s()\n", __func__); @@ -1068,11 +1041,10 @@ int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) netif_stop_queue(dev); priv->rtllib->wpa_ie_len = 0; - if (priv->rtllib->wpa_ie) - kfree(priv->rtllib->wpa_ie); + kfree(priv->rtllib->wpa_ie); priv->rtllib->wpa_ie = NULL; CamResetAllEntry(dev); - memset(priv->rtllib->swcamtable,0,sizeof(struct sw_cam_table)*32); + memset(priv->rtllib->swcamtable, 0, sizeof(struct sw_cam_table) * 32); rtl8192_irq_disable(dev); del_timer_sync(&priv->watch_dog_timer); @@ -1080,40 +1052,40 @@ int rtl8192_sta_down(struct net_device *dev, bool shutdownrf) cancel_delayed_work(&priv->rtllib->hw_wakeup_wq); rtllib_softmac_stop_protocol(priv->rtllib, 0, true); - spin_lock_irqsave(&priv->rf_ps_lock,flags); - while(priv->RFChangeInProgress) - { - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); - if (RFInProgressTimeOut > 100) - { - spin_lock_irqsave(&priv->rf_ps_lock,flags); + spin_lock_irqsave(&priv->rf_ps_lock, flags); + while (priv->RFChangeInProgress) { + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); + if (RFInProgressTimeOut > 100) { + spin_lock_irqsave(&priv->rf_ps_lock, flags); break; } - RT_TRACE(COMP_DBG, "===>%s():RF is in progress, need to wait until rf chang is done.\n",__func__); + RT_TRACE(COMP_DBG, "===>%s():RF is in progress, need to wait " + "until rf chang is done.\n", __func__); mdelay(1); - RFInProgressTimeOut ++; - spin_lock_irqsave(&priv->rf_ps_lock,flags); + RFInProgressTimeOut++; + spin_lock_irqsave(&priv->rf_ps_lock, flags); } priv->RFChangeInProgress = true; - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); priv->ops->stop_adapter(dev, false); - spin_lock_irqsave(&priv->rf_ps_lock,flags); + spin_lock_irqsave(&priv->rf_ps_lock, flags); priv->RFChangeInProgress = false; - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); udelay(100); - memset(&priv->rtllib->current_network, 0 , offsetof(struct rtllib_network, list)); + memset(&priv->rtllib->current_network, 0, + offsetof(struct rtllib_network, list)); RT_TRACE(COMP_DOWN, "<==========%s()\n", __func__); return 0; } -static void rtl8192_init_priv_handler(struct net_device* dev) +static void rtl8192_init_priv_handler(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); priv->rtllib->softmac_hard_start_xmit = rtl8192_hard_start_xmit; - priv->rtllib->set_chan = rtl8192_set_chan; - priv->rtllib->link_change = priv->ops->link_change; + priv->rtllib->set_chan = rtl8192_set_chan; + priv->rtllib->link_change = priv->ops->link_change; priv->rtllib->softmac_data_hard_start_xmit = rtl8192_hard_data_xmit; priv->rtllib->data_hard_stop = rtl8192_data_hard_stop; priv->rtllib->data_hard_resume = rtl8192_data_hard_resume; @@ -1134,7 +1106,8 @@ static void rtl8192_init_priv_handler(struct net_device* dev) priv->rtllib->ps_is_queue_empty = rtl8192_is_tx_queue_empty; priv->rtllib->GetNmodeSupportBySecCfg = rtl8192_GetNmodeSupportBySecCfg; - priv->rtllib->GetHalfNmodeSupportByAPsHandler = rtl8192_GetHalfNmodeSupportByAPs; + priv->rtllib->GetHalfNmodeSupportByAPsHandler = + rtl8192_GetHalfNmodeSupportByAPs; priv->rtllib->SetHwRegHandler = rtl8192e_SetHwReg; priv->rtllib->AllowAllDestAddrHandler = rtl8192_AllowAllDestAddr; @@ -1151,10 +1124,11 @@ static void rtl8192_init_priv_handler(struct net_device* dev) priv->rtllib->rtllib_rfkill_poll = NULL; } -static void rtl8192_init_priv_constant(struct net_device* dev) +static void rtl8192_init_priv_constant(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + &(priv->rtllib->PowerSaveControl); pPSC->RegMaxLPSAwakeIntvl = 5; @@ -1170,7 +1144,7 @@ static void rtl8192_init_priv_constant(struct net_device* dev) } -static void rtl8192_init_priv_variable(struct net_device* dev) +static void rtl8192_init_priv_variable(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u8 i; @@ -1194,7 +1168,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->txringcount = 64; priv->rxbuffersize = 9100; priv->rxringcount = MAX_RX_COUNT; - priv->irq_enabled=0; + priv->irq_enabled = 0; priv->chan = 1; priv->RegWirelessMode = WIRELESS_MODE_AUTO; priv->RegChannelPlan = 0xf; @@ -1206,14 +1180,15 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->rtllib->iw_mode = IW_MODE_INFRA; priv->rtllib->bNetPromiscuousMode = false; priv->rtllib->IntelPromiscuousModeInfo.bPromiscuousOn = false; - priv->rtllib->IntelPromiscuousModeInfo.bFilterSourceStationFrame = false; - priv->rtllib->ieee_up=0; + priv->rtllib->IntelPromiscuousModeInfo.bFilterSourceStationFrame = + false; + priv->rtllib->ieee_up = 0; priv->retry_rts = DEFAULT_RETRY_RTS; priv->retry_data = DEFAULT_RETRY_DATA; priv->rtllib->rts = DEFAULT_RTS_THRESHOLD; priv->rtllib->rate = 110; priv->rtllib->short_slot = 1; - priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; + priv->promisc = (dev->flags & IFF_PROMISC) ? 1 : 0; priv->bcck_in_ch14 = false; priv->bfsync_processing = false; priv->CCKPresentAttentuation = 0; @@ -1225,11 +1200,11 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->bForcedSilentReset = 0; priv->bDisableNormalResetCheck = false; priv->force_reset = false; - memset(priv->rtllib->swcamtable,0,sizeof(struct sw_cam_table)*32); + memset(priv->rtllib->swcamtable, 0, sizeof(struct sw_cam_table) * 32); - memset(&priv->InterruptLog,0,sizeof(struct log_int_8190)); + memset(&priv->InterruptLog, 0, sizeof(struct log_int_8190)); priv->RxCounter = 0; - priv->rtllib->wx_set_enc = 0; + priv->rtllib->wx_set_enc = 0; priv->bHwRadioOff = false; priv->RegRfOff = 0; priv->isRFOff = false; @@ -1247,7 +1222,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->rtllib->eRFPowerState = eRfOn; priv->txpower_checkcnt = 0; - priv->thermal_readback_index =0; + priv->thermal_readback_index = 0; priv->txpower_tracking_callback_cnt = 0; priv->ccktxpower_adjustcnt_ch14 = 0; priv->ccktxpower_adjustcnt_not_ch14 = 0; @@ -1256,7 +1231,8 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->rtllib->iw_mode = IW_MODE_INFRA; priv->rtllib->active_scan = 1; priv->rtllib->be_scan_inprogress = false; - priv->rtllib->modulation = RTLLIB_CCK_MODULATION | RTLLIB_OFDM_MODULATION; + priv->rtllib->modulation = RTLLIB_CCK_MODULATION | + RTLLIB_OFDM_MODULATION; priv->rtllib->host_encrypt = 1; priv->rtllib->host_decrypt = 1; @@ -1268,23 +1244,20 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->card_type = PCI; priv->AcmControl = 0; - priv->pFirmware = (struct rt_firmware *)vmalloc(sizeof(struct rt_firmware)); + priv->pFirmware = vmalloc(sizeof(struct rt_firmware)); if (priv->pFirmware) - memset(priv->pFirmware, 0, sizeof(struct rt_firmware)); + memset(priv->pFirmware, 0, sizeof(struct rt_firmware)); - skb_queue_head_init(&priv->rx_queue); + skb_queue_head_init(&priv->rx_queue); skb_queue_head_init(&priv->skb_queue); - for (i = 0; i < MAX_QUEUE_SIZE; i++) { - skb_queue_head_init(&priv->rtllib->skb_waitQ [i]); - } - for (i = 0; i < MAX_QUEUE_SIZE; i++) { - skb_queue_head_init(&priv->rtllib->skb_aggQ [i]); - } - + for (i = 0; i < MAX_QUEUE_SIZE; i++) + skb_queue_head_init(&priv->rtllib->skb_waitQ[i]); + for (i = 0; i < MAX_QUEUE_SIZE; i++) + skb_queue_head_init(&priv->rtllib->skb_aggQ[i]); } -static void rtl8192_init_priv_lock(struct r8192_priv * priv) +static void rtl8192_init_priv_lock(struct r8192_priv *priv) { spin_lock_init(&priv->fw_scan_lock); spin_lock_init(&priv->tx_lock); @@ -1294,57 +1267,64 @@ static void rtl8192_init_priv_lock(struct r8192_priv * priv) spin_lock_init(&priv->ps_lock); spin_lock_init(&priv->rf_lock); spin_lock_init(&priv->rt_h2c_lock); - sema_init(&priv->wx_sem,1); - sema_init(&priv->rf_sem,1); + sema_init(&priv->wx_sem, 1); + sema_init(&priv->rf_sem, 1); mutex_init(&priv->mutex); } -static void rtl8192_init_priv_task(struct net_device* dev) +static void rtl8192_init_priv_task(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); priv->priv_wq = create_workqueue(DRV_NAME); - INIT_WORK_RSL(&priv->reset_wq, (void*)rtl8192_restart, dev); - INIT_WORK_RSL(&priv->rtllib->ips_leave_wq, (void*)IPSLeave_wq, dev); - INIT_DELAYED_WORK_RSL(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev); - INIT_DELAYED_WORK_RSL(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev); - INIT_DELAYED_WORK_RSL(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev); - INIT_DELAYED_WORK_RSL(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev); - INIT_WORK_RSL(&priv->qos_activate, (void*)rtl8192_qos_activate, dev); - INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev); - INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev); + INIT_WORK_RSL(&priv->reset_wq, (void *)rtl8192_restart, dev); + INIT_WORK_RSL(&priv->rtllib->ips_leave_wq, (void *)IPSLeave_wq, dev); + INIT_DELAYED_WORK_RSL(&priv->watch_dog_wq, + (void *)rtl819x_watchdog_wqcallback, dev); + INIT_DELAYED_WORK_RSL(&priv->txpower_tracking_wq, + (void *)dm_txpower_trackingcallback, dev); + INIT_DELAYED_WORK_RSL(&priv->rfpath_check_wq, + (void *)dm_rf_pathcheck_workitemcallback, dev); + INIT_DELAYED_WORK_RSL(&priv->update_beacon_wq, + (void *)rtl8192_update_beacon, dev); + INIT_WORK_RSL(&priv->qos_activate, (void *)rtl8192_qos_activate, dev); + INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq, + (void *) rtl8192_hw_wakeup_wq, dev); + INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq, + (void *) rtl8192_hw_sleep_wq, dev); tasklet_init(&priv->irq_rx_tasklet, - (void(*)(unsigned long))rtl8192_irq_rx_tasklet, - (unsigned long)priv); + (void(*)(unsigned long))rtl8192_irq_rx_tasklet, + (unsigned long)priv); tasklet_init(&priv->irq_tx_tasklet, - (void(*)(unsigned long))rtl8192_irq_tx_tasklet, - (unsigned long)priv); - tasklet_init(&priv->irq_prepare_beacon_tasklet, - (void(*)(unsigned long))rtl8192_prepare_beacon, - (unsigned long)priv); + (void(*)(unsigned long))rtl8192_irq_tx_tasklet, + (unsigned long)priv); + tasklet_init(&priv->irq_prepare_beacon_tasklet, + (void(*)(unsigned long))rtl8192_prepare_beacon, + (unsigned long)priv); } -short rtl8192_get_channel_map(struct net_device * dev) +short rtl8192_get_channel_map(struct net_device *dev) { int i; struct r8192_priv *priv = rtllib_priv(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("rtl819x_init:Error channel plan! Set to default.\n"); - priv->ChannelPlan= COUNTRY_CODE_FCC; + printk(KERN_INFO "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); + RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); Dot11d_Init(priv->rtllib); Dot11d_Channelmap(priv->ChannelPlan, priv->rtllib); - for (i = 1; i <= 11; i++) { + for (i = 1; i <= 11; i++) (priv->rtllib->active_channel_map)[i] = 1; - } (priv->rtllib->active_channel_map)[12] = 2; (priv->rtllib->active_channel_map)[13] = 2; @@ -1355,10 +1335,9 @@ short rtl8192_init(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - memset(&(priv->stats),0,sizeof(struct rt_stats)); + memset(&(priv->stats), 0, sizeof(struct rt_stats)); rtl8192_dbgp_flag_init(dev); - rtl8192_init_priv_handler(dev); rtl8192_init_priv_constant(dev); rtl8192_init_priv_variable(dev); @@ -1381,17 +1360,17 @@ short rtl8192_init(struct net_device *dev) (unsigned long)dev); rtl8192_irq_disable(dev); - if (request_irq(dev->irq, (void*)rtl8192_interrupt_rsl, IRQF_SHARED, dev->name, dev)) - { - printk("Error allocating IRQ %d",dev->irq); + if (request_irq(dev->irq, (void *)rtl8192_interrupt_rsl, IRQF_SHARED, + dev->name, dev)) { + printk(KERN_ERR "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("Endopoints initialization failed"); + printk(KERN_ERR "Endopoints initialization failed"); return -1; } @@ -1399,51 +1378,48 @@ short rtl8192_init(struct net_device *dev) } /*************************************************************************** - -------------------------------WATCHDOG STUFF--------------------------- + -------------------------------WATCHDOG STUFF--------------------------- ***************************************************************************/ short rtl8192_is_tx_queue_empty(struct net_device *dev) { - int i=0; + int i = 0; struct r8192_priv *priv = rtllib_priv(dev); - for (i=0; i<=MGNT_QUEUE; i++) - { - if ((i== TXCMD_QUEUE) || (i == HCCA_QUEUE) ) + for (i = 0; i <= MGNT_QUEUE; i++) { + if ((i == TXCMD_QUEUE) || (i == HCCA_QUEUE)) continue; - if (skb_queue_len(&(&priv->tx_ring[i])->queue) > 0){ - printk("===>tx queue is not empty:%d, %d\n", i, skb_queue_len(&(&priv->tx_ring[i])->queue)); + if (skb_queue_len(&(&priv->tx_ring[i])->queue) > 0) { + printk(KERN_INFO "===>tx queue is not empty:%d, %d\n", + i, skb_queue_len(&(&priv->tx_ring[i])->queue)); return 0; } } return 1; } -enum reset_type -rtl819x_TxCheckStuck(struct net_device *dev) +enum reset_type rtl819x_TxCheckStuck(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - u8 QueueID; - u8 ResetThreshold = NIC_SEND_HANG_THRESHOLD_POWERSAVE; - bool bCheckFwTxCnt = false; + u8 QueueID; + u8 ResetThreshold = NIC_SEND_HANG_THRESHOLD_POWERSAVE; + bool bCheckFwTxCnt = false; struct rtl8192_tx_ring *ring = NULL; - struct sk_buff* skb = NULL; - struct cb_desc * tcb_desc = NULL; + struct sk_buff *skb = NULL; + struct cb_desc *tcb_desc = NULL; unsigned long flags = 0; - switch (priv->rtllib->ps) - { - case RTLLIB_PS_DISABLED: - ResetThreshold = NIC_SEND_HANG_THRESHOLD_NORMAL; - break; - case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST): - ResetThreshold = NIC_SEND_HANG_THRESHOLD_POWERSAVE; - break; - default: - ResetThreshold = NIC_SEND_HANG_THRESHOLD_POWERSAVE; - break; + switch (priv->rtllib->ps) { + case RTLLIB_PS_DISABLED: + ResetThreshold = NIC_SEND_HANG_THRESHOLD_NORMAL; + break; + case (RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST): + ResetThreshold = NIC_SEND_HANG_THRESHOLD_POWERSAVE; + break; + default: + ResetThreshold = NIC_SEND_HANG_THRESHOLD_POWERSAVE; + break; } - spin_lock_irqsave(&priv->irq_th_lock,flags); - for (QueueID = 0; QueueID < MAX_TX_QUEUE; QueueID++) - { + spin_lock_irqsave(&priv->irq_th_lock, flags); + for (QueueID = 0; QueueID < MAX_TX_QUEUE; QueueID++) { if (QueueID == TXCMD_QUEUE) continue; @@ -1452,24 +1428,26 @@ rtl819x_TxCheckStuck(struct net_device *dev) ring = &priv->tx_ring[QueueID]; - if (skb_queue_len(&ring->queue) == 0) + if (skb_queue_len(&ring->queue) == 0) { continue; - else - { + } else { skb = (&ring->queue)->next; - tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(skb->cb + + MAX_DEV_ADDR_SIZE); tcb_desc->nStuckCount++; bCheckFwTxCnt = true; if (tcb_desc->nStuckCount > 1) - printk("%s: QueueID=%d tcb_desc->nStuckCount=%d\n",__func__,QueueID,tcb_desc->nStuckCount); + printk(KERN_INFO "%s: QueueID=%d tcb_desc->n" + "StuckCount=%d\n", __func__, QueueID, + tcb_desc->nStuckCount); } } - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + 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"); + if (priv->ops->TxCheckStuckHandler(dev)) { + RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no" + " Tx condition!\n"); return RESET_TYPE_SILENT; } } @@ -1481,8 +1459,7 @@ enum reset_type rtl819x_RxCheckStuck(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - if (priv->ops->RxCheckStuckHandler(dev)) - { + if (priv->ops->RxCheckStuckHandler(dev)) { RT_TRACE(COMP_RESET, "RxStuck Condition\n"); return RESET_TYPE_SILENT; } @@ -1503,18 +1480,20 @@ rtl819x_ifcheck_resetornot(struct net_device *dev) if (rfState == eRfOn) TxResetType = rtl819x_TxCheckStuck(dev); - if ( rfState == eRfOn && + if (rfState == eRfOn && (priv->rtllib->iw_mode == IW_MODE_INFRA) && - (priv->rtllib->state == RTLLIB_LINKED)) { - + (priv->rtllib->state == RTLLIB_LINKED)) RxResetType = rtl819x_RxCheckStuck(dev); - } - if (TxResetType==RESET_TYPE_NORMAL || RxResetType==RESET_TYPE_NORMAL){ - printk("%s(): TxResetType is %d, RxResetType is %d\n",__func__,TxResetType,RxResetType); + if (TxResetType == RESET_TYPE_NORMAL || + RxResetType == RESET_TYPE_NORMAL) { + printk(KERN_INFO "%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("%s(): TxResetType is %d, RxResetType is %d\n",__func__,TxResetType,RxResetType); + } else if (TxResetType == RESET_TYPE_SILENT || + RxResetType == RESET_TYPE_SILENT) { + printk(KERN_INFO "%s(): TxResetType is %d, RxResetType is %d\n", + __func__, TxResetType, RxResetType); return RESET_TYPE_SILENT; } else { return RESET_TYPE_NORESET; @@ -1537,21 +1516,20 @@ void rtl819x_ifsilentreset(struct net_device *dev) u8 IsPortal = 0; - if (priv->ResetProgress==RESET_TYPE_NORESET) { + if (priv->ResetProgress == RESET_TYPE_NORESET) { - RT_TRACE(COMP_RESET,"=========>Reset progress!! \n"); + RT_TRACE(COMP_RESET, "=========>Reset progress!!\n"); priv->ResetProgress = RESET_TYPE_SILENT; - spin_lock_irqsave(&priv->rf_ps_lock,flag); - if (priv->RFChangeInProgress) - { - spin_unlock_irqrestore(&priv->rf_ps_lock,flag); + spin_lock_irqsave(&priv->rf_ps_lock, flag); + if (priv->RFChangeInProgress) { + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); goto END; } priv->RFChangeInProgress = true; priv->bResetInProgress = true; - spin_unlock_irqrestore(&priv->rf_ps_lock,flag); + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); RESET_START: @@ -1561,15 +1539,18 @@ RESET_START: LeisurePSLeave(dev); if (IS_NIC_DOWN(priv)) { - RT_TRACE(COMP_ERR,"%s():the driver is not up! return\n",__func__); + RT_TRACE(COMP_ERR, "%s():the driver is not up! " + "return\n", __func__); up(&priv->wx_sem); return ; } priv->up = 0; - RT_TRACE(COMP_RESET,"%s():======>start to down the driver\n",__func__); + 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); @@ -1582,7 +1563,7 @@ RESET_START: if (ieee->state == RTLLIB_LINKED) { SEM_DOWN_IEEE_WX(&ieee->wx_sem); - printk("ieee->state is RTLLIB_LINKED\n"); + printk(KERN_INFO "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); @@ -1590,43 +1571,51 @@ RESET_START: netif_carrier_off(dev); SEM_UP_IEEE_WX(&ieee->wx_sem); } else { - printk("ieee->state is NOT LINKED\n"); - rtllib_softmac_stop_protocol(priv->rtllib, 0 ,true); + printk(KERN_INFO "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 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__); } } ieee->is_silent_reset = 1; - spin_lock_irqsave(&priv->rf_ps_lock,flag); + spin_lock_irqsave(&priv->rf_ps_lock, flag); priv->RFChangeInProgress = false; - spin_unlock_irqrestore(&priv->rf_ps_lock,flag); + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); EnableHWSecurityConfig8192(dev); - if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == IW_MODE_INFRA) { - ieee->set_chan(ieee->dev, ieee->current_network.channel); + if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == + IW_MODE_INFRA) { + ieee->set_chan(ieee->dev, + ieee->current_network.channel); queue_work_rsl(ieee->wq, &ieee->associate_complete_wq); - } else if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == IW_MODE_ADHOC) { - ieee->set_chan(ieee->dev, ieee->current_network.channel); + } else if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == + IW_MODE_ADHOC) { + ieee->set_chan(ieee->dev, + ieee->current_network.channel); ieee->link_change(ieee->dev); notify_wx_assoc_event(ieee); @@ -1646,27 +1635,30 @@ END: priv->ResetProgress = RESET_TYPE_NORESET; priv->reset_count++; - priv->bForcedSilentReset =false; + priv->bForcedSilentReset = false; priv->bResetInProgress = false; write_nic_byte(dev, UFWP, 1); - RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count); + RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", + priv->reset_count); } } -void rtl819x_update_rxcounts(struct r8192_priv *priv, - u32 *TotalRxBcnNum, +void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, u32 *TotalRxDataNum) { - u16 SlotIndex; - u8 i; + u16 SlotIndex; + u8 i; *TotalRxBcnNum = 0; *TotalRxDataNum = 0; - SlotIndex = (priv->rtllib->LinkDetectInfo.SlotIndex++)%(priv->rtllib->LinkDetectInfo.SlotNum); - priv->rtllib->LinkDetectInfo.RxBcnNum[SlotIndex] = priv->rtllib->LinkDetectInfo.NumRecvBcnInPeriod; - priv->rtllib->LinkDetectInfo.RxDataNum[SlotIndex] = priv->rtllib->LinkDetectInfo.NumRecvDataInPeriod; + SlotIndex = (priv->rtllib->LinkDetectInfo.SlotIndex++) % + (priv->rtllib->LinkDetectInfo.SlotNum); + priv->rtllib->LinkDetectInfo.RxBcnNum[SlotIndex] = + priv->rtllib->LinkDetectInfo.NumRecvBcnInPeriod; + priv->rtllib->LinkDetectInfo.RxDataNum[SlotIndex] = + priv->rtllib->LinkDetectInfo.NumRecvDataInPeriod; for (i = 0; i < priv->rtllib->LinkDetectInfo.SlotNum; i++) { *TotalRxBcnNum += priv->rtllib->LinkDetectInfo.RxBcnNum[i]; *TotalRxDataNum += priv->rtllib->LinkDetectInfo.RxDataNum[i]; @@ -1676,13 +1668,15 @@ void rtl819x_update_rxcounts(struct r8192_priv *priv, void rtl819x_watchdog_wqcallback(void *data) { - struct r8192_priv *priv = container_of_dwork_rsl(data, struct r8192_priv, watch_dog_wq); + struct r8192_priv *priv = container_of_dwork_rsl(data, + struct r8192_priv, watch_dog_wq); struct net_device *dev = priv->rtllib->dev; - struct rtllib_device* ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; enum reset_type ResetType = RESET_TYPE_NORESET; - static u8 check_reset_cnt = 0; + static u8 check_reset_cnt; unsigned long flags; - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + (&(priv->rtllib->PowerSaveControl)); bool bBusyTraffic = false; bool bHigherBusyTraffic = false; bool bHigherBusyRxTraffic = false; @@ -1692,7 +1686,7 @@ void rtl819x_watchdog_wqcallback(void *data) return; if (priv->rtllib->state >= RTLLIB_LINKED) { - if (priv->rtllib->CntAfterLink<2) + if (priv->rtllib->CntAfterLink < 2) priv->rtllib->CntAfterLink++; } else { priv->rtllib->CntAfterLink = 0; @@ -1700,130 +1694,125 @@ void rtl819x_watchdog_wqcallback(void *data) hal_dm_watchdog(dev); - if (rtllib_act_scanning(priv->rtllib,false) == false){ - if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == RTLLIB_NOLINK) &&\ - (ieee->eRFPowerState == eRfOn)&&!ieee->is_set_key &&\ - (!ieee->proto_stoppping) && !ieee->wx_set_enc - ){ - if ((ieee->PowerSaveControl.ReturnPoint == IPS_CALLBACK_NONE)&& - (!ieee->bNetPromiscuousMode)) - { - RT_TRACE(COMP_PS, "====================>haha:IPSEnter()\n"); + if (rtllib_act_scanning(priv->rtllib, false) == false) { + if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == + RTLLIB_NOLINK) && + (ieee->eRFPowerState == eRfOn) && !ieee->is_set_key && + (!ieee->proto_stoppping) && !ieee->wx_set_enc) { + if ((ieee->PowerSaveControl.ReturnPoint == + IPS_CALLBACK_NONE) && + (!ieee->bNetPromiscuousMode)) { + RT_TRACE(COMP_PS, "====================>haha: " + "IPSEnter()\n"); IPSEnter(dev); } } } - { - if ((ieee->state == RTLLIB_LINKED) && (ieee->iw_mode == IW_MODE_INFRA) && (!ieee->bNetPromiscuousMode)) - { - if ( ieee->LinkDetectInfo.NumRxOkInPeriod> 100 || - ieee->LinkDetectInfo.NumTxOkInPeriod> 100 ) { - bBusyTraffic = true; - } + if ((ieee->state == RTLLIB_LINKED) && (ieee->iw_mode == + IW_MODE_INFRA) && (!ieee->bNetPromiscuousMode)) { + if (ieee->LinkDetectInfo.NumRxOkInPeriod > 100 || + ieee->LinkDetectInfo.NumTxOkInPeriod > 100) + bBusyTraffic = true; - if ( ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 || - ieee->LinkDetectInfo.NumTxOkInPeriod > 4000 ) - { - bHigherBusyTraffic = true; - if (ieee->LinkDetectInfo.NumRxOkInPeriod > 5000) - bHigherBusyRxTraffic = true; - else - bHigherBusyRxTraffic = false; - } - - if (((ieee->LinkDetectInfo.NumRxUnicastOkInPeriod + ieee->LinkDetectInfo.NumTxOkInPeriod) > 8) || - (ieee->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) - bEnterPS= false; + if (ieee->LinkDetectInfo.NumRxOkInPeriod > 4000 || + ieee->LinkDetectInfo.NumTxOkInPeriod > 4000) { + bHigherBusyTraffic = true; + if (ieee->LinkDetectInfo.NumRxOkInPeriod > 5000) + bHigherBusyRxTraffic = true; else - bEnterPS= true; + bHigherBusyRxTraffic = false; + } - if (ieee->current_network.beacon_interval < 95) - bEnterPS= false; + if (((ieee->LinkDetectInfo.NumRxUnicastOkInPeriod + + ieee->LinkDetectInfo.NumTxOkInPeriod) > 8) || + (ieee->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) + bEnterPS = false; + else + bEnterPS = true; - if (bEnterPS) - LeisurePSEnter(dev); - else - LeisurePSLeave(dev); + if (ieee->current_network.beacon_interval < 95) + bEnterPS = false; - } else { - RT_TRACE(COMP_LPS,"====>no link LPS leave\n"); + if (bEnterPS) + LeisurePSEnter(dev); + else LeisurePSLeave(dev); - } - ieee->LinkDetectInfo.NumRxOkInPeriod = 0; - ieee->LinkDetectInfo.NumTxOkInPeriod = 0; - ieee->LinkDetectInfo.NumRxUnicastOkInPeriod = 0; - ieee->LinkDetectInfo.bBusyTraffic = bBusyTraffic; + } else { + RT_TRACE(COMP_LPS, "====>no link LPS leave\n"); + LeisurePSLeave(dev); + } - ieee->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic; - ieee->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic; + ieee->LinkDetectInfo.NumRxOkInPeriod = 0; + ieee->LinkDetectInfo.NumTxOkInPeriod = 0; + ieee->LinkDetectInfo.NumRxUnicastOkInPeriod = 0; + ieee->LinkDetectInfo.bBusyTraffic = bBusyTraffic; - } + ieee->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic; + ieee->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic; - { - if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == IW_MODE_INFRA) - { - u32 TotalRxBcnNum = 0; - u32 TotalRxDataNum = 0; + if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == IW_MODE_INFRA) { + u32 TotalRxBcnNum = 0; + u32 TotalRxDataNum = 0; - rtl819x_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum); + rtl819x_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum); - if ((TotalRxBcnNum+TotalRxDataNum) == 0) - priv->check_roaming_cnt ++; - else - priv->check_roaming_cnt = 0; + if ((TotalRxBcnNum+TotalRxDataNum) == 0) + priv->check_roaming_cnt++; + else + priv->check_roaming_cnt = 0; - if (priv->check_roaming_cnt > 0) - { - if ( ieee->eRFPowerState == eRfOff) - RT_TRACE(COMP_ERR,"========>%s()\n",__func__); + if (priv->check_roaming_cnt > 0) { + if (ieee->eRFPowerState == eRfOff) + RT_TRACE(COMP_ERR, "========>%s()\n", __func__); - printk("===>%s(): AP is power off,chan:%d, connect another one\n",__func__, priv->chan); + printk(KERN_INFO "===>%s(): AP is power off, chan:%d," + " connect another one\n", __func__, priv->chan); - ieee->state = RTLLIB_ASSOCIATING; + ieee->state = RTLLIB_ASSOCIATING; - RemovePeerTS(priv->rtllib,priv->rtllib->current_network.bssid); - ieee->is_roaming = true; - ieee->is_set_key = false; - ieee->link_change(dev); - if (ieee->LedControlHandler) - ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK); + RemovePeerTS(priv->rtllib, + priv->rtllib->current_network.bssid); + ieee->is_roaming = true; + ieee->is_set_key = false; + ieee->link_change(dev); + if (ieee->LedControlHandler) + ieee->LedControlHandler(ieee->dev, + LED_CTL_START_TO_LINK); - notify_wx_assoc_event(ieee); + notify_wx_assoc_event(ieee); - if (!(ieee->rtllib_ap_sec_type(ieee)&(SEC_ALG_CCMP|SEC_ALG_TKIP))) - queue_delayed_work_rsl(ieee->wq, &ieee->associate_procedure_wq, 0); + if (!(ieee->rtllib_ap_sec_type(ieee) & + (SEC_ALG_CCMP|SEC_ALG_TKIP))) + queue_delayed_work_rsl(ieee->wq, + &ieee->associate_procedure_wq, 0); - priv->check_roaming_cnt = 0; - } + priv->check_roaming_cnt = 0; } - ieee->LinkDetectInfo.NumRecvBcnInPeriod=0; - ieee->LinkDetectInfo.NumRecvDataInPeriod=0; + ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0; + ieee->LinkDetectInfo.NumRecvDataInPeriod = 0; } - spin_lock_irqsave(&priv->tx_lock,flags); + spin_lock_irqsave(&priv->tx_lock, flags); if ((check_reset_cnt++ >= 3) && (!ieee->is_roaming) && - (!priv->RFChangeInProgress) && (!pPSC->bSwRfProcessing)) - { + (!priv->RFChangeInProgress) && (!pPSC->bSwRfProcessing)) { ResetType = rtl819x_ifcheck_resetornot(dev); check_reset_cnt = 3; } - spin_unlock_irqrestore(&priv->tx_lock,flags); + spin_unlock_irqrestore(&priv->tx_lock, flags); - if (!priv->bDisableNormalResetCheck && ResetType == RESET_TYPE_NORMAL) - { + if (!priv->bDisableNormalResetCheck && ResetType == RESET_TYPE_NORMAL) { priv->ResetProgress = RESET_TYPE_NORMAL; - RT_TRACE(COMP_RESET,"%s(): NOMAL RESET\n",__func__); + RT_TRACE(COMP_RESET, "%s(): NOMAL RESET\n", __func__); return; } - if ( ((priv->force_reset) || (!priv->bDisableNormalResetCheck && ResetType==RESET_TYPE_SILENT))) - { + if (((priv->force_reset) || (!priv->bDisableNormalResetCheck && + ResetType == RESET_TYPE_SILENT))) rtl819x_ifsilentreset(dev); - } priv->force_reset = false; priv->bForcedSilentReset = false; priv->bResetInProgress = false; @@ -1832,9 +1821,10 @@ void rtl819x_watchdog_wqcallback(void *data) void watch_dog_timer_callback(unsigned long data) { - struct r8192_priv *priv = rtllib_priv((struct net_device *) 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)); + struct r8192_priv *priv = rtllib_priv((struct net_device *)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)); } /**************************************************************************** @@ -1842,61 +1832,65 @@ void watch_dog_timer_callback(unsigned long data) *****************************************************************************/ void rtl8192_rx_enable(struct net_device *dev) { - struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); + struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); priv->ops->rx_enable(dev); } void rtl8192_tx_enable(struct net_device *dev) { - struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); + struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); priv->ops->tx_enable(dev); - rtllib_reset_queue(priv->rtllib); + rtllib_reset_queue(priv->rtllib); } static void rtl8192_free_rx_ring(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); - int i,rx_queue_idx; + struct r8192_priv *priv = rtllib_priv(dev); + int i, rx_queue_idx; - for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx ++){ - for (i = 0; i < priv->rxringcount; i++) { + for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; + rx_queue_idx++) { + for (i = 0; i < priv->rxringcount; i++) { struct sk_buff *skb = priv->rx_buf[rx_queue_idx][i]; - if (!skb) - continue; + if (!skb) + continue; - pci_unmap_single(priv->pdev, - *((dma_addr_t *)skb->cb), - priv->rxbuffersize, PCI_DMA_FROMDEVICE); - kfree_skb(skb); - } + pci_unmap_single(priv->pdev, + *((dma_addr_t *)skb->cb), + priv->rxbuffersize, PCI_DMA_FROMDEVICE); + kfree_skb(skb); + } - pci_free_consistent(priv->pdev, sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, - priv->rx_ring[rx_queue_idx], priv->rx_ring_dma[rx_queue_idx]); + pci_free_consistent(priv->pdev, + sizeof(*priv->rx_ring[rx_queue_idx]) * + priv->rxringcount, + priv->rx_ring[rx_queue_idx], + priv->rx_ring_dma[rx_queue_idx]); priv->rx_ring[rx_queue_idx] = NULL; } } static void rtl8192_free_tx_ring(struct net_device *dev, unsigned int prio) { - struct r8192_priv *priv = rtllib_priv(dev); - struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; + struct r8192_priv *priv = rtllib_priv(dev); + struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; - while (skb_queue_len(&ring->queue)) { - struct tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb = __skb_dequeue(&ring->queue); + while (skb_queue_len(&ring->queue)) { + struct tx_desc *entry = &ring->desc[ring->idx]; + struct sk_buff *skb = __skb_dequeue(&ring->queue); - pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), - skb->len, PCI_DMA_TODEVICE); - kfree_skb(skb); - ring->idx = (ring->idx + 1) % ring->entries; - } + pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), + skb->len, PCI_DMA_TODEVICE); + kfree_skb(skb); + ring->idx = (ring->idx + 1) % ring->entries; + } - pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries, - ring->desc, ring->dma); - ring->desc = NULL; + pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries, + ring->desc, ring->dma); + ring->desc = NULL; } void rtl8192_data_hard_stop(struct net_device *dev) @@ -1908,14 +1902,17 @@ void rtl8192_data_hard_resume(struct net_device *dev) { } -void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) +void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, + int rate) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); int ret; - struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; - if ((priv->rtllib->eRFPowerState == eRfOff) || IS_NIC_DOWN(priv) || priv->bResetInProgress){ + if ((priv->rtllib->eRFPowerState == eRfOff) || IS_NIC_DOWN(priv) || + priv->bResetInProgress) { kfree_skb(skb); return; } @@ -1923,15 +1920,16 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rat assert(queue_index != TXCMD_QUEUE); - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); skb_push(skb, priv->rtllib->tx_headroom); ret = rtl8192_tx(dev, skb); if (ret != 0) { kfree_skb(skb); }; - if (queue_index!=MGNT_QUEUE) { - priv->rtllib->stats.tx_bytes+=(skb->len - priv->rtllib->tx_headroom); + if (queue_index != MGNT_QUEUE) { + priv->rtllib->stats.tx_bytes += (skb->len - + priv->rtllib->tx_headroom); priv->rtllib->stats.tx_packets++; } @@ -1939,21 +1937,23 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rat return; } -int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) +int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); int ret; - struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; - if (queue_index != TXCMD_QUEUE){ - if ((priv->rtllib->eRFPowerState == eRfOff) ||IS_NIC_DOWN(priv) || priv->bResetInProgress){ + if (queue_index != TXCMD_QUEUE) { + if ((priv->rtllib->eRFPowerState == eRfOff) || + IS_NIC_DOWN(priv) || priv->bResetInProgress) { kfree_skb(skb); return 0; } } - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); if (queue_index == TXCMD_QUEUE) { rtl8192_tx_cmd(dev, skb); ret = 0; @@ -1978,81 +1978,82 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) void rtl8192_tx_isr(struct net_device *dev, int prio) { - struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - - struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; + struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - while (skb_queue_len(&ring->queue)) { - struct tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb; + struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; - if (prio != BEACON_QUEUE) { - if (entry->OWN) - return; - ring->idx = (ring->idx + 1) % ring->entries; - } + while (skb_queue_len(&ring->queue)) { + struct tx_desc *entry = &ring->desc[ring->idx]; + struct sk_buff *skb; - skb = __skb_dequeue(&ring->queue); - pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), - skb->len, PCI_DMA_TODEVICE); + if (prio != BEACON_QUEUE) { + if (entry->OWN) + return; + ring->idx = (ring->idx + 1) % ring->entries; + } - kfree_skb(skb); - } - if (prio != BEACON_QUEUE) { - tasklet_schedule(&priv->irq_tx_tasklet); - } + skb = __skb_dequeue(&ring->queue); + pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), + skb->len, PCI_DMA_TODEVICE); + kfree_skb(skb); + } + if (prio != BEACON_QUEUE) + tasklet_schedule(&priv->irq_tx_tasklet); } void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb) { - struct r8192_priv *priv = rtllib_priv(dev); - struct rtl8192_tx_ring *ring; - struct tx_desc_cmd * entry; - unsigned int idx; - struct cb_desc *tcb_desc; - unsigned long flags; + struct r8192_priv *priv = rtllib_priv(dev); + struct rtl8192_tx_ring *ring; + struct tx_desc_cmd *entry; + unsigned int idx; + struct cb_desc *tcb_desc; + unsigned long flags; - spin_lock_irqsave(&priv->irq_th_lock,flags); - ring = &priv->tx_ring[TXCMD_QUEUE]; + spin_lock_irqsave(&priv->irq_th_lock, flags); + ring = &priv->tx_ring[TXCMD_QUEUE]; - idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; - entry = (struct tx_desc_cmd *) &ring->desc[idx]; + idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; + entry = (struct tx_desc_cmd *) &ring->desc[idx]; - tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - priv->ops->tx_fill_cmd_descriptor(dev, entry, tcb_desc, skb); + priv->ops->tx_fill_cmd_descriptor(dev, entry, tcb_desc, skb); - __skb_queue_tail(&ring->queue, skb); - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + __skb_queue_tail(&ring->queue, skb); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); - return; + return; } -short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) +short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); struct rtl8192_tx_ring *ring; unsigned long flags; - struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + + MAX_DEV_ADDR_SIZE); struct tx_desc *pdesc = NULL; - struct rtllib_hdr_1addr * header = NULL; - u16 fc=0, type=0,stype=0; - bool multi_addr=false,broad_addr=false,uni_addr=false; - u8* pda_addr = NULL; + struct rtllib_hdr_1addr *header = NULL; + u16 fc = 0, type = 0, stype = 0; + bool multi_addr = false, broad_addr = false, uni_addr = false; + u8 *pda_addr = NULL; int idx; 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); - return skb->len; + 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); + return skb->len; } priv->rtllib->bAwakePktSent = true; fwinfo_size = sizeof(struct tx_fwinfo_8190pci); - header = (struct rtllib_hdr_1addr *)(((u8*)skb->data) + fwinfo_size); + header = (struct rtllib_hdr_1addr *)(((u8 *)skb->data) + fwinfo_size); fc = header->frame_ctl; type = WLAN_FC_GET_TYPE(fc); stype = WLAN_FC_GET_STYPE(fc); @@ -2062,9 +2063,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) multi_addr = true; else if (is_broadcast_ether_addr(pda_addr)) broad_addr = true; - else { + else uni_addr = true; - } if (uni_addr) priv->stats.txbytesunicast += skb->len - fwinfo_size; @@ -2073,36 +2073,34 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) else priv->stats.txbytesbroadcast += skb->len - fwinfo_size; - spin_lock_irqsave(&priv->irq_th_lock,flags); + spin_lock_irqsave(&priv->irq_th_lock, flags); ring = &priv->tx_ring[tcb_desc->queue_index]; - if (tcb_desc->queue_index != BEACON_QUEUE) { + if (tcb_desc->queue_index != BEACON_QUEUE) idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; - } else { + else idx = 0; - } 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", \ - tcb_desc->queue_index,ring->idx, idx,skb->len, skb_queue_len(&ring->queue)); - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + 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); return skb->len; } - if (tcb_desc->queue_index == MGNT_QUEUE){ - } - - if (type == RTLLIB_FTYPE_DATA){ + if (type == RTLLIB_FTYPE_DATA) { if (priv->rtllib->LedControlHandler) priv->rtllib->LedControlHandler(dev, LED_CTL_TX); } priv->ops->tx_fill_descriptor(dev, pdesc, tcb_desc, skb); __skb_queue_tail(&ring->queue, skb); pdesc->OWN = 1; - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); dev->trans_start = jiffies; - write_nic_word(dev,TPPoll,0x01<queue_index); + write_nic_word(dev, TPPoll, 0x01 << tcb_desc->queue_index); return 0; } @@ -2112,16 +2110,21 @@ short rtl8192_alloc_rx_desc_ring(struct net_device *dev) struct rx_desc *entry = NULL; int i, rx_queue_idx; - for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx ++){ + for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) { priv->rx_ring[rx_queue_idx] = pci_alloc_consistent(priv->pdev, - sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, &priv->rx_ring_dma[rx_queue_idx]); + sizeof(*priv->rx_ring[rx_queue_idx]) * + priv->rxringcount, + &priv->rx_ring_dma[rx_queue_idx]); - if (!priv->rx_ring[rx_queue_idx] || (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) { - RT_TRACE(COMP_ERR,"Cannot allocate RX ring\n"); + if (!priv->rx_ring[rx_queue_idx] || + (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) { + RT_TRACE(COMP_ERR, "Cannot allocate RX ring\n"); return -ENOMEM; } - memset(priv->rx_ring[rx_queue_idx], 0, sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount); + memset(priv->rx_ring[rx_queue_idx], 0, + sizeof(*priv->rx_ring[rx_queue_idx]) * + priv->rxringcount); priv->rx_idx[rx_queue_idx] = 0; for (i = 0; i < priv->rxringcount; i++) { @@ -2133,8 +2136,10 @@ short rtl8192_alloc_rx_desc_ring(struct net_device *dev) skb->dev = dev; priv->rx_buf[rx_queue_idx][i] = skb; mapping = (dma_addr_t *)skb->cb; - *mapping = pci_map_single(priv->pdev, skb_tail_pointer_rsl(skb), - priv->rxbuffersize, PCI_DMA_FROMDEVICE); + *mapping = pci_map_single(priv->pdev, + skb_tail_pointer_rsl(skb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); entry->BufferAddress = cpu_to_le32(*mapping); @@ -2148,68 +2153,69 @@ short rtl8192_alloc_rx_desc_ring(struct net_device *dev) } static int rtl8192_alloc_tx_desc_ring(struct net_device *dev, - unsigned int prio, unsigned int entries) + unsigned int prio, unsigned int entries) { - struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - struct tx_desc *ring; - dma_addr_t dma; - int i; + struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); + struct tx_desc *ring; + dma_addr_t dma; + int i; - ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); - if (!ring || (unsigned long)ring & 0xFF) { - RT_TRACE(COMP_ERR, "Cannot allocate TX ring (prio = %d)\n", prio); - return -ENOMEM; - } + ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); + if (!ring || (unsigned long)ring & 0xFF) { + RT_TRACE(COMP_ERR, "Cannot allocate TX ring (prio = %d)\n", + prio); + return -ENOMEM; + } - memset(ring, 0, sizeof(*ring)*entries); - priv->tx_ring[prio].desc = ring; - priv->tx_ring[prio].dma = dma; - priv->tx_ring[prio].idx = 0; - priv->tx_ring[prio].entries = entries; - skb_queue_head_init(&priv->tx_ring[prio].queue); + memset(ring, 0, sizeof(*ring)*entries); + priv->tx_ring[prio].desc = ring; + priv->tx_ring[prio].dma = dma; + priv->tx_ring[prio].idx = 0; + priv->tx_ring[prio].entries = entries; + skb_queue_head_init(&priv->tx_ring[prio].queue); - for (i = 0; i < entries; i++) - ring[i].NextDescAddress = - cpu_to_le32((u32)dma + ((i + 1) % entries) * sizeof(*ring)); + for (i = 0; i < entries; i++) + ring[i].NextDescAddress = + cpu_to_le32((u32)dma + ((i + 1) % entries) * + sizeof(*ring)); - return 0; + return 0; } short rtl8192_pci_initdescring(struct net_device *dev) { - u32 ret; - int i; - struct r8192_priv *priv = rtllib_priv(dev); - - ret = rtl8192_alloc_rx_desc_ring(dev); - if (ret) { - return ret; - } + u32 ret; + int i; + struct r8192_priv *priv = rtllib_priv(dev); + ret = rtl8192_alloc_rx_desc_ring(dev); + if (ret) + return ret; - for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) { - if ((ret = rtl8192_alloc_tx_desc_ring(dev, i, priv->txringcount))) - goto err_free_rings; - } + for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) { + ret = rtl8192_alloc_tx_desc_ring(dev, i, priv->txringcount); + if (ret) + goto err_free_rings; + } - return 0; + return 0; err_free_rings: - rtl8192_free_rx_ring(dev); - for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) - if (priv->tx_ring[i].desc) - rtl8192_free_tx_ring(dev, i); - return 1; + rtl8192_free_rx_ring(dev); + for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) + if (priv->tx_ring[i].desc) + rtl8192_free_tx_ring(dev, i); + return 1; } void rtl8192_pci_resetdescring(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); - int i,rx_queue_idx; - unsigned long flags = 0; + struct r8192_priv *priv = rtllib_priv(dev); + int i, rx_queue_idx; + unsigned long flags = 0; - for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx ++){ + for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) { if (priv->rx_ring[rx_queue_idx]) { struct rx_desc *entry = NULL; for (i = 0; i < priv->rxringcount; i++) { @@ -2220,27 +2226,30 @@ void rtl8192_pci_resetdescring(struct net_device *dev) } } - spin_lock_irqsave(&priv->irq_th_lock,flags); - for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) { - if (priv->tx_ring[i].desc) { - struct rtl8192_tx_ring *ring = &priv->tx_ring[i]; + spin_lock_irqsave(&priv->irq_th_lock, flags); + for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) { + if (priv->tx_ring[i].desc) { + struct rtl8192_tx_ring *ring = &priv->tx_ring[i]; - while (skb_queue_len(&ring->queue)) { - struct tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb = __skb_dequeue(&ring->queue); + while (skb_queue_len(&ring->queue)) { + struct tx_desc *entry = &ring->desc[ring->idx]; + struct sk_buff *skb = + __skb_dequeue(&ring->queue); - pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), - skb->len, PCI_DMA_TODEVICE); - kfree_skb(skb); - ring->idx = (ring->idx + 1) % ring->entries; - } - ring->idx = 0; - } - } - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + pci_unmap_single(priv->pdev, + le32_to_cpu(entry->TxBuffAddr), + skb->len, PCI_DMA_TODEVICE); + kfree_skb(skb); + ring->idx = (ring->idx + 1) % ring->entries; + } + ring->idx = 0; + } + } + spin_unlock_irqrestore(&priv->irq_th_lock, flags); } -void rtl819x_UpdateRxPktTimeStamp (struct net_device *dev, struct rtllib_rx_stats *stats) +void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, + struct rtllib_rx_stats *stats) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -2250,7 +2259,7 @@ void rtl819x_UpdateRxPktTimeStamp (struct net_device *dev, struct rtllib_rx_stat priv->LastRxDescTSF = stats->mac_time; } -long rtl819x_translate_todbm(struct r8192_priv * priv, u8 signal_strength_index ) +long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index) { long signal_power; @@ -2263,48 +2272,41 @@ long rtl819x_translate_todbm(struct r8192_priv * priv, u8 signal_strength_index void rtl819x_update_rxsignalstatistics8190pci( - struct r8192_priv * priv, - struct rtllib_rx_stats * pprevious_stats + struct r8192_priv *priv, + struct rtllib_rx_stats *pprevious_stats ) { int weighting = 0; if (priv->stats.recv_signal_power == 0) - priv->stats.recv_signal_power = pprevious_stats->RecvSignalPower; + priv->stats.recv_signal_power = + pprevious_stats->RecvSignalPower; if (pprevious_stats->RecvSignalPower > priv->stats.recv_signal_power) weighting = 5; - else if (pprevious_stats->RecvSignalPower < priv->stats.recv_signal_power) + else if (pprevious_stats->RecvSignalPower < + priv->stats.recv_signal_power) weighting = (-5); - priv->stats.recv_signal_power = (priv->stats.recv_signal_power * 5 + pprevious_stats->RecvSignalPower + weighting) / 6; + priv->stats.recv_signal_power = (priv->stats.recv_signal_power * 5 + + pprevious_stats->RecvSignalPower + + weighting) / 6; } -void -rtl819x_process_cck_rxpathsel( - struct r8192_priv * priv, - struct rtllib_rx_stats * pprevious_stats - ) +void rtl819x_process_cck_rxpathsel(struct r8192_priv *priv, + struct rtllib_rx_stats *pprevious_stats) { } -u8 rtl819x_query_rxpwrpercentage( - char antpower - ) +u8 rtl819x_query_rxpwrpercentage(char antpower) { if ((antpower <= -100) || (antpower >= 20)) - { return 0; - } else if (antpower >= 0) - { return 100; - } else - { - return (100+antpower); - } + return 100 + antpower; } /* QueryRxPwrPercentage */ @@ -2322,16 +2324,16 @@ rtl819x_evm_dbtopercentage( if (ret_val <= -33) ret_val = -33; ret_val = 0 - ret_val; - ret_val*=3; + ret_val *= 3; if (ret_val == 99) ret_val = 100; - return(ret_val); + return ret_val; } void rtl8192_record_rxdesc_forlateruse( - struct rtllib_rx_stats * psrc_stats, - struct rtllib_rx_stats * ptarget_stats + struct rtllib_rx_stats *psrc_stats, + struct rtllib_rx_stats *ptarget_stats ) { ptarget_stats->bIsAMPDU = psrc_stats->bIsAMPDU; @@ -2345,8 +2347,8 @@ void rtl8192_rx_normal(struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct rtllib_hdr_1addr *rtllib_hdr = NULL; bool unicast_packet = false; - bool bLedBlinking=true; - u16 fc=0, type=0; + bool bLedBlinking = true; + u16 fc = 0, type = 0; u32 skb_len = 0; int rx_queue_idx = RX_MPDU_QUEUE; @@ -2361,8 +2363,10 @@ void rtl8192_rx_normal(struct net_device *dev) stats.nic_type = NIC_8192E; while (count--) { - struct rx_desc *pdesc = &priv->rx_ring[rx_queue_idx][priv->rx_idx[rx_queue_idx]]; - struct sk_buff *skb = priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]]; + struct rx_desc *pdesc = &priv->rx_ring[rx_queue_idx] + [priv->rx_idx[rx_queue_idx]]; + struct sk_buff *skb = priv->rx_buf[rx_queue_idx] + [priv->rx_idx[rx_queue_idx]]; if (pdesc->OWN) { return; @@ -2370,11 +2374,11 @@ void rtl8192_rx_normal(struct net_device *dev) struct sk_buff *new_skb; if (!priv->ops->rx_query_status_descriptor(dev, &stats, - pdesc, skb)) + pdesc, skb)) goto done; new_skb = dev_alloc_skb(priv->rxbuffersize); /* if allocation of new skb failed - drop current packet - * and reuse skb */ + * and reuse skb */ if (unlikely(!new_skb)) goto done; @@ -2385,11 +2389,11 @@ void rtl8192_rx_normal(struct net_device *dev) skb_put(skb, pdesc->Length); skb_reserve(skb, stats.RxDrvInfoSize + - stats.RxBufShift); + stats.RxBufShift); skb_trim(skb, skb->len - 4/*sCrcLng*/); rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; if (!is_broadcast_ether_addr(rtllib_hdr->addr1) && - !is_multicast_ether_addr(rtllib_hdr->addr1)) { + !is_multicast_ether_addr(rtllib_hdr->addr1)) { /* unicast packet */ unicast_packet = true; } @@ -2401,18 +2405,18 @@ void rtl8192_rx_normal(struct net_device *dev) if (bLedBlinking) if (priv->rtllib->LedControlHandler) priv->rtllib->LedControlHandler(dev, - LED_CTL_RX); + LED_CTL_RX); if (stats.bCRC) { if (type != RTLLIB_FTYPE_MGMT) - priv->stats.rxdatacrcerr ++; + priv->stats.rxdatacrcerr++; else - priv->stats.rxmgmtcrcerr ++; + priv->stats.rxmgmtcrcerr++; } skb_len = skb->len; - if (!rtllib_rx(priv->rtllib, skb, &stats)){ + if (!rtllib_rx(priv->rtllib, skb, &stats)) { dev_kfree_skb_any(skb); } else { priv->stats.rxok++; @@ -2423,8 +2427,12 @@ void rtl8192_rx_normal(struct net_device *dev) 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); + 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); } done: @@ -2433,7 +2441,8 @@ done: pdesc->Length = priv->rxbuffersize; if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1) pdesc->EOR = 1; - priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) % priv->rxringcount; + priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) % + priv->rxringcount; } } @@ -2450,18 +2459,19 @@ void rtl8192_tx_resume(struct net_device *dev) struct sk_buff *skb; int queue_index; - for (queue_index = BK_QUEUE; queue_index < MAX_QUEUE_SIZE;queue_index++) { - while ((!skb_queue_empty(&ieee->skb_waitQ[queue_index]))&& - (priv->rtllib->check_nic_enough_desc(dev,queue_index) > 0)) { + for (queue_index = BK_QUEUE; + queue_index < MAX_QUEUE_SIZE; queue_index++) { + while ((!skb_queue_empty(&ieee->skb_waitQ[queue_index])) && + (priv->rtllib->check_nic_enough_desc(dev, queue_index) > 0)) { skb = skb_dequeue(&ieee->skb_waitQ[queue_index]); - ieee->softmac_data_hard_start_xmit(skb,dev,0/* rate useless now*/); + ieee->softmac_data_hard_start_xmit(skb, dev, 0); } } } void rtl8192_irq_tx_tasklet(struct r8192_priv *priv) { - rtl8192_tx_resume(priv->rtllib->dev); + rtl8192_tx_resume(priv->rtllib->dev); } void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) @@ -2471,13 +2481,14 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) if (MAX_RX_QUEUE > 1) rtl8192_rx_cmd(priv->rtllib->dev); - write_nic_dword(priv->rtllib->dev, INTA_MASK,read_nic_dword(priv->rtllib->dev, INTA_MASK) | IMR_RDU); + write_nic_dword(priv->rtllib->dev, INTA_MASK, + read_nic_dword(priv->rtllib->dev, INTA_MASK) | IMR_RDU); } /**************************************************************************** ---------------------------- NIC START/CLOSE STUFF--------------------------- *****************************************************************************/ -void rtl8192_cancel_deferred_work(struct r8192_priv * priv) +void rtl8192_cancel_deferred_work(struct r8192_priv *priv) { cancel_delayed_work(&priv->watch_dog_wq); cancel_delayed_work(&priv->update_beacon_wq); @@ -2486,7 +2497,7 @@ void rtl8192_cancel_deferred_work(struct r8192_priv * priv) cancel_work_sync(&priv->qos_activate); } -int _rtl8192_up(struct net_device *dev,bool is_silent_reset) +int _rtl8192_up(struct net_device *dev, bool is_silent_reset) { if (_rtl8192_sta_up(dev, is_silent_reset) == -1) return -1; @@ -2511,8 +2522,9 @@ int rtl8192_up(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - if (priv->up == 1) return -1; - return _rtl8192_up(dev,false); + if (priv->up == 1) + return -1; + return _rtl8192_up(dev, false); } @@ -2522,13 +2534,13 @@ int rtl8192_close(struct net_device *dev) int ret; if ((rtllib_act_scanning(priv->rtllib, false)) && - !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ + !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { rtllib_stop_scan(priv->rtllib); } down(&priv->wx_sem); - ret = rtl8192_down(dev,true); + ret = rtl8192_down(dev, true); up(&priv->wx_sem); @@ -2548,16 +2560,18 @@ void rtl8192_commit(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - if (priv->up == 0) return ; + if (priv->up == 0) + return; rtllib_softmac_stop_protocol(priv->rtllib, 0 , true); rtl8192_irq_disable(dev); priv->ops->stop_adapter(dev, true); - _rtl8192_up(dev,false); + _rtl8192_up(dev, false); } void rtl8192_restart(void *data) { - struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, reset_wq); + struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, + reset_wq); struct net_device *dev = priv->rtllib->dev; down(&priv->wx_sem); @@ -2572,14 +2586,7 @@ static void r8192_set_multicast(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); short promisc; - - - promisc = (dev->flags & IFF_PROMISC) ? 1:0; - - if (promisc != priv->promisc) { - ; - } - + promisc = (dev->flags & IFF_PROMISC) ? 1 : 0; priv->promisc = promisc; } @@ -2605,117 +2612,118 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct iwreq *wrq = (struct iwreq *)rq; - int ret=-1; + int ret = -1; struct rtllib_device *ieee = priv->rtllib; u32 key[4]; - u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; + u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 zero_addr[6] = {0}; struct iw_point *p = &wrq->u.data; + struct ieee_param *ipw = NULL; down(&priv->wx_sem); switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - { - struct ieee_param *ipw = NULL; - if (p->length < sizeof(struct ieee_param) || !p->pointer){ - ret = -EINVAL; - goto out; - } + case RTL_IOCTL_WPA_SUPPLICANT: + if (p->length < sizeof(struct ieee_param) || !p->pointer) { + ret = -EINVAL; + goto out; + } - ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); - if (ipw == NULL){ - ret = -ENOMEM; - goto out; - } - if (copy_from_user(ipw, p->pointer, p->length)) { - kfree(ipw); - ret = -EFAULT; - goto out; - } - - if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) - { - if (ipw->u.crypt.set_tx) - { - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) - ieee->pairwise_key_type = KEY_TYPE_CCMP; - else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) - ieee->pairwise_key_type = KEY_TYPE_TKIP; - else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) - { - if (ipw->u.crypt.key_len == 13) - ieee->pairwise_key_type = KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->pairwise_key_type = KEY_TYPE_WEP40; - } - else - ieee->pairwise_key_type = KEY_TYPE_NA; - - if (ieee->pairwise_key_type) - { - if (memcmp(ieee->ap_mac_addr, zero_addr, 6) == 0) - ieee->iw_mode = IW_MODE_ADHOC; - - memcpy((u8*)key, ipw->u.crypt.key, 16); - EnableHWSecurityConfig8192(dev); - set_swcam(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key,0); - setKey(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); - if (ieee->iw_mode == IW_MODE_ADHOC){ - set_swcam(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key,0); - setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); - } - } - if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){ - write_nic_byte(dev, 0x173, 1); - } + ipw = kmalloc(p->length, GFP_KERNEL); + if (ipw == NULL) { + ret = -ENOMEM; + goto out; + } + if (copy_from_user(ipw, p->pointer, p->length)) { + kfree(ipw); + ret = -EFAULT; + goto out; + } + if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) { + if (ipw->u.crypt.set_tx) { + if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) + ieee->pairwise_key_type = KEY_TYPE_CCMP; + else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) + ieee->pairwise_key_type = KEY_TYPE_TKIP; + else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { + if (ipw->u.crypt.key_len == 13) + ieee->pairwise_key_type = + KEY_TYPE_WEP104; + else if (ipw->u.crypt.key_len == 5) + ieee->pairwise_key_type = + KEY_TYPE_WEP40; + } else { + ieee->pairwise_key_type = KEY_TYPE_NA; } - else - { - memcpy((u8*)key, ipw->u.crypt.key, 16); - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) - ieee->group_key_type= KEY_TYPE_CCMP; - else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) - ieee->group_key_type = KEY_TYPE_TKIP; - else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) - { - if (ipw->u.crypt.key_len == 13) - ieee->group_key_type = KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->group_key_type = KEY_TYPE_WEP40; - } - else - ieee->group_key_type = KEY_TYPE_NA; - - if (ieee->group_key_type) - { - set_swcam( dev, - ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->group_key_type, - broadcast_addr, - 0, - key, - 0); - setKey( dev, - ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->group_key_type, - broadcast_addr, - 0, - key); + + if (ieee->pairwise_key_type) { + if (memcmp(ieee->ap_mac_addr, zero_addr, + 6) == 0) + ieee->iw_mode = IW_MODE_ADHOC; + memcpy((u8 *)key, ipw->u.crypt.key, 16); + EnableHWSecurityConfig8192(dev); + set_swcam(dev, 4, ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key, 0); + setKey(dev, 4, ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, 0, key); + if (ieee->iw_mode == IW_MODE_ADHOC) { + set_swcam(dev, ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key, 0); + setKey(dev, ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->pairwise_key_type, + (u8 *)ieee->ap_mac_addr, + 0, key); } } - } + if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) + && ieee->pHTInfo->bCurrentHTSupport) { + write_nic_byte(dev, 0x173, 1); + } - ret = rtllib_wpa_supplicant_ioctl(priv->rtllib, &wrq->u.data, 0); - kfree(ipw); - break; + } else { + memcpy((u8 *)key, ipw->u.crypt.key, 16); + if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) + ieee->group_key_type = KEY_TYPE_CCMP; + else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) + ieee->group_key_type = KEY_TYPE_TKIP; + else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { + if (ipw->u.crypt.key_len == 13) + ieee->group_key_type = + KEY_TYPE_WEP104; + else if (ipw->u.crypt.key_len == 5) + ieee->group_key_type = + KEY_TYPE_WEP40; + } else + ieee->group_key_type = KEY_TYPE_NA; + + if (ieee->group_key_type) { + set_swcam(dev, ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->group_key_type, + broadcast_addr, 0, key, 0); + setKey(dev, ipw->u.crypt.idx, + ipw->u.crypt.idx, + ieee->group_key_type, + broadcast_addr, 0, key); + } + } } - default: - ret = -EOPNOTSUPP; - break; + + ret = rtllib_wpa_supplicant_ioctl(priv->rtllib, &wrq->u.data, + 0); + kfree(ipw); + break; + default: + ret = -EOPNOTSUPP; + break; } out: @@ -2728,40 +2736,48 @@ void FairBeacon(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct rtllib_network *net = &priv->rtllib->current_network; - static u8 i=100; - static u8 forceturn =0; - u16 beaconint = net->beacon_interval; + static u8 i = 100; + static u8 forceturn; + u16 beaconint = net->beacon_interval; if (priv->rtllib->iw_mode != IW_MODE_ADHOC) return; - if (priv->bIbssCoordinator){ + if (priv->bIbssCoordinator) { i--; - if (forceturn ==2){ - forceturn =0; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_BEACON_INTERVAL, (u8*)(&beaconint)); - i=100; + if (forceturn == 2) { + forceturn = 0; + priv->rtllib->SetHwRegHandler(dev, + HW_VAR_BEACON_INTERVAL, + (u8 *)(&beaconint)); + i = 100; } - if (i<=94){ - beaconint=beaconint+2; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_BEACON_INTERVAL, (u8*)(&beaconint)); - forceturn =1; + if (i <= 94) { + beaconint = beaconint+2; + priv->rtllib->SetHwRegHandler(dev, + HW_VAR_BEACON_INTERVAL, + (u8 *)(&beaconint)); + forceturn = 1; } } else { i++; - if (forceturn ==1){ - forceturn =0; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_BEACON_INTERVAL, (u8*)(&beaconint)); - i=100; + if (forceturn == 1) { + forceturn = 0; + priv->rtllib->SetHwRegHandler(dev, + HW_VAR_BEACON_INTERVAL, + (u8 *)(&beaconint)); + i = 100; } - if (i>=106){ - beaconint=beaconint-2; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_BEACON_INTERVAL, (u8*)(&beaconint)); - forceturn =2; + if (i >= 106) { + beaconint = beaconint-2; + priv->rtllib->SetHwRegHandler(dev, + HW_VAR_BEACON_INTERVAL, + (u8 *)(&beaconint)); + forceturn = 2; } } } @@ -2776,71 +2792,67 @@ irqreturn_type rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs) u32 intb; intb = 0; - if (priv->irq_enabled == 0){ + if (priv->irq_enabled == 0) goto done; - } - spin_lock_irqsave(&priv->irq_th_lock,flags); + spin_lock_irqsave(&priv->irq_th_lock, flags); priv->ops->interrupt_recognized(dev, &inta, &intb); priv->stats.shints++; if (!inta) { - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); goto done; } if (inta == 0xffff) { - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); goto done; } priv->stats.ints++; if (!netif_running(dev)) { - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); goto done; } - if (inta & IMR_TBDOK){ + if (inta & IMR_TBDOK) { RT_TRACE(COMP_INTR, "beacon ok interrupt!\n"); priv->stats.txbeaconokint++; } - if (inta & IMR_TBDER){ + if (inta & IMR_TBDER) { RT_TRACE(COMP_INTR, "beacon ok interrupt!\n"); priv->stats.txbeaconerr++; } - if (inta & IMR_BDOK) { + if (inta & IMR_BDOK) RT_TRACE(COMP_INTR, "beacon interrupt!\n"); - } - if (inta & IMR_MGNTDOK ) { + if (inta & IMR_MGNTDOK) { RT_TRACE(COMP_INTR, "Manage ok interrupt!\n"); priv->stats.txmanageokint++; - rtl8192_tx_isr(dev,MGNT_QUEUE); - spin_unlock_irqrestore(&priv->irq_th_lock,flags); - if (priv->rtllib->ack_tx_to_ieee){ - if (rtl8192_is_tx_queue_empty(dev)){ + rtl8192_tx_isr(dev, MGNT_QUEUE); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); + if (priv->rtllib->ack_tx_to_ieee) { + if (rtl8192_is_tx_queue_empty(dev)) { priv->rtllib->ack_tx_to_ieee = 0; rtllib_ps_tx_ack(priv->rtllib, 1); } } - spin_lock_irqsave(&priv->irq_th_lock,flags); + spin_lock_irqsave(&priv->irq_th_lock, flags); } if (inta & IMR_COMDOK) { priv->stats.txcmdpktokint++; - rtl8192_tx_isr(dev,TXCMD_QUEUE); + rtl8192_tx_isr(dev, TXCMD_QUEUE); } - if (inta & IMR_HIGHDOK) { - rtl8192_tx_isr(dev,HIGH_QUEUE); - } + if (inta & IMR_HIGHDOK) + rtl8192_tx_isr(dev, HIGH_QUEUE); - if (inta & IMR_ROK) - { + if (inta & IMR_ROK) { priv->stats.rxint++; priv->InterruptLog.nIMR_ROK++; tasklet_schedule(&priv->irq_rx_tasklet); @@ -2854,7 +2866,8 @@ irqreturn_type rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs) if (inta & IMR_RDU) { RT_TRACE(COMP_INTR, "rx descriptor unavailable!\n"); priv->stats.rxrdu++; - write_nic_dword(dev,INTA_MASK,read_nic_dword(dev, INTA_MASK) & ~IMR_RDU); + write_nic_dword(dev, INTA_MASK, + read_nic_dword(dev, INTA_MASK) & ~IMR_RDU); tasklet_schedule(&priv->irq_rx_tasklet); } @@ -2864,37 +2877,38 @@ irqreturn_type rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs) tasklet_schedule(&priv->irq_rx_tasklet); } - if (inta & IMR_TXFOVW) priv->stats.txoverflow++; + if (inta & IMR_TXFOVW) + priv->stats.txoverflow++; if (inta & IMR_BKDOK) { RT_TRACE(COMP_INTR, "BK Tx OK interrupt!\n"); priv->stats.txbkokint++; priv->rtllib->LinkDetectInfo.NumTxOkInPeriod++; - rtl8192_tx_isr(dev,BK_QUEUE); + rtl8192_tx_isr(dev, BK_QUEUE); } if (inta & IMR_BEDOK) { RT_TRACE(COMP_INTR, "BE TX OK interrupt!\n"); priv->stats.txbeokint++; priv->rtllib->LinkDetectInfo.NumTxOkInPeriod++; - rtl8192_tx_isr(dev,BE_QUEUE); + rtl8192_tx_isr(dev, BE_QUEUE); } if (inta & IMR_VIDOK) { RT_TRACE(COMP_INTR, "VI TX OK interrupt!\n"); priv->stats.txviokint++; priv->rtllib->LinkDetectInfo.NumTxOkInPeriod++; - rtl8192_tx_isr(dev,VI_QUEUE); + rtl8192_tx_isr(dev, VI_QUEUE); } if (inta & IMR_VODOK) { priv->stats.txvookint++; RT_TRACE(COMP_INTR, "Vo TX OK interrupt!\n"); priv->rtllib->LinkDetectInfo.NumTxOkInPeriod++; - rtl8192_tx_isr(dev,VO_QUEUE); + rtl8192_tx_isr(dev, VO_QUEUE); } - spin_unlock_irqrestore(&priv->irq_th_lock,flags); + spin_unlock_irqrestore(&priv->irq_th_lock, flags); done: @@ -2904,7 +2918,7 @@ done: /**************************************************************************** - ---------------------------- PCI_STUFF--------------------------- + ---------------------------- PCI_STUFF--------------------------- *****************************************************************************/ #ifdef HAVE_NET_DEVICE_OPS static const struct net_device_ops rtl8192_netdev_ops = { @@ -2921,73 +2935,71 @@ static const struct net_device_ops rtl8192_netdev_ops = { #endif static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) + const struct pci_device_id *id) { unsigned long ioaddr = 0; struct net_device *dev = NULL; - struct r8192_priv *priv= NULL; + struct r8192_priv *priv = NULL; struct rtl819x_ops *ops = (struct rtl819x_ops *)(id->driver_data); unsigned long pmem_start, pmem_len, pmem_flags; int err = 0; bool bdma64 = false; u8 revision_id; - RT_TRACE(COMP_INIT,"Configuring chip resources"); + RT_TRACE(COMP_INIT, "Configuring chip resources"); - if ( pci_enable_device (pdev) ){ - RT_TRACE(COMP_ERR,"Failed to enable PCI device"); + if (pci_enable_device(pdev)) { + RT_TRACE(COMP_ERR, "Failed to enable PCI device"); return -EIO; } pci_set_master(pdev); - { - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { - if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk( "Unable to obtain 32bit DMA for consistent allocations\n"); - pci_disable_device(pdev); - return -ENOMEM; - } + 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"); + pci_disable_device(pdev); + return -ENOMEM; } } dev = alloc_rtllib(sizeof(struct r8192_priv)); if (!dev) return -ENOMEM; - if (bdma64){ + if (bdma64) dev->features |= NETIF_F_HIGHDMA; - } pci_set_drvdata(pdev, dev); SET_NETDEV_DEV(dev, &pdev->dev); priv = rtllib_priv(dev); priv->rtllib = (struct rtllib_device *)netdev_priv_rsl(dev); - priv->pdev=pdev; - priv->rtllib->pdev=pdev; - if ((pdev->subsystem_vendor == PCI_VENDOR_ID_DLINK)&&(pdev->subsystem_device == 0x3304)) + priv->pdev = pdev; + priv->rtllib->pdev = pdev; + if ((pdev->subsystem_vendor == PCI_VENDOR_ID_DLINK) && + (pdev->subsystem_device == 0x3304)) priv->rtllib->bSupportRemoteWakeUp = 1; else priv->rtllib->bSupportRemoteWakeUp = 0; pmem_start = pci_resource_start(pdev, 1); pmem_len = pci_resource_len(pdev, 1); - pmem_flags = pci_resource_flags (pdev, 1); + pmem_flags = pci_resource_flags(pdev, 1); if (!(pmem_flags & IORESOURCE_MEM)) { - RT_TRACE(COMP_ERR,"region #1 not a MMIO resource, aborting"); + RT_TRACE(COMP_ERR, "region #1 not a MMIO resource, aborting"); goto fail; } - printk("Memory mapped space start: 0x%08lx \n", pmem_start); + printk(KERN_INFO "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!"); + RT_TRACE(COMP_ERR, "request_mem_region failed!"); goto fail; } - ioaddr = (unsigned long)ioremap_nocache( pmem_start, pmem_len); - if ( ioaddr == (unsigned long)NULL ){ - RT_TRACE(COMP_ERR,"ioremap failed!"); + ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len); + if (ioaddr == (unsigned long)NULL) { + RT_TRACE(COMP_ERR, "ioremap failed!"); goto fail1; } @@ -3019,19 +3031,21 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, dev->hard_start_xmit = rtllib_xmit; #endif - dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def; + dev->wireless_handlers = (struct iw_handler_def *) + &r8192_wx_handlers_def; dev->ethtool_ops = &rtl819x_ethtool_ops; dev->type = ARPHRD_ETHER; - dev->watchdog_timeo = HZ*3; + dev->watchdog_timeo = HZ * 3; - if (dev_alloc_name(dev, ifname) < 0){ - RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n"); - dev_alloc_name(dev, ifname); - } + if (dev_alloc_name(dev, ifname) < 0) { + RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying " + "wlan%%d...\n"); + dev_alloc_name(dev, ifname); + } RT_TRACE(COMP_INIT, "Driver probe completed1\n"); - if (rtl8192_init(dev)!=0){ + if (rtl8192_init(dev) != 0) { RT_TRACE(COMP_ERR, "Initialization failed"); goto fail1; } @@ -3040,33 +3054,31 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, netif_stop_queue(dev); register_netdev(dev); - RT_TRACE(COMP_INIT, "dev name: %s\n",dev->name); + RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name); err = rtl_debug_module_init(priv, dev->name); - if (err) { - RT_TRACE(COMP_DBG, "failed to create debugfs files. Ignoring error: %d\n", err); - } + if (err) + RT_TRACE(COMP_DBG, "failed to create debugfs files. Ignoring " + "error: %d\n", err); rtl8192_proc_init_one(dev); - if (priv->polling_timer_on == 0){ + if (priv->polling_timer_on == 0) check_rfctrl_gpio_timer((unsigned long)dev); - } RT_TRACE(COMP_INIT, "Driver probe completed\n"); return 0; fail1: - if ( dev->mem_start != (unsigned long)NULL ){ - iounmap( (void *)dev->mem_start ); - release_mem_region( pci_resource_start(pdev, 1), - pci_resource_len(pdev, 1) ); + if (dev->mem_start != (unsigned long)NULL) { + iounmap((void *)dev->mem_start); + release_mem_region(pci_resource_start(pdev, 1), + pci_resource_len(pdev, 1)); } fail: - if (dev){ - + if (dev) { if (priv->irq) { free_irq(dev->irq, dev); - dev->irq=0; + dev->irq = 0; } free_rtllib(dev); } @@ -3083,7 +3095,9 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); struct r8192_priv *priv ; - if (dev){ + u32 i; + + if (dev) { unregister_netdev(dev); priv = rtllib_priv(dev); @@ -3093,63 +3107,59 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev) priv->polling_timer_on = 0; rtl_debug_module_remove(priv); rtl8192_proc_remove_one(dev); - rtl8192_down(dev,true); + rtl8192_down(dev, true); deinit_hal_dm(dev); if (priv->pFirmware) { vfree(priv->pFirmware); priv->pFirmware = NULL; } destroy_workqueue(priv->priv_wq); - { - u32 i; - rtl8192_free_rx_ring(dev); - for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) { - rtl8192_free_tx_ring(dev, i); - } - } + rtl8192_free_rx_ring(dev); + for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) + rtl8192_free_tx_ring(dev, i); - if (priv->irq){ - - printk("Freeing irq %d\n",dev->irq); + if (priv->irq) { + printk(KERN_INFO "Freeing irq %d\n", dev->irq); free_irq(dev->irq, dev); - priv->irq=0; - + priv->irq = 0; } free_rtllib(dev); - if (priv->scan_cmd) - kfree(priv->scan_cmd); + kfree(priv->scan_cmd); if (dev->mem_start != 0) { iounmap((void *)dev->mem_start); release_mem_region(pci_resource_start(pdev, 1), - pci_resource_len(pdev, 1)); + pci_resource_len(pdev, 1)); } - } else{ - priv=rtllib_priv(dev); - } + } else { + priv = rtllib_priv(dev); + } pci_disable_device(pdev); RT_TRACE(COMP_DOWN, "wlan driver removed\n"); } -bool NicIFEnableNIC(struct net_device* dev) +bool NicIFEnableNIC(struct net_device *dev) { bool init_status = true; - struct r8192_priv * priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct r8192_priv *priv = rtllib_priv(dev); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + (&(priv->rtllib->PowerSaveControl)); - if (IS_NIC_DOWN(priv)){ - RT_TRACE(COMP_ERR, "ERR!!! %s(): Driver is already down!\n",__func__); + if (IS_NIC_DOWN(priv)) { + RT_TRACE(COMP_ERR, "ERR!!! %s(): Driver is already down!\n", + __func__); priv->bdisable_nic = false; return RT_STATUS_FAILURE; } - RT_TRACE(COMP_PS, "===========>%s()\n",__func__); + RT_TRACE(COMP_PS, "===========>%s()\n", __func__); priv->bfirst_init = true; init_status = priv->ops->initialize_adapter(dev); if (init_status != true) { - RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n",__func__); + RT_TRACE(COMP_ERR, "ERR!!! %s(): initialization is failed!\n", + __func__); priv->bdisable_nic = false; return -1; } @@ -3159,15 +3169,15 @@ bool NicIFEnableNIC(struct net_device* dev) rtl8192_irq_enable(dev); priv->bdisable_nic = false; - RT_TRACE(COMP_PS,"<===========%s()\n",__func__); + RT_TRACE(COMP_PS, "<===========%s()\n", __func__); return init_status; } -bool NicIFDisableNIC(struct net_device* dev) +bool NicIFDisableNIC(struct net_device *dev) { bool status = true; - struct r8192_priv * priv = rtllib_priv(dev); + struct r8192_priv *priv = rtllib_priv(dev); u8 tmp_state = 0; - RT_TRACE(COMP_PS, "=========>%s()\n",__func__); + RT_TRACE(COMP_PS, "=========>%s()\n", __func__); priv->bdisable_nic = true; tmp_state = priv->rtllib->state; rtllib_softmac_stop_protocol(priv->rtllib, 0, false); @@ -3176,7 +3186,7 @@ bool NicIFDisableNIC(struct net_device* dev) rtl8192_irq_disable(dev); priv->ops->stop_adapter(dev, false); - RT_TRACE(COMP_PS, "<=========%s()\n",__func__); + RT_TRACE(COMP_PS, "<=========%s()\n", __func__); return status; } @@ -3221,14 +3231,14 @@ static int __init rtl8192_pci_module_init(void) } rtl8192_proc_module_init(); - if (0!=pci_register_driver(&rtl8192_pci_driver)) { + if (0 != pci_register_driver(&rtl8192_pci_driver)) { DMESG("No device found"); /*pci_unregister_driver (&rtl8192_pci_driver);*/ return -ENODEV; } return 0; err_out: - return error; + return error; } @@ -3248,17 +3258,18 @@ static void __exit rtl8192_pci_module_exit(void) void check_rfctrl_gpio_timer(unsigned long data) { - struct r8192_priv * priv = rtllib_priv((struct net_device *)data); + struct r8192_priv *priv = rtllib_priv((struct net_device *)data); priv->polling_timer_on = 1; - queue_delayed_work_rsl(priv->priv_wq,&priv->gpio_change_rf_wq,0); + 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)); + mod_timer(&priv->gpio_polling_timer, jiffies + + MSECS(RTLLIB_WATCH_DOG_TIME)); } /*************************************************************************** - ------------------- module init / exit stubs ---------------- + ------------------- module init / exit stubs ---------------- ****************************************************************************/ module_init(rtl8192_pci_module_init); module_exit(rtl8192_pci_module_exit); @@ -3268,10 +3279,10 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); MODULE_VERSION(DRV_VERSION); MODULE_LICENSE("GPL"); -module_param(ifname, charp, S_IRUGO|S_IWUSR ); -module_param(hwwep,int, S_IRUGO|S_IWUSR); -module_param(channels,int, S_IRUGO|S_IWUSR); +module_param(ifname, charp, S_IRUGO|S_IWUSR); +module_param(hwwep, int, S_IRUGO|S_IWUSR); +module_param(channels, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default"); -MODULE_PARM_DESC(hwwep," Try to use hardware WEP support(default use hw. set 0 to use software security)"); -MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); +MODULE_PARM_DESC(ifname, " Net interface name, wlan%d=default"); +MODULE_PARM_DESC(hwwep, " Try to use hardware WEP support(default use hw. set 0 to use software security)"); +MODULE_PARM_DESC(channels, " Channel bitmask for specific locales. NYI"); diff --git a/drivers/staging/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl_core.h index 4f94d0a18f06..03a86fe283c0 100644 --- a/drivers/staging/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl_core.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include "rtllib.h" #include "dot11d.h" @@ -62,28 +62,35 @@ #include "rtl_pci.h" #include "rtl_cam.h" -#define DRV_COPYRIGHT "Copyright(c) 2008 - 2010 Realsil Semiconductor Corporation" +#define DRV_COPYRIGHT \ + "Copyright(c) 2008 - 2010 Realsil Semiconductor Corporation" #define DRV_AUTHOR "" #define DRV_VERSION "0014.0401.2010" #define DRV_NAME "rtl819xE" -#define IS_HARDWARE_TYPE_819xP(_priv) ((((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8190P)||\ - (((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8192E)) -#define IS_HARDWARE_TYPE_8192SE(_priv) (((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8192SE) -#define IS_HARDWARE_TYPE_8192CE(_priv) (((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8192CE) -#define IS_HARDWARE_TYPE_8192CU(_priv) (((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8192CU) -#define IS_HARDWARE_TYPE_8192DE(_priv) (((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8192DE) -#define IS_HARDWARE_TYPE_8192DU(_priv) (((struct r8192_priv *)rtllib_priv(dev))->card_8192==NIC_8192DU) +#define IS_HARDWARE_TYPE_819xP(_priv) \ + ((((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8190P) || \ + (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192E)) +#define IS_HARDWARE_TYPE_8192SE(_priv) \ + (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192SE) +#define IS_HARDWARE_TYPE_8192CE(_priv) \ + (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192CE) +#define IS_HARDWARE_TYPE_8192CU(_priv) \ + (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192CU) +#define IS_HARDWARE_TYPE_8192DE(_priv) \ + (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192DE) +#define IS_HARDWARE_TYPE_8192DU(_priv) \ + (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192DU) #define RTL_PCI_DEVICE(vend, dev, cfg) \ .vendor = (vend), .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice =PCI_ANY_ID , \ + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID , \ .driver_data = (kernel_ulong_t)&(cfg) #define irqreturn_type irqreturn_t -#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y) +#define rtl8192_interrupt(x, y, z) rtl8192_interrupt_rsl(x, y) #define RTL_MAX_SCAN_SIZE 128 @@ -100,8 +107,9 @@ #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 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 @@ -120,36 +128,38 @@ #define HAL_HW_PCI_8198_DEVICE_ID 0x8198 #define HAL_HW_PCI_8190_DEVICE_ID 0x8190 #define HAL_HW_PCI_8192_DEVICE_ID 0x8192 -#define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 +#define HAL_HW_PCI_8192SE_DEVICE_ID 0x8192 #define HAL_HW_PCI_8174_DEVICE_ID 0x8174 #define HAL_HW_PCI_8173_DEVICE_ID 0x8173 #define HAL_HW_PCI_8172_DEVICE_ID 0x8172 #define HAL_HW_PCI_8171_DEVICE_ID 0x8171 -#define HAL_HW_PCI_0045_DEVICE_ID 0x0045 -#define HAL_HW_PCI_0046_DEVICE_ID 0x0046 -#define HAL_HW_PCI_0044_DEVICE_ID 0x0044 -#define HAL_HW_PCI_0047_DEVICE_ID 0x0047 -#define HAL_HW_PCI_700F_DEVICE_ID 0x700F -#define HAL_HW_PCI_701F_DEVICE_ID 0x701F -#define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304 +#define HAL_HW_PCI_0045_DEVICE_ID 0x0045 +#define HAL_HW_PCI_0046_DEVICE_ID 0x0046 +#define HAL_HW_PCI_0044_DEVICE_ID 0x0044 +#define HAL_HW_PCI_0047_DEVICE_ID 0x0047 +#define HAL_HW_PCI_700F_DEVICE_ID 0x700F +#define HAL_HW_PCI_701F_DEVICE_ID 0x701F +#define HAL_HW_PCI_DLINK_DEVICE_ID 0x3304 #define HAL_HW_PCI_8192CET_DEVICE_ID 0x8191 -#define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178 -#define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177 -#define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176 -#define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 -#define HAL_HW_PCI_8192DE_DEVICE_ID 0x092D -#define HAL_HW_PCI_8192DU_DEVICE_ID 0x092D +#define HAL_HW_PCI_8192CE_DEVICE_ID 0x8178 +#define HAL_HW_PCI_8191CE_DEVICE_ID 0x8177 +#define HAL_HW_PCI_8188CE_DEVICE_ID 0x8176 +#define HAL_HW_PCI_8192CU_DEVICE_ID 0x8191 +#define HAL_HW_PCI_8192DE_DEVICE_ID 0x092D +#define HAL_HW_PCI_8192DU_DEVICE_ID 0x092D #define RTL819X_DEFAULT_RF_TYPE RF_1T2R #define RTLLIB_WATCH_DOG_TIME 2000 -#define MAX_DEV_ADDR_SIZE 8 /* support till 64 bit bus width OS */ +#define MAX_DEV_ADDR_SIZE 8 /*support till 64 bit bus width OS*/ #define MAX_FIRMWARE_INFORMATION_SIZE 32 #define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE) #define ENCRYPTION_MAX_OVERHEAD 128 #define MAX_FRAGMENT_COUNT 8 -#define MAX_TRANSMIT_BUFFER_SIZE (1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT) +#define MAX_TRANSMIT_BUFFER_SIZE \ + (1600 + (MAX_802_11_HEADER_LENGTH + ENCRYPTION_MAX_OVERHEAD) * \ + MAX_FRAGMENT_COUNT) #define scrclng 4 @@ -164,13 +174,13 @@ #define PHY_RSSI_SLID_WIN_MAX 100 -#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 +#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) -#define TxBBGainTableLength 37 -#define CCKTxBBGainTableLength 23 +#define TxBBGainTableLength 37 +#define CCKTxBBGainTableLength 23 #define CHANNEL_PLAN_LEN 10 -#define sCrcLng 4 +#define sCrcLng 4 #define NIC_SEND_HANG_THRESHOLD_NORMAL 4 #define NIC_SEND_HANG_THRESHOLD_POWERSAVE 8 @@ -179,30 +189,30 @@ #define MAX_RX_QUEUE 1 -#define MAX_RX_COUNT 64 -#define MAX_TX_QUEUE_COUNT 9 +#define MAX_RX_COUNT 64 +#define MAX_TX_QUEUE_COUNT 9 enum RTL819x_PHY_PARAM { - RTL819X_PHY_MACPHY_REG = 0, - RTL819X_PHY_MACPHY_REG_PG = 1, - RTL8188C_PHY_MACREG =2, - RTL8192C_PHY_MACREG =3, + RTL819X_PHY_MACPHY_REG = 0, + RTL819X_PHY_MACPHY_REG_PG = 1, + RTL8188C_PHY_MACREG = 2, + RTL8192C_PHY_MACREG = 3, RTL819X_PHY_REG = 4, RTL819X_PHY_REG_1T2R = 5, - RTL819X_PHY_REG_to1T1R = 6, - RTL819X_PHY_REG_to1T2R = 7, - RTL819X_PHY_REG_to2T2R = 8, + RTL819X_PHY_REG_to1T1R = 6, + RTL819X_PHY_REG_to1T2R = 7, + RTL819X_PHY_REG_to2T2R = 8, RTL819X_PHY_REG_PG = 9, RTL819X_AGC_TAB = 10, - RTL819X_PHY_RADIO_A =11, - RTL819X_PHY_RADIO_A_1T =12, - RTL819X_PHY_RADIO_A_2T =13, - RTL819X_PHY_RADIO_B =14, - RTL819X_PHY_RADIO_B_GM =15, - RTL819X_PHY_RADIO_C =16, - RTL819X_PHY_RADIO_D =17, - RTL819X_EEPROM_MAP =18, - RTL819X_EFUSE_MAP =19, + RTL819X_PHY_RADIO_A = 11, + RTL819X_PHY_RADIO_A_1T = 12, + RTL819X_PHY_RADIO_A_2T = 13, + RTL819X_PHY_RADIO_B = 14, + RTL819X_PHY_RADIO_B_GM = 15, + RTL819X_PHY_RADIO_C = 16, + RTL819X_PHY_RADIO_D = 17, + RTL819X_EEPROM_MAP = 18, + RTL819X_EFUSE_MAP = 19, }; enum RTL_DEBUG { @@ -212,27 +222,27 @@ enum RTL_DEBUG { COMP_RECV = BIT3, COMP_SEND = BIT4, COMP_CMD = BIT5, - COMP_POWER = BIT6, - COMP_EPROM = BIT7, + COMP_POWER = BIT6, + COMP_EPROM = BIT7, COMP_SWBW = BIT8, COMP_SEC = BIT9, COMP_LPS = BIT10, COMP_QOS = BIT11, COMP_RATE = BIT12, - COMP_RXDESC = BIT13, + COMP_RXDESC = BIT13, COMP_PHY = BIT14, COMP_DIG = BIT15, COMP_TXAGC = BIT16, - COMP_HALDM = BIT17, + COMP_HALDM = BIT17, COMP_POWER_TRACKING = BIT18, - COMP_CH = BIT19, - COMP_RF = BIT20, - COMP_FIRMWARE = BIT21, - COMP_HT = BIT22, + COMP_CH = BIT19, + COMP_RF = BIT20, + COMP_FIRMWARE = BIT21, + COMP_HT = BIT22, COMP_RESET = BIT23, - COMP_CMDPKT = BIT24, + COMP_CMDPKT = BIT24, COMP_SCAN = BIT25, - COMP_PS = BIT26, + COMP_PS = BIT26, COMP_DOWN = BIT27, COMP_INTR = BIT28, COMP_LED = BIT29, @@ -245,11 +255,11 @@ enum nic_t { NIC_8192E = 1, NIC_8190P = 2, NIC_8192SE = 4, - NIC_8192CE = 5, - NIC_8192CU = 6, - NIC_8192DE = 7, - NIC_8192DU = 8, - }; + NIC_8192CE = 5, + NIC_8192CU = 6, + NIC_8192DE = 7, + NIC_8192DU = 8, +}; enum rt_eeprom_type { EEPROM_93C46, @@ -258,7 +268,7 @@ enum rt_eeprom_type { }; enum dcmg_txcmd_op { - TXCMD_TXRA_HISTORY_CTRL = 0xFF900000, + TXCMD_TXRA_HISTORY_CTRL = 0xFF900000, TXCMD_RESET_TX_PKT_BUFF = 0xFF900001, TXCMD_RESET_RX_PKT_BUFF = 0xFF900002, TXCMD_SET_TX_DURATION = 0xFF900003, @@ -268,18 +278,18 @@ enum dcmg_txcmd_op { }; enum rt_rf_type_819xu { - RF_TYPE_MIN = 0, - RF_8225, - RF_8256, - RF_8258, - RF_6052=4, - RF_PSEUDO_11N = 5, + RF_TYPE_MIN = 0, + RF_8225, + RF_8256, + RF_8258, + RF_6052 = 4, + RF_PSEUDO_11N = 5, }; enum rf_step { - RF_STEP_INIT = 0, - RF_STEP_NORMAL, - RF_STEP_MAX + RF_STEP_INIT = 0, + RF_STEP_NORMAL, + RF_STEP_MAX }; enum rt_status { @@ -290,32 +300,32 @@ enum rt_status { }; enum rt_customer_id { - RT_CID_DEFAULT = 0, + RT_CID_DEFAULT = 0, RT_CID_8187_ALPHA0 = 1, RT_CID_8187_SERCOMM_PS = 2, RT_CID_8187_HW_LED = 3, RT_CID_8187_NETGEAR = 4, - RT_CID_WHQL = 5, + RT_CID_WHQL = 5, RT_CID_819x_CAMEO = 6, RT_CID_819x_RUNTOP = 7, RT_CID_819x_Senao = 8, - RT_CID_TOSHIBA = 9, + RT_CID_TOSHIBA = 9, RT_CID_819x_Netcore = 10, - RT_CID_Nettronix = 11, - RT_CID_DLINK = 12, - RT_CID_PRONET = 13, - RT_CID_COREGA = 14, + RT_CID_Nettronix = 11, + RT_CID_DLINK = 12, + RT_CID_PRONET = 13, + RT_CID_COREGA = 14, RT_CID_819x_ALPHA = 15, RT_CID_819x_Sitecom = 16, - RT_CID_CCX = 17, + RT_CID_CCX = 17, RT_CID_819x_Lenovo = 18, - RT_CID_819x_QMI = 19, + RT_CID_819x_QMI = 19, RT_CID_819x_Edimax_Belkin = 20, RT_CID_819x_Sercomm_Belkin = 21, RT_CID_819x_CAMEO1 = 22, RT_CID_819x_MSI = 23, RT_CID_819x_Acer = 24, - RT_CID_819x_HP =27, + RT_CID_819x_HP = 27, RT_CID_819x_CLEVO = 28, RT_CID_819x_Arcadyan_Belkin = 29, RT_CID_819x_SAMSUNG = 30, @@ -329,8 +339,8 @@ enum reset_type { }; enum ic_inferiority_8192s { - IC_INFERIORITY_A = 0, - IC_INFERIORITY_B = 1, + IC_INFERIORITY_A = 0, + IC_INFERIORITY_B = 1, }; enum pci_bridge_vendor { @@ -350,20 +360,20 @@ struct buffer { }; struct rtl_reg_debug { - unsigned int cmd; - struct { - unsigned char type; - unsigned char addr; - unsigned char page; - unsigned char length; - } head; - unsigned char buf[0xff]; + unsigned int cmd; + struct { + unsigned char type; + unsigned char addr; + unsigned char page; + unsigned char length; + } head; + unsigned char buf[0xff]; }; struct rt_tx_rahis { - u32 cck[4]; - u32 ofdm[8]; - u32 ht_mcs[4][16]; + u32 cck[4]; + u32 ofdm[8]; + u32 ht_mcs[4][16]; }; struct rt_smooth_data_4rf { @@ -449,7 +459,7 @@ struct rt_stats { unsigned long txerrunicast; unsigned long txretrycount; unsigned long txfeedbackretry; - u8 last_packet_rate; + u8 last_packet_rate; unsigned long slide_signal_strength[100]; unsigned long slide_evm[100]; unsigned long slide_rssi_total; @@ -496,51 +506,63 @@ struct ccktxbbgain { }; struct init_gain { - u8 xaagccore1; - u8 xbagccore1; - u8 xcagccore1; - u8 xdagccore1; - u8 cca; + u8 xaagccore1; + u8 xbagccore1; + u8 xcagccore1; + u8 xdagccore1; + u8 cca; }; struct tx_ring { - u32 * desc; + u32 *desc; u8 nStuckCount; - struct tx_ring * next; + struct tx_ring *next; } __packed; struct rtl8192_tx_ring { - struct tx_desc *desc; - dma_addr_t dma; - unsigned int idx; - unsigned int entries; - struct sk_buff_head queue; + struct tx_desc *desc; + dma_addr_t dma; + unsigned int idx; + unsigned int entries; + struct sk_buff_head queue; }; -struct rtl819x_ops{ +struct rtl819x_ops { enum nic_t nic_type; - void (* get_eeprom_size)(struct net_device* dev); - void (* init_adapter_variable)(struct net_device* dev); - void (* init_before_adapter_start)(struct net_device* dev); - bool (* initialize_adapter)(struct net_device* dev); - void (*link_change)(struct net_device* dev); - void (* tx_fill_descriptor)(struct net_device* dev, struct tx_desc *tx_desc, struct cb_desc *cb_desc, struct sk_buff *skb); - void (* tx_fill_cmd_descriptor)(struct net_device* dev, struct tx_desc_cmd * entry, struct cb_desc *cb_desc, struct sk_buff *skb); - bool (* rx_query_status_descriptor)(struct net_device* dev, struct rtllib_rx_stats* stats, struct rx_desc *pdesc, struct sk_buff* skb); - bool (* rx_command_packet_handler)(struct net_device *dev, struct sk_buff* skb, struct rx_desc *pdesc); - void (* stop_adapter)(struct net_device *dev, bool reset); - void (* update_ratr_table)(struct net_device* dev); - void (* irq_enable)(struct net_device* dev); - void (* irq_disable)(struct net_device* dev); - void (* irq_clear)(struct net_device* dev); - void (* rx_enable)(struct net_device* dev); - void (* tx_enable)(struct net_device* dev); - void (* interrupt_recognized)(struct net_device *dev, u32 *p_inta, u32 *p_intb); - bool (* TxCheckStuckHandler)(struct net_device* dev); - bool (* RxCheckStuckHandler)(struct net_device* dev); + void (*get_eeprom_size)(struct net_device *dev); + void (*init_adapter_variable)(struct net_device *dev); + void (*init_before_adapter_start)(struct net_device *dev); + bool (*initialize_adapter)(struct net_device *dev); + void (*link_change)(struct net_device *dev); + void (*tx_fill_descriptor)(struct net_device *dev, + struct tx_desc *tx_desc, + struct cb_desc *cb_desc, + struct sk_buff *skb); + void (*tx_fill_cmd_descriptor)(struct net_device *dev, + struct tx_desc_cmd *entry, + struct cb_desc *cb_desc, + struct sk_buff *skb); + bool (*rx_query_status_descriptor)(struct net_device *dev, + struct rtllib_rx_stats *stats, + struct rx_desc *pdesc, + struct sk_buff *skb); + bool (*rx_command_packet_handler)(struct net_device *dev, + struct sk_buff *skb, + struct rx_desc *pdesc); + void (*stop_adapter)(struct net_device *dev, bool reset); + void (*update_ratr_table)(struct net_device *dev); + void (*irq_enable)(struct net_device *dev); + void (*irq_disable)(struct net_device *dev); + void (*irq_clear)(struct net_device *dev); + void (*rx_enable)(struct net_device *dev); + void (*tx_enable)(struct net_device *dev); + void (*interrupt_recognized)(struct net_device *dev, + u32 *p_inta, u32 *p_intb); + bool (*TxCheckStuckHandler)(struct net_device *dev); + bool (*RxCheckStuckHandler)(struct net_device *dev); }; struct r8192_priv { @@ -630,8 +652,8 @@ struct r8192_priv { struct iw_statistics wstats; struct proc_dir_entry *dir_dev; - short (*rf_set_sens)(struct net_device *dev,short sens); - u8 (*rf_set_chan)(struct net_device *dev,u8 ch); + short (*rf_set_sens)(struct net_device *dev, short sens); + u8 (*rf_set_chan)(struct net_device *dev, u8 ch); void (*rf_close)(struct net_device *dev); void (*rf_init)(struct net_device *dev); @@ -672,227 +694,229 @@ struct r8192_priv { /**********************************************************/ - enum card_type {PCI,MINIPCI,CARDBUS,USB}card_type; + enum card_type { + PCI, MINIPCI, + CARDBUS, USB + } card_type; struct work_struct qos_activate; - u8 bIbssCoordinator; + u8 bIbssCoordinator; short promisc; short crcmon; - int txbeaconcount; + int txbeaconcount; short chan; short sens; short max_sens; - u32 rx_prevlen; + u32 rx_prevlen; - u8 ScanDelay; - bool ps_force; + u8 ScanDelay; + bool ps_force; - u32 irq_mask[2]; + u32 irq_mask[2]; - u8 Rf_Mode; + u8 Rf_Mode; enum nic_t card_8192; - u8 card_8192_version; + u8 card_8192_version; short enable_gpio0; - u8 rf_type; - u8 IC_Cut; - char nick[IW_ESSID_MAX_SIZE + 1]; - - u8 RegBcnCtrlVal; - bool bHwAntDiv; + u8 rf_type; + u8 IC_Cut; + char nick[IW_ESSID_MAX_SIZE + 1]; - bool bTKIPinNmodeFromReg; - bool bWEPinNmodeFromReg; + u8 RegBcnCtrlVal; + bool bHwAntDiv; - bool bLedOpenDrain; + bool bTKIPinNmodeFromReg; + bool bWEPinNmodeFromReg; - u8 check_roaming_cnt; + bool bLedOpenDrain; - bool bIgnoreSilentReset; - u32 SilentResetRxSoltNum; - u32 SilentResetRxSlotIndex; - u32 SilentResetRxStuckEvent[MAX_SILENT_RESET_RX_SLOT_NUM]; + u8 check_roaming_cnt; - void *scan_cmd; - u8 hwscan_bw_40; + bool bIgnoreSilentReset; + u32 SilentResetRxSoltNum; + u32 SilentResetRxSlotIndex; + u32 SilentResetRxStuckEvent[MAX_SILENT_RESET_RX_SLOT_NUM]; - u16 nrxAMPDU_size; - u8 nrxAMPDU_aggr_num; + void *scan_cmd; + u8 hwscan_bw_40; - u32 last_rxdesc_tsf_high; - u32 last_rxdesc_tsf_low; + u16 nrxAMPDU_size; + u8 nrxAMPDU_aggr_num; + u32 last_rxdesc_tsf_high; + u32 last_rxdesc_tsf_low; - u16 basic_rate; - u8 short_preamble; - u8 dot11CurrentPreambleMode; - u8 slot_time; - u16 SifsTime; + u16 basic_rate; + u8 short_preamble; + u8 dot11CurrentPreambleMode; + u8 slot_time; + u16 SifsTime; - u8 RegWirelessMode; + u8 RegWirelessMode; - u8 firmware_version; - u16 FirmwareSubVersion; - u16 rf_pathmap; - bool AutoloadFailFlag; + u8 firmware_version; + u16 FirmwareSubVersion; + u16 rf_pathmap; + bool AutoloadFailFlag; - u8 RegPciASPM; - u8 RegAMDPciASPM; - u8 RegHwSwRfOffD3; - u8 RegSupportPciASPM; - bool bSupportASPM; + u8 RegPciASPM; + u8 RegAMDPciASPM; + u8 RegHwSwRfOffD3; + u8 RegSupportPciASPM; + bool bSupportASPM; - u32 RfRegChnlVal[2]; + u32 RfRegChnlVal[2]; - u8 ShowRateMode; - u8 RATRTableBitmap; + u8 ShowRateMode; + u8 RATRTableBitmap; - u8 EfuseMap[2][HWSET_MAX_SIZE_92S]; - u16 EfuseUsedBytes; - u8 EfuseUsedPercentage; + u8 EfuseMap[2][HWSET_MAX_SIZE_92S]; + u16 EfuseUsedBytes; + u8 EfuseUsedPercentage; short epromtype; - u16 eeprom_vid; - u16 eeprom_did; - u16 eeprom_svid; - u16 eeprom_smid; - u8 eeprom_CustomerID; - u16 eeprom_ChannelPlan; - u8 eeprom_version; - - u8 EEPROMRegulatory; - u8 EEPROMPwrGroup[2][3]; - u8 EEPROMOptional; - - u8 EEPROMTxPowerLevelCCK[14]; - u8 EEPROMTxPowerLevelOFDM24G[14]; - u8 EEPROMTxPowerLevelOFDM5G[24]; - u8 EEPROMRfACCKChnl1TxPwLevel[3]; - u8 EEPROMRfAOfdmChnlTxPwLevel[3]; - u8 EEPROMRfCCCKChnl1TxPwLevel[3]; - u8 EEPROMRfCOfdmChnlTxPwLevel[3]; - u16 EEPROMTxPowerDiff; - u16 EEPROMAntPwDiff; - u8 EEPROMThermalMeter; - u8 EEPROMPwDiff; - u8 EEPROMCrystalCap; - - u8 EEPROMBluetoothCoexist; - u8 EEPROMBluetoothType; - u8 EEPROMBluetoothAntNum; - u8 EEPROMBluetoothAntIsolation; - u8 EEPROMBluetoothRadioShared; - - - u8 EEPROMSupportWoWLAN; - u8 EEPROMBoardType; - u8 EEPROM_Def_Ver; - u8 EEPROMHT2T_TxPwr[6]; - u8 EEPROMTSSI_A; - u8 EEPROMTSSI_B; - u8 EEPROMTxPowerLevelCCK_V1[3]; - u8 EEPROMLegacyHTTxPowerDiff; - - u8 BluetoothCoexist; - - u8 CrystalCap; - u8 ThermalMeter[2]; - - u16 FwCmdIOMap; - u32 FwCmdIOParam; - - u8 SwChnlInProgress; - u8 SwChnlStage; - u8 SwChnlStep; - u8 SetBWModeInProgress; - - u8 nCur40MhzPrimeSC; - - u32 RfReg0Value[4]; - u8 NumTotalRFPath; - bool brfpath_rxenable[4]; - - bool bTXPowerDataReadFromEEPORM; - - u16 RegChannelPlan; - u16 ChannelPlan; - bool bChnlPlanFromHW; - - bool RegRfOff; - bool isRFOff; - bool bInPowerSaveMode; - u8 bHwRfOffAction; - - bool aspm_clkreq_enable; - u32 pci_bridge_vendor; - u8 RegHostPciASPMSetting; - u8 RegDevicePciASPMSetting; - - bool RFChangeInProgress; - bool SetRFPowerStateInProgress; - bool bdisable_nic; - - u8 pwrGroupCnt; - - u8 ThermalValue_LCK; - u8 ThermalValue_IQK; - bool bRfPiEnable; - - u32 APKoutput[2][2]; - bool bAPKdone; - - long RegE94; - long RegE9C; - long RegEB4; - long RegEBC; - - u32 RegC04; - u32 Reg874; - u32 RegC08; - u32 ADDA_backup[16]; - u32 IQK_MAC_backup[3]; - - bool SetFwCmdInProgress; - u8 CurrentFwCmdIO; - - u8 rssi_level; - - bool bInformFWDriverControlDM; - u8 PwrGroupHT20[2][14]; - u8 PwrGroupHT40[2][14]; - - u8 ThermalValue; - long EntryMinUndecoratedSmoothedPWDB; - long EntryMaxUndecoratedSmoothedPWDB; - u8 DynamicTxHighPowerLvl; - u8 LastDTPLvl; - u32 CurrentRATR0; + u16 eeprom_vid; + u16 eeprom_did; + u16 eeprom_svid; + u16 eeprom_smid; + u8 eeprom_CustomerID; + u16 eeprom_ChannelPlan; + u8 eeprom_version; + + u8 EEPROMRegulatory; + u8 EEPROMPwrGroup[2][3]; + u8 EEPROMOptional; + + u8 EEPROMTxPowerLevelCCK[14]; + u8 EEPROMTxPowerLevelOFDM24G[14]; + u8 EEPROMTxPowerLevelOFDM5G[24]; + u8 EEPROMRfACCKChnl1TxPwLevel[3]; + u8 EEPROMRfAOfdmChnlTxPwLevel[3]; + u8 EEPROMRfCCCKChnl1TxPwLevel[3]; + u8 EEPROMRfCOfdmChnlTxPwLevel[3]; + u16 EEPROMTxPowerDiff; + u16 EEPROMAntPwDiff; + u8 EEPROMThermalMeter; + u8 EEPROMPwDiff; + u8 EEPROMCrystalCap; + + u8 EEPROMBluetoothCoexist; + u8 EEPROMBluetoothType; + u8 EEPROMBluetoothAntNum; + u8 EEPROMBluetoothAntIsolation; + u8 EEPROMBluetoothRadioShared; + + + u8 EEPROMSupportWoWLAN; + u8 EEPROMBoardType; + u8 EEPROM_Def_Ver; + u8 EEPROMHT2T_TxPwr[6]; + u8 EEPROMTSSI_A; + u8 EEPROMTSSI_B; + u8 EEPROMTxPowerLevelCCK_V1[3]; + u8 EEPROMLegacyHTTxPowerDiff; + + u8 BluetoothCoexist; + + u8 CrystalCap; + u8 ThermalMeter[2]; + + u16 FwCmdIOMap; + u32 FwCmdIOParam; + + u8 SwChnlInProgress; + u8 SwChnlStage; + u8 SwChnlStep; + u8 SetBWModeInProgress; + + u8 nCur40MhzPrimeSC; + + u32 RfReg0Value[4]; + u8 NumTotalRFPath; + bool brfpath_rxenable[4]; + + bool bTXPowerDataReadFromEEPORM; + + u16 RegChannelPlan; + u16 ChannelPlan; + bool bChnlPlanFromHW; + + bool RegRfOff; + bool isRFOff; + bool bInPowerSaveMode; + u8 bHwRfOffAction; + + bool aspm_clkreq_enable; + u32 pci_bridge_vendor; + u8 RegHostPciASPMSetting; + u8 RegDevicePciASPMSetting; + + bool RFChangeInProgress; + bool SetRFPowerStateInProgress; + bool bdisable_nic; + + u8 pwrGroupCnt; + + u8 ThermalValue_LCK; + u8 ThermalValue_IQK; + bool bRfPiEnable; + + u32 APKoutput[2][2]; + bool bAPKdone; + + long RegE94; + long RegE9C; + long RegEB4; + long RegEBC; + + u32 RegC04; + u32 Reg874; + u32 RegC08; + u32 ADDA_backup[16]; + u32 IQK_MAC_backup[3]; + + bool SetFwCmdInProgress; + u8 CurrentFwCmdIO; + + u8 rssi_level; + + bool bInformFWDriverControlDM; + u8 PwrGroupHT20[2][14]; + u8 PwrGroupHT40[2][14]; + + u8 ThermalValue; + long EntryMinUndecoratedSmoothedPWDB; + long EntryMaxUndecoratedSmoothedPWDB; + u8 DynamicTxHighPowerLvl; + u8 LastDTPLvl; + u32 CurrentRATR0; struct false_alarm_stats FalseAlmCnt; - u8 DMFlag; - u8 DM_Type; - - u8 CckPwEnl; - u16 TSSI_13dBm; - u32 Pwr_Track; - u8 CCKPresentAttentuation_20Mdefault; - u8 CCKPresentAttentuation_40Mdefault; - char CCKPresentAttentuation_difference; - char CCKPresentAttentuation; - u8 bCckHighPower; - long undecorated_smoothed_pwdb; - long undecorated_smoothed_cck_adc_pwdb[4]; - - u32 MCSTxPowerLevelOriginalOffset[6]; - u32 CCKTxPowerLevelOriginalOffset; - u8 TxPowerLevelCCK[14]; - u8 TxPowerLevelCCK_A[14]; - u8 TxPowerLevelCCK_C[14]; + u8 DMFlag; + u8 DM_Type; + + u8 CckPwEnl; + u16 TSSI_13dBm; + u32 Pwr_Track; + u8 CCKPresentAttentuation_20Mdefault; + u8 CCKPresentAttentuation_40Mdefault; + char CCKPresentAttentuation_difference; + char CCKPresentAttentuation; + u8 bCckHighPower; + long undecorated_smoothed_pwdb; + long undecorated_smoothed_cck_adc_pwdb[4]; + + u32 MCSTxPowerLevelOriginalOffset[6]; + u32 CCKTxPowerLevelOriginalOffset; + u8 TxPowerLevelCCK[14]; + u8 TxPowerLevelCCK_A[14]; + u8 TxPowerLevelCCK_C[14]; u8 TxPowerLevelOFDM24G[14]; u8 TxPowerLevelOFDM5G[14]; u8 TxPowerLevelOFDM24G_A[14]; @@ -962,7 +986,7 @@ struct r8192_priv { u8 framesyncMonitor; bool bDMInitialGainEnable; - bool MutualAuthenticationFail; + bool MutualAuthenticationFail; bool bDisableFrameBursting; @@ -1016,41 +1040,42 @@ struct r8192_priv { extern const struct ethtool_ops rtl819x_ethtool_ops; void rtl8192_tx_cmd(struct net_device *dev, struct sk_buff *skb); -short rtl8192_tx(struct net_device *dev, struct sk_buff* skb); +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) ; -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); +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) ; -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); +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); void force_pci_posting(struct net_device *dev); void rtl8192_rx_enable(struct net_device *); void rtl8192_tx_enable(struct net_device *); -int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev); -void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate); +int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); +void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, + int rate); void rtl8192_data_hard_stop(struct net_device *dev); void rtl8192_data_hard_resume(struct net_device *dev); void rtl8192_restart(void *data); void rtl819x_watchdog_wqcallback(void *data); -void rtl8192_hw_sleep_wq (void *data); +void rtl8192_hw_sleep_wq(void *data); void watch_dog_timer_callback(unsigned long data); void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); void rtl8192_irq_tx_tasklet(struct r8192_priv *priv); -int rtl8192_down(struct net_device *dev,bool shutdownrf); +int rtl8192_down(struct net_device *dev, bool shutdownrf); int rtl8192_up(struct net_device *dev); void rtl8192_commit(struct net_device *dev); -void rtl8192_set_chan(struct net_device *dev,short ch); +void rtl8192_set_chan(struct net_device *dev, short ch); void check_rfctrl_gpio_timer(unsigned long data); @@ -1059,44 +1084,42 @@ irqreturn_type rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs); short rtl8192_pci_initdescring(struct net_device *dev); -void rtl8192_cancel_deferred_work(struct r8192_priv * priv); +void rtl8192_cancel_deferred_work(struct r8192_priv *priv); -int _rtl8192_up(struct net_device *dev,bool is_silent_reset); +int _rtl8192_up(struct net_device *dev, bool is_silent_reset); short rtl8192_is_tx_queue_empty(struct net_device *dev); void rtl8192_irq_disable(struct net_device *dev); void rtl8192_tx_timeout(struct net_device *dev); void rtl8192_pci_resetdescring(struct net_device *dev); -void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode); +void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode); void rtl8192_irq_enable(struct net_device *dev); -void rtl8192_config_rate(struct net_device* dev, u16* rate_config); -void rtl8192_update_cap(struct net_device* dev, u16 cap); +void rtl8192_config_rate(struct net_device *dev, u16 *rate_config); +void rtl8192_update_cap(struct net_device *dev, u16 cap); void rtl8192_irq_disable(struct net_device *dev); -void rtl819x_UpdateRxPktTimeStamp (struct net_device *dev, struct rtllib_rx_stats *stats); -long rtl819x_translate_todbm(struct r8192_priv * priv, u8 signal_strength_index ); -void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv * priv,struct rtllib_rx_stats * pprevious_stats); +void rtl819x_UpdateRxPktTimeStamp(struct net_device *dev, + struct rtllib_rx_stats *stats); +long rtl819x_translate_todbm(struct r8192_priv *priv, u8 signal_strength_index); +void rtl819x_update_rxsignalstatistics8190pci(struct r8192_priv *priv, + struct rtllib_rx_stats *pprevious_stats); u8 rtl819x_evm_dbtopercentage(char value); -void rtl819x_process_cck_rxpathsel(struct r8192_priv * priv,struct rtllib_rx_stats * pprevious_stats); -u8 rtl819x_query_rxpwrpercentage( char antpower ); -void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats * psrc_stats,struct rtllib_rx_stats * ptarget_stats); - -bool NicIFEnableNIC(struct net_device* dev); -bool NicIFDisableNIC(struct net_device* dev); - -bool -MgntActSet_RF_State( - struct net_device* dev, - enum rt_rf_power_state StateToSet, - RT_RF_CHANGE_SOURCE ChangeSource, - bool ProtectOrNot - ); -void -ActUpdateChannelAccessSetting( - struct net_device* dev, - enum wireless_mode WirelessMode, - struct channel_access_setting *ChnlAccessSetting - ); +void rtl819x_process_cck_rxpathsel(struct r8192_priv *priv, + struct rtllib_rx_stats *pprevious_stats); +u8 rtl819x_query_rxpwrpercentage(char antpower); +void rtl8192_record_rxdesc_forlateruse(struct rtllib_rx_stats *psrc_stats, + struct rtllib_rx_stats *ptarget_stats); + +bool NicIFEnableNIC(struct net_device *dev); +bool NicIFDisableNIC(struct net_device *dev); + +bool MgntActSet_RF_State(struct net_device *dev, + enum rt_rf_power_state StateToSet, + RT_RF_CHANGE_SOURCE ChangeSource, + bool ProtectOrNot); +void ActUpdateChannelAccessSetting(struct net_device *dev, + enum wireless_mode WirelessMode, + struct channel_access_setting *ChnlAccessSetting); #endif