diff options
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8192ce/trx.c')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | 170 |
1 files changed, 101 insertions, 69 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index bf5852f2d634..01b95427fee0 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "trx.h" | 36 | #include "trx.h" |
37 | #include "led.h" | 37 | #include "led.h" |
38 | 38 | ||
39 | static enum rtl_desc_qsel _rtl92ce_map_hwqueue_to_fwqueue(u16 fc, | 39 | static enum rtl_desc_qsel _rtl92ce_map_hwqueue_to_fwqueue(__le16 fc, |
40 | unsigned int | 40 | unsigned int |
41 | skb_queue) | 41 | skb_queue) |
42 | { | 42 | { |
@@ -245,9 +245,9 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
245 | struct rtl_stats *pstats, | 245 | struct rtl_stats *pstats, |
246 | struct rx_desc_92c *pdesc, | 246 | struct rx_desc_92c *pdesc, |
247 | struct rx_fwinfo_92c *p_drvinfo, | 247 | struct rx_fwinfo_92c *p_drvinfo, |
248 | bool bpacket_match_bssid, | 248 | bool packet_match_bssid, |
249 | bool bpacket_toself, | 249 | bool packet_toself, |
250 | bool b_packet_beacon) | 250 | bool packet_beacon) |
251 | { | 251 | { |
252 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 252 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
253 | struct phy_sts_cck_8192s_t *cck_buf; | 253 | struct phy_sts_cck_8192s_t *cck_buf; |
@@ -258,11 +258,11 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
258 | bool is_cck_rate; | 258 | bool is_cck_rate; |
259 | 259 | ||
260 | is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); | 260 | is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); |
261 | pstats->b_packet_matchbssid = bpacket_match_bssid; | 261 | pstats->packet_matchbssid = packet_match_bssid; |
262 | pstats->b_packet_toself = bpacket_toself; | 262 | pstats->packet_toself = packet_toself; |
263 | pstats->b_is_cck = is_cck_rate; | 263 | pstats->is_cck = is_cck_rate; |
264 | pstats->b_packet_beacon = b_packet_beacon; | 264 | pstats->packet_beacon = packet_beacon; |
265 | pstats->b_is_cck = is_cck_rate; | 265 | pstats->is_cck = is_cck_rate; |
266 | pstats->rx_mimo_signalquality[0] = -1; | 266 | pstats->rx_mimo_signalquality[0] = -1; |
267 | pstats->rx_mimo_signalquality[1] = -1; | 267 | pstats->rx_mimo_signalquality[1] = -1; |
268 | 268 | ||
@@ -315,7 +315,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
315 | pstats->rx_pwdb_all = pwdb_all; | 315 | pstats->rx_pwdb_all = pwdb_all; |
316 | pstats->recvsignalpower = rx_pwr_all; | 316 | pstats->recvsignalpower = rx_pwr_all; |
317 | 317 | ||
318 | if (bpacket_match_bssid) { | 318 | if (packet_match_bssid) { |
319 | u8 sq; | 319 | u8 sq; |
320 | if (pstats->rx_pwdb_all > 40) | 320 | if (pstats->rx_pwdb_all > 40) |
321 | sq = 100; | 321 | sq = 100; |
@@ -334,10 +334,10 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
334 | pstats->rx_mimo_signalquality[1] = -1; | 334 | pstats->rx_mimo_signalquality[1] = -1; |
335 | } | 335 | } |
336 | } else { | 336 | } else { |
337 | rtlpriv->dm.brfpath_rxenable[0] = | 337 | rtlpriv->dm.rfpath_rxenable[0] = |
338 | rtlpriv->dm.brfpath_rxenable[1] = true; | 338 | rtlpriv->dm.rfpath_rxenable[1] = true; |
339 | for (i = RF90_PATH_A; i < RF90_PATH_MAX; i++) { | 339 | for (i = RF90_PATH_A; i < RF90_PATH_MAX; i++) { |
340 | if (rtlpriv->dm.brfpath_rxenable[i]) | 340 | if (rtlpriv->dm.rfpath_rxenable[i]) |
341 | rf_rx_num++; | 341 | rf_rx_num++; |
342 | 342 | ||
343 | rx_pwr[i] = | 343 | rx_pwr[i] = |
@@ -347,7 +347,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
347 | rtlpriv->stats.rx_snr_db[i] = | 347 | rtlpriv->stats.rx_snr_db[i] = |
348 | (long)(p_drvinfo->rxsnr[i] / 2); | 348 | (long)(p_drvinfo->rxsnr[i] / 2); |
349 | 349 | ||
350 | if (bpacket_match_bssid) | 350 | if (packet_match_bssid) |
351 | pstats->rx_mimo_signalstrength[i] = (u8) rssi; | 351 | pstats->rx_mimo_signalstrength[i] = (u8) rssi; |
352 | } | 352 | } |
353 | 353 | ||
@@ -366,7 +366,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
366 | for (i = 0; i < max_spatial_stream; i++) { | 366 | for (i = 0; i < max_spatial_stream; i++) { |
367 | evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]); | 367 | evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]); |
368 | 368 | ||
369 | if (bpacket_match_bssid) { | 369 | if (packet_match_bssid) { |
370 | if (i == 0) | 370 | if (i == 0) |
371 | pstats->signalquality = | 371 | pstats->signalquality = |
372 | (u8) (evm & 0xff); | 372 | (u8) (evm & 0xff); |
@@ -393,7 +393,7 @@ static void _rtl92ce_process_ui_rssi(struct ieee80211_hw *hw, | |||
393 | u8 rfpath; | 393 | u8 rfpath; |
394 | u32 last_rssi, tmpval; | 394 | u32 last_rssi, tmpval; |
395 | 395 | ||
396 | if (pstats->b_packet_toself || pstats->b_packet_beacon) { | 396 | if (pstats->packet_toself || pstats->packet_beacon) { |
397 | rtlpriv->stats.rssi_calculate_cnt++; | 397 | rtlpriv->stats.rssi_calculate_cnt++; |
398 | 398 | ||
399 | if (rtlpriv->stats.ui_rssi.total_num++ >= | 399 | if (rtlpriv->stats.ui_rssi.total_num++ >= |
@@ -421,7 +421,7 @@ static void _rtl92ce_process_ui_rssi(struct ieee80211_hw *hw, | |||
421 | pstats->rssi = rtlpriv->stats.signal_strength; | 421 | pstats->rssi = rtlpriv->stats.signal_strength; |
422 | } | 422 | } |
423 | 423 | ||
424 | if (!pstats->b_is_cck && pstats->b_packet_toself) { | 424 | if (!pstats->is_cck && pstats->packet_toself) { |
425 | for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; | 425 | for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; |
426 | rfpath++) { | 426 | rfpath++) { |
427 | 427 | ||
@@ -493,7 +493,7 @@ static void _rtl92ce_process_pwdb(struct ieee80211_hw *hw, | |||
493 | rtlpriv->dm.undecorated_smoothed_pwdb; | 493 | rtlpriv->dm.undecorated_smoothed_pwdb; |
494 | } | 494 | } |
495 | 495 | ||
496 | if (pstats->b_packet_toself || pstats->b_packet_beacon) { | 496 | if (pstats->packet_toself || pstats->packet_beacon) { |
497 | if (undecorated_smoothed_pwdb < 0) | 497 | if (undecorated_smoothed_pwdb < 0) |
498 | undecorated_smoothed_pwdb = pstats->rx_pwdb_all; | 498 | undecorated_smoothed_pwdb = pstats->rx_pwdb_all; |
499 | 499 | ||
@@ -525,7 +525,7 @@ static void _rtl92ce_process_ui_link_quality(struct ieee80211_hw *hw, | |||
525 | u32 last_evm, n_spatialstream, tmpval; | 525 | u32 last_evm, n_spatialstream, tmpval; |
526 | 526 | ||
527 | if (pstats->signalquality != 0) { | 527 | if (pstats->signalquality != 0) { |
528 | if (pstats->b_packet_toself || pstats->b_packet_beacon) { | 528 | if (pstats->packet_toself || pstats->packet_beacon) { |
529 | 529 | ||
530 | if (rtlpriv->stats.ui_link_quality.total_num++ >= | 530 | if (rtlpriv->stats.ui_link_quality.total_num++ >= |
531 | PHY_LINKQUALITY_SLID_WIN_MAX) { | 531 | PHY_LINKQUALITY_SLID_WIN_MAX) { |
@@ -595,8 +595,8 @@ static void _rtl92ce_process_phyinfo(struct ieee80211_hw *hw, | |||
595 | struct rtl_stats *pcurrent_stats) | 595 | struct rtl_stats *pcurrent_stats) |
596 | { | 596 | { |
597 | 597 | ||
598 | if (!pcurrent_stats->b_packet_matchbssid && | 598 | if (!pcurrent_stats->packet_matchbssid && |
599 | !pcurrent_stats->b_packet_beacon) | 599 | !pcurrent_stats->packet_beacon) |
600 | return; | 600 | return; |
601 | 601 | ||
602 | _rtl92ce_process_ui_rssi(hw, pcurrent_stats); | 602 | _rtl92ce_process_ui_rssi(hw, pcurrent_stats); |
@@ -617,34 +617,36 @@ static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw, | |||
617 | u8 *tmp_buf; | 617 | u8 *tmp_buf; |
618 | u8 *praddr; | 618 | u8 *praddr; |
619 | u8 *psaddr; | 619 | u8 *psaddr; |
620 | u16 fc, type; | 620 | __le16 fc; |
621 | bool b_packet_matchbssid, b_packet_toself, b_packet_beacon; | 621 | u16 type, c_fc; |
622 | bool packet_matchbssid, packet_toself, packet_beacon; | ||
622 | 623 | ||
623 | tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; | 624 | tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; |
624 | 625 | ||
625 | hdr = (struct ieee80211_hdr *)tmp_buf; | 626 | hdr = (struct ieee80211_hdr *)tmp_buf; |
626 | fc = le16_to_cpu(hdr->frame_control); | 627 | fc = hdr->frame_control; |
628 | c_fc = le16_to_cpu(fc); | ||
627 | type = WLAN_FC_GET_TYPE(fc); | 629 | type = WLAN_FC_GET_TYPE(fc); |
628 | praddr = hdr->addr1; | 630 | praddr = hdr->addr1; |
629 | psaddr = hdr->addr2; | 631 | psaddr = hdr->addr2; |
630 | 632 | ||
631 | b_packet_matchbssid = | 633 | packet_matchbssid = |
632 | ((IEEE80211_FTYPE_CTL != type) && | 634 | ((IEEE80211_FTYPE_CTL != type) && |
633 | (!compare_ether_addr(mac->bssid, | 635 | (!compare_ether_addr(mac->bssid, |
634 | (fc & IEEE80211_FCTL_TODS) ? | 636 | (c_fc & IEEE80211_FCTL_TODS) ? |
635 | hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? | 637 | hdr->addr1 : (c_fc & IEEE80211_FCTL_FROMDS) ? |
636 | hdr->addr2 : hdr->addr3)) && | 638 | hdr->addr2 : hdr->addr3)) && |
637 | (!pstats->b_hwerror) && (!pstats->b_crc) && (!pstats->b_icv)); | 639 | (!pstats->hwerror) && (!pstats->crc) && (!pstats->icv)); |
638 | 640 | ||
639 | b_packet_toself = b_packet_matchbssid && | 641 | packet_toself = packet_matchbssid && |
640 | (!compare_ether_addr(praddr, rtlefuse->dev_addr)); | 642 | (!compare_ether_addr(praddr, rtlefuse->dev_addr)); |
641 | 643 | ||
642 | if (ieee80211_is_beacon(fc)) | 644 | if (ieee80211_is_beacon(fc)) |
643 | b_packet_beacon = true; | 645 | packet_beacon = true; |
644 | 646 | ||
645 | _rtl92ce_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, | 647 | _rtl92ce_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, |
646 | b_packet_matchbssid, b_packet_toself, | 648 | packet_matchbssid, packet_toself, |
647 | b_packet_beacon); | 649 | packet_beacon); |
648 | 650 | ||
649 | _rtl92ce_process_phyinfo(hw, tmp_buf, pstats); | 651 | _rtl92ce_process_phyinfo(hw, tmp_buf, pstats); |
650 | } | 652 | } |
@@ -662,14 +664,14 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, | |||
662 | stats->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * | 664 | stats->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * |
663 | RX_DRV_INFO_SIZE_UNIT; | 665 | RX_DRV_INFO_SIZE_UNIT; |
664 | stats->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); | 666 | stats->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); |
665 | stats->b_icv = (u16) GET_RX_DESC_ICV(pdesc); | 667 | stats->icv = (u16) GET_RX_DESC_ICV(pdesc); |
666 | stats->b_crc = (u16) GET_RX_DESC_CRC32(pdesc); | 668 | stats->crc = (u16) GET_RX_DESC_CRC32(pdesc); |
667 | stats->b_hwerror = (stats->b_crc | stats->b_icv); | 669 | stats->hwerror = (stats->crc | stats->icv); |
668 | stats->decrypted = !GET_RX_DESC_SWDEC(pdesc); | 670 | stats->decrypted = !GET_RX_DESC_SWDEC(pdesc); |
669 | stats->rate = (u8) GET_RX_DESC_RXMCS(pdesc); | 671 | stats->rate = (u8) GET_RX_DESC_RXMCS(pdesc); |
670 | stats->b_shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); | 672 | stats->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); |
671 | stats->b_isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); | 673 | stats->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); |
672 | stats->b_isampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) | 674 | stats->isampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) |
673 | && (GET_RX_DESC_FAGGR(pdesc) == 1)); | 675 | && (GET_RX_DESC_FAGGR(pdesc) == 1)); |
674 | stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); | 676 | stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); |
675 | stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); | 677 | stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); |
@@ -727,27 +729,24 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
727 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 729 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
728 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 730 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
729 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 731 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
730 | bool b_defaultadapter = true; | 732 | bool defaultadapter = true; |
731 | |||
732 | struct ieee80211_sta *sta = ieee80211_find_sta(mac->vif, mac->bssid); | 733 | struct ieee80211_sta *sta = ieee80211_find_sta(mac->vif, mac->bssid); |
733 | |||
734 | u8 *pdesc = (u8 *) pdesc_tx; | 734 | u8 *pdesc = (u8 *) pdesc_tx; |
735 | struct rtl_tcb_desc tcb_desc; | 735 | struct rtl_tcb_desc tcb_desc; |
736 | u8 *qc = ieee80211_get_qos_ctl(hdr); | 736 | u8 *qc = ieee80211_get_qos_ctl(hdr); |
737 | u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; | 737 | u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
738 | u16 seq_number; | 738 | u16 seq_number; |
739 | u16 fc = le16_to_cpu(hdr->frame_control); | 739 | __le16 fc = hdr->frame_control; |
740 | u8 rate_flag = info->control.rates[0].flags; | 740 | u8 rate_flag = info->control.rates[0].flags; |
741 | 741 | ||
742 | enum rtl_desc_qsel fw_qsel = | 742 | enum rtl_desc_qsel fw_qsel = |
743 | _rtl92ce_map_hwqueue_to_fwqueue(le16_to_cpu(hdr->frame_control), | 743 | _rtl92ce_map_hwqueue_to_fwqueue(fc, queue_index); |
744 | queue_index); | ||
745 | 744 | ||
746 | bool b_firstseg = ((hdr->seq_ctrl & | 745 | bool firstseg = ((hdr->seq_ctrl & |
747 | cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); | 746 | cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); |
748 | 747 | ||
749 | bool b_lastseg = ((hdr->frame_control & | 748 | bool lastseg = ((hdr->frame_control & |
750 | cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); | 749 | cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); |
751 | 750 | ||
752 | dma_addr_t mapping = pci_map_single(rtlpci->pdev, | 751 | dma_addr_t mapping = pci_map_single(rtlpci->pdev, |
753 | skb->data, skb->len, | 752 | skb->data, skb->len, |
@@ -759,7 +758,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
759 | 758 | ||
760 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92c)); | 759 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92c)); |
761 | 760 | ||
762 | if (b_firstseg) { | 761 | if (firstseg) { |
763 | SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); | 762 | SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); |
764 | 763 | ||
765 | SET_TX_DESC_TX_RATE(pdesc, tcb_desc.hw_rate); | 764 | SET_TX_DESC_TX_RATE(pdesc, tcb_desc.hw_rate); |
@@ -774,25 +773,25 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
774 | } | 773 | } |
775 | SET_TX_DESC_SEQ(pdesc, seq_number); | 774 | SET_TX_DESC_SEQ(pdesc, seq_number); |
776 | 775 | ||
777 | SET_TX_DESC_RTS_ENABLE(pdesc, ((tcb_desc.b_rts_enable && | 776 | SET_TX_DESC_RTS_ENABLE(pdesc, ((tcb_desc.rts_enable && |
778 | !tcb_desc. | 777 | !tcb_desc. |
779 | b_cts_enable) ? 1 : 0)); | 778 | cts_enable) ? 1 : 0)); |
780 | SET_TX_DESC_HW_RTS_ENABLE(pdesc, | 779 | SET_TX_DESC_HW_RTS_ENABLE(pdesc, |
781 | ((tcb_desc.b_rts_enable | 780 | ((tcb_desc.rts_enable |
782 | || tcb_desc.b_cts_enable) ? 1 : 0)); | 781 | || tcb_desc.cts_enable) ? 1 : 0)); |
783 | SET_TX_DESC_CTS2SELF(pdesc, ((tcb_desc.b_cts_enable) ? 1 : 0)); | 782 | SET_TX_DESC_CTS2SELF(pdesc, ((tcb_desc.cts_enable) ? 1 : 0)); |
784 | SET_TX_DESC_RTS_STBC(pdesc, ((tcb_desc.b_rts_stbc) ? 1 : 0)); | 783 | SET_TX_DESC_RTS_STBC(pdesc, ((tcb_desc.rts_stbc) ? 1 : 0)); |
785 | 784 | ||
786 | SET_TX_DESC_RTS_RATE(pdesc, tcb_desc.rts_rate); | 785 | SET_TX_DESC_RTS_RATE(pdesc, tcb_desc.rts_rate); |
787 | SET_TX_DESC_RTS_BW(pdesc, 0); | 786 | SET_TX_DESC_RTS_BW(pdesc, 0); |
788 | SET_TX_DESC_RTS_SC(pdesc, tcb_desc.rts_sc); | 787 | SET_TX_DESC_RTS_SC(pdesc, tcb_desc.rts_sc); |
789 | SET_TX_DESC_RTS_SHORT(pdesc, | 788 | SET_TX_DESC_RTS_SHORT(pdesc, |
790 | ((tcb_desc.rts_rate <= DESC92C_RATE54M) ? | 789 | ((tcb_desc.rts_rate <= DESC92C_RATE54M) ? |
791 | (tcb_desc.b_rts_use_shortpreamble ? 1 : 0) | 790 | (tcb_desc.rts_use_shortpreamble ? 1 : 0) |
792 | : (tcb_desc.b_rts_use_shortgi ? 1 : 0))); | 791 | : (tcb_desc.rts_use_shortgi ? 1 : 0))); |
793 | 792 | ||
794 | if (mac->bw_40) { | 793 | if (mac->bw_40) { |
795 | if (tcb_desc.b_packet_bw) { | 794 | if (tcb_desc.packet_bw) { |
796 | SET_TX_DESC_DATA_BW(pdesc, 1); | 795 | SET_TX_DESC_DATA_BW(pdesc, 1); |
797 | SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); | 796 | SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); |
798 | } else { | 797 | } else { |
@@ -854,14 +853,14 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
854 | } | 853 | } |
855 | } | 854 | } |
856 | 855 | ||
857 | SET_TX_DESC_FIRST_SEG(pdesc, (b_firstseg ? 1 : 0)); | 856 | SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); |
858 | SET_TX_DESC_LAST_SEG(pdesc, (b_lastseg ? 1 : 0)); | 857 | SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); |
859 | 858 | ||
860 | SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) skb->len); | 859 | SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) skb->len); |
861 | 860 | ||
862 | SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); | 861 | SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); |
863 | 862 | ||
864 | if (rtlpriv->dm.b_useramask) { | 863 | if (rtlpriv->dm.useramask) { |
865 | SET_TX_DESC_RATE_ID(pdesc, tcb_desc.ratr_index); | 864 | SET_TX_DESC_RATE_ID(pdesc, tcb_desc.ratr_index); |
866 | SET_TX_DESC_MACID(pdesc, tcb_desc.mac_id); | 865 | SET_TX_DESC_MACID(pdesc, tcb_desc.mac_id); |
867 | } else { | 866 | } else { |
@@ -869,16 +868,16 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
869 | SET_TX_DESC_MACID(pdesc, tcb_desc.ratr_index); | 868 | SET_TX_DESC_MACID(pdesc, tcb_desc.ratr_index); |
870 | } | 869 | } |
871 | 870 | ||
872 | if ((!ieee80211_is_data_qos(fc)) && ppsc->b_leisure_ps && | 871 | if ((!ieee80211_is_data_qos(fc)) && ppsc->leisure_ps && |
873 | ppsc->b_fwctrl_lps) { | 872 | ppsc->fwctrl_lps) { |
874 | SET_TX_DESC_HWSEQ_EN(pdesc, 1); | 873 | SET_TX_DESC_HWSEQ_EN(pdesc, 1); |
875 | SET_TX_DESC_PKT_ID(pdesc, 8); | 874 | SET_TX_DESC_PKT_ID(pdesc, 8); |
876 | 875 | ||
877 | if (!b_defaultadapter) | 876 | if (!defaultadapter) |
878 | SET_TX_DESC_QOS(pdesc, 1); | 877 | SET_TX_DESC_QOS(pdesc, 1); |
879 | } | 878 | } |
880 | 879 | ||
881 | SET_TX_DESC_MORE_FRAG(pdesc, (b_lastseg ? 0 : 1)); | 880 | SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); |
882 | 881 | ||
883 | if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || | 882 | if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || |
884 | is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { | 883 | is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { |
@@ -889,8 +888,8 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
889 | } | 888 | } |
890 | 889 | ||
891 | void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, | 890 | void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, |
892 | u8 *pdesc, bool b_firstseg, | 891 | u8 *pdesc, bool firstseg, |
893 | bool b_lastseg, struct sk_buff *skb) | 892 | bool lastseg, struct sk_buff *skb) |
894 | { | 893 | { |
895 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 894 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
896 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 895 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
@@ -901,11 +900,11 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
901 | PCI_DMA_TODEVICE); | 900 | PCI_DMA_TODEVICE); |
902 | 901 | ||
903 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); | 902 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); |
904 | u16 fc = le16_to_cpu(hdr->frame_control); | 903 | __le16 fc = hdr->frame_control; |
905 | 904 | ||
906 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 905 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
907 | 906 | ||
908 | if (b_firstseg) | 907 | if (firstseg) |
909 | SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); | 908 | SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); |
910 | 909 | ||
911 | SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M); | 910 | SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M); |
@@ -1029,3 +1028,36 @@ void rtl92ce_tx_polling(struct ieee80211_hw *hw, unsigned int hw_queue) | |||
1029 | BIT(0) << (hw_queue)); | 1028 | BIT(0) << (hw_queue)); |
1030 | } | 1029 | } |
1031 | } | 1030 | } |
1031 | |||
1032 | bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw, | ||
1033 | struct sk_buff *skb) | ||
1034 | { | ||
1035 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1036 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
1037 | struct rtl8192_tx_ring *ring; | ||
1038 | struct rtl_tx_desc *pdesc; | ||
1039 | u8 own; | ||
1040 | unsigned long flags; | ||
1041 | struct sk_buff *pskb = NULL; | ||
1042 | |||
1043 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; | ||
1044 | |||
1045 | spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); | ||
1046 | |||
1047 | pskb = __skb_dequeue(&ring->queue); | ||
1048 | if (pskb) | ||
1049 | kfree_skb(pskb); | ||
1050 | |||
1051 | pdesc = &ring->desc[0]; | ||
1052 | own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN); | ||
1053 | |||
1054 | rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); | ||
1055 | |||
1056 | __skb_queue_tail(&ring->queue, skb); | ||
1057 | |||
1058 | spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); | ||
1059 | |||
1060 | rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); | ||
1061 | |||
1062 | return true; | ||
1063 | } | ||