.. | .. |
---|
1 | | -/****************************************************************************** |
---|
2 | | - * |
---|
3 | | - * Copyright(c) 2009-2013 Realtek Corporation. |
---|
4 | | - * |
---|
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. |
---|
8 | | - * |
---|
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 |
---|
12 | | - * more details. |
---|
13 | | - * |
---|
14 | | - * The full GNU General Public License is included in this distribution in the |
---|
15 | | - * file called LICENSE. |
---|
16 | | - * |
---|
17 | | - * Contact Information: |
---|
18 | | - * wlanfae <wlanfae@realtek.com> |
---|
19 | | - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
---|
20 | | - * Hsinchu 300, Taiwan. |
---|
21 | | - * |
---|
22 | | - * Larry Finger <Larry.Finger@lwfinger.net> |
---|
23 | | - * |
---|
24 | | - *****************************************************************************/ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
| 2 | +/* Copyright(c) 2009-2013 Realtek Corporation.*/ |
---|
25 | 3 | |
---|
26 | 4 | #include "../wifi.h" |
---|
27 | 5 | #include "../pci.h" |
---|
.. | .. |
---|
29 | 7 | #include "../stats.h" |
---|
30 | 8 | #include "reg.h" |
---|
31 | 9 | #include "def.h" |
---|
32 | | -#include "phy.h" |
---|
33 | 10 | #include "trx.h" |
---|
34 | 11 | #include "led.h" |
---|
35 | 12 | #include "dm.h" |
---|
.. | .. |
---|
48 | 25 | } |
---|
49 | 26 | |
---|
50 | 27 | static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw, |
---|
51 | | - struct rtl_stats *pstatus, u8 *pdesc, |
---|
| 28 | + struct rtl_stats *pstatus, __le32 *pdesc, |
---|
52 | 29 | struct rx_fwinfo_88e *p_drvinfo, |
---|
53 | 30 | bool bpacket_match_bssid, |
---|
54 | 31 | bool bpacket_toself, bool packet_beacon) |
---|
.. | .. |
---|
294 | 271 | static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw, |
---|
295 | 272 | struct sk_buff *skb, |
---|
296 | 273 | struct rtl_stats *pstatus, |
---|
297 | | - u8 *pdesc, |
---|
| 274 | + __le32 *pdesc, |
---|
298 | 275 | struct rx_fwinfo_88e *p_drvinfo) |
---|
299 | 276 | { |
---|
300 | 277 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
---|
.. | .. |
---|
336 | 313 | rtl_process_phyinfo(hw, tmp_buf, pstatus); |
---|
337 | 314 | } |
---|
338 | 315 | |
---|
339 | | -static void _rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, |
---|
340 | | - u8 *virtualaddress) |
---|
| 316 | +static void rtl88ee_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, |
---|
| 317 | + __le32 *virtualaddress) |
---|
341 | 318 | { |
---|
342 | 319 | u32 dwtmp = 0; |
---|
343 | 320 | memset(virtualaddress, 0, 8); |
---|
344 | 321 | |
---|
345 | | - SET_EARLYMODE_PKTNUM(virtualaddress, ptcb_desc->empkt_num); |
---|
| 322 | + set_earlymode_pktnum(virtualaddress, ptcb_desc->empkt_num); |
---|
346 | 323 | if (ptcb_desc->empkt_num == 1) { |
---|
347 | 324 | dwtmp = ptcb_desc->empkt_len[0]; |
---|
348 | 325 | } else { |
---|
.. | .. |
---|
350 | 327 | dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4; |
---|
351 | 328 | dwtmp += ptcb_desc->empkt_len[1]; |
---|
352 | 329 | } |
---|
353 | | - SET_EARLYMODE_LEN0(virtualaddress, dwtmp); |
---|
| 330 | + set_earlymode_len0(virtualaddress, dwtmp); |
---|
354 | 331 | |
---|
355 | 332 | if (ptcb_desc->empkt_num <= 3) { |
---|
356 | 333 | dwtmp = ptcb_desc->empkt_len[2]; |
---|
.. | .. |
---|
359 | 336 | dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4; |
---|
360 | 337 | dwtmp += ptcb_desc->empkt_len[3]; |
---|
361 | 338 | } |
---|
362 | | - SET_EARLYMODE_LEN1(virtualaddress, dwtmp); |
---|
| 339 | + set_earlymode_len1(virtualaddress, dwtmp); |
---|
363 | 340 | if (ptcb_desc->empkt_num <= 5) { |
---|
364 | 341 | dwtmp = ptcb_desc->empkt_len[4]; |
---|
365 | 342 | } else { |
---|
.. | .. |
---|
367 | 344 | dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4; |
---|
368 | 345 | dwtmp += ptcb_desc->empkt_len[5]; |
---|
369 | 346 | } |
---|
370 | | - SET_EARLYMODE_LEN2_1(virtualaddress, dwtmp & 0xF); |
---|
371 | | - SET_EARLYMODE_LEN2_2(virtualaddress, dwtmp >> 4); |
---|
| 347 | + set_earlymode_len2_1(virtualaddress, dwtmp & 0xF); |
---|
| 348 | + set_earlymode_len2_2(virtualaddress, dwtmp >> 4); |
---|
372 | 349 | if (ptcb_desc->empkt_num <= 7) { |
---|
373 | 350 | dwtmp = ptcb_desc->empkt_len[6]; |
---|
374 | 351 | } else { |
---|
.. | .. |
---|
376 | 353 | dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4; |
---|
377 | 354 | dwtmp += ptcb_desc->empkt_len[7]; |
---|
378 | 355 | } |
---|
379 | | - SET_EARLYMODE_LEN3(virtualaddress, dwtmp); |
---|
| 356 | + set_earlymode_len3(virtualaddress, dwtmp); |
---|
380 | 357 | if (ptcb_desc->empkt_num <= 9) { |
---|
381 | 358 | dwtmp = ptcb_desc->empkt_len[8]; |
---|
382 | 359 | } else { |
---|
.. | .. |
---|
384 | 361 | dwtmp += ((dwtmp%4) ? (4-dwtmp%4) : 0)+4; |
---|
385 | 362 | dwtmp += ptcb_desc->empkt_len[9]; |
---|
386 | 363 | } |
---|
387 | | - SET_EARLYMODE_LEN4(virtualaddress, dwtmp); |
---|
| 364 | + set_earlymode_len4(virtualaddress, dwtmp); |
---|
388 | 365 | } |
---|
389 | 366 | |
---|
390 | 367 | bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw, |
---|
391 | 368 | struct rtl_stats *status, |
---|
392 | 369 | struct ieee80211_rx_status *rx_status, |
---|
393 | | - u8 *pdesc, struct sk_buff *skb) |
---|
| 370 | + u8 *pdesc8, struct sk_buff *skb) |
---|
394 | 371 | { |
---|
395 | 372 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
---|
396 | 373 | struct rx_fwinfo_88e *p_drvinfo; |
---|
397 | 374 | struct ieee80211_hdr *hdr; |
---|
| 375 | + u8 wake_match; |
---|
| 376 | + __le32 *pdesc = (__le32 *)pdesc8; |
---|
| 377 | + u32 phystatus = get_rx_desc_physt(pdesc); |
---|
398 | 378 | |
---|
399 | | - u32 phystatus = GET_RX_DESC_PHYST(pdesc); |
---|
400 | | - status->packet_report_type = (u8)GET_RX_STATUS_DESC_RPT_SEL(pdesc); |
---|
| 379 | + status->packet_report_type = (u8)get_rx_status_desc_rpt_sel(pdesc); |
---|
401 | 380 | if (status->packet_report_type == TX_REPORT2) |
---|
402 | | - status->length = (u16)GET_RX_RPT2_DESC_PKT_LEN(pdesc); |
---|
| 381 | + status->length = (u16)get_rx_rpt2_desc_pkt_len(pdesc); |
---|
403 | 382 | else |
---|
404 | | - status->length = (u16)GET_RX_DESC_PKT_LEN(pdesc); |
---|
405 | | - status->rx_drvinfo_size = (u8)GET_RX_DESC_DRV_INFO_SIZE(pdesc) * |
---|
| 383 | + status->length = (u16)get_rx_desc_pkt_len(pdesc); |
---|
| 384 | + status->rx_drvinfo_size = (u8)get_rx_desc_drv_info_size(pdesc) * |
---|
406 | 385 | RX_DRV_INFO_SIZE_UNIT; |
---|
407 | | - status->rx_bufshift = (u8)(GET_RX_DESC_SHIFT(pdesc) & 0x03); |
---|
408 | | - status->icv = (u16)GET_RX_DESC_ICV(pdesc); |
---|
409 | | - status->crc = (u16)GET_RX_DESC_CRC32(pdesc); |
---|
| 386 | + status->rx_bufshift = (u8)(get_rx_desc_shift(pdesc) & 0x03); |
---|
| 387 | + status->icv = (u16)get_rx_desc_icv(pdesc); |
---|
| 388 | + status->crc = (u16)get_rx_desc_crc32(pdesc); |
---|
410 | 389 | status->hwerror = (status->crc | status->icv); |
---|
411 | | - status->decrypted = !GET_RX_DESC_SWDEC(pdesc); |
---|
412 | | - status->rate = (u8)GET_RX_DESC_RXMCS(pdesc); |
---|
413 | | - status->shortpreamble = (u16)GET_RX_DESC_SPLCP(pdesc); |
---|
414 | | - status->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); |
---|
415 | | - status->isfirst_ampdu = (bool)((GET_RX_DESC_PAGGR(pdesc) == 1) && |
---|
416 | | - (GET_RX_DESC_FAGGR(pdesc) == 1)); |
---|
| 390 | + status->decrypted = !get_rx_desc_swdec(pdesc); |
---|
| 391 | + status->rate = (u8)get_rx_desc_rxmcs(pdesc); |
---|
| 392 | + status->shortpreamble = (u16)get_rx_desc_splcp(pdesc); |
---|
| 393 | + status->isampdu = (bool) (get_rx_desc_paggr(pdesc) == 1); |
---|
| 394 | + status->isfirst_ampdu = (bool)((get_rx_desc_paggr(pdesc) == 1) && |
---|
| 395 | + (get_rx_desc_faggr(pdesc) == 1)); |
---|
417 | 396 | if (status->packet_report_type == NORMAL_RX) |
---|
418 | | - status->timestamp_low = GET_RX_DESC_TSFL(pdesc); |
---|
419 | | - status->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); |
---|
420 | | - status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); |
---|
| 397 | + status->timestamp_low = get_rx_desc_tsfl(pdesc); |
---|
| 398 | + status->rx_is40mhzpacket = (bool)get_rx_desc_bw(pdesc); |
---|
| 399 | + status->is_ht = (bool)get_rx_desc_rxht(pdesc); |
---|
421 | 400 | |
---|
422 | 401 | status->is_cck = RTL8188_RX_HAL_IS_CCK_RATE(status->rate); |
---|
423 | 402 | |
---|
424 | | - status->macid = GET_RX_DESC_MACID(pdesc); |
---|
425 | | - if (GET_RX_STATUS_DESC_MAGIC_MATCH(pdesc)) |
---|
426 | | - status->wake_match = BIT(2); |
---|
427 | | - else if (GET_RX_STATUS_DESC_MAGIC_MATCH(pdesc)) |
---|
428 | | - status->wake_match = BIT(1); |
---|
429 | | - else if (GET_RX_STATUS_DESC_UNICAST_MATCH(pdesc)) |
---|
430 | | - status->wake_match = BIT(0); |
---|
| 403 | + status->macid = get_rx_desc_macid(pdesc); |
---|
| 404 | + if (get_rx_status_desc_pattern_match(pdesc)) |
---|
| 405 | + wake_match = BIT(2); |
---|
| 406 | + else if (get_rx_status_desc_magic_match(pdesc)) |
---|
| 407 | + wake_match = BIT(1); |
---|
| 408 | + else if (get_rx_status_desc_unicast_match(pdesc)) |
---|
| 409 | + wake_match = BIT(0); |
---|
431 | 410 | else |
---|
432 | | - status->wake_match = 0; |
---|
433 | | - if (status->wake_match) |
---|
434 | | - RT_TRACE(rtlpriv, COMP_RXDESC, DBG_LOUD, |
---|
435 | | - "GGGGGGGGGGGGGet Wakeup Packet!! WakeMatch=%d\n", |
---|
436 | | - status->wake_match); |
---|
| 411 | + wake_match = 0; |
---|
| 412 | + if (wake_match) |
---|
| 413 | + rtl_dbg(rtlpriv, COMP_RXDESC, DBG_LOUD, |
---|
| 414 | + "GGGGGGGGGGGGGet Wakeup Packet!! WakeMatch=%d\n", |
---|
| 415 | + wake_match); |
---|
437 | 416 | rx_status->freq = hw->conf.chandef.chan->center_freq; |
---|
438 | 417 | rx_status->band = hw->conf.chandef.chan->band; |
---|
439 | 418 | |
---|
.. | .. |
---|
443 | 422 | if (status->crc) |
---|
444 | 423 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; |
---|
445 | 424 | |
---|
446 | | - if (status->rx_is40Mhzpacket) |
---|
| 425 | + if (status->rx_is40mhzpacket) |
---|
447 | 426 | rx_status->bw = RATE_INFO_BW_40; |
---|
448 | 427 | |
---|
449 | 428 | if (status->is_ht) |
---|
.. | .. |
---|
487 | 466 | rx_status->signal = status->recvsignalpower + 10; |
---|
488 | 467 | if (status->packet_report_type == TX_REPORT2) { |
---|
489 | 468 | status->macid_valid_entry[0] = |
---|
490 | | - GET_RX_RPT2_DESC_MACID_VALID_1(pdesc); |
---|
| 469 | + get_rx_rpt2_desc_macid_valid_1(pdesc); |
---|
491 | 470 | status->macid_valid_entry[1] = |
---|
492 | | - GET_RX_RPT2_DESC_MACID_VALID_2(pdesc); |
---|
| 471 | + get_rx_rpt2_desc_macid_valid_2(pdesc); |
---|
493 | 472 | } |
---|
494 | 473 | return true; |
---|
495 | 474 | } |
---|
496 | 475 | |
---|
497 | 476 | void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw, |
---|
498 | | - struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
---|
| 477 | + struct ieee80211_hdr *hdr, u8 *pdesc8, |
---|
499 | 478 | u8 *txbd, struct ieee80211_tx_info *info, |
---|
500 | 479 | struct ieee80211_sta *sta, |
---|
501 | 480 | struct sk_buff *skb, |
---|
.. | .. |
---|
506 | 485 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
---|
507 | 486 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
---|
508 | 487 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
---|
509 | | - u8 *pdesc = (u8 *)pdesc_tx; |
---|
510 | 488 | u16 seq_number; |
---|
511 | 489 | __le16 fc = hdr->frame_control; |
---|
512 | 490 | unsigned int buf_len = 0; |
---|
.. | .. |
---|
519 | 497 | dma_addr_t mapping; |
---|
520 | 498 | u8 bw_40 = 0; |
---|
521 | 499 | u8 short_gi = 0; |
---|
| 500 | + __le32 *pdesc = (__le32 *)pdesc8; |
---|
522 | 501 | |
---|
523 | 502 | if (mac->opmode == NL80211_IFTYPE_STATION) { |
---|
524 | 503 | bw_40 = mac->bw_40; |
---|
.. | .. |
---|
536 | 515 | memset(skb->data, 0, EM_HDR_LEN); |
---|
537 | 516 | } |
---|
538 | 517 | buf_len = skb->len; |
---|
539 | | - mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, |
---|
540 | | - PCI_DMA_TODEVICE); |
---|
541 | | - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
---|
542 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
543 | | - "DMA mapping error\n"); |
---|
| 518 | + mapping = dma_map_single(&rtlpci->pdev->dev, skb->data, skb->len, |
---|
| 519 | + DMA_TO_DEVICE); |
---|
| 520 | + if (dma_mapping_error(&rtlpci->pdev->dev, mapping)) { |
---|
| 521 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
| 522 | + "DMA mapping error\n"); |
---|
544 | 523 | return; |
---|
545 | 524 | } |
---|
546 | | - CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_88e)); |
---|
| 525 | + clear_pci_tx_desc_content(pdesc, sizeof(struct tx_desc_88e)); |
---|
547 | 526 | if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { |
---|
548 | 527 | firstseg = true; |
---|
549 | 528 | lastseg = true; |
---|
550 | 529 | } |
---|
551 | 530 | if (firstseg) { |
---|
552 | 531 | if (rtlhal->earlymode_enable) { |
---|
553 | | - SET_TX_DESC_PKT_OFFSET(pdesc, 1); |
---|
554 | | - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN + |
---|
| 532 | + set_tx_desc_pkt_offset(pdesc, 1); |
---|
| 533 | + set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN + |
---|
555 | 534 | EM_HDR_LEN); |
---|
556 | 535 | if (ptcb_desc->empkt_num) { |
---|
557 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
558 | | - "Insert 8 byte.pTcb->EMPktNum:%d\n", |
---|
559 | | - ptcb_desc->empkt_num); |
---|
560 | | - _rtl88ee_insert_emcontent(ptcb_desc, |
---|
561 | | - (u8 *)(skb->data)); |
---|
| 536 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
| 537 | + "Insert 8 byte.pTcb->EMPktNum:%d\n", |
---|
| 538 | + ptcb_desc->empkt_num); |
---|
| 539 | + rtl88ee_insert_emcontent(ptcb_desc, |
---|
| 540 | + (__le32 *)(skb->data)); |
---|
562 | 541 | } |
---|
563 | 542 | } else { |
---|
564 | | - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); |
---|
| 543 | + set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN); |
---|
565 | 544 | } |
---|
566 | 545 | |
---|
567 | 546 | ptcb_desc->use_driver_rate = true; |
---|
568 | | - SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate); |
---|
| 547 | + set_tx_desc_tx_rate(pdesc, ptcb_desc->hw_rate); |
---|
569 | 548 | if (ptcb_desc->hw_rate > DESC92C_RATEMCS0) |
---|
570 | 549 | short_gi = (ptcb_desc->use_shortgi) ? 1 : 0; |
---|
571 | 550 | else |
---|
572 | 551 | short_gi = (ptcb_desc->use_shortpreamble) ? 1 : 0; |
---|
573 | 552 | |
---|
574 | | - SET_TX_DESC_DATA_SHORTGI(pdesc, short_gi); |
---|
| 553 | + set_tx_desc_data_shortgi(pdesc, short_gi); |
---|
575 | 554 | |
---|
576 | 555 | if (info->flags & IEEE80211_TX_CTL_AMPDU) { |
---|
577 | | - SET_TX_DESC_AGG_ENABLE(pdesc, 1); |
---|
578 | | - SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); |
---|
| 556 | + set_tx_desc_agg_enable(pdesc, 1); |
---|
| 557 | + set_tx_desc_max_agg_num(pdesc, 0x14); |
---|
579 | 558 | } |
---|
580 | | - SET_TX_DESC_SEQ(pdesc, seq_number); |
---|
581 | | - SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcb_desc->rts_enable && |
---|
| 559 | + set_tx_desc_seq(pdesc, seq_number); |
---|
| 560 | + set_tx_desc_rts_enable(pdesc, ((ptcb_desc->rts_enable && |
---|
582 | 561 | !ptcb_desc->cts_enable) ? 1 : 0)); |
---|
583 | | - SET_TX_DESC_HW_RTS_ENABLE(pdesc, 0); |
---|
584 | | - SET_TX_DESC_CTS2SELF(pdesc, ((ptcb_desc->cts_enable) ? 1 : 0)); |
---|
585 | | - SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0)); |
---|
| 562 | + set_tx_desc_hw_rts_enable(pdesc, 0); |
---|
| 563 | + set_tx_desc_cts2self(pdesc, ((ptcb_desc->cts_enable) ? 1 : 0)); |
---|
| 564 | + set_tx_desc_rts_stbc(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0)); |
---|
586 | 565 | |
---|
587 | | - SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); |
---|
588 | | - SET_TX_DESC_RTS_BW(pdesc, 0); |
---|
589 | | - SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc); |
---|
590 | | - SET_TX_DESC_RTS_SHORT(pdesc, |
---|
| 566 | + set_tx_desc_rts_rate(pdesc, ptcb_desc->rts_rate); |
---|
| 567 | + set_tx_desc_rts_bw(pdesc, 0); |
---|
| 568 | + set_tx_desc_rts_sc(pdesc, ptcb_desc->rts_sc); |
---|
| 569 | + set_tx_desc_rts_short(pdesc, |
---|
591 | 570 | ((ptcb_desc->rts_rate <= DESC92C_RATE54M) ? |
---|
592 | 571 | (ptcb_desc->rts_use_shortpreamble ? 1 : 0) : |
---|
593 | 572 | (ptcb_desc->rts_use_shortgi ? 1 : 0))); |
---|
594 | 573 | |
---|
595 | 574 | if (ptcb_desc->tx_enable_sw_calc_duration) |
---|
596 | | - SET_TX_DESC_NAV_USE_HDR(pdesc, 1); |
---|
| 575 | + set_tx_desc_nav_use_hdr(pdesc, 1); |
---|
597 | 576 | |
---|
598 | 577 | if (bw_40) { |
---|
599 | 578 | if (ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_20_40) { |
---|
600 | | - SET_TX_DESC_DATA_BW(pdesc, 1); |
---|
601 | | - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); |
---|
| 579 | + set_tx_desc_data_bw(pdesc, 1); |
---|
| 580 | + set_tx_desc_tx_sub_carrier(pdesc, 3); |
---|
602 | 581 | } else { |
---|
603 | | - SET_TX_DESC_DATA_BW(pdesc, 0); |
---|
604 | | - SET_TX_DESC_TX_SUB_CARRIER(pdesc, |
---|
| 582 | + set_tx_desc_data_bw(pdesc, 0); |
---|
| 583 | + set_tx_desc_tx_sub_carrier(pdesc, |
---|
605 | 584 | mac->cur_40_prime_sc); |
---|
606 | 585 | } |
---|
607 | 586 | } else { |
---|
608 | | - SET_TX_DESC_DATA_BW(pdesc, 0); |
---|
609 | | - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); |
---|
| 587 | + set_tx_desc_data_bw(pdesc, 0); |
---|
| 588 | + set_tx_desc_tx_sub_carrier(pdesc, 0); |
---|
610 | 589 | } |
---|
611 | 590 | |
---|
612 | | - SET_TX_DESC_LINIP(pdesc, 0); |
---|
613 | | - SET_TX_DESC_PKT_SIZE(pdesc, (u16)skb_len); |
---|
| 591 | + set_tx_desc_linip(pdesc, 0); |
---|
| 592 | + set_tx_desc_pkt_size(pdesc, (u16)skb_len); |
---|
614 | 593 | if (sta) { |
---|
615 | 594 | u8 ampdu_density = sta->ht_cap.ampdu_density; |
---|
616 | | - SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); |
---|
| 595 | + set_tx_desc_ampdu_density(pdesc, ampdu_density); |
---|
617 | 596 | } |
---|
618 | 597 | if (info->control.hw_key) { |
---|
619 | 598 | struct ieee80211_key_conf *keyconf; |
---|
.. | .. |
---|
623 | 602 | case WLAN_CIPHER_SUITE_WEP40: |
---|
624 | 603 | case WLAN_CIPHER_SUITE_WEP104: |
---|
625 | 604 | case WLAN_CIPHER_SUITE_TKIP: |
---|
626 | | - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); |
---|
| 605 | + set_tx_desc_sec_type(pdesc, 0x1); |
---|
627 | 606 | break; |
---|
628 | 607 | case WLAN_CIPHER_SUITE_CCMP: |
---|
629 | | - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); |
---|
| 608 | + set_tx_desc_sec_type(pdesc, 0x3); |
---|
630 | 609 | break; |
---|
631 | 610 | default: |
---|
632 | | - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); |
---|
| 611 | + set_tx_desc_sec_type(pdesc, 0x0); |
---|
633 | 612 | break; |
---|
634 | 613 | |
---|
635 | 614 | } |
---|
636 | 615 | } |
---|
637 | 616 | |
---|
638 | | - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); |
---|
639 | | - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); |
---|
640 | | - SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); |
---|
641 | | - SET_TX_DESC_DISABLE_FB(pdesc, ptcb_desc->disable_ratefallback ? |
---|
| 617 | + set_tx_desc_queue_sel(pdesc, fw_qsel); |
---|
| 618 | + set_tx_desc_data_rate_fb_limit(pdesc, 0x1F); |
---|
| 619 | + set_tx_desc_rts_rate_fb_limit(pdesc, 0xF); |
---|
| 620 | + set_tx_desc_disable_fb(pdesc, ptcb_desc->disable_ratefallback ? |
---|
642 | 621 | 1 : 0); |
---|
643 | | - SET_TX_DESC_USE_RATE(pdesc, ptcb_desc->use_driver_rate ? 1 : 0); |
---|
| 622 | + set_tx_desc_use_rate(pdesc, ptcb_desc->use_driver_rate ? 1 : 0); |
---|
644 | 623 | |
---|
645 | | - /*SET_TX_DESC_PWR_STATUS(pdesc, pwr_status);*/ |
---|
| 624 | + /*set_tx_desc_pwr_status(pdesc, pwr_status);*/ |
---|
646 | 625 | /* Set TxRate and RTSRate in TxDesc */ |
---|
647 | 626 | /* This prevent Tx initial rate of new-coming packets */ |
---|
648 | 627 | /* from being overwritten by retried packet rate.*/ |
---|
649 | 628 | if (!ptcb_desc->use_driver_rate) { |
---|
650 | | - /*SET_TX_DESC_RTS_RATE(pdesc, 0x08); */ |
---|
651 | | - /* SET_TX_DESC_TX_RATE(pdesc, 0x0b); */ |
---|
| 629 | + /*set_tx_desc_rts_rate(pdesc, 0x08); */ |
---|
| 630 | + /* set_tx_desc_tx_rate(pdesc, 0x0b); */ |
---|
652 | 631 | } |
---|
653 | 632 | if (ieee80211_is_data_qos(fc)) { |
---|
654 | 633 | if (mac->rdg_en) { |
---|
655 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
| 634 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
656 | 635 | "Enable RDG function.\n"); |
---|
657 | | - SET_TX_DESC_RDG_ENABLE(pdesc, 1); |
---|
658 | | - SET_TX_DESC_HTC(pdesc, 1); |
---|
| 636 | + set_tx_desc_rdg_enable(pdesc, 1); |
---|
| 637 | + set_tx_desc_htc(pdesc, 1); |
---|
659 | 638 | } |
---|
660 | 639 | } |
---|
661 | 640 | } |
---|
662 | 641 | |
---|
663 | | - SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); |
---|
664 | | - SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); |
---|
665 | | - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)buf_len); |
---|
666 | | - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); |
---|
| 642 | + set_tx_desc_first_seg(pdesc, (firstseg ? 1 : 0)); |
---|
| 643 | + set_tx_desc_last_seg(pdesc, (lastseg ? 1 : 0)); |
---|
| 644 | + set_tx_desc_tx_buffer_size(pdesc, (u16)buf_len); |
---|
| 645 | + set_tx_desc_tx_buffer_address(pdesc, mapping); |
---|
667 | 646 | if (rtlpriv->dm.useramask) { |
---|
668 | | - SET_TX_DESC_RATE_ID(pdesc, ptcb_desc->ratr_index); |
---|
669 | | - SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id); |
---|
| 647 | + set_tx_desc_rate_id(pdesc, ptcb_desc->ratr_index); |
---|
| 648 | + set_tx_desc_macid(pdesc, ptcb_desc->mac_id); |
---|
670 | 649 | } else { |
---|
671 | | - SET_TX_DESC_RATE_ID(pdesc, 0xC + ptcb_desc->ratr_index); |
---|
672 | | - SET_TX_DESC_MACID(pdesc, ptcb_desc->ratr_index); |
---|
| 650 | + set_tx_desc_rate_id(pdesc, 0xC + ptcb_desc->ratr_index); |
---|
| 651 | + set_tx_desc_macid(pdesc, ptcb_desc->ratr_index); |
---|
673 | 652 | } |
---|
674 | 653 | if (ieee80211_is_data_qos(fc)) |
---|
675 | | - SET_TX_DESC_QOS(pdesc, 1); |
---|
| 654 | + set_tx_desc_qos(pdesc, 1); |
---|
676 | 655 | |
---|
677 | 656 | if (!ieee80211_is_data_qos(fc)) |
---|
678 | | - SET_TX_DESC_HWSEQ_EN(pdesc, 1); |
---|
679 | | - SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); |
---|
| 657 | + set_tx_desc_hwseq_en(pdesc, 1); |
---|
| 658 | + set_tx_desc_more_frag(pdesc, (lastseg ? 0 : 1)); |
---|
680 | 659 | if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || |
---|
681 | 660 | is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { |
---|
682 | | - SET_TX_DESC_BMC(pdesc, 1); |
---|
| 661 | + set_tx_desc_bmc(pdesc, 1); |
---|
683 | 662 | } |
---|
684 | 663 | |
---|
685 | | - rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc, ptcb_desc->mac_id); |
---|
686 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); |
---|
| 664 | + rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc8, ptcb_desc->mac_id); |
---|
| 665 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); |
---|
687 | 666 | } |
---|
688 | 667 | |
---|
689 | 668 | void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw, |
---|
690 | | - u8 *pdesc, bool firstseg, |
---|
| 669 | + u8 *pdesc8, bool firstseg, |
---|
691 | 670 | bool lastseg, struct sk_buff *skb) |
---|
692 | 671 | { |
---|
693 | 672 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
---|
694 | 673 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
---|
695 | 674 | u8 fw_queue = QSLT_BEACON; |
---|
| 675 | + __le32 *pdesc = (__le32 *)pdesc8; |
---|
696 | 676 | |
---|
697 | | - dma_addr_t mapping = pci_map_single(rtlpci->pdev, |
---|
698 | | - skb->data, skb->len, |
---|
699 | | - PCI_DMA_TODEVICE); |
---|
| 677 | + dma_addr_t mapping = dma_map_single(&rtlpci->pdev->dev, skb->data, |
---|
| 678 | + skb->len, DMA_TO_DEVICE); |
---|
700 | 679 | |
---|
701 | 680 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); |
---|
702 | 681 | __le16 fc = hdr->frame_control; |
---|
703 | 682 | |
---|
704 | | - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
---|
705 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
706 | | - "DMA mapping error\n"); |
---|
| 683 | + if (dma_mapping_error(&rtlpci->pdev->dev, mapping)) { |
---|
| 684 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
| 685 | + "DMA mapping error\n"); |
---|
707 | 686 | return; |
---|
708 | 687 | } |
---|
709 | | - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
---|
| 688 | + clear_pci_tx_desc_content(pdesc, TX_DESC_SIZE); |
---|
710 | 689 | |
---|
711 | 690 | if (firstseg) |
---|
712 | | - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); |
---|
| 691 | + set_tx_desc_offset(pdesc, USB_HWDESC_HEADER_LEN); |
---|
713 | 692 | |
---|
714 | | - SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M); |
---|
| 693 | + set_tx_desc_tx_rate(pdesc, DESC92C_RATE1M); |
---|
715 | 694 | |
---|
716 | | - SET_TX_DESC_SEQ(pdesc, 0); |
---|
| 695 | + set_tx_desc_seq(pdesc, 0); |
---|
717 | 696 | |
---|
718 | | - SET_TX_DESC_LINIP(pdesc, 0); |
---|
| 697 | + set_tx_desc_linip(pdesc, 0); |
---|
719 | 698 | |
---|
720 | | - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); |
---|
| 699 | + set_tx_desc_queue_sel(pdesc, fw_queue); |
---|
721 | 700 | |
---|
722 | | - SET_TX_DESC_FIRST_SEG(pdesc, 1); |
---|
723 | | - SET_TX_DESC_LAST_SEG(pdesc, 1); |
---|
| 701 | + set_tx_desc_first_seg(pdesc, 1); |
---|
| 702 | + set_tx_desc_last_seg(pdesc, 1); |
---|
724 | 703 | |
---|
725 | | - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len)); |
---|
| 704 | + set_tx_desc_tx_buffer_size(pdesc, (u16)(skb->len)); |
---|
726 | 705 | |
---|
727 | | - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); |
---|
| 706 | + set_tx_desc_tx_buffer_address(pdesc, mapping); |
---|
728 | 707 | |
---|
729 | | - SET_TX_DESC_RATE_ID(pdesc, 7); |
---|
730 | | - SET_TX_DESC_MACID(pdesc, 0); |
---|
| 708 | + set_tx_desc_rate_id(pdesc, 7); |
---|
| 709 | + set_tx_desc_macid(pdesc, 0); |
---|
731 | 710 | |
---|
732 | | - SET_TX_DESC_OWN(pdesc, 1); |
---|
| 711 | + set_tx_desc_own(pdesc, 1); |
---|
733 | 712 | |
---|
734 | | - SET_TX_DESC_PKT_SIZE(pdesc, (u16)(skb->len)); |
---|
| 713 | + set_tx_desc_pkt_size(pdesc, (u16)(skb->len)); |
---|
735 | 714 | |
---|
736 | | - SET_TX_DESC_FIRST_SEG(pdesc, 1); |
---|
737 | | - SET_TX_DESC_LAST_SEG(pdesc, 1); |
---|
| 715 | + set_tx_desc_first_seg(pdesc, 1); |
---|
| 716 | + set_tx_desc_last_seg(pdesc, 1); |
---|
738 | 717 | |
---|
739 | | - SET_TX_DESC_OFFSET(pdesc, 0x20); |
---|
| 718 | + set_tx_desc_offset(pdesc, 0x20); |
---|
740 | 719 | |
---|
741 | | - SET_TX_DESC_USE_RATE(pdesc, 1); |
---|
| 720 | + set_tx_desc_use_rate(pdesc, 1); |
---|
742 | 721 | |
---|
743 | 722 | if (!ieee80211_is_data_qos(fc)) |
---|
744 | | - SET_TX_DESC_HWSEQ_EN(pdesc, 1); |
---|
| 723 | + set_tx_desc_hwseq_en(pdesc, 1); |
---|
745 | 724 | |
---|
746 | 725 | RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, |
---|
747 | 726 | "H2C Tx Cmd Content\n", |
---|
748 | 727 | pdesc, TX_DESC_SIZE); |
---|
749 | 728 | } |
---|
750 | 729 | |
---|
751 | | -void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc, |
---|
| 730 | +void rtl88ee_set_desc(struct ieee80211_hw *hw, u8 *pdesc8, |
---|
752 | 731 | bool istx, u8 desc_name, u8 *val) |
---|
753 | 732 | { |
---|
754 | | - if (istx == true) { |
---|
| 733 | + __le32 *pdesc = (__le32 *)pdesc8; |
---|
| 734 | + |
---|
| 735 | + if (istx) { |
---|
755 | 736 | switch (desc_name) { |
---|
756 | 737 | case HW_DESC_OWN: |
---|
757 | | - SET_TX_DESC_OWN(pdesc, 1); |
---|
| 738 | + set_tx_desc_own(pdesc, 1); |
---|
758 | 739 | break; |
---|
759 | 740 | case HW_DESC_TX_NEXTDESC_ADDR: |
---|
760 | | - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *)val); |
---|
| 741 | + set_tx_desc_next_desc_address(pdesc, *(u32 *)val); |
---|
761 | 742 | break; |
---|
762 | 743 | default: |
---|
763 | 744 | WARN_ONCE(true, "rtl8188ee: ERR txdesc :%d not processed\n", |
---|
.. | .. |
---|
767 | 748 | } else { |
---|
768 | 749 | switch (desc_name) { |
---|
769 | 750 | case HW_DESC_RXOWN: |
---|
770 | | - SET_RX_DESC_OWN(pdesc, 1); |
---|
| 751 | + set_rx_desc_own(pdesc, 1); |
---|
771 | 752 | break; |
---|
772 | 753 | case HW_DESC_RXBUFF_ADDR: |
---|
773 | | - SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *)val); |
---|
| 754 | + set_rx_desc_buff_addr(pdesc, *(u32 *)val); |
---|
774 | 755 | break; |
---|
775 | 756 | case HW_DESC_RXPKT_LEN: |
---|
776 | | - SET_RX_DESC_PKT_LEN(pdesc, *(u32 *)val); |
---|
| 757 | + set_rx_desc_pkt_len(pdesc, *(u32 *)val); |
---|
777 | 758 | break; |
---|
778 | 759 | case HW_DESC_RXERO: |
---|
779 | | - SET_RX_DESC_EOR(pdesc, 1); |
---|
| 760 | + set_rx_desc_eor(pdesc, 1); |
---|
780 | 761 | break; |
---|
781 | 762 | default: |
---|
782 | 763 | WARN_ONCE(true, "rtl8188ee: ERR rxdesc :%d not processed\n", |
---|
.. | .. |
---|
787 | 768 | } |
---|
788 | 769 | |
---|
789 | 770 | u64 rtl88ee_get_desc(struct ieee80211_hw *hw, |
---|
790 | | - u8 *pdesc, bool istx, u8 desc_name) |
---|
| 771 | + u8 *pdesc8, bool istx, u8 desc_name) |
---|
791 | 772 | { |
---|
792 | 773 | u32 ret = 0; |
---|
| 774 | + __le32 *pdesc = (__le32 *)pdesc8; |
---|
793 | 775 | |
---|
794 | | - if (istx == true) { |
---|
| 776 | + if (istx) { |
---|
795 | 777 | switch (desc_name) { |
---|
796 | 778 | case HW_DESC_OWN: |
---|
797 | | - ret = GET_TX_DESC_OWN(pdesc); |
---|
| 779 | + ret = get_tx_desc_own(pdesc); |
---|
798 | 780 | break; |
---|
799 | 781 | case HW_DESC_TXBUFF_ADDR: |
---|
800 | | - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(pdesc); |
---|
| 782 | + ret = get_tx_desc_tx_buffer_address(pdesc); |
---|
801 | 783 | break; |
---|
802 | 784 | default: |
---|
803 | 785 | WARN_ONCE(true, "rtl8188ee: ERR txdesc :%d not processed\n", |
---|
.. | .. |
---|
807 | 789 | } else { |
---|
808 | 790 | switch (desc_name) { |
---|
809 | 791 | case HW_DESC_OWN: |
---|
810 | | - ret = GET_RX_DESC_OWN(pdesc); |
---|
| 792 | + ret = get_rx_desc_own(pdesc); |
---|
811 | 793 | break; |
---|
812 | 794 | case HW_DESC_RXPKT_LEN: |
---|
813 | | - ret = GET_RX_DESC_PKT_LEN(pdesc); |
---|
| 795 | + ret = get_rx_desc_pkt_len(pdesc); |
---|
814 | 796 | break; |
---|
815 | 797 | case HW_DESC_RXBUFF_ADDR: |
---|
816 | | - ret = GET_RX_DESC_BUFF_ADDR(pdesc); |
---|
| 798 | + ret = get_rx_desc_buff_addr(pdesc); |
---|
817 | 799 | break; |
---|
818 | 800 | default: |
---|
819 | 801 | WARN_ONCE(true, "rtl8188ee: ERR rxdesc :%d not processed\n", |
---|