diff options
Diffstat (limited to 'drivers/staging/rtl8192u/r8192U_core.c')
-rw-r--r-- | drivers/staging/rtl8192u/r8192U_core.c | 135 |
1 files changed, 34 insertions, 101 deletions
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 2821411878ce..7e2cabd16e88 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -98,8 +98,6 @@ static char *ifname = "wlan%d"; static int hwwep = 1; /* default use hw. set 0 to use software security */ static int channels = 0x3fff; - - module_param(ifname, charp, 0644); module_param(hwwep, int, 0644); module_param(channels, int, 0644); @@ -112,7 +110,6 @@ static int rtl8192_usb_probe(struct usb_interface *intf, const struct usb_device_id *id); static void rtl8192_usb_disconnect(struct usb_interface *intf); - static struct usb_driver rtl8192_usb_driver = { .name = RTL819XU_MODULE_NAME, /* Driver name */ .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ @@ -122,7 +119,6 @@ static struct usb_driver rtl8192_usb_driver = { .resume = NULL, /* PM resume fn */ }; - struct CHANNEL_LIST { u8 Channel[32]; u8 Len; @@ -207,9 +203,6 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) } } - - - static void CamResetAllEntry(struct net_device *dev) { u32 ulcommand = 0; @@ -297,7 +290,6 @@ int write_nic_byte(struct net_device *dev, int indx, u8 data) return 0; } - int write_nic_word(struct net_device *dev, int indx, u16 data) { int status; @@ -324,7 +316,6 @@ int write_nic_word(struct net_device *dev, int indx, u16 data) return 0; } - int write_nic_dword(struct net_device *dev, int indx, u32 data) { int status; @@ -343,7 +334,6 @@ int write_nic_dword(struct net_device *dev, int indx, u32 data) usbdata, 4, HZ / 2); kfree(usbdata); - if (status < 0) { netdev_err(dev, "%s TimeOut! status: %d\n", __func__, status); return status; @@ -352,8 +342,6 @@ int write_nic_dword(struct net_device *dev, int indx, u32 data) return 0; } - - int read_nic_byte(struct net_device *dev, int indx, u8 *data) { int status; @@ -379,8 +367,6 @@ int read_nic_byte(struct net_device *dev, int indx, u8 *data) return 0; } - - int read_nic_word(struct net_device *dev, int indx, u16 *data) { int status; @@ -628,13 +614,13 @@ static void rtl8192_proc_init_one(struct net_device *dev) return; proc_create_single("stats-rx", S_IFREG | S_IRUGO, dir, - proc_get_stats_rx); + proc_get_stats_rx); proc_create_single("stats-tx", S_IFREG | S_IRUGO, dir, - proc_get_stats_tx); + proc_get_stats_tx); proc_create_single("stats-ap", S_IFREG | S_IRUGO, dir, - proc_get_stats_ap); + proc_get_stats_ap); proc_create_single("registers", S_IFREG | S_IRUGO, dir, - proc_get_registers); + proc_get_registers); } static void rtl8192_proc_remove_one(struct net_device *dev) @@ -788,7 +774,6 @@ void rtl8192_set_rxconf(struct net_device *dev) rxconf = rxconf | RCR_CBSSID; } - if (priv->ieee80211->iw_mode == IW_MODE_MONITOR) { rxconf = rxconf | RCR_AICV; rxconf = rxconf | RCR_APWRMGT; @@ -797,7 +782,6 @@ void rtl8192_set_rxconf(struct net_device *dev) if (priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) rxconf = rxconf | RCR_ACRC32; - rxconf = rxconf & ~RX_FIFO_THRESHOLD_MASK; rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE << RX_FIFO_THRESHOLD_SHIFT); rxconf = rxconf & ~MAX_RX_DMA_MASK; @@ -901,13 +885,11 @@ static u32 rtl819xusb_rx_command_packet(struct net_device *dev, return status; } - static void rtl8192_data_hard_stop(struct net_device *dev) { /* FIXME !! */ } - static void rtl8192_data_hard_resume(struct net_device *dev) { /* FIXME !! */ @@ -951,7 +933,6 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; - spin_lock_irqsave(&priv->tx_lock, flags); memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); @@ -1123,7 +1104,6 @@ static void rtl8192_config_rate(struct net_device *dev, u16 *rate_config) } } - #define SHORT_SLOT_TIME 9 #define NON_SHORT_SLOT_TIME 20 @@ -1188,7 +1168,6 @@ static void rtl8192_net_update(struct net_device *dev) */ void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate) { - } short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) @@ -1232,6 +1211,8 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) return 0; DMESGE("Error TX CMD URB, error %d", status); + dev_kfree_skb(skb); + usb_free_urb(tx_urb); return -1; } @@ -1389,7 +1370,6 @@ static u8 MRateToHwRate8190Pci(u8 rate) return ret; } - static u8 QueryIsShort(u8 TxHT, u8 TxRate, struct cb_desc *tcb_desc) { u8 tmp_Short; @@ -1422,7 +1402,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) (struct tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); struct usb_device *udev = priv->udev; int pend; - int status; + int status, rt = -1; struct urb *tx_urb = NULL, *tx_urb_zero = NULL; unsigned int idx_pipe; @@ -1566,8 +1546,10 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) } if (bSend0Byte) { tx_urb_zero = usb_alloc_urb(0, GFP_ATOMIC); - if (!tx_urb_zero) - return -ENOMEM; + if (!tx_urb_zero) { + rt = -ENOMEM; + goto error; + } usb_fill_bulk_urb(tx_urb_zero, udev, usb_sndbulkpipe(udev, idx_pipe), &zero, 0, tx_zero_isr, dev); @@ -1577,7 +1559,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); - return -1; + goto error; } } netif_trans_update(dev); @@ -1588,7 +1570,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); - return -1; + +error: + dev_kfree_skb_any(skb); + usb_free_urb(tx_urb); + usb_free_urb(tx_urb_zero); + return rt; } static short rtl8192_usb_initendpoints(struct net_device *dev) @@ -1742,7 +1729,6 @@ static const struct ieee80211_qos_parameters def_qos_parameters = { {0, 0, 0, 0} /* tx_op_limit */ }; - static void rtl8192_update_beacon(struct work_struct *work) { struct r8192_priv *priv = container_of(work, struct r8192_priv, @@ -1913,15 +1899,12 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, if (set_qos_param == 1) schedule_work(&priv->qos_activate); - return 0; } - -static int rtl8192_handle_assoc_response( - struct net_device *dev, - struct ieee80211_assoc_response_frame *resp, - struct ieee80211_network *network) +static int rtl8192_handle_assoc_response(struct net_device *dev, + struct ieee80211_assoc_response_frame *resp, + struct ieee80211_network *network) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -1929,7 +1912,6 @@ static int rtl8192_handle_assoc_response( return 0; } - static void rtl8192_update_ratr_table(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -2211,14 +2193,13 @@ static void rtl8192_init_priv_lock(struct r8192_priv *priv) static void rtl819x_watchdog_wqcallback(struct work_struct *work); -static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); +static void rtl8192_irq_rx_tasklet(unsigned long data); /* init tasklet and wait_queue here. only 2.6 above kernel is considered */ #define DRV_NAME "wlan0" static void rtl8192_init_priv_task(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - INIT_WORK(&priv->reset_wq, rtl8192_restart); INIT_DELAYED_WORK(&priv->watch_dog_wq, @@ -2233,8 +2214,7 @@ static void rtl8192_init_priv_task(struct net_device *dev) InitialGainOperateWorkItemCallBack); INIT_WORK(&priv->qos_activate, rtl8192_qos_activate); - tasklet_init(&priv->irq_rx_tasklet, - (void(*)(unsigned long))rtl8192_irq_rx_tasklet, + tasklet_init(&priv->irq_rx_tasklet, rtl8192_irq_rx_tasklet, (unsigned long)priv); } @@ -2515,7 +2495,6 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) break; } - if (priv->rf_type == RF_1T2R) RT_TRACE(COMP_EPROM, "\n1T2R config\n"); else @@ -2668,7 +2647,6 @@ static void rtl8192_hwconfig(struct net_device *dev) /* Set Auto Rate fallback control */ } - /* InitializeAdapter and PhyCfg */ static bool rtl8192_adapter_start(struct net_device *dev) { @@ -2803,14 +2781,12 @@ static bool rtl8192_adapter_start(struct net_device *dev) RT_TRACE(COMP_INIT, "%s():after phy RF config\n", __func__); } - if (priv->ieee80211->FwRWRF) /* We can force firmware to do RF-R/W */ priv->Rf_Mode = RF_OP_By_FW; else priv->Rf_Mode = RF_OP_By_SW_3wire; - rtl8192_phy_updateInitGain(dev); /*--set CCK and OFDM Block "ON"--*/ rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); @@ -2865,7 +2841,6 @@ static bool rtl8192_adapter_start(struct net_device *dev) } write_nic_byte(dev, 0x87, 0x0); - return init_status; } @@ -2996,7 +2971,6 @@ static RESET_TYPE RxCheckStuck(struct net_device *dev) return RESET_TYPE_NORESET; } - /** * This function is called by Checkforhang to check whether we should * ask OS to reset driver @@ -3052,8 +3026,6 @@ static void rtl8192_cancel_deferred_work(struct r8192_priv *priv); static int _rtl8192_up(struct net_device *dev); static int rtl8192_close(struct net_device *dev); - - static void CamRestoreAllEntry(struct net_device *dev) { u8 EntryId = 0; @@ -3070,7 +3042,6 @@ static void CamRestoreAllEntry(struct net_device *dev) RT_TRACE(COMP_SEC, "%s:\n", __func__); - if ((priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP40) || (priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP104)) { for (EntryId = 0; EntryId < 4; EntryId++) { @@ -3096,8 +3067,6 @@ static void CamRestoreAllEntry(struct net_device *dev) MacAddr, 0, NULL); } - - if (priv->ieee80211->group_key_type == KEY_TYPE_TKIP) { MacAddr = CAM_CONST_BROAD; for (EntryId = 1; EntryId < 4; EntryId++) { @@ -3134,7 +3103,6 @@ static void rtl819x_ifsilentreset(struct net_device *dev) int reset_status = 0; struct ieee80211_device *ieee = priv->ieee80211; - /* If we need to check CCK stop, please uncomment this line. */ /* bStuck = Adapter->HalFunc.CheckHWStopHandler(Adapter); */ @@ -3258,7 +3226,6 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, } } - static void rtl819x_watchdog_wqcallback(struct work_struct *work) { struct delayed_work *dwork = to_delayed_work(work); @@ -3369,7 +3336,6 @@ static int _rtl8192_up(struct net_device *dev) return 0; } - static int rtl8192_open(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -3381,7 +3347,6 @@ static int rtl8192_open(struct net_device *dev) return ret; } - int rtl8192_up(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -3392,7 +3357,6 @@ int rtl8192_up(struct net_device *dev) return _rtl8192_up(dev); } - static int rtl8192_close(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -3440,7 +3404,6 @@ int rtl8192_down(struct net_device *dev) deinit_hal_dm(dev); del_timer_sync(&priv->watch_dog_timer); - ieee80211_softmac_stop_protocol(priv->ieee80211); memset(&priv->ieee80211->current_network, 0, offsetof(struct ieee80211_network, list)); @@ -3449,7 +3412,6 @@ int rtl8192_down(struct net_device *dev) return 0; } - void rtl8192_commit(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -3495,7 +3457,6 @@ static void r8192_set_multicast(struct net_device *dev) priv->promisc = promisc; } - static int r8192_set_mac_adr(struct net_device *dev, void *mac) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -3525,7 +3486,6 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) mutex_lock(&priv->wx_mutex); - if (p->length < sizeof(struct ieee_param) || !p->pointer) { ret = -EINVAL; goto out; @@ -3778,7 +3738,6 @@ static long rtl819x_translate_todbm(u8 signal_strength_index) return signal_power; } - /* We can not declare RSSI/EVM total value of sliding window to * be a local static. Otherwise, it may increase when we return from S3/S4. The * value will be kept in memory or disk. Declare the value in the adaptor @@ -3841,7 +3800,6 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (!bcheck) return; - /* only rtl8190 supported * rtl8190_process_cck_rxpathsel(priv,pprevious_stats); */ @@ -3851,17 +3809,15 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, /* record the general signal strength to the sliding window. */ - /* <2> Showed on UI for engineering * hardware does not provide rssi information for each rf path in CCK */ if (!pprevious_stats->bIsCCK && (pprevious_stats->bPacketToSelf || pprevious_stats->bToSelfBA)) { for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) { - if (!rtl8192_phy_CheckIsLegalRFPath( - priv->ieee80211->dev, rfpath)) + if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, + rfpath)) continue; - if (priv->stats.rx_rssi_percentage[rfpath] == 0) priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath]; @@ -3881,7 +3837,6 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, } } - /* Check PWDB. */ RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", pprevious_stats->bIsCCK ? "CCK" : "OFDM", @@ -3908,7 +3863,6 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, pprevious_stats->bIsCCK ? "CCK" : "OFDM", pprevious_stats->RxPWDBAll); - if (pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { @@ -4083,7 +4037,6 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, u8 rf_rx_num = 0; u8 sq; - priv->stats.numqry_phystatus++; is_cck_rate = rx_hal_is_cck_rate(pdrvinfo); @@ -4192,8 +4145,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, else continue; - if (!rtl8192_phy_CheckIsLegalRFPath( - priv->ieee80211->dev, i)) + if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, i)) continue; rx_pwr[i] = @@ -4214,7 +4166,6 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, precord_stats->RxMIMOSignalStrength[i] = (u8)RSSI; } - /* (2)PWDB, Average PWDB calculated by hardware * (for rate adaptive) */ @@ -4259,7 +4210,6 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, evm & 0xff; } - /* record rx statistics for debug */ rxsc_sgien_exflg = pofdm_buf->rxsc_sgien_exflg; prxsc = (struct phy_ofdm_rx_status_rxsc_sgien_exintfflag *) @@ -4288,16 +4238,14 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, } } /* QueryRxPhyStatus8190Pci */ -static void rtl8192_record_rxdesc_forlateruse( - struct ieee80211_rx_stats *psrc_stats, - struct ieee80211_rx_stats *ptarget_stats) +static void rtl8192_record_rxdesc_forlateruse(struct ieee80211_rx_stats *psrc_stats, + struct ieee80211_rx_stats *ptarget_stats) { ptarget_stats->bIsAMPDU = psrc_stats->bIsAMPDU; ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU; ptarget_stats->Seq_Num = psrc_stats->Seq_Num; } - static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, struct ieee80211_rx_stats *pstats, struct rx_drvinfo_819x_usb *pdrvinfo) @@ -4341,8 +4289,6 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, bToSelfBA = true; } - - if (bpacket_match_bssid) priv->stats.numpacket_matchbssid++; if (bpacket_toself) @@ -4383,7 +4329,6 @@ UpdateReceivedRateHistogramStatistics8190(struct net_device *dev, /* 1: short preamble/GI, 0: long preamble/GI */ u32 preamble_guardinterval; - if (stats->bCRC) rcvType = 2; else if (stats->bICV) @@ -4491,7 +4436,6 @@ UpdateReceivedRateHistogramStatistics8190(struct net_device *dev, priv->stats.received_rate_histogram[rcvType][rateIndex]++; } - static void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats, bool bIsRxAggrSubframe) @@ -4526,8 +4470,7 @@ static void query_rxdesc_status(struct sk_buff *skb, * Driver info are written to the RxBuffer following rx desc */ if (stats->RxDrvInfoSize != 0) { - driver_info = (struct rx_drvinfo_819x_usb *)( - skb->data + driver_info = (struct rx_drvinfo_819x_usb *)(skb->data + sizeof(struct rx_desc_819x_usb) + stats->RxBufShift ); @@ -4556,7 +4499,6 @@ static void query_rxdesc_status(struct sk_buff *skb, stats->bShortPreamble = driver_info->SPLCP; - UpdateReceivedRateHistogramStatistics8190(dev, stats); stats->bIsAMPDU = (driver_info->PartAggr == 1); @@ -4569,7 +4511,7 @@ static void query_rxdesc_status(struct sk_buff *skb, /* Rx A-MPDU */ if (driver_info->FirstAGGR == 1 || driver_info->PartAggr == 1) RT_TRACE(COMP_RXDESC, - "driver_info->FirstAGGR = %d, driver_info->PartAggr = %d\n", + "driver_info->FirstAGGR = %d, driver_info->PartAggr = %d\n", driver_info->FirstAGGR, driver_info->PartAggr); } @@ -4636,9 +4578,8 @@ static void rtl8192_rx_nomal(struct sk_buff *skb) } } -static void rtl819xusb_process_received_packet( - struct net_device *dev, - struct ieee80211_rx_stats *pstats) +static void rtl819xusb_process_received_packet(struct net_device *dev, + struct ieee80211_rx_stats *pstats) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -4671,8 +4612,6 @@ static void rtl819xusb_process_received_packet( #ifdef SW_CRC_CHECK SwCrcCheck(); #endif - - } static void query_rx_cmdpkt_desc_status(struct sk_buff *skb, @@ -4691,7 +4630,6 @@ static void query_rx_cmdpkt_desc_status(struct sk_buff *skb, stats->ntotalfrag = 1; } - static void rtl8192_rx_cmd(struct sk_buff *skb) { struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; @@ -4716,8 +4654,9 @@ static void rtl8192_rx_cmd(struct sk_buff *skb) } } -static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) +static void rtl8192_irq_rx_tasklet(unsigned long data) { + struct r8192_priv *priv = (struct r8192_priv *)data; struct sk_buff *skb; struct rtl8192_rx_info *info; @@ -4759,7 +4698,6 @@ static const struct net_device_ops rtl8192_netdev_ops = { .ndo_start_xmit = ieee80211_xmit, }; - /**************************************************************************** * ---------------------------- USB_STUFF--------------------------- *****************************************************************************/ @@ -4815,7 +4753,6 @@ static int rtl8192_usb_probe(struct usb_interface *intf, RT_TRACE(COMP_INIT, "dev name=======> %s\n", dev->name); rtl8192_proc_init_one(dev); - RT_TRACE(COMP_INIT, "Driver probe completed\n"); return 0; @@ -4843,7 +4780,6 @@ static void rtl8192_cancel_deferred_work(struct r8192_priv *priv) cancel_work_sync(&priv->qos_activate); } - static void rtl8192_usb_disconnect(struct usb_interface *intf) { struct net_device *dev = usb_get_intfdata(intf); @@ -4907,7 +4843,6 @@ static int __init rtl8192_usb_module_init(void) return usb_register(&rtl8192_usb_driver); } - static void __exit rtl8192_usb_module_exit(void) { usb_deregister(&rtl8192_usb_driver); @@ -4949,7 +4884,6 @@ void EnableHWSecurityConfig8192(struct net_device *dev) write_nic_byte(dev, SECR, SECR_value); } - void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent) { @@ -4970,7 +4904,6 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, else usConfig |= BIT(15) | (KeyType << 2) | KeyIndex; - for (i = 0; i < CAM_CONTENT_COUNT; i++) { TargetCommand = i + CAM_CONTENT_COUNT * EntryNo; TargetCommand |= BIT(31) | BIT(16); |