1 /******************************************************************************
3 * Copyright(c) 2009-2012 Realtek Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
40 static u8
_rtl8723ae_map_hwqueue_to_fwqueue(struct sk_buff
*skb
, u8 hw_queue
)
42 __le16 fc
= rtl_get_fc(skb
);
44 if (unlikely(ieee80211_is_beacon(fc
)))
46 if (ieee80211_is_mgmt(fc
) || ieee80211_is_ctl(fc
))
52 static void _rtl8723ae_query_rxphystatus(struct ieee80211_hw
*hw
,
53 struct rtl_stats
*pstatus
, u8
*pdesc
,
54 struct rx_fwinfo_8723e
*p_drvinfo
,
55 bool bpacket_match_bssid
,
56 bool bpacket_toself
, bool packet_beacon
)
58 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
59 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtlpriv
);
60 struct phy_sts_cck_8723e_t
*cck_buf
;
61 s8 rx_pwr_all
, rx_pwr
[4];
62 u8 rf_rx_num
= 0, evm
, pwdb_all
;
63 u8 i
, max_spatial_stream
;
64 u32 rssi
, total_rssi
= 0;
65 bool is_cck
= pstatus
->is_cck
;
67 /* Record it for next packet processing */
68 pstatus
->packet_matchbssid
= bpacket_match_bssid
;
69 pstatus
->packet_toself
= bpacket_toself
;
70 pstatus
->packet_beacon
= packet_beacon
;
71 pstatus
->rx_mimo_sig_qual
[0] = -1;
72 pstatus
->rx_mimo_sig_qual
[1] = -1;
75 u8 report
, cck_highpwr
;
77 /* CCK Driver info Structure is not the same as OFDM packet. */
78 cck_buf
= (struct phy_sts_cck_8723e_t
*)p_drvinfo
;
80 /* (1)Hardware does not provide RSSI for CCK
81 * (2)PWDB, Average PWDB cacluated by
82 * hardware (for rate adaptive)
84 if (ppsc
->rfpwr_state
== ERFON
)
85 cck_highpwr
= (u8
) rtl_get_bbreg(hw
,
86 RFPGA0_XA_HSSIPARAMETER2
,
92 u8 cck_agc_rpt
= cck_buf
->cck_agc_rpt
;
93 report
= cck_buf
->cck_agc_rpt
& 0xc0;
97 rx_pwr_all
= -46 - (cck_agc_rpt
& 0x3e);
100 rx_pwr_all
= -26 - (cck_agc_rpt
& 0x3e);
103 rx_pwr_all
= -12 - (cck_agc_rpt
& 0x3e);
106 rx_pwr_all
= 16 - (cck_agc_rpt
& 0x3e);
110 u8 cck_agc_rpt
= cck_buf
->cck_agc_rpt
;
111 report
= p_drvinfo
->cfosho
[0] & 0x60;
112 report
= report
>> 5;
115 rx_pwr_all
= -46 - ((cck_agc_rpt
& 0x1f) << 1);
118 rx_pwr_all
= -26 - ((cck_agc_rpt
& 0x1f) << 1);
121 rx_pwr_all
= -12 - ((cck_agc_rpt
& 0x1f) << 1);
124 rx_pwr_all
= 16 - ((cck_agc_rpt
& 0x1f) << 1);
129 pwdb_all
= rtl_query_rxpwrpercentage(rx_pwr_all
);
130 /* CCK gain is smaller than OFDM/MCS gain,
131 * so we add gain diff. From experience, the val is 6
136 /* modify the offset to make the same
137 * gain index with OFDM.
139 if (pwdb_all
> 34 && pwdb_all
<= 42)
141 else if (pwdb_all
> 26 && pwdb_all
<= 34)
143 else if (pwdb_all
> 14 && pwdb_all
<= 26)
145 else if (pwdb_all
> 4 && pwdb_all
<= 14)
148 pstatus
->rx_pwdb_all
= pwdb_all
;
149 pstatus
->recvsignalpower
= rx_pwr_all
;
151 /* (3) Get Signal Quality (EVM) */
152 if (bpacket_match_bssid
) {
155 if (pstatus
->rx_pwdb_all
> 40) {
158 sq
= cck_buf
->sq_rpt
;
164 sq
= ((64 - sq
) * 100) / 44;
167 pstatus
->signalquality
= sq
;
168 pstatus
->rx_mimo_sig_qual
[0] = sq
;
169 pstatus
->rx_mimo_sig_qual
[1] = -1;
172 rtlpriv
->dm
.rfpath_rxenable
[0] =
173 rtlpriv
->dm
.rfpath_rxenable
[1] = true;
175 /* (1)Get RSSI for HT rate */
176 for (i
= RF90_PATH_A
; i
< RF6052_MAX_PATH
; i
++) {
178 /* we will judge RF RX path now. */
179 if (rtlpriv
->dm
.rfpath_rxenable
[i
])
182 rx_pwr
[i
] = ((p_drvinfo
->gain_trsw
[i
] & 0x3f)*2) - 110;
184 /* Translate DBM to percentage. */
185 rssi
= rtl_query_rxpwrpercentage(rx_pwr
[i
]);
188 /* Get Rx snr value in DB */
189 rtlpriv
->stats
.rx_snr_db
[i
] = (p_drvinfo
->rxsnr
[i
] / 2);
191 /* Record Signal Strength for next packet */
192 if (bpacket_match_bssid
)
193 pstatus
->rx_mimo_signalstrength
[i
] = (u8
) rssi
;
196 /* (2)PWDB, Average PWDB cacluated by
197 * hardware (for rate adaptive)
199 rx_pwr_all
= ((p_drvinfo
->pwdb_all
>> 1) & 0x7f) - 110;
201 pwdb_all
= rtl_query_rxpwrpercentage(rx_pwr_all
);
202 pstatus
->rx_pwdb_all
= pwdb_all
;
203 pstatus
->rxpower
= rx_pwr_all
;
204 pstatus
->recvsignalpower
= rx_pwr_all
;
206 /* (3)EVM of HT rate */
207 if (pstatus
->is_ht
&& pstatus
->rate
>= DESC92_RATEMCS8
&&
208 pstatus
->rate
<= DESC92_RATEMCS15
)
209 max_spatial_stream
= 2;
211 max_spatial_stream
= 1;
213 for (i
= 0; i
< max_spatial_stream
; i
++) {
214 evm
= rtl_evm_db_to_percentage(p_drvinfo
->rxevm
[i
]);
216 if (bpacket_match_bssid
) {
217 /* Fill value in RFD, Get the first
218 * spatial stream only
221 pstatus
->signalquality
= (evm
& 0xff);
222 pstatus
->rx_mimo_sig_qual
[i
] = (evm
& 0xff);
227 /* UI BSS List signal strength(in percentage),
228 * make it good looking, from 0~100.
231 pstatus
->signalstrength
= (u8
)(rtl_signal_scale_mapping(hw
,
233 else if (rf_rx_num
!= 0)
234 pstatus
->signalstrength
= (u8
)(rtl_signal_scale_mapping(hw
,
235 total_rssi
/= rf_rx_num
));
238 static void _rtl8723ae_translate_rx_signal_stuff(struct ieee80211_hw
*hw
,
239 struct sk_buff
*skb
, struct rtl_stats
*pstatus
,
240 u8
*pdesc
, struct rx_fwinfo_8723e
*p_drvinfo
)
242 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
243 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
244 struct ieee80211_hdr
*hdr
;
249 bool packet_matchbssid
, packet_toself
, packet_beacon
= false;
251 tmp_buf
= skb
->data
+ pstatus
->rx_drvinfo_size
+ pstatus
->rx_bufshift
;
253 hdr
= (struct ieee80211_hdr
*)tmp_buf
;
254 fc
= hdr
->frame_control
;
255 type
= WLAN_FC_GET_TYPE(fc
);
259 ((IEEE80211_FTYPE_CTL
!= type
) &&
260 ether_addr_equal(mac
->bssid
,
261 (le16_to_cpu(fc
) & IEEE80211_FCTL_TODS
) ? hdr
->addr1
:
262 (le16_to_cpu(fc
) & IEEE80211_FCTL_FROMDS
) ? hdr
->addr2
:
264 (!pstatus
->hwerror
) && (!pstatus
->crc
) && (!pstatus
->icv
));
266 packet_toself
= (packet_matchbssid
&&
267 ether_addr_equal(praddr
, rtlefuse
->dev_addr
));
269 if (ieee80211_is_beacon(fc
))
270 packet_beacon
= true;
272 _rtl8723ae_query_rxphystatus(hw
, pstatus
, pdesc
, p_drvinfo
,
273 packet_matchbssid
, packet_toself
,
276 rtl_process_phyinfo(hw
, tmp_buf
, pstatus
);
279 bool rtl8723ae_rx_query_desc(struct ieee80211_hw
*hw
,
280 struct rtl_stats
*status
,
281 struct ieee80211_rx_status
*rx_status
,
282 u8
*pdesc
, struct sk_buff
*skb
)
284 struct rx_fwinfo_8723e
*p_drvinfo
;
285 struct ieee80211_hdr
*hdr
;
286 u32 phystatus
= GET_RX_DESC_PHYST(pdesc
);
288 status
->length
= (u16
) GET_RX_DESC_PKT_LEN(pdesc
);
289 status
->rx_drvinfo_size
= (u8
) GET_RX_DESC_DRV_INFO_SIZE(pdesc
) *
290 RX_DRV_INFO_SIZE_UNIT
;
291 status
->rx_bufshift
= (u8
) (GET_RX_DESC_SHIFT(pdesc
) & 0x03);
292 status
->icv
= (u16
) GET_RX_DESC_ICV(pdesc
);
293 status
->crc
= (u16
) GET_RX_DESC_CRC32(pdesc
);
294 status
->hwerror
= (status
->crc
| status
->icv
);
295 status
->decrypted
= !GET_RX_DESC_SWDEC(pdesc
);
296 status
->rate
= (u8
) GET_RX_DESC_RXMCS(pdesc
);
297 status
->shortpreamble
= (u16
) GET_RX_DESC_SPLCP(pdesc
);
298 status
->isampdu
= (bool) (GET_RX_DESC_PAGGR(pdesc
) == 1);
299 status
->isfirst_ampdu
= (bool) ((GET_RX_DESC_PAGGR(pdesc
) == 1)
300 && (GET_RX_DESC_FAGGR(pdesc
) == 1));
301 status
->timestamp_low
= GET_RX_DESC_TSFL(pdesc
);
302 status
->rx_is40Mhzpacket
= (bool) GET_RX_DESC_BW(pdesc
);
303 status
->is_ht
= (bool)GET_RX_DESC_RXHT(pdesc
);
305 status
->is_cck
= RTL8723E_RX_HAL_IS_CCK_RATE(status
->rate
);
307 rx_status
->freq
= hw
->conf
.chandef
.chan
->center_freq
;
308 rx_status
->band
= hw
->conf
.chandef
.chan
->band
;
311 rx_status
->flag
|= RX_FLAG_FAILED_FCS_CRC
;
313 if (status
->rx_is40Mhzpacket
)
314 rx_status
->flag
|= RX_FLAG_40MHZ
;
317 rx_status
->flag
|= RX_FLAG_HT
;
319 rx_status
->flag
|= RX_FLAG_MACTIME_START
;
321 /* hw will set status->decrypted true, if it finds the
322 * frame is open data frame or mgmt frame.
323 * Thus hw will not decrypt a robust managment frame
324 * for IEEE80211w but still set status->decrypted
325 * true, so here we should set it back to undecrypted
326 * for IEEE80211w frame, and mac80211 sw will help
329 if (status
->decrypted
) {
330 hdr
= (struct ieee80211_hdr
*)(skb
->data
+
331 status
->rx_drvinfo_size
+ status
->rx_bufshift
);
334 /* during testing, hdr could be NULL here */
337 if ((ieee80211_is_robust_mgmt_frame(hdr
)) &&
338 (ieee80211_has_protected(hdr
->frame_control
)))
339 rx_status
->flag
&= ~RX_FLAG_DECRYPTED
;
341 rx_status
->flag
|= RX_FLAG_DECRYPTED
;
344 /* rate_idx: index of data rate into band's
345 * supported rates or MCS index if HT rates
346 * are use (RX_FLAG_HT)
348 rx_status
->rate_idx
= rtlwifi_rate_mapping(hw
, status
->is_ht
,
349 status
->rate
, false);
351 rx_status
->mactime
= status
->timestamp_low
;
352 if (phystatus
== true) {
353 p_drvinfo
= (struct rx_fwinfo_8723e
*)(skb
->data
+
354 status
->rx_bufshift
);
356 _rtl8723ae_translate_rx_signal_stuff(hw
,
357 skb
, status
, pdesc
, p_drvinfo
);
360 /*rx_status->qual = status->signal; */
361 rx_status
->signal
= status
->recvsignalpower
+ 10;
362 /*rx_status->noise = -status->noise; */
367 void rtl8723ae_tx_fill_desc(struct ieee80211_hw
*hw
,
368 struct ieee80211_hdr
*hdr
, u8
*pdesc_tx
,
369 struct ieee80211_tx_info
*info
,
370 struct ieee80211_sta
*sta
,
371 struct sk_buff
*skb
, u8 hw_queue
,
372 struct rtl_tcb_desc
*ptcdesc
)
374 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
375 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
376 struct rtl_pci
*rtlpci
= rtl_pcidev(rtl_pcipriv(hw
));
377 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
378 bool defaultadapter
= true;
379 u8
*pdesc
= (u8
*) pdesc_tx
;
381 __le16 fc
= hdr
->frame_control
;
382 u8 fw_qsel
= _rtl8723ae_map_hwqueue_to_fwqueue(skb
, hw_queue
);
383 bool firstseg
= ((hdr
->seq_ctrl
&
384 cpu_to_le16(IEEE80211_SCTL_FRAG
)) == 0);
385 bool lastseg
= ((hdr
->frame_control
&
386 cpu_to_le16(IEEE80211_FCTL_MOREFRAGS
)) == 0);
387 dma_addr_t mapping
= pci_map_single(rtlpci
->pdev
,
392 if (pci_dma_mapping_error(rtlpci
->pdev
, mapping
)) {
393 RT_TRACE(rtlpriv
, COMP_SEND
, DBG_TRACE
,
394 "DMA mapping error");
397 if (mac
->opmode
== NL80211_IFTYPE_STATION
) {
399 } else if (mac
->opmode
== NL80211_IFTYPE_AP
||
400 mac
->opmode
== NL80211_IFTYPE_ADHOC
) {
402 bw_40
= sta
->bandwidth
>= IEEE80211_STA_RX_BW_40
;
405 seq_number
= (le16_to_cpu(hdr
->seq_ctrl
) & IEEE80211_SCTL_SEQ
) >> 4;
407 rtl_get_tcb_desc(hw
, info
, sta
, skb
, ptcdesc
);
409 CLEAR_PCI_TX_DESC_CONTENT(pdesc
, sizeof(struct tx_desc_8723e
));
411 if (ieee80211_is_nullfunc(fc
) || ieee80211_is_ctl(fc
)) {
417 SET_TX_DESC_OFFSET(pdesc
, USB_HWDESC_HEADER_LEN
);
419 SET_TX_DESC_TX_RATE(pdesc
, ptcdesc
->hw_rate
);
421 if (ptcdesc
->use_shortgi
|| ptcdesc
->use_shortpreamble
)
422 SET_TX_DESC_DATA_SHORTGI(pdesc
, 1);
424 if (info
->flags
& IEEE80211_TX_CTL_AMPDU
) {
425 SET_TX_DESC_AGG_BREAK(pdesc
, 1);
426 SET_TX_DESC_MAX_AGG_NUM(pdesc
, 0x14);
428 SET_TX_DESC_SEQ(pdesc
, seq_number
);
430 SET_TX_DESC_RTS_ENABLE(pdesc
, ((ptcdesc
->rts_enable
&&
432 cts_enable
) ? 1 : 0));
433 SET_TX_DESC_HW_RTS_ENABLE(pdesc
,
434 ((ptcdesc
->rts_enable
435 || ptcdesc
->cts_enable
) ? 1 : 0));
436 SET_TX_DESC_CTS2SELF(pdesc
, ((ptcdesc
->cts_enable
) ? 1 : 0));
437 SET_TX_DESC_RTS_STBC(pdesc
, ((ptcdesc
->rts_stbc
) ? 1 : 0));
439 SET_TX_DESC_RTS_RATE(pdesc
, ptcdesc
->rts_rate
);
440 SET_TX_DESC_RTS_BW(pdesc
, 0);
441 SET_TX_DESC_RTS_SC(pdesc
, ptcdesc
->rts_sc
);
442 SET_TX_DESC_RTS_SHORT(pdesc
,
443 ((ptcdesc
->rts_rate
<= DESC92_RATE54M
) ?
444 (ptcdesc
->rts_use_shortpreamble
? 1 : 0)
445 : (ptcdesc
->rts_use_shortgi
? 1 : 0)));
448 if (ptcdesc
->packet_bw
) {
449 SET_TX_DESC_DATA_BW(pdesc
, 1);
450 SET_TX_DESC_TX_SUB_CARRIER(pdesc
, 3);
452 SET_TX_DESC_DATA_BW(pdesc
, 0);
453 SET_TX_DESC_TX_SUB_CARRIER(pdesc
,
454 mac
->cur_40_prime_sc
);
457 SET_TX_DESC_DATA_BW(pdesc
, 0);
458 SET_TX_DESC_TX_SUB_CARRIER(pdesc
, 0);
461 SET_TX_DESC_LINIP(pdesc
, 0);
462 SET_TX_DESC_PKT_SIZE(pdesc
, (u16
) skb
->len
);
465 u8 ampdu_density
= sta
->ht_cap
.ampdu_density
;
466 SET_TX_DESC_AMPDU_DENSITY(pdesc
, ampdu_density
);
469 if (info
->control
.hw_key
) {
470 struct ieee80211_key_conf
*keyconf
=
471 info
->control
.hw_key
;
473 switch (keyconf
->cipher
) {
474 case WLAN_CIPHER_SUITE_WEP40
:
475 case WLAN_CIPHER_SUITE_WEP104
:
476 case WLAN_CIPHER_SUITE_TKIP
:
477 SET_TX_DESC_SEC_TYPE(pdesc
, 0x1);
479 case WLAN_CIPHER_SUITE_CCMP
:
480 SET_TX_DESC_SEC_TYPE(pdesc
, 0x3);
483 SET_TX_DESC_SEC_TYPE(pdesc
, 0x0);
488 SET_TX_DESC_PKT_ID(pdesc
, 0);
489 SET_TX_DESC_QUEUE_SEL(pdesc
, fw_qsel
);
491 SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc
, 0x1F);
492 SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc
, 0xF);
493 SET_TX_DESC_DISABLE_FB(pdesc
, 0);
494 SET_TX_DESC_USE_RATE(pdesc
, ptcdesc
->use_driver_rate
? 1 : 0);
496 if (ieee80211_is_data_qos(fc
)) {
498 RT_TRACE(rtlpriv
, COMP_SEND
, DBG_TRACE
,
499 "Enable RDG function.\n");
500 SET_TX_DESC_RDG_ENABLE(pdesc
, 1);
501 SET_TX_DESC_HTC(pdesc
, 1);
506 SET_TX_DESC_FIRST_SEG(pdesc
, (firstseg
? 1 : 0));
507 SET_TX_DESC_LAST_SEG(pdesc
, (lastseg
? 1 : 0));
509 SET_TX_DESC_TX_BUFFER_SIZE(pdesc
, (u16
) skb
->len
);
511 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc
, mapping
);
513 if (rtlpriv
->dm
.useramask
) {
514 SET_TX_DESC_RATE_ID(pdesc
, ptcdesc
->ratr_index
);
515 SET_TX_DESC_MACID(pdesc
, ptcdesc
->mac_id
);
517 SET_TX_DESC_RATE_ID(pdesc
, 0xC + ptcdesc
->ratr_index
);
518 SET_TX_DESC_MACID(pdesc
, ptcdesc
->ratr_index
);
521 if ((!ieee80211_is_data_qos(fc
)) && ppsc
->fwctrl_lps
) {
522 SET_TX_DESC_HWSEQ_EN_8723(pdesc
, 1);
525 SET_TX_DESC_HWSEQ_SEL_8723(pdesc
, 1);
528 SET_TX_DESC_MORE_FRAG(pdesc
, (lastseg
? 0 : 1));
530 if (is_multicast_ether_addr(ieee80211_get_DA(hdr
)) ||
531 is_broadcast_ether_addr(ieee80211_get_DA(hdr
))) {
532 SET_TX_DESC_BMC(pdesc
, 1);
535 RT_TRACE(rtlpriv
, COMP_SEND
, DBG_TRACE
, "\n");
538 void rtl8723ae_tx_fill_cmddesc(struct ieee80211_hw
*hw
,
539 u8
*pdesc
, bool firstseg
,
540 bool lastseg
, struct sk_buff
*skb
)
542 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
543 struct rtl_pci
*rtlpci
= rtl_pcidev(rtl_pcipriv(hw
));
544 struct ieee80211_hdr
*hdr
= (struct ieee80211_hdr
*)(skb
->data
);
545 u8 fw_queue
= QSLT_BEACON
;
546 dma_addr_t mapping
= pci_map_single(rtlpci
->pdev
,
549 __le16 fc
= hdr
->frame_control
;
551 if (pci_dma_mapping_error(rtlpci
->pdev
, mapping
)) {
552 RT_TRACE(rtlpriv
, COMP_SEND
, DBG_TRACE
,
553 "DMA mapping error");
556 CLEAR_PCI_TX_DESC_CONTENT(pdesc
, TX_DESC_SIZE
);
559 SET_TX_DESC_OFFSET(pdesc
, USB_HWDESC_HEADER_LEN
);
561 SET_TX_DESC_TX_RATE(pdesc
, DESC92_RATE1M
);
563 SET_TX_DESC_SEQ(pdesc
, 0);
565 SET_TX_DESC_LINIP(pdesc
, 0);
567 SET_TX_DESC_QUEUE_SEL(pdesc
, fw_queue
);
569 SET_TX_DESC_FIRST_SEG(pdesc
, 1);
570 SET_TX_DESC_LAST_SEG(pdesc
, 1);
572 SET_TX_DESC_TX_BUFFER_SIZE(pdesc
, (u16
) (skb
->len
));
574 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc
, mapping
);
576 SET_TX_DESC_RATE_ID(pdesc
, 7);
577 SET_TX_DESC_MACID(pdesc
, 0);
579 SET_TX_DESC_OWN(pdesc
, 1);
581 SET_TX_DESC_PKT_SIZE((u8
*) pdesc
, (u16
) (skb
->len
));
583 SET_TX_DESC_FIRST_SEG(pdesc
, 1);
584 SET_TX_DESC_LAST_SEG(pdesc
, 1);
586 SET_TX_DESC_OFFSET(pdesc
, 0x20);
588 SET_TX_DESC_USE_RATE(pdesc
, 1);
590 if (!ieee80211_is_data_qos(fc
)) {
591 SET_TX_DESC_HWSEQ_EN_8723(pdesc
, 1);
592 /* SET_TX_DESC_HWSEQ_EN(pdesc, 1); */
593 /* SET_TX_DESC_PKT_ID(pdesc, 8); */
596 RT_PRINT_DATA(rtlpriv
, COMP_CMD
, DBG_LOUD
,
597 "H2C Tx Cmd Content\n",
598 pdesc
, TX_DESC_SIZE
);
601 void rtl8723ae_set_desc(u8
*pdesc
, bool istx
, u8 desc_name
, u8
*val
)
606 SET_TX_DESC_OWN(pdesc
, 1);
608 case HW_DESC_TX_NEXTDESC_ADDR
:
609 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc
, *(u32
*) val
);
612 RT_ASSERT(false, "ERR txdesc :%d not process\n",
619 SET_RX_DESC_OWN(pdesc
, 1);
621 case HW_DESC_RXBUFF_ADDR
:
622 SET_RX_DESC_BUFF_ADDR(pdesc
, *(u32
*) val
);
624 case HW_DESC_RXPKT_LEN
:
625 SET_RX_DESC_PKT_LEN(pdesc
, *(u32
*) val
);
628 SET_RX_DESC_EOR(pdesc
, 1);
631 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
638 u32
rtl8723ae_get_desc(u8
*pdesc
, bool istx
, u8 desc_name
)
645 ret
= GET_TX_DESC_OWN(pdesc
);
647 case HW_DESC_TXBUFF_ADDR
:
648 ret
= GET_TX_DESC_TX_BUFFER_ADDRESS(pdesc
);
651 RT_ASSERT(false, "ERR txdesc :%d not process\n",
658 ret
= GET_RX_DESC_OWN(pdesc
);
660 case HW_DESC_RXPKT_LEN
:
661 ret
= GET_RX_DESC_PKT_LEN(pdesc
);
664 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
672 void rtl8723ae_tx_polling(struct ieee80211_hw
*hw
, u8 hw_queue
)
674 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
675 if (hw_queue
== BEACON_QUEUE
) {
676 rtl_write_word(rtlpriv
, REG_PCIE_CTRL_REG
, BIT(4));
678 rtl_write_word(rtlpriv
, REG_PCIE_CTRL_REG
,
679 BIT(0) << (hw_queue
));