aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/pci.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2013-03-24 23:06:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-04-01 16:17:06 -0400
commit26634c4b1868323f49f8cd24c3493b57819867fd (patch)
tree281409ae1cc5c43951ea74761065a427a5a3ea84 /drivers/net/wireless/rtlwifi/pci.c
parentcbafb601cad81de612013fad8daf710ca900015a (diff)
rtlwifi Modify existing bits to match vendor version 2013.02.07
These changes add the new variables for P2P and modify the various struct definitions for other new features. This patch updates files base.{c,h} for the changes in the newest vendor driver. This patch updates files ps.{c,h} for the changes in the newest vendor driver. This patch updates files debug.{c,h}, efuse.c, pci.{c,h}, and wifi.h for the changes in the newest vendor driver. This patch updates files core.c, ps.c, rc.c, and wifi.h for the changes in the newest vendor driver. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: jcheung@suse.com Cc: machen@suse.com Cc: mmarek@suse.cz Cc: zhiyuan_yang@realsil.com.cn Cc: page_he@realsil.com.cn Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/pci.c')
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c117
1 files changed, 97 insertions, 20 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 4261e8ecc4c3..4af6abd1491c 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -59,7 +59,7 @@ static u8 _rtl_mac_to_hwqueue(struct ieee80211_hw *hw,
59 59
60 if (unlikely(ieee80211_is_beacon(fc))) 60 if (unlikely(ieee80211_is_beacon(fc)))
61 return BEACON_QUEUE; 61 return BEACON_QUEUE;
62 if (ieee80211_is_mgmt(fc)) 62 if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc))
63 return MGNT_QUEUE; 63 return MGNT_QUEUE;
64 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) 64 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE)
65 if (ieee80211_is_nullfunc(fc)) 65 if (ieee80211_is_nullfunc(fc))
@@ -271,9 +271,6 @@ static void rtl_pci_enable_aspm(struct ieee80211_hw *hw)
271 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 271 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
272 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 272 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
273 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 273 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
274 u8 pcibridge_busnum = pcipriv->ndis_adapter.pcibridge_busnum;
275 u8 pcibridge_devnum = pcipriv->ndis_adapter.pcibridge_devnum;
276 u8 pcibridge_funcnum = pcipriv->ndis_adapter.pcibridge_funcnum;
277 u8 pcibridge_vendor = pcipriv->ndis_adapter.pcibridge_vendor; 274 u8 pcibridge_vendor = pcipriv->ndis_adapter.pcibridge_vendor;
278 u8 num4bytes = pcipriv->ndis_adapter.num4bytes; 275 u8 num4bytes = pcipriv->ndis_adapter.num4bytes;
279 u16 aspmlevel; 276 u16 aspmlevel;
@@ -302,8 +299,7 @@ static void rtl_pci_enable_aspm(struct ieee80211_hw *hw)
302 u_pcibridge_aspmsetting); 299 u_pcibridge_aspmsetting);
303 300
304 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 301 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
305 "PlatformEnableASPM():PciBridge busnumber[%x], DevNumbe[%x], funcnumber[%x], Write reg[%x] = %x\n", 302 "PlatformEnableASPM(): Write reg[%x] = %x\n",
306 pcibridge_busnum, pcibridge_devnum, pcibridge_funcnum,
307 (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10), 303 (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10),
308 u_pcibridge_aspmsetting); 304 u_pcibridge_aspmsetting);
309 305
@@ -349,6 +345,49 @@ static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw)
349 return status; 345 return status;
350} 346}
351 347
348static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw,
349 struct rtl_priv **buddy_priv)
350{
351 struct rtl_priv *rtlpriv = rtl_priv(hw);
352 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
353 bool find_buddy_priv = false;
354 struct rtl_priv *tpriv = NULL;
355 struct rtl_pci_priv *tpcipriv = NULL;
356
357 if (!list_empty(&rtlpriv->glb_var->glb_priv_list)) {
358 list_for_each_entry(tpriv, &rtlpriv->glb_var->glb_priv_list,
359 list) {
360 if (tpriv) {
361 tpcipriv = (struct rtl_pci_priv *)tpriv->priv;
362 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
363 "pcipriv->ndis_adapter.funcnumber %x\n",
364 pcipriv->ndis_adapter.funcnumber);
365 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
366 "tpcipriv->ndis_adapter.funcnumber %x\n",
367 tpcipriv->ndis_adapter.funcnumber);
368
369 if ((pcipriv->ndis_adapter.busnumber ==
370 tpcipriv->ndis_adapter.busnumber) &&
371 (pcipriv->ndis_adapter.devnumber ==
372 tpcipriv->ndis_adapter.devnumber) &&
373 (pcipriv->ndis_adapter.funcnumber !=
374 tpcipriv->ndis_adapter.funcnumber)) {
375 find_buddy_priv = true;
376 break;
377 }
378 }
379 }
380 }
381
382 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
383 "find_buddy_priv %d\n", find_buddy_priv);
384
385 if (find_buddy_priv)
386 *buddy_priv = tpriv;
387
388 return find_buddy_priv;
389}
390
352static void rtl_pci_get_linkcontrol_field(struct ieee80211_hw *hw) 391static void rtl_pci_get_linkcontrol_field(struct ieee80211_hw *hw)
353{ 392{
354 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 393 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
@@ -420,17 +459,14 @@ static void _rtl_pci_io_handler_init(struct device *dev,
420 459
421} 460}
422 461
423static void _rtl_pci_io_handler_release(struct ieee80211_hw *hw)
424{
425}
426
427static bool _rtl_update_earlymode_info(struct ieee80211_hw *hw, 462static bool _rtl_update_earlymode_info(struct ieee80211_hw *hw,
428 struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc, u8 tid) 463 struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc, u8 tid)
429{ 464{
430 struct rtl_priv *rtlpriv = rtl_priv(hw); 465 struct rtl_priv *rtlpriv = rtl_priv(hw);
431 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 466 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
432 u8 additionlen = FCS_LEN; 467 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
433 struct sk_buff *next_skb; 468 struct sk_buff *next_skb;
469 u8 additionlen = FCS_LEN;
434 470
435 /* here open is 4, wep/tkip is 8, aes is 12*/ 471 /* here open is 4, wep/tkip is 8, aes is 12*/
436 if (info->control.hw_key) 472 if (info->control.hw_key)
@@ -455,7 +491,7 @@ static bool _rtl_update_earlymode_info(struct ieee80211_hw *hw,
455 next_skb)) 491 next_skb))
456 break; 492 break;
457 493
458 if (tcb_desc->empkt_num >= 5) 494 if (tcb_desc->empkt_num >= rtlhal->max_earlymode_num)
459 break; 495 break;
460 } 496 }
461 spin_unlock_bh(&rtlpriv->locks.waitq_lock); 497 spin_unlock_bh(&rtlpriv->locks.waitq_lock);
@@ -471,11 +507,17 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)
471 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 507 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
472 struct sk_buff *skb = NULL; 508 struct sk_buff *skb = NULL;
473 struct ieee80211_tx_info *info = NULL; 509 struct ieee80211_tx_info *info = NULL;
510 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
474 int tid; 511 int tid;
475 512
476 if (!rtlpriv->rtlhal.earlymode_enable) 513 if (!rtlpriv->rtlhal.earlymode_enable)
477 return; 514 return;
478 515
516 if (rtlpriv->dm.supp_phymode_switch &&
517 (rtlpriv->easy_concurrent_ctl.switch_in_process ||
518 (rtlpriv->buddy_priv &&
519 rtlpriv->buddy_priv->easy_concurrent_ctl.switch_in_process)))
520 return;
479 /* we juse use em for BE/BK/VI/VO */ 521 /* we juse use em for BE/BK/VI/VO */
480 for (tid = 7; tid >= 0; tid--) { 522 for (tid = 7; tid >= 0; tid--) {
481 u8 hw_queue = ac_to_hwq[rtl_tid_to_ac(tid)]; 523 u8 hw_queue = ac_to_hwq[rtl_tid_to_ac(tid)];
@@ -487,7 +529,8 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)
487 529
488 spin_lock_bh(&rtlpriv->locks.waitq_lock); 530 spin_lock_bh(&rtlpriv->locks.waitq_lock);
489 if (!skb_queue_empty(&mac->skb_waitq[tid]) && 531 if (!skb_queue_empty(&mac->skb_waitq[tid]) &&
490 (ring->entries - skb_queue_len(&ring->queue) > 5)) { 532 (ring->entries - skb_queue_len(&ring->queue) >
533 rtlhal->max_earlymode_num)) {
491 skb = skb_dequeue(&mac->skb_waitq[tid]); 534 skb = skb_dequeue(&mac->skb_waitq[tid]);
492 } else { 535 } else {
493 spin_unlock_bh(&rtlpriv->locks.waitq_lock); 536 spin_unlock_bh(&rtlpriv->locks.waitq_lock);
@@ -525,9 +568,8 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
525 u8 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) entry, true, 568 u8 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) entry, true,
526 HW_DESC_OWN); 569 HW_DESC_OWN);
527 570
528 /* 571 /*beacon packet will only use the first
529 *beacon packet will only use the first 572 *descriptor by defaut, and the own may not
530 *descriptor defautly,and the own may not
531 *be cleared by the hardware 573 *be cleared by the hardware
532 */ 574 */
533 if (own) 575 if (own)
@@ -558,8 +600,9 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
558 } 600 }
559 601
560 /* for sw LPS, just after NULL skb send out, we can 602 /* for sw LPS, just after NULL skb send out, we can
561 * sure AP kown we are sleeped, our we should not let 603 * sure AP knows we are sleeping, we should not let
562 * rf to sleep*/ 604 * rf sleep
605 */
563 fc = rtl_get_fc(skb); 606 fc = rtl_get_fc(skb);
564 if (ieee80211_is_nullfunc(fc)) { 607 if (ieee80211_is_nullfunc(fc)) {
565 if (ieee80211_has_pm(fc)) { 608 if (ieee80211_has_pm(fc)) {
@@ -569,6 +612,15 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
569 rtlpriv->psc.state_inap = false; 612 rtlpriv->psc.state_inap = false;
570 } 613 }
571 } 614 }
615 if (ieee80211_is_action(fc)) {
616 struct ieee80211_mgmt *action_frame =
617 (struct ieee80211_mgmt *)skb->data;
618 if (action_frame->u.action.u.ht_smps.action ==
619 WLAN_HT_ACTION_SMPS) {
620 dev_kfree_skb(skb);
621 goto tx_status_ok;
622 }
623 }
572 624
573 /* update tid tx pkt num */ 625 /* update tid tx pkt num */
574 tid = rtl_get_tid(skb); 626 tid = rtl_get_tid(skb);
@@ -637,6 +689,10 @@ static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb,
637 rtlpriv->link_info.num_rx_inperiod++; 689 rtlpriv->link_info.num_rx_inperiod++;
638 } 690 }
639 691
692 /* static bcn for roaming */
693 rtl_beacon_statistic(hw, skb);
694 rtl_p2p_info(hw, (void *)skb->data, skb->len);
695
640 /* for sw lps */ 696 /* for sw lps */
641 rtl_swlps_beacon(hw, (void *)skb->data, skb->len); 697 rtl_swlps_beacon(hw, (void *)skb->data, skb->len);
642 rtl_recognize_peer(hw, (void *)skb->data, skb->len); 698 rtl_recognize_peer(hw, (void *)skb->data, skb->len);
@@ -884,6 +940,16 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
884 _rtl_pci_rx_interrupt(hw); 940 _rtl_pci_rx_interrupt(hw);
885 } 941 }
886 942
943 /*fw related*/
944 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8723AE) {
945 if (inta & rtlpriv->cfg->maps[RTL_IMR_C2HCMD]) {
946 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
947 "firmware interrupt!\n");
948 queue_delayed_work(rtlpriv->works.rtl_wq,
949 &rtlpriv->works.fwevt_wq, 0);
950 }
951 }
952
887 if (rtlpriv->rtlhal.earlymode_enable) 953 if (rtlpriv->rtlhal.earlymode_enable)
888 tasklet_schedule(&rtlpriv->works.irq_tasklet); 954 tasklet_schedule(&rtlpriv->works.irq_tasklet);
889 955
@@ -1458,10 +1524,14 @@ static void rtl_pci_flush(struct ieee80211_hw *hw, bool drop)
1458 struct rtl_priv *rtlpriv = rtl_priv(hw); 1524 struct rtl_priv *rtlpriv = rtl_priv(hw);
1459 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 1525 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
1460 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1526 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1527 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1461 u16 i = 0; 1528 u16 i = 0;
1462 int queue_id; 1529 int queue_id;
1463 struct rtl8192_tx_ring *ring; 1530 struct rtl8192_tx_ring *ring;
1464 1531
1532 if (mac->skip_scan)
1533 return;
1534
1465 for (queue_id = RTL_PCI_MAX_TX_QUEUE_COUNT - 1; queue_id >= 0;) { 1535 for (queue_id = RTL_PCI_MAX_TX_QUEUE_COUNT - 1; queue_id >= 0;) {
1466 u32 queue_len; 1536 u32 queue_len;
1467 ring = &pcipriv->dev.tx_ring[queue_id]; 1537 ring = &pcipriv->dev.tx_ring[queue_id];
@@ -1704,6 +1774,9 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1704 pcipriv->ndis_adapter.devnumber = PCI_SLOT(pdev->devfn); 1774 pcipriv->ndis_adapter.devnumber = PCI_SLOT(pdev->devfn);
1705 pcipriv->ndis_adapter.funcnumber = PCI_FUNC(pdev->devfn); 1775 pcipriv->ndis_adapter.funcnumber = PCI_FUNC(pdev->devfn);
1706 1776
1777 /* some ARM have no bridge_pdev and will crash here
1778 * so we should check if bridge_pdev is NULL
1779 */
1707 if (bridge_pdev) { 1780 if (bridge_pdev) {
1708 /*find bridge info if available */ 1781 /*find bridge info if available */
1709 pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor; 1782 pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor;
@@ -1758,6 +1831,7 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1758 pcipriv->ndis_adapter.amd_l1_patch); 1831 pcipriv->ndis_adapter.amd_l1_patch);
1759 1832
1760 rtl_pci_parse_configuration(pdev, hw); 1833 rtl_pci_parse_configuration(pdev, hw);
1834 list_add_tail(&rtlpriv->list, &rtlpriv->glb_var->glb_priv_list);
1761 1835
1762 return true; 1836 return true;
1763} 1837}
@@ -1804,6 +1878,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
1804 pci_set_drvdata(pdev, hw); 1878 pci_set_drvdata(pdev, hw);
1805 1879
1806 rtlpriv = hw->priv; 1880 rtlpriv = hw->priv;
1881 rtlpriv->hw = hw;
1807 pcipriv = (void *)rtlpriv->priv; 1882 pcipriv = (void *)rtlpriv->priv;
1808 pcipriv->dev.pdev = pdev; 1883 pcipriv->dev.pdev = pdev;
1809 init_completion(&rtlpriv->firmware_loading_complete); 1884 init_completion(&rtlpriv->firmware_loading_complete);
@@ -1812,6 +1887,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
1812 rtlpriv->rtlhal.interface = INTF_PCI; 1887 rtlpriv->rtlhal.interface = INTF_PCI;
1813 rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); 1888 rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data);
1814 rtlpriv->intf_ops = &rtl_pci_ops; 1889 rtlpriv->intf_ops = &rtl_pci_ops;
1890 rtlpriv->glb_var = &global_var;
1815 1891
1816 /* 1892 /*
1817 *init dbgp flags before all 1893 *init dbgp flags before all
@@ -1916,7 +1992,6 @@ int rtl_pci_probe(struct pci_dev *pdev,
1916 1992
1917fail3: 1993fail3:
1918 rtl_deinit_core(hw); 1994 rtl_deinit_core(hw);
1919 _rtl_pci_io_handler_release(hw);
1920 1995
1921 if (rtlpriv->io.pci_mem_start != 0) 1996 if (rtlpriv->io.pci_mem_start != 0)
1922 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); 1997 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
@@ -1965,14 +2040,15 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
1965 2040
1966 rtl_pci_deinit(hw); 2041 rtl_pci_deinit(hw);
1967 rtl_deinit_core(hw); 2042 rtl_deinit_core(hw);
1968 _rtl_pci_io_handler_release(hw);
1969 rtlpriv->cfg->ops->deinit_sw_vars(hw); 2043 rtlpriv->cfg->ops->deinit_sw_vars(hw);
1970 2044
1971 if (rtlpci->irq_alloc) { 2045 if (rtlpci->irq_alloc) {
2046 synchronize_irq(rtlpci->pdev->irq);
1972 free_irq(rtlpci->pdev->irq, hw); 2047 free_irq(rtlpci->pdev->irq, hw);
1973 rtlpci->irq_alloc = 0; 2048 rtlpci->irq_alloc = 0;
1974 } 2049 }
1975 2050
2051 list_del(&rtlpriv->list);
1976 if (rtlpriv->io.pci_mem_start != 0) { 2052 if (rtlpriv->io.pci_mem_start != 0) {
1977 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); 2053 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
1978 pci_release_regions(pdev); 2054 pci_release_regions(pdev);
@@ -2034,6 +2110,7 @@ struct rtl_intf_ops rtl_pci_ops = {
2034 .read_efuse_byte = read_efuse_byte, 2110 .read_efuse_byte = read_efuse_byte,
2035 .adapter_start = rtl_pci_start, 2111 .adapter_start = rtl_pci_start,
2036 .adapter_stop = rtl_pci_stop, 2112 .adapter_stop = rtl_pci_stop,
2113 .check_buddy_priv = rtl_pci_check_buddy_priv,
2037 .adapter_tx = rtl_pci_tx, 2114 .adapter_tx = rtl_pci_tx,
2038 .flush = rtl_pci_flush, 2115 .flush = rtl_pci_flush,
2039 .reset_trx_ring = rtl_pci_reset_trx_ring, 2116 .reset_trx_ring = rtl_pci_reset_trx_ring,