1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2012 Realtek Corporation.*/
14 static u8
_rtl8723e_map_hwqueue_to_fwqueue(struct sk_buff
*skb
, u8 hw_queue
)
16 __le16 fc
= rtl_get_fc(skb
);
18 if (unlikely(ieee80211_is_beacon(fc
)))
20 if (ieee80211_is_mgmt(fc
) || ieee80211_is_ctl(fc
))
26 static void _rtl8723e_query_rxphystatus(struct ieee80211_hw
*hw
,
27 struct rtl_stats
*pstatus
, u8
*pdesc
,
28 struct rx_fwinfo_8723e
*p_drvinfo
,
29 bool bpacket_match_bssid
,
30 bool bpacket_toself
, bool packet_beacon
)
32 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
33 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtlpriv
);
34 struct phy_sts_cck_8723e_t
*cck_buf
;
35 s8 rx_pwr_all
= 0, rx_pwr
[4];
36 u8 rf_rx_num
= 0, evm
, pwdb_all
;
37 u8 i
, max_spatial_stream
;
38 u32 rssi
, total_rssi
= 0;
39 bool is_cck
= pstatus
->is_cck
;
41 /* Record it for next packet processing */
42 pstatus
->packet_matchbssid
= bpacket_match_bssid
;
43 pstatus
->packet_toself
= bpacket_toself
;
44 pstatus
->packet_beacon
= packet_beacon
;
45 pstatus
->rx_mimo_signalquality
[0] = -1;
46 pstatus
->rx_mimo_signalquality
[1] = -1;
49 u8 report
, cck_highpwr
;
51 /* CCK Driver info Structure is not the same as OFDM packet. */
52 cck_buf
= (struct phy_sts_cck_8723e_t
*)p_drvinfo
;
54 /* (1)Hardware does not provide RSSI for CCK */
55 /* (2)PWDB, Average PWDB cacluated by
56 * hardware (for rate adaptive)
58 if (ppsc
->rfpwr_state
== ERFON
)
59 cck_highpwr
= (u8
)rtl_get_bbreg(hw
,
60 RFPGA0_XA_HSSIPARAMETER2
,
66 u8 cck_agc_rpt
= cck_buf
->cck_agc_rpt
;
67 report
= cck_buf
->cck_agc_rpt
& 0xc0;
71 rx_pwr_all
= -46 - (cck_agc_rpt
& 0x3e);
74 rx_pwr_all
= -26 - (cck_agc_rpt
& 0x3e);
77 rx_pwr_all
= -12 - (cck_agc_rpt
& 0x3e);
80 rx_pwr_all
= 16 - (cck_agc_rpt
& 0x3e);
84 u8 cck_agc_rpt
= cck_buf
->cck_agc_rpt
;
85 report
= p_drvinfo
->cfosho
[0] & 0x60;
89 rx_pwr_all
= -46 - ((cck_agc_rpt
& 0x1f) << 1);
92 rx_pwr_all
= -26 - ((cck_agc_rpt
& 0x1f) << 1);
95 rx_pwr_all
= -12 - ((cck_agc_rpt
& 0x1f) << 1);
98 rx_pwr_all
= 16 - ((cck_agc_rpt
& 0x1f) << 1);
103 pwdb_all
= rtl_query_rxpwrpercentage(rx_pwr_all
);
104 /* CCK gain is smaller than OFDM/MCS gain, */
105 /* so we add gain diff by experiences,
111 /* modify the offset to make the same
112 * gain index with OFDM.
114 if (pwdb_all
> 34 && pwdb_all
<= 42)
116 else if (pwdb_all
> 26 && pwdb_all
<= 34)
118 else if (pwdb_all
> 14 && pwdb_all
<= 26)
120 else if (pwdb_all
> 4 && pwdb_all
<= 14)
123 pstatus
->rx_pwdb_all
= pwdb_all
;
124 pstatus
->recvsignalpower
= rx_pwr_all
;
126 /* (3) Get Signal Quality (EVM) */
127 if (bpacket_match_bssid
) {
130 if (pstatus
->rx_pwdb_all
> 40)
133 sq
= cck_buf
->sq_rpt
;
139 sq
= ((64 - sq
) * 100) / 44;
142 pstatus
->signalquality
= sq
;
143 pstatus
->rx_mimo_signalquality
[0] = sq
;
144 pstatus
->rx_mimo_signalquality
[1] = -1;
147 rtlpriv
->dm
.rfpath_rxenable
[0] =
148 rtlpriv
->dm
.rfpath_rxenable
[1] = true;
150 /* (1)Get RSSI for HT rate */
151 for (i
= RF90_PATH_A
; i
< RF6052_MAX_PATH
; i
++) {
153 /* we will judge RF RX path now. */
154 if (rtlpriv
->dm
.rfpath_rxenable
[i
])
157 rx_pwr
[i
] = ((p_drvinfo
->gain_trsw
[i
] &
160 /* Translate DBM to percentage. */
161 rssi
= rtl_query_rxpwrpercentage(rx_pwr
[i
]);
164 /* Get Rx snr value in DB */
165 rtlpriv
->stats
.rx_snr_db
[i
] =
166 (long)(p_drvinfo
->rxsnr
[i
] / 2);
168 /* Record Signal Strength for next packet */
169 if (bpacket_match_bssid
)
170 pstatus
->rx_mimo_signalstrength
[i
] = (u8
)rssi
;
173 /* (2)PWDB, Average PWDB cacluated by
174 * hardware (for rate adaptive)
176 rx_pwr_all
= ((p_drvinfo
->pwdb_all
>> 1) & 0x7f) - 110;
178 pwdb_all
= rtl_query_rxpwrpercentage(rx_pwr_all
);
179 pstatus
->rx_pwdb_all
= pwdb_all
;
180 pstatus
->rxpower
= rx_pwr_all
;
181 pstatus
->recvsignalpower
= rx_pwr_all
;
183 /* (3)EVM of HT rate */
184 if (pstatus
->is_ht
&& pstatus
->rate
>= DESC92C_RATEMCS8
&&
185 pstatus
->rate
<= DESC92C_RATEMCS15
)
186 max_spatial_stream
= 2;
188 max_spatial_stream
= 1;
190 for (i
= 0; i
< max_spatial_stream
; i
++) {
191 evm
= rtl_evm_db_to_percentage(p_drvinfo
->rxevm
[i
]);
193 if (bpacket_match_bssid
) {
194 /* Fill value in RFD, Get the first
195 * spatial stream only
198 pstatus
->signalquality
=
200 pstatus
->rx_mimo_signalquality
[i
] =
206 /* UI BSS List signal strength(in percentage),
207 * make it good looking, from 0~100.
210 pstatus
->signalstrength
= (u8
)(rtl_signal_scale_mapping(hw
,
212 else if (rf_rx_num
!= 0)
213 pstatus
->signalstrength
= (u8
)(rtl_signal_scale_mapping(hw
,
214 total_rssi
/= rf_rx_num
));
217 static void translate_rx_signal_stuff(struct ieee80211_hw
*hw
,
219 struct rtl_stats
*pstatus
, u8
*pdesc
,
220 struct rx_fwinfo_8723e
*p_drvinfo
)
222 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
223 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
224 struct ieee80211_hdr
*hdr
;
229 bool packet_matchbssid
, packet_toself
, packet_beacon
;
231 tmp_buf
= skb
->data
+ pstatus
->rx_drvinfo_size
+ pstatus
->rx_bufshift
;
233 hdr
= (struct ieee80211_hdr
*)tmp_buf
;
234 fc
= le16_to_cpu(hdr
->frame_control
);
235 type
= WLAN_FC_GET_TYPE(hdr
->frame_control
);
238 packet_matchbssid
= ((IEEE80211_FTYPE_CTL
!= type
) &&
239 (ether_addr_equal(mac
->bssid
, (fc
& IEEE80211_FCTL_TODS
) ?
240 hdr
->addr1
: (fc
& IEEE80211_FCTL_FROMDS
) ?
241 hdr
->addr2
: hdr
->addr3
)) &&
242 (!pstatus
->hwerror
) &&
243 (!pstatus
->crc
) && (!pstatus
->icv
));
245 packet_toself
= packet_matchbssid
&&
246 (ether_addr_equal(praddr
, rtlefuse
->dev_addr
));
248 if (ieee80211_is_beacon(hdr
->frame_control
))
249 packet_beacon
= true;
251 packet_beacon
= false;
253 _rtl8723e_query_rxphystatus(hw
, pstatus
, pdesc
, p_drvinfo
,
254 packet_matchbssid
, packet_toself
,
257 rtl_process_phyinfo(hw
, tmp_buf
, pstatus
);
260 bool rtl8723e_rx_query_desc(struct ieee80211_hw
*hw
,
261 struct rtl_stats
*status
,
262 struct ieee80211_rx_status
*rx_status
,
263 u8
*pdesc8
, struct sk_buff
*skb
)
265 struct rx_fwinfo_8723e
*p_drvinfo
;
266 struct ieee80211_hdr
*hdr
;
267 __le32
*pdesc
= (__le32
*)pdesc8
;
268 u32 phystatus
= get_rx_desc_physt(pdesc
);
270 status
->length
= (u16
)get_rx_desc_pkt_len(pdesc
);
271 status
->rx_drvinfo_size
= (u8
)get_rx_desc_drv_info_size(pdesc
) *
272 RX_DRV_INFO_SIZE_UNIT
;
273 status
->rx_bufshift
= (u8
)(get_rx_desc_shift(pdesc
) & 0x03);
274 status
->icv
= (u16
)get_rx_desc_icv(pdesc
);
275 status
->crc
= (u16
)get_rx_desc_crc32(pdesc
);
276 status
->hwerror
= (status
->crc
| status
->icv
);
277 status
->decrypted
= !get_rx_desc_swdec(pdesc
);
278 status
->rate
= (u8
)get_rx_desc_rxmcs(pdesc
);
279 status
->shortpreamble
= (u16
)get_rx_desc_splcp(pdesc
);
280 status
->isampdu
= (bool)(get_rx_desc_paggr(pdesc
) == 1);
281 status
->isfirst_ampdu
= (bool)((get_rx_desc_paggr(pdesc
) == 1) &&
282 (get_rx_desc_faggr(pdesc
) == 1));
283 status
->timestamp_low
= get_rx_desc_tsfl(pdesc
);
284 status
->rx_is40mhzpacket
= (bool)get_rx_desc_bw(pdesc
);
285 status
->is_ht
= (bool)get_rx_desc_rxht(pdesc
);
287 status
->is_cck
= RX_HAL_IS_CCK_RATE(status
->rate
);
289 rx_status
->freq
= hw
->conf
.chandef
.chan
->center_freq
;
290 rx_status
->band
= hw
->conf
.chandef
.chan
->band
;
292 hdr
= (struct ieee80211_hdr
*)(skb
->data
+ status
->rx_drvinfo_size
293 + status
->rx_bufshift
);
296 rx_status
->flag
|= RX_FLAG_FAILED_FCS_CRC
;
298 if (status
->rx_is40mhzpacket
)
299 rx_status
->bw
= RATE_INFO_BW_40
;
302 rx_status
->encoding
= RX_ENC_HT
;
304 rx_status
->flag
|= RX_FLAG_MACTIME_START
;
306 /* hw will set status->decrypted true, if it finds the
307 * frame is open data frame or mgmt frame.
308 * So hw will not decryption robust managment frame
309 * for IEEE80211w but still set status->decrypted
310 * true, so here we should set it back to undecrypted
311 * for IEEE80211w frame, and mac80211 sw will help
314 if (status
->decrypted
) {
315 if ((!_ieee80211_is_robust_mgmt_frame(hdr
)) &&
316 (ieee80211_has_protected(hdr
->frame_control
)))
317 rx_status
->flag
|= RX_FLAG_DECRYPTED
;
319 rx_status
->flag
&= ~RX_FLAG_DECRYPTED
;
322 /* rate_idx: index of data rate into band's
323 * supported rates or MCS index if HT rates
324 * are use (RX_FLAG_HT)
325 * Notice: this is diff with windows define
327 rx_status
->rate_idx
= rtlwifi_rate_mapping(hw
, status
->is_ht
,
328 false, status
->rate
);
330 rx_status
->mactime
= status
->timestamp_low
;
331 if (phystatus
== true) {
332 p_drvinfo
= (struct rx_fwinfo_8723e
*)(skb
->data
+
333 status
->rx_bufshift
);
335 translate_rx_signal_stuff(hw
, skb
, status
, pdesc8
, p_drvinfo
);
337 rx_status
->signal
= status
->recvsignalpower
+ 10;
341 void rtl8723e_tx_fill_desc(struct ieee80211_hw
*hw
,
342 struct ieee80211_hdr
*hdr
, u8
*pdesc_tx
,
343 u8
*txbd
, struct ieee80211_tx_info
*info
,
344 struct ieee80211_sta
*sta
,
346 u8 hw_queue
, struct rtl_tcb_desc
*ptcb_desc
)
348 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
349 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
350 struct rtl_pci
*rtlpci
= rtl_pcidev(rtl_pcipriv(hw
));
351 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
352 bool b_defaultadapter
= true;
353 /* bool b_trigger_ac = false; */
354 u8
*pdesc8
= (u8
*)pdesc_tx
;
355 __le32
*pdesc
= (__le32
*)pdesc8
;
357 __le16 fc
= hdr
->frame_control
;
358 u8 fw_qsel
= _rtl8723e_map_hwqueue_to_fwqueue(skb
, hw_queue
);
359 bool firstseg
= ((hdr
->seq_ctrl
&
360 cpu_to_le16(IEEE80211_SCTL_FRAG
)) == 0);
362 bool lastseg
= ((hdr
->frame_control
&
363 cpu_to_le16(IEEE80211_FCTL_MOREFRAGS
)) == 0);
365 dma_addr_t mapping
= dma_map_single(&rtlpci
->pdev
->dev
, skb
->data
,
366 skb
->len
, DMA_TO_DEVICE
);
369 if (dma_mapping_error(&rtlpci
->pdev
->dev
, mapping
)) {
370 rtl_dbg(rtlpriv
, COMP_SEND
, DBG_TRACE
,
371 "DMA mapping error\n");
374 if (mac
->opmode
== NL80211_IFTYPE_STATION
) {
376 } else if (mac
->opmode
== NL80211_IFTYPE_AP
||
377 mac
->opmode
== NL80211_IFTYPE_ADHOC
) {
379 bw_40
= sta
->ht_cap
.cap
&
380 IEEE80211_HT_CAP_SUP_WIDTH_20_40
;
383 seq_number
= (le16_to_cpu(hdr
->seq_ctrl
) & IEEE80211_SCTL_SEQ
) >> 4;
385 rtl_get_tcb_desc(hw
, info
, sta
, skb
, ptcb_desc
);
387 clear_pci_tx_desc_content(pdesc
, sizeof(struct tx_desc_8723e
));
389 if (ieee80211_is_nullfunc(fc
) || ieee80211_is_ctl(fc
)) {
395 set_tx_desc_offset(pdesc
, USB_HWDESC_HEADER_LEN
);
397 set_tx_desc_tx_rate(pdesc
, ptcb_desc
->hw_rate
);
399 if (ptcb_desc
->use_shortgi
|| ptcb_desc
->use_shortpreamble
)
400 set_tx_desc_data_shortgi(pdesc
, 1);
402 if (info
->flags
& IEEE80211_TX_CTL_AMPDU
) {
403 set_tx_desc_agg_break(pdesc
, 1);
404 set_tx_desc_max_agg_num(pdesc
, 0x14);
406 set_tx_desc_seq(pdesc
, seq_number
);
408 set_tx_desc_rts_enable(pdesc
,
409 ((ptcb_desc
->rts_enable
&&
410 !ptcb_desc
->cts_enable
) ? 1 : 0));
411 set_tx_desc_hw_rts_enable(pdesc
,
412 ((ptcb_desc
->rts_enable
||
413 ptcb_desc
->cts_enable
) ? 1 : 0));
414 set_tx_desc_cts2self(pdesc
,
415 ((ptcb_desc
->cts_enable
) ? 1 : 0));
416 set_tx_desc_rts_stbc(pdesc
,
417 ((ptcb_desc
->rts_stbc
) ? 1 : 0));
419 set_tx_desc_rts_rate(pdesc
, ptcb_desc
->rts_rate
);
420 set_tx_desc_rts_bw(pdesc
, 0);
421 set_tx_desc_rts_sc(pdesc
, ptcb_desc
->rts_sc
);
422 set_tx_desc_rts_short(pdesc
,
423 ((ptcb_desc
->rts_rate
<= DESC92C_RATE54M
) ?
424 (ptcb_desc
->rts_use_shortpreamble
? 1 : 0)
425 : (ptcb_desc
->rts_use_shortgi
? 1 : 0)));
428 if (ptcb_desc
->packet_bw
== HT_CHANNEL_WIDTH_20_40
) {
429 set_tx_desc_data_bw(pdesc
, 1);
430 set_tx_desc_tx_sub_carrier(pdesc
, 3);
432 set_tx_desc_data_bw(pdesc
, 0);
433 set_tx_desc_tx_sub_carrier(pdesc
,
434 mac
->cur_40_prime_sc
);
437 set_tx_desc_data_bw(pdesc
, 0);
438 set_tx_desc_tx_sub_carrier(pdesc
, 0);
441 set_tx_desc_linip(pdesc
, 0);
442 set_tx_desc_pkt_size(pdesc
, (u16
)skb
->len
);
445 u8 ampdu_density
= sta
->ht_cap
.ampdu_density
;
446 set_tx_desc_ampdu_density(pdesc
, ampdu_density
);
449 if (info
->control
.hw_key
) {
450 struct ieee80211_key_conf
*keyconf
=
451 info
->control
.hw_key
;
453 switch (keyconf
->cipher
) {
454 case WLAN_CIPHER_SUITE_WEP40
:
455 case WLAN_CIPHER_SUITE_WEP104
:
456 case WLAN_CIPHER_SUITE_TKIP
:
457 set_tx_desc_sec_type(pdesc
, 0x1);
459 case WLAN_CIPHER_SUITE_CCMP
:
460 set_tx_desc_sec_type(pdesc
, 0x3);
463 set_tx_desc_sec_type(pdesc
, 0x0);
469 set_tx_desc_pkt_id(pdesc
, 0);
470 set_tx_desc_queue_sel(pdesc
, fw_qsel
);
472 set_tx_desc_data_rate_fb_limit(pdesc
, 0x1F);
473 set_tx_desc_rts_rate_fb_limit(pdesc
, 0xF);
474 set_tx_desc_disable_fb(pdesc
, 0);
475 set_tx_desc_use_rate(pdesc
, ptcb_desc
->use_driver_rate
? 1 : 0);
477 if (ieee80211_is_data_qos(fc
)) {
479 rtl_dbg(rtlpriv
, COMP_SEND
, DBG_TRACE
,
480 "Enable RDG function.\n");
481 set_tx_desc_rdg_enable(pdesc
, 1);
482 set_tx_desc_htc(pdesc
, 1);
487 set_tx_desc_first_seg(pdesc
, (firstseg
? 1 : 0));
488 set_tx_desc_last_seg(pdesc
, (lastseg
? 1 : 0));
490 set_tx_desc_tx_buffer_size(pdesc
, (u16
)skb
->len
);
492 set_tx_desc_tx_buffer_address(pdesc
, mapping
);
494 if (rtlpriv
->dm
.useramask
) {
495 set_tx_desc_rate_id(pdesc
, ptcb_desc
->ratr_index
);
496 set_tx_desc_macid(pdesc
, ptcb_desc
->mac_id
);
498 set_tx_desc_rate_id(pdesc
, 0xC + ptcb_desc
->ratr_index
);
499 set_tx_desc_macid(pdesc
, ptcb_desc
->ratr_index
);
502 if ((!ieee80211_is_data_qos(fc
)) && ppsc
->fwctrl_lps
) {
503 set_tx_desc_hwseq_en_8723(pdesc
, 1);
504 /* set_tx_desc_hwseq_en(pdesc, 1); */
505 /* set_tx_desc_pkt_id(pdesc, 8); */
507 if (!b_defaultadapter
)
508 set_tx_desc_hwseq_sel_8723(pdesc
, 1);
509 /* set_tx_desc_qos(pdesc, 1); */
512 set_tx_desc_more_frag(pdesc
, (lastseg
? 0 : 1));
514 if (is_multicast_ether_addr(ieee80211_get_DA(hdr
)) ||
515 is_broadcast_ether_addr(ieee80211_get_DA(hdr
))) {
516 set_tx_desc_bmc(pdesc
, 1);
519 rtl_dbg(rtlpriv
, COMP_SEND
, DBG_TRACE
, "\n");
522 void rtl8723e_tx_fill_cmddesc(struct ieee80211_hw
*hw
,
523 u8
*pdesc8
, bool firstseg
,
524 bool lastseg
, struct sk_buff
*skb
)
526 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
527 struct rtl_pci
*rtlpci
= rtl_pcidev(rtl_pcipriv(hw
));
528 u8 fw_queue
= QSLT_BEACON
;
529 __le32
*pdesc
= (__le32
*)pdesc8
;
531 struct ieee80211_hdr
*hdr
= (struct ieee80211_hdr
*)(skb
->data
);
532 __le16 fc
= hdr
->frame_control
;
534 dma_addr_t mapping
= dma_map_single(&rtlpci
->pdev
->dev
, skb
->data
,
535 skb
->len
, DMA_TO_DEVICE
);
537 if (dma_mapping_error(&rtlpci
->pdev
->dev
, mapping
)) {
538 rtl_dbg(rtlpriv
, COMP_SEND
, DBG_TRACE
,
539 "DMA mapping error\n");
542 clear_pci_tx_desc_content(pdesc
, TX_DESC_SIZE
);
545 set_tx_desc_offset(pdesc
, USB_HWDESC_HEADER_LEN
);
547 set_tx_desc_tx_rate(pdesc
, DESC92C_RATE1M
);
549 set_tx_desc_seq(pdesc
, 0);
551 set_tx_desc_linip(pdesc
, 0);
553 set_tx_desc_queue_sel(pdesc
, fw_queue
);
555 set_tx_desc_first_seg(pdesc
, 1);
556 set_tx_desc_last_seg(pdesc
, 1);
558 set_tx_desc_tx_buffer_size(pdesc
, (u16
)(skb
->len
));
560 set_tx_desc_tx_buffer_address(pdesc
, mapping
);
562 set_tx_desc_rate_id(pdesc
, 7);
563 set_tx_desc_macid(pdesc
, 0);
565 set_tx_desc_own(pdesc
, 1);
567 set_tx_desc_pkt_size(pdesc
, (u16
)(skb
->len
));
569 set_tx_desc_first_seg(pdesc
, 1);
570 set_tx_desc_last_seg(pdesc
, 1);
572 set_tx_desc_offset(pdesc
, 0x20);
574 set_tx_desc_use_rate(pdesc
, 1);
576 if (!ieee80211_is_data_qos(fc
)) {
577 set_tx_desc_hwseq_en_8723(pdesc
, 1);
578 /* set_tx_desc_hwseq_en(pdesc, 1); */
579 /* set_tx_desc_pkt_id(pdesc, 8); */
582 RT_PRINT_DATA(rtlpriv
, COMP_CMD
, DBG_LOUD
,
583 "H2C Tx Cmd Content\n",
584 pdesc
, TX_DESC_SIZE
);
587 void rtl8723e_set_desc(struct ieee80211_hw
*hw
, u8
*pdesc8
,
588 bool istx
, u8 desc_name
, u8
*val
)
590 __le32
*pdesc
= (__le32
*)pdesc8
;
595 set_tx_desc_own(pdesc
, 1);
597 case HW_DESC_TX_NEXTDESC_ADDR
:
598 set_tx_desc_next_desc_address(pdesc
, *(u32
*)val
);
601 WARN_ONCE(true, "rtl8723ae: ERR txdesc :%d not processed\n",
608 set_rx_desc_own(pdesc
, 1);
610 case HW_DESC_RXBUFF_ADDR
:
611 set_rx_desc_buff_addr(pdesc
, *(u32
*)val
);
613 case HW_DESC_RXPKT_LEN
:
614 set_rx_desc_pkt_len(pdesc
, *(u32
*)val
);
617 set_rx_desc_eor(pdesc
, 1);
620 WARN_ONCE(true, "rtl8723ae: ERR rxdesc :%d not processed\n",
627 u64
rtl8723e_get_desc(struct ieee80211_hw
*hw
,
628 u8
*pdesc8
, bool istx
, u8 desc_name
)
631 __le32
*pdesc
= (__le32
*)pdesc8
;
636 ret
= get_tx_desc_own(pdesc
);
638 case HW_DESC_TXBUFF_ADDR
:
639 ret
= get_tx_desc_tx_buffer_address(pdesc
);
642 WARN_ONCE(true, "rtl8723ae: ERR txdesc :%d not processed\n",
649 ret
= get_rx_desc_own(pdesc
);
651 case HW_DESC_RXPKT_LEN
:
652 ret
= get_rx_desc_pkt_len(pdesc
);
654 case HW_DESC_RXBUFF_ADDR
:
655 ret
= get_rx_desc_buff_addr(pdesc
);
658 WARN_ONCE(true, "rtl8723ae: ERR rxdesc :%d not processed\n",
666 bool rtl8723e_is_tx_desc_closed(struct ieee80211_hw
*hw
,
667 u8 hw_queue
, u16 index
)
669 struct rtl_pci
*rtlpci
= rtl_pcidev(rtl_pcipriv(hw
));
670 struct rtl8192_tx_ring
*ring
= &rtlpci
->tx_ring
[hw_queue
];
671 u8
*entry
= (u8
*)(&ring
->desc
[ring
->idx
]);
672 u8 own
= (u8
)rtl8723e_get_desc(hw
, entry
, true, HW_DESC_OWN
);
675 *beacon packet will only use the first
676 *descriptor defautly,and the own may not
677 *be cleared by the hardware
684 void rtl8723e_tx_polling(struct ieee80211_hw
*hw
, u8 hw_queue
)
686 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
687 if (hw_queue
== BEACON_QUEUE
) {
688 rtl_write_word(rtlpriv
, REG_PCIE_CTRL_REG
, BIT(4));
690 rtl_write_word(rtlpriv
, REG_PCIE_CTRL_REG
,
691 BIT(0) << (hw_queue
));