diff options
author | Raphaël Beamonte <raphael.beamonte@gmail.com> | 2015-09-20 13:14:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-20 19:16:13 -0700 |
commit | 069b3162590896352d3f3d55868667495a8ba9fb (patch) | |
tree | f784ec89a9edd0476d48334662d5ea5476060f89 /drivers/staging/rtl8192u/r8192U_core.c | |
parent | 98a52483161d5a117e137b43874fd9182492f0e8 (diff) |
staging: rtl8192u: r8192U_core: add line breaks to keep lines under 80 characters
Add line breaks in multiple lines to keep them under 80 characters,
as to follow the kernel code style.
Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u/r8192U_core.c')
-rw-r--r-- | drivers/staging/rtl8192u/r8192U_core.c | 608 |
1 files changed, 409 insertions, 199 deletions
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index d243989c7d66..28b54babf498 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -190,11 +190,14 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) min_chan = 1; max_chan = 14; } else { - RT_TRACE(COMP_ERR, "unknown rf chip, can't set channel map in function:%s()\n", __func__); + RT_TRACE(COMP_ERR, + "unknown rf chip, can't set channel map in function:%s()\n", + __func__); } if (ChannelPlan[channel_plan].Len != 0) { /* Clear old channel map */ - memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); + memset(GET_DOT11D_INFO(ieee)->channel_map, 0, + sizeof(GET_DOT11D_INFO(ieee)->channel_map)); /* Set new channel map */ for (i = 0; i < ChannelPlan[channel_plan].Len; i++) { if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan) @@ -262,7 +265,8 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) indx | 0xfe00, 0, &data, 1, HZ / 2); if (status < 0) - netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", status); + netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", + status); } int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) @@ -292,7 +296,8 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, - (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, &data, 1, HZ / 2); + (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, + &data, 1, HZ / 2); if (status < 0) netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status); @@ -311,7 +316,8 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, - (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, &data, 2, HZ / 2); + (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, + &data, 2, HZ / 2); if (status < 0) netdev_err(dev, "write_nic_word TimeOut! status: %d\n", status); @@ -329,11 +335,13 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, - (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, &data, 4, HZ / 2); + (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, + &data, 4, HZ / 2); if (status < 0) - netdev_err(dev, "write_nic_dword TimeOut! status: %d\n", status); + netdev_err(dev, "write_nic_dword TimeOut! status: %d\n", + status); } @@ -347,7 +355,8 @@ int read_nic_byte(struct net_device *dev, int indx, u8 *data) status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, - (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, data, 1, HZ / 2); + (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, + data, 1, HZ / 2); if (status < 0) { netdev_err(dev, "%s failure status: %d\n", __func__, status); @@ -619,7 +628,8 @@ static void rtl8192_proc_init_one(struct net_device *dev) if (rtl8192_proc) { dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); if (!dir) { - RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", + RT_TRACE(COMP_ERR, + "Unable to initialize /proc/net/rtl8192/%s\n", dev->name); return; } @@ -732,7 +742,8 @@ static int rtl8192_rx_initiate(struct net_device *dev) break; } usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb), + usb_rcvbulkpipe(priv->udev, 3), + skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); info = (struct rtl8192_rx_info *)skb->cb; info->urb = entry; @@ -753,7 +764,8 @@ static int rtl8192_rx_initiate(struct net_device *dev) break; } usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb), + usb_rcvbulkpipe(priv->udev, 9), + skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); info = (struct rtl8192_rx_info *)skb->cb; info->urb = entry; @@ -924,7 +936,8 @@ static void rtl8192_rx_isr(struct urb *urb) } usb_fill_bulk_urb(urb, priv->udev, - usb_rcvbulkpipe(priv->udev, out_pipe), skb_tail_pointer(skb), + usb_rcvbulkpipe(priv->udev, out_pipe), + skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); info = (struct rtl8192_rx_info *)skb->cb; @@ -937,7 +950,9 @@ static void rtl8192_rx_isr(struct urb *urb) skb_queue_tail(&priv->rx_queue, skb); err = usb_submit_urb(urb, GFP_ATOMIC); if (err && err != EPERM) - netdev_err(dev, "can not submit rxurb, err is %x, URB status is %x\n", err, urb->status); + netdev_err(dev, + "can not submit rxurb, err is %x, URB status is %x\n", + err, urb->status); } static u32 rtl819xusb_rx_command_packet(struct net_device *dev, @@ -967,7 +982,8 @@ static void rtl8192_data_hard_resume(struct net_device *dev) /* this function TX data frames when the ieee80211 stack requires this. * It checks also if we need to stop the ieee tx queue, eventually do it */ -static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) +static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, + int rate) { struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); int ret; @@ -1034,7 +1050,8 @@ static void rtl8192_tx_isr(struct urb *tx_urb) dev->trans_start = jiffies; priv->stats.txoktotal++; priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++; - priv->stats.txbytesunicast += (skb->len - priv->ieee80211->tx_headroom); + priv->stats.txbytesunicast += + (skb->len - priv->ieee80211->tx_headroom); } else { priv->ieee80211->stats.tx_errors++; /* TODO */ @@ -1067,7 +1084,8 @@ static void rtl8192_tx_isr(struct urb *tx_urb) (!(priv->ieee80211->queue_stop))) { skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index])); if (skb) - priv->ieee80211->softmac_hard_start_xmit(skb, dev); + priv->ieee80211->softmac_hard_start_xmit(skb, + dev); return; /* avoid further processing AMSDU */ } @@ -1186,7 +1204,8 @@ static void rtl8192_update_cap(struct net_device *dev, u16 cap) if (net->mode & (IEEE_G | IEEE_N_24G)) { u8 slot_time = 0; - if ((cap & WLAN_CAPABILITY_SHORT_SLOT) && (!priv->ieee80211->pHTInfo->bCurrentRT2RTLongSlotTime)) + if ((cap & WLAN_CAPABILITY_SHORT_SLOT) && + (!priv->ieee80211->pHTInfo->bCurrentRT2RTLongSlotTime)) /* short slot time */ slot_time = SHORT_SLOT_TIME; else /* long slot time */ @@ -1276,7 +1295,8 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) *--------------------------------------------------------------------- */ idx_pipe = 0x04; - usb_fill_bulk_urb(tx_urb, priv->udev, usb_sndbulkpipe(priv->udev, idx_pipe), + usb_fill_bulk_urb(tx_urb, priv->udev, + usb_sndbulkpipe(priv->udev, idx_pipe), skb->data, skb->len, rtl8192_tx_isr, skb); status = usb_submit_urb(tx_urb, GFP_ATOMIC); @@ -1333,7 +1353,9 @@ static u8 MapHwQueueToFirmwareQueue(u8 QueueID) break; default: - RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection: %d\n", QueueID); + RT_TRACE(COMP_ERR, + "TransmitTCB(): Impossible Queue Selection: %d\n", + QueueID); break; } return QueueSelect; @@ -1445,7 +1467,9 @@ static u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) { u8 tmp_Short; - tmp_Short = (TxHT == 1) ? ((tcb_desc->bUseShortGI) ? 1 : 0) : ((tcb_desc->bUseShortPreamble) ? 1 : 0); + tmp_Short = (TxHT == 1) ? + ((tcb_desc->bUseShortGI) ? 1 : 0) : + ((tcb_desc->bUseShortPreamble) ? 1 : 0); if (TxHT == 1 && TxRate != DESC90_RATEMCS15) tmp_Short = 0; @@ -1467,7 +1491,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) struct r8192_priv *priv = ieee80211_priv(dev); cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tx_desc_819x_usb *tx_desc = (tx_desc_819x_usb *)skb->data; - tx_fwinfo_819x_usb *tx_fwinfo = (tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); + tx_fwinfo_819x_usb *tx_fwinfo = + (tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); struct usb_device *udev = priv->udev; int pend; int status; @@ -1497,7 +1522,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) tx_fwinfo->TxHT = (tcb_desc->data_rate & 0x80) ? 1 : 0; tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate); tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur; - tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc); + tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, + tcb_desc); if (tcb_desc->bAMPDUEnable) { /* AMPDU enabled */ tx_fwinfo->AllowAggregation = 1; /* DWORD 1 */ @@ -1614,15 +1640,19 @@ 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) { - RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n"); + RT_TRACE(COMP_ERR, + "can't alloc urb for zero byte\n"); return -ENOMEM; } usb_fill_bulk_urb(tx_urb_zero, udev, - usb_sndbulkpipe(udev, idx_pipe), &zero, - 0, tx_zero_isr, dev); + usb_sndbulkpipe(udev, idx_pipe), + &zero, 0, tx_zero_isr, dev); status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); if (status) { - RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); + RT_TRACE(COMP_ERR, + "Error TX URB for zero byte %d, error %d", + atomic_read(&priv->tx_pending[tcb_desc->queue_index]), + status); return -1; } } @@ -1631,7 +1661,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) return 0; } - RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), + RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", + atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); return -1; } @@ -1650,7 +1681,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) priv->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); - priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); + priv->rx_urb[i]->transfer_buffer = + kmalloc(RX_URB_SIZE, GFP_KERNEL); priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; } @@ -1757,7 +1789,8 @@ static void rtl8192_link_change(struct net_device *dev) * way, but there is no chance to set this as wep will not set * group key in wext. */ - if ((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) + if (KEY_TYPE_WEP40 == ieee->pairwise_key_type || + KEY_TYPE_WEP104 == ieee->pairwise_key_type) EnableHWSecurityConfig8192(dev); } /*update timing params*/ @@ -1784,25 +1817,30 @@ static struct ieee80211_qos_parameters def_qos_parameters = { static void rtl8192_update_beacon(struct work_struct *work) { - struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); + struct r8192_priv *priv = container_of(work, struct r8192_priv, + update_beacon_wq.work); struct net_device *dev = priv->ieee80211->dev; struct ieee80211_device *ieee = priv->ieee80211; struct ieee80211_network *net = &ieee->current_network; if (ieee->pHTInfo->bCurrentHTSupport) HTUpdateSelfAndPeerSetting(ieee, net); - ieee->pHTInfo->bCurrentRT2RTLongSlotTime = net->bssht.bdRT2RTLongSlotTime; + ieee->pHTInfo->bCurrentRT2RTLongSlotTime = + net->bssht.bdRT2RTLongSlotTime; rtl8192_update_cap(dev, net->capability); } /* * background support to run QoS activate functionality */ -static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO}; +static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, + EDCAPARA_VI, EDCAPARA_VO}; static void rtl8192_qos_activate(struct work_struct *work) { - struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); + struct r8192_priv *priv = container_of(work, struct r8192_priv, + qos_activate); struct net_device *dev = priv->ieee80211->dev; - struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; + struct ieee80211_qos_parameters *qos_parameters = + &priv->ieee80211->current_network.qos_data.parameters; u8 mode = priv->ieee80211->current_network.mode; u32 u1bAIFS; u32 u4bAcParam; @@ -1814,7 +1852,8 @@ static void rtl8192_qos_activate(struct work_struct *work) mutex_lock(&priv->mutex); if (priv->ieee80211->state != IEEE80211_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"); /* It better set slot time at first * * For we just support b/g mode at present, let the slot time at @@ -1874,7 +1913,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if ((network->qos_data.active == 1) && (active_network == 1)) { queue_work(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; @@ -1939,7 +1979,9 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, spin_unlock_irqrestore(&priv->ieee80211->lock, flags); - RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n", __func__, network->flags, priv->ieee80211->current_network.qos_data.active); + RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n", __func__, + network->flags, + priv->ieee80211->current_network.qos_data.active); if (set_qos_param == 1) queue_work(priv->priv_wq, &priv->qos_activate); @@ -1948,9 +1990,10 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, } -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); @@ -1996,7 +2039,8 @@ static void rtl8192_update_ratr_table(struct net_device *dev) ratr_value &= 0x0FFFFFFF; if (ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI40MHz) ratr_value |= 0x80000000; - else if (!ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI20MHz) + else if (!ieee->pHTInfo->bCurTxBW40MHz && + ieee->pHTInfo->bCurShortGI20MHz) ratr_value |= 0x80000000; write_nic_dword(dev, RATR0 + rate_index * 4, ratr_value); write_nic_byte(dev, UFWP, 1); @@ -2017,7 +2061,9 @@ static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) /* we use connecting AP's capability instead of only security config * on our driver to distinguish whether it should use N mode or G mode */ - encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name, "WEP"))); + encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || + (ieee->host_encrypt && crypt && crypt->ops && + (0 == strcmp(crypt->ops->name, "WEP"))); /* simply judge */ if (encrypt && (wpa_ie_len == 0)) { @@ -2049,8 +2095,10 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv) /* We do not consider set support rate for ABG mode, only * HT MCS rate is set here. */ - if (ieee->mode == WIRELESS_MODE_N_24G || ieee->mode == WIRELESS_MODE_N_5G) - memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16); + if (ieee->mode == WIRELESS_MODE_N_24G || + ieee->mode == WIRELESS_MODE_N_5G) + memcpy(ieee->Regdot11HTOperationalRateSet, + ieee->RegHTSuppRateSet, 16); else memset(ieee->Regdot11HTOperationalRateSet, 0, 16); } @@ -2080,7 +2128,8 @@ static void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) struct r8192_priv *priv = ieee80211_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) { @@ -2092,7 +2141,9 @@ static 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, SupportedWirelessMode(%x)!!!\n", __func__, bSupportMode); + RT_TRACE(COMP_ERR, + "%s(), No valid wireless mode supported, SupportedWirelessMode(%x)!!!\n", + __func__, bSupportMode); wireless_mode = WIRELESS_MODE_B; } } @@ -2100,11 +2151,14 @@ static void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) /* TODO: this function doesn't work well at this time, * we should wait for FPGA */ - ActUpdateChannelAccessSetting(pAdapter, pHalData->CurrentWirelessMode, &pAdapter->MgntInfo.Info8185.ChannelAccessSetting); + ActUpdateChannelAccessSetting( + pAdapter, pHalData->CurrentWirelessMode, + &pAdapter->MgntInfo.Info8185.ChannelAccessSetting); #endif priv->ieee80211->mode = wireless_mode; - 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->ieee80211->pHTInfo->bEnableHT = 1; else priv->ieee80211->pHTInfo->bEnableHT = 0; @@ -2139,14 +2193,16 @@ static void rtl8192_init_priv_variable(struct net_device *dev) /* we don't use FW read/write RF until stable firmware is available. */ priv->ieee80211->FwRWRF = 0; - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; + priv->ieee80211->current_network.beacon_interval = + DEFAULT_BEACONINTERVAL; priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE | IEEE_SOFTMAC_BEACONS; priv->ieee80211->active_scan = 1; - priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; + priv->ieee80211->modulation = + IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; priv->ieee80211->host_encrypt = 1; priv->ieee80211->host_decrypt = 1; priv->ieee80211->start_send_beacons = NULL; @@ -2168,7 +2224,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev) priv->ieee80211->handle_beacon = rtl8192_handle_beacon; priv->ieee80211->GetNmodeSupportBySecCfg = GetNmodeSupportBySecCfg8192; - priv->ieee80211->GetHalfNmodeSupportByAPsHandler = GetHalfNmodeSupportByAPs819xUsb; + priv->ieee80211->GetHalfNmodeSupportByAPsHandler = + GetHalfNmodeSupportByAPs819xUsb; priv->ieee80211->SetWirelessMode = rtl8192_SetWirelessMode; priv->ieee80211->InitialGainHandler = InitialGain819xUsb; @@ -2196,28 +2253,29 @@ static void rtl8192_init_priv_variable(struct net_device *dev) (false ? TCR_SAT : 0); #ifdef TO_DO_LIST if (Adapter->bInHctTest) - pHalData->ReceiveConfig = pHalData->CSMethod | - /* accept management/data */ - RCR_AMF | RCR_ADF | - /* accept control frame for SW - * AP needs PS-poll - */ - RCR_ACF | - /* accept BC/MC/UC */ - RCR_AB | RCR_AM | RCR_APM | - /* accept ICV/CRC error - * packet - */ - RCR_AICV | RCR_ACRC32 | - /* Max DMA Burst Size per Tx - * DMA Burst, 7: unlimited. - */ - ((u32)7 << RCR_MXDMA_OFFSET) | - /* Rx FIFO Threshold, - * 7: No Rx threshold. - */ - (pHalData->EarlyRxThreshold << RCR_FIFO_OFFSET) | - (pHalData->EarlyRxThreshold == 7 ? RCR_OnlyErlPkt : 0); + pHalData->ReceiveConfig = + pHalData->CSMethod | + /* accept management/data */ + RCR_AMF | RCR_ADF | + /* accept control frame for SW + * AP needs PS-poll + */ + RCR_ACF | + /* accept BC/MC/UC */ + RCR_AB | RCR_AM | RCR_APM | + /* accept ICV/CRC error + * packet + */ + RCR_AICV | RCR_ACRC32 | + /* Max DMA Burst Size per Tx + * DMA Burst, 7: unlimited. + */ + ((u32)7 << RCR_MXDMA_OFFSET) | + /* Rx FIFO Threshold, + * 7: No Rx threshold. + */ + (pHalData->EarlyRxThreshold << RCR_FIFO_OFFSET) | + (pHalData->EarlyRxThreshold == 7 ? RCR_OnlyErlPkt : 0); else #endif @@ -2274,11 +2332,16 @@ static void rtl8192_init_priv_task(struct net_device *dev) INIT_WORK(&priv->reset_wq, rtl8192_restart); - INIT_DELAYED_WORK(&priv->watch_dog_wq, rtl819x_watchdog_wqcallback); - INIT_DELAYED_WORK(&priv->txpower_tracking_wq, dm_txpower_trackingcallback); - INIT_DELAYED_WORK(&priv->rfpath_check_wq, dm_rf_pathcheck_workitemcallback); - INIT_DELAYED_WORK(&priv->update_beacon_wq, rtl8192_update_beacon); - INIT_DELAYED_WORK(&priv->initialgain_operate_wq, InitialGainOperateWorkItemCallBack); + INIT_DELAYED_WORK(&priv->watch_dog_wq, + rtl819x_watchdog_wqcallback); + INIT_DELAYED_WORK(&priv->txpower_tracking_wq, + dm_txpower_trackingcallback); + INIT_DELAYED_WORK(&priv->rfpath_check_wq, + dm_rf_pathcheck_workitemcallback); + INIT_DELAYED_WORK(&priv->update_beacon_wq, + rtl8192_update_beacon); + INIT_DELAYED_WORK(&priv->initialgain_operate_wq, + InitialGainOperateWorkItemCallBack); INIT_WORK(&priv->qos_activate, rtl8192_qos_activate); tasklet_init(&priv->irq_rx_tasklet, @@ -2293,10 +2356,13 @@ static void rtl8192_get_eeprom_size(struct net_device *dev) RT_TRACE(COMP_EPROM, "===========>%s()\n", __func__); read_nic_word_E(dev, EPROM_CMD, &curCR); - RT_TRACE(COMP_EPROM, "read from Reg EPROM_CMD(%x):%x\n", EPROM_CMD, curCR); + RT_TRACE(COMP_EPROM, + "read from Reg EPROM_CMD(%x):%x\n", EPROM_CMD, curCR); /* whether need I consider BIT5? */ - priv->epromtype = (curCR & Cmd9346CR_9356SEL) ? EPROM_93c56 : EPROM_93c46; - RT_TRACE(COMP_EPROM, "<===========%s(), epromtype:%d\n", __func__, priv->epromtype); + priv->epromtype = + (curCR & Cmd9346CR_9356SEL) ? EPROM_93c56 : EPROM_93c46; + RT_TRACE(COMP_EPROM, + "<===========%s(), epromtype:%d\n", __func__, priv->epromtype); } /* used to swap endian. as ntohl & htonl are not necessary @@ -2322,7 +2388,9 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); if (wEPROM_ID != RTL8190_EEPROM_ID) - RT_TRACE(COMP_ERR, "EEPROM ID is invalid(is 0x%x(should be 0x%x)\n", wEPROM_ID, RTL8190_EEPROM_ID); + RT_TRACE(COMP_ERR, + "EEPROM ID is invalid(is 0x%x(should be 0x%x)\n", + wEPROM_ID, RTL8190_EEPROM_ID); else bLoad_From_EEPOM = true; @@ -2333,7 +2401,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) tmpValue = eprom_read(dev, EEPROM_ChannelPlan >> 1); priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8; priv->btxpowerdata_readfromEEPORM = true; - priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; + priv->eeprom_CustomerID = + eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; } else { priv->eeprom_vid = 0; priv->eeprom_pid = 0; @@ -2341,7 +2410,10 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->eeprom_ChannelPlan = 0; priv->eeprom_CustomerID = 0; } - RT_TRACE(COMP_EPROM, "vid:0x%4x, pid:0x%4x, CustomID:0x%2x, ChanPlan:0x%x\n", priv->eeprom_vid, priv->eeprom_pid, priv->eeprom_CustomerID, priv->eeprom_ChannelPlan); + RT_TRACE(COMP_EPROM, + "vid:0x%4x, pid:0x%4x, CustomID:0x%2x, ChanPlan:0x%x\n", + priv->eeprom_vid, priv->eeprom_pid, priv->eeprom_CustomerID, + priv->eeprom_ChannelPlan); /* set channelplan from eeprom */ priv->ChannelPlan = priv->eeprom_ChannelPlan; if (bLoad_From_EEPOM) { @@ -2474,7 +2546,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) /* Antenna B gain offset to antenna A, bit0~3 */ priv->AntennaTxPwDiff[0] = (priv->EEPROMTxPowerDiff & 0xf); /* Antenna C gain offset to antenna A, bit4~7 */ - priv->AntennaTxPwDiff[1] = (priv->EEPROMTxPowerDiff & 0xf0) >> 4; + priv->AntennaTxPwDiff[1] = + (priv->EEPROMTxPowerDiff & 0xf0) >> 4; /* CrystalCap, bit12~15 */ priv->CrystalCap = priv->EEPROMCrystalCap; /* ThermalMeter, bit0~3 for RFIC1, bit4~7 for RFIC2 @@ -2533,7 +2606,8 @@ static short rtl8192_get_channel_map(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); if (priv->ChannelPlan > COUNTRY_CODE_GLOBAL_DOMAIN) { - netdev_err(dev, "rtl8180_init: Error channel plan! Set to default.\n"); + netdev_err(dev, + "rtl8180_init: Error channel plan! Set to default.\n"); priv->ChannelPlan = 0; } RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); @@ -2622,7 +2696,8 @@ static void rtl8192_hwconfig(struct net_device *dev) #endif { regBwOpMode = BW_OPMODE_20MHZ; - regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; + regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | + RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; } break; @@ -2631,12 +2706,14 @@ static void rtl8192_hwconfig(struct net_device *dev) * out only when associated AP does not support it. */ regBwOpMode = BW_OPMODE_20MHZ; - regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; + regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | + RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; break; case WIRELESS_MODE_N_5G: regBwOpMode = BW_OPMODE_5G; - regRATR = RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; + regRATR = RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | + RATE_ALL_OFDM_2SS; regRRSR = RATE_ALL_OFDM_AG; break; } @@ -2695,7 +2772,9 @@ static bool rtl8192_adapter_start(struct net_device *dev) else if (priv->pFirmware->firmware_status == FW_STATUS_5_READY) dwRegRead |= CPU_GEN_FIRMWARE_RESET; else - RT_TRACE(COMP_ERR, "ERROR in %s(): undefined firmware state(%d)\n", __func__, priv->pFirmware->firmware_status); + RT_TRACE(COMP_ERR, + "ERROR in %s(): undefined firmware state(%d)\n", + __func__, priv->pFirmware->firmware_status); write_nic_dword(dev, CPU_GEN, dwRegRead); /* config BB. */ @@ -2706,11 +2785,14 @@ static bool rtl8192_adapter_start(struct net_device *dev) read_nic_dword(dev, CPU_GEN, &dwRegRead); if (priv->LoopbackMode == RTL819xU_NO_LOOPBACK) - dwRegRead = (dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET; + dwRegRead = (dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | + CPU_GEN_NO_LOOPBACK_SET; else if (priv->LoopbackMode == RTL819xU_MAC_LOOPBACK) dwRegRead |= CPU_CCK_LOOPBACK; else - RT_TRACE(COMP_ERR, "Serious error in %s(): wrong loopback mode setting(%d)\n", __func__, priv->LoopbackMode); + RT_TRACE(COMP_ERR, + "Serious error in %s(): wrong loopback mode setting(%d)\n", + __func__, priv->LoopbackMode); write_nic_dword(dev, CPU_GEN, dwRegRead); @@ -2735,14 +2817,17 @@ static bool rtl8192_adapter_start(struct net_device *dev) write_nic_dword(dev, RCR, priv->ReceiveConfig); /* Initialize Number of Reserved Pages in Firmware Queue */ - write_nic_dword(dev, RQPN1, NUM_OF_PAGE_IN_FW_QUEUE_BK << RSVD_FW_QUEUE_PAGE_BK_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_BE << RSVD_FW_QUEUE_PAGE_BE_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_VI << RSVD_FW_QUEUE_PAGE_VI_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_VO << RSVD_FW_QUEUE_PAGE_VO_SHIFT); - write_nic_dword(dev, RQPN2, NUM_OF_PAGE_IN_FW_QUEUE_MGNT << RSVD_FW_QUEUE_PAGE_MGNT_SHIFT | - NUM_OF_PAGE_IN_FW_QUEUE_CMD << RSVD_FW_QUEUE_PAGE_CMD_SHIFT); - write_nic_dword(dev, RQPN3, APPLIED_RESERVED_QUEUE_IN_FW | - NUM_OF_PAGE_IN_FW_QUEUE_BCN << RSVD_FW_QUEUE_PAGE_BCN_SHIFT); + write_nic_dword(dev, RQPN1, + NUM_OF_PAGE_IN_FW_QUEUE_BK << RSVD_FW_QUEUE_PAGE_BK_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_BE << RSVD_FW_QUEUE_PAGE_BE_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_VI << RSVD_FW_QUEUE_PAGE_VI_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_VO << RSVD_FW_QUEUE_PAGE_VO_SHIFT); + write_nic_dword(dev, RQPN2, + NUM_OF_PAGE_IN_FW_QUEUE_MGNT << RSVD_FW_QUEUE_PAGE_MGNT_SHIFT | + NUM_OF_PAGE_IN_FW_QUEUE_CMD << RSVD_FW_QUEUE_PAGE_CMD_SHIFT); + write_nic_dword(dev, RQPN3, + APPLIED_RESERVED_QUEUE_IN_FW | + NUM_OF_PAGE_IN_FW_QUEUE_BCN << RSVD_FW_QUEUE_PAGE_BCN_SHIFT); write_nic_dword(dev, RATR0 + 4 * 7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK)); /* Set AckTimeout */ @@ -2781,7 +2866,8 @@ static bool rtl8192_adapter_start(struct net_device *dev) /* Firmware download */ init_status = init_firmware(dev); if (!init_status) { - RT_TRACE(COMP_ERR, "ERR!!! %s(): Firmware download is failed\n", __func__); + RT_TRACE(COMP_ERR, "ERR!!! %s(): Firmware download is failed\n", + __func__); return init_status; } RT_TRACE(COMP_INIT, "%s():after firmware download\n", __func__); @@ -2789,30 +2875,42 @@ static bool rtl8192_adapter_start(struct net_device *dev) #ifdef TO_DO_LIST if (Adapter->ResetProgress == RESET_TYPE_NORESET) { if (pMgntInfo->RegRfOff) { /* User disable RF via registry. */ - RT_TRACE((COMP_INIT | COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RegRfOff ----------\n")); + RT_TRACE((COMP_INIT | COMP_RF), DBG_LOUD, + ("InitializeAdapter819xUsb(): Turn off RF for RegRfOff ----------\n")); MgntActSet_RF_State(Adapter, eRfOff, RF_CHANGE_BY_SW); /* Those actions will be discard in MgntActSet_RF_State * because of the same state */ for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) - PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); + PHY_SetRFReg(Adapter, + (RF90_RADIO_PATH_E)eRFPath, + 0x4, 0xC00, 0x0); } else if (pMgntInfo->RfOffReason > RF_CHANGE_BY_PS) { /* H/W or S/W RF OFF before sleep. */ - RT_TRACE((COMP_INIT | COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RfOffReason(%d) ----------\n", pMgntInfo->RfOffReason)); - MgntActSet_RF_State(Adapter, eRfOff, pMgntInfo->RfOffReason); + RT_TRACE((COMP_INIT | COMP_RF), DBG_LOUD, + ("InitializeAdapter819xUsb(): Turn off RF for RfOffReason(%d) ----------\n", + pMgntInfo->RfOffReason)); + MgntActSet_RF_State(Adapter, + eRfOff, + pMgntInfo->RfOffReason); } else { pHalData->eRFPowerState = eRfOn; pMgntInfo->RfOffReason = 0; - RT_TRACE((COMP_INIT | COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): RF is on ----------\n")); + RT_TRACE((COMP_INIT | COMP_RF), DBG_LOUD, + ("InitializeAdapter819xUsb(): RF is on ----------\n")); } } else { if (pHalData->eRFPowerState == eRfOff) { - MgntActSet_RF_State(Adapter, eRfOff, pMgntInfo->RfOffReason); + MgntActSet_RF_State(Adapter, + eRfOff, + pMgntInfo->RfOffReason); /* Those actions will be discard in MgntActSet_RF_State * because of the same state */ for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) - PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); + PHY_SetRFReg(Adapter, + (RF90_RADIO_PATH_E)eRFPath, + 0x4, 0xC00, 0x0); } } #endif @@ -2851,18 +2949,24 @@ static bool rtl8192_adapter_start(struct net_device *dev) if (priv->bDcut) { u32 i, TempCCk; - u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord); + u32 tmpRegA = rtl8192_QueryBBReg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord); for (i = 0; i < TxBBGainTableLength; i++) { if (tmpRegA == priv->txbbgain_table[i].txbbgain_value) { priv->rfa_txpowertrackingindex = (u8)i; - priv->rfa_txpowertrackingindex_real = (u8)i; - priv->rfa_txpowertracking_default = priv->rfa_txpowertrackingindex; + priv->rfa_txpowertrackingindex_real = + (u8)i; + priv->rfa_txpowertracking_default = + priv->rfa_txpowertrackingindex; break; } } - TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2); + TempCCk = rtl8192_QueryBBReg(dev, + rCCK0_TxFilter1, + bMaskByte2); for (i = 0; i < CCKTxBBGainTableLength; i++) { @@ -2873,7 +2977,8 @@ static bool rtl8192_adapter_start(struct net_device *dev) } priv->cck_present_attentuation_40Mdefault = 0; priv->cck_present_attentuation_difference = 0; - priv->cck_present_attentuation = priv->cck_present_attentuation_20Mdefault; + priv->cck_present_attentuation = + priv->cck_present_attentuation_20Mdefault; } } @@ -2905,7 +3010,9 @@ static bool HalTxCheckStuck819xUsb(struct net_device *dev) bool bStuck = false; read_nic_word(dev, 0x128, &RegTxCounter); - RT_TRACE(COMP_RESET, "%s():RegTxCounter is %d,TxCounter is %d\n", __func__, RegTxCounter, priv->TxCounter); + RT_TRACE(COMP_RESET, + "%s():RegTxCounter is %d,TxCounter is %d\n", __func__, + RegTxCounter, priv->TxCounter); if (priv->TxCounter == RegTxCounter) bStuck = true; @@ -2936,7 +3043,8 @@ static RESET_TYPE TxCheckStuck(struct net_device *dev) } if (bCheckFwTxCnt) { if (HalTxCheckStuck819xUsb(dev)) { - RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no Tx condition!\n"); + RT_TRACE(COMP_RESET, + "TxCheckStuck(): Fw indicates no Tx condition!\n"); return RESET_TYPE_SILENT; } } @@ -2951,7 +3059,9 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) static u8 rx_chk_cnt; read_nic_word(dev, 0x130, &RegRxCounter); - RT_TRACE(COMP_RESET, "%s(): RegRxCounter is %d,RxCounter is %d\n", __func__, RegRxCounter, priv->RxCounter); + RT_TRACE(COMP_RESET, + "%s(): RegRxCounter is %d,RxCounter is %d\n", __func__, + RegRxCounter, priv->RxCounter); /* If rssi is small, we should check rx for long time because of bad rx. * or maybe it will continuous silent reset every 2 seconds. */ @@ -3044,9 +3154,11 @@ static RESET_TYPE rtl819x_ifcheck_resetornot(struct net_device *dev) */ RxResetType = RxCheckStuck(dev); } - if (TxResetType == RESET_TYPE_NORMAL || RxResetType == RESET_TYPE_NORMAL) { + if (TxResetType == RESET_TYPE_NORMAL || + RxResetType == RESET_TYPE_NORMAL) { return RESET_TYPE_NORMAL; - } else if (TxResetType == RESET_TYPE_SILENT || RxResetType == RESET_TYPE_SILENT) { + } else if (TxResetType == RESET_TYPE_SILENT || + RxResetType == RESET_TYPE_SILENT) { RT_TRACE(COMP_RESET, "%s():silent reset\n", __func__); return RESET_TYPE_SILENT; } else { @@ -3156,12 +3268,16 @@ RESET_START: priv->ResetProgress = RESET_TYPE_SILENT; down(&priv->wx_sem); if (priv->up == 0) { - 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__); rtl8192_rtx_disable(dev); rtl8192_cancel_deferred_work(priv); @@ -3183,28 +3299,40 @@ RESET_START: ieee80211_softmac_stop_protocol(priv->ieee80211); } up(&priv->wx_sem); - RT_TRACE(COMP_RESET, "%s():<==========down process is finished\n", __func__); - RT_TRACE(COMP_RESET, "%s():===========>start up the driver\n", __func__); + RT_TRACE(COMP_RESET, + "%s():<==========down process is finished\n", + __func__); + RT_TRACE(COMP_RESET, + "%s():===========>start up the driver\n", + __func__); reset_status = _rtl8192_up(dev); - 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 == -EAGAIN) { 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; EnableHWSecurityConfig8192(dev); - if (ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_INFRA) { - ieee->set_chan(ieee->dev, ieee->current_netw |