1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 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 * 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 17 * 18 * 19 ******************************************************************************/ 20 #ifndef _RTW_XMIT_H_ 21 #define _RTW_XMIT_H_ 22 23 24 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 25 #ifdef CONFIG_TX_AGGREGATION 26 #define MAX_XMITBUF_SZ (20480) // 20k 27 //#define SDIO_TX_AGG_MAX 5 28 #else 29 #define MAX_XMITBUF_SZ (1664) 30 #define SDIO_TX_AGG_MAX 1 31 #endif 32 33 #if defined CONFIG_SDIO_HCI 34 #define NR_XMITBUFF (16) 35 #endif 36 #if defined(CONFIG_GSPI_HCI) 37 #define NR_XMITBUFF (128) 38 #endif 39 40 #elif defined (CONFIG_USB_HCI) 41 42 #ifdef CONFIG_USB_TX_AGGREGATION 43 #if defined(CONFIG_PLATFORM_ARM_SUNxI) || defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) || defined(CONFIG_PLATFORM_ARM_SUN8I) 44 #define MAX_XMITBUF_SZ (12288) //12k 1536*8 45 #elif defined (CONFIG_PLATFORM_MSTAR) 46 #define MAX_XMITBUF_SZ 7680 // 7.5k 47 #else 48 #define MAX_XMITBUF_SZ (20480) // 20k 49 #endif 50 #else 51 #define MAX_XMITBUF_SZ (2048) 52 #endif 53 54 #ifdef CONFIG_SINGLE_XMIT_BUF 55 #define NR_XMITBUFF (1) 56 #else 57 #define NR_XMITBUFF (4) 58 #endif //CONFIG_SINGLE_XMIT_BUF 59 #elif defined (CONFIG_PCI_HCI) 60 #define MAX_XMITBUF_SZ (1664) 61 #define NR_XMITBUFF (128) 62 #endif 63 64 #ifdef PLATFORM_OS_CE 65 #define XMITBUF_ALIGN_SZ 4 66 #else 67 #ifdef CONFIG_PCI_HCI 68 #define XMITBUF_ALIGN_SZ 4 69 #else 70 #ifdef USB_XMITBUF_ALIGN_SZ 71 #define XMITBUF_ALIGN_SZ (USB_XMITBUF_ALIGN_SZ) 72 #else 73 #define XMITBUF_ALIGN_SZ 512 74 #endif 75 #endif 76 #endif 77 78 // xmit extension buff defination 79 #define MAX_XMIT_EXTBUF_SZ (1536) 80 81 #ifdef CONFIG_SINGLE_XMIT_BUF 82 #define NR_XMIT_EXTBUFF (1) 83 #else 84 #define NR_XMIT_EXTBUFF (32) 85 #endif 86 87 #ifdef CONFIG_RTL8812A 88 #define MAX_CMDBUF_SZ (512*12) 89 #else 90 #define MAX_CMDBUF_SZ (5120) //(4096) 91 #endif 92 93 #define MAX_NUMBLKS (1) 94 95 #define XMIT_VO_QUEUE (0) 96 #define XMIT_VI_QUEUE (1) 97 #define XMIT_BE_QUEUE (2) 98 #define XMIT_BK_QUEUE (3) 99 100 #define VO_QUEUE_INX 0 101 #define VI_QUEUE_INX 1 102 #define BE_QUEUE_INX 2 103 #define BK_QUEUE_INX 3 104 #define BCN_QUEUE_INX 4 105 #define MGT_QUEUE_INX 5 106 #define HIGH_QUEUE_INX 6 107 #define TXCMD_QUEUE_INX 7 108 109 #define HW_QUEUE_ENTRY 8 110 111 #ifdef CONFIG_PCI_HCI 112 //#define TXDESC_NUM 64 113 #define TXDESC_NUM 128 114 #define TXDESC_NUM_BE_QUEUE 128 115 #endif 116 117 #define WEP_IV(pattrib_iv, dot11txpn, keyidx)\ 118 do{\ 119 pattrib_iv[0] = dot11txpn._byte_.TSC0;\ 120 pattrib_iv[1] = dot11txpn._byte_.TSC1;\ 121 pattrib_iv[2] = dot11txpn._byte_.TSC2;\ 122 pattrib_iv[3] = ((keyidx & 0x3)<<6);\ 123 dot11txpn.val = (dot11txpn.val == 0xffffff) ? 0: (dot11txpn.val+1);\ 124 }while(0) 125 126 127 #define TKIP_IV(pattrib_iv, dot11txpn, keyidx)\ 128 do{\ 129 pattrib_iv[0] = dot11txpn._byte_.TSC1;\ 130 pattrib_iv[1] = (dot11txpn._byte_.TSC1 | 0x20) & 0x7f;\ 131 pattrib_iv[2] = dot11txpn._byte_.TSC0;\ 132 pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\ 133 pattrib_iv[4] = dot11txpn._byte_.TSC2;\ 134 pattrib_iv[5] = dot11txpn._byte_.TSC3;\ 135 pattrib_iv[6] = dot11txpn._byte_.TSC4;\ 136 pattrib_iv[7] = dot11txpn._byte_.TSC5;\ 137 dot11txpn.val = dot11txpn.val == 0xffffffffffffULL ? 0: (dot11txpn.val+1);\ 138 }while(0) 139 140 #define AES_IV(pattrib_iv, dot11txpn, keyidx)\ 141 do{\ 142 pattrib_iv[0] = dot11txpn._byte_.TSC0;\ 143 pattrib_iv[1] = dot11txpn._byte_.TSC1;\ 144 pattrib_iv[2] = 0;\ 145 pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\ 146 pattrib_iv[4] = dot11txpn._byte_.TSC2;\ 147 pattrib_iv[5] = dot11txpn._byte_.TSC3;\ 148 pattrib_iv[6] = dot11txpn._byte_.TSC4;\ 149 pattrib_iv[7] = dot11txpn._byte_.TSC5;\ 150 dot11txpn.val = dot11txpn.val == 0xffffffffffffULL ? 0: (dot11txpn.val+1);\ 151 }while(0) 152 153 154 #define HWXMIT_ENTRY 4 155 156 // For Buffer Descriptor ring architecture 157 #ifdef BUF_DESC_ARCH 158 #if defined(CONFIG_RTL8192E) 159 #define TX_BUFFER_SEG_NUM 1 /* 0:2 seg, 1: 4 seg, 2: 8 seg. */ 160 #elif defined(CONFIG_RTL8814A) 161 #define TX_BUFFER_SEG_NUM 1 /* 0:2 seg, 1: 4 seg, 2: 8 seg. */ 162 #endif 163 #endif 164 165 #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8703B) || defined(CONFIG_RTL8188F) 166 #define TXDESC_SIZE 40 167 #else 168 #define TXDESC_SIZE 32 /* old IC (ex: 8188E) */ 169 #endif 170 171 #ifdef CONFIG_TX_EARLY_MODE 172 #define EARLY_MODE_INFO_SIZE 8 173 #endif 174 175 176 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 177 #define TXDESC_OFFSET TXDESC_SIZE 178 #endif 179 180 #ifdef CONFIG_USB_HCI 181 #ifdef USB_PACKET_OFFSET_SZ 182 #define PACKET_OFFSET_SZ (USB_PACKET_OFFSET_SZ) 183 #else 184 #define PACKET_OFFSET_SZ (8) 185 #endif 186 #define TXDESC_OFFSET (TXDESC_SIZE + PACKET_OFFSET_SZ) 187 #endif 188 189 #ifdef CONFIG_PCI_HCI 190 #if defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8814A) 191 /* this section is defined for buffer descriptor ring architecture */ 192 #define TX_WIFI_INFO_SIZE (TXDESC_SIZE) /* it may add 802.11 hdr or others... */ 193 /* tx desc and payload are in the same buf */ 194 #define TXDESC_OFFSET (TX_WIFI_INFO_SIZE) 195 #else 196 /* tx desc and payload are NOT in the same buf */ 197 #define TXDESC_OFFSET (0) 198 /* 8188ee/8723be/8812ae/8821ae has extra PCI DMA info in tx desc */ 199 #define TX_DESC_NEXT_DESC_OFFSET (TXDESC_SIZE + 8) 200 #endif 201 #endif /* CONFIG_PCI_HCI */ 202 203 enum TXDESC_SC{ 204 SC_DONT_CARE = 0x00, 205 SC_UPPER= 0x01, 206 SC_LOWER=0x02, 207 SC_DUPLICATE=0x03 208 }; 209 210 #ifdef CONFIG_PCI_HCI 211 #define TXDESC_64_BYTES 212 #elif defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8188F) 213 #define TXDESC_40_BYTES 214 #endif 215 216 #if (defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8814A)) && defined(CONFIG_PCI_HCI) /* 8192ee or 8814ae */ 217 //8192EE_TODO 218 struct tx_desc 219 { 220 unsigned int txdw0; 221 unsigned int txdw1; 222 unsigned int txdw2; 223 unsigned int txdw3; 224 unsigned int txdw4; 225 unsigned int txdw5; 226 unsigned int txdw6; 227 unsigned int txdw7; 228 }; 229 #else 230 struct tx_desc 231 { 232 unsigned int txdw0; 233 unsigned int txdw1; 234 unsigned int txdw2; 235 unsigned int txdw3; 236 unsigned int txdw4; 237 unsigned int txdw5; 238 unsigned int txdw6; 239 unsigned int txdw7; 240 241 #if defined(TXDESC_40_BYTES) || defined(TXDESC_64_BYTES) 242 unsigned int txdw8; 243 unsigned int txdw9; 244 #endif // TXDESC_40_BYTES 245 246 #ifdef TXDESC_64_BYTES 247 unsigned int txdw10; 248 unsigned int txdw11; 249 250 // 2008/05/15 MH Because PCIE HW memory R/W 4K limit. And now, our descriptor 251 // size is 40 bytes. If you use more than 102 descriptor( 103*40>4096), HW will execute 252 // memoryR/W CRC error. And then all DMA fetch will fail. We must decrease descriptor 253 // number or enlarge descriptor size as 64 bytes. 254 unsigned int txdw12; 255 unsigned int txdw13; 256 unsigned int txdw14; 257 unsigned int txdw15; 258 #endif 259 }; 260 #endif 261 262 union txdesc { 263 struct tx_desc txdesc; 264 unsigned int value[TXDESC_SIZE>>2]; 265 }; 266 267 #ifdef CONFIG_PCI_HCI 268 #define PCI_MAX_TX_QUEUE_COUNT 8 269 270 struct rtw_tx_ring { 271 unsigned char qid; 272 struct tx_desc *desc; 273 dma_addr_t dma; 274 unsigned int idx; 275 unsigned int entries; 276 _queue queue; 277 u32 qlen; 278 }; 279 #endif 280 281 struct hw_xmit { 282 //_lock xmit_lock; 283 //_list pending; 284 _queue *sta_queue; 285 //struct hw_txqueue *phwtxqueue; 286 //sint txcmdcnt; 287 int accnt; 288 }; 289 290 #if 0 291 struct pkt_attrib 292 { 293 u8 type; 294 u8 subtype; 295 u8 bswenc; 296 u8 dhcp_pkt; 297 u16 ether_type; 298 int pktlen; //the original 802.3 pkt raw_data len (not include ether_hdr data) 299 int pkt_hdrlen; //the original 802.3 pkt header len 300 int hdrlen; //the WLAN Header Len 301 int nr_frags; 302 int last_txcmdsz; 303 int encrypt; //when 0 indicate no encrypt. when non-zero, indicate the encrypt algorith 304 u8 iv[8]; 305 int iv_len; 306 u8 icv[8]; 307 int icv_len; 308 int priority; 309 int ack_policy; 310 int mac_id; 311 int vcs_mode; //virtual carrier sense method 312 313 u8 dst[ETH_ALEN]; 314 u8 src[ETH_ALEN]; 315 u8 ta[ETH_ALEN]; 316 u8 ra[ETH_ALEN]; 317 318 u8 key_idx; 319 320 u8 qos_en; 321 u8 ht_en; 322 u8 raid;//rate adpative id 323 u8 bwmode; 324 u8 ch_offset;//PRIME_CHNL_OFFSET 325 u8 sgi;//short GI 326 u8 ampdu_en;//tx ampdu enable 327 u8 mdata;//more data bit 328 u8 eosp; 329 330 u8 triggered;//for ap mode handling Power Saving sta 331 332 u32 qsel; 333 u16 seqnum; 334 335 struct sta_info * psta; 336 #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX 337 u8 hw_tcp_csum; 338 #endif 339 }; 340 #else 341 //reduce size 342 struct pkt_attrib 343 { 344 u8 type; 345 u8 subtype; 346 u8 bswenc; 347 u8 dhcp_pkt; 348 u16 ether_type; 349 u16 seqnum; 350 u8 hw_ssn_sel; //for HW_SEQ0,1,2,3 351 u16 pkt_hdrlen; //the original 802.3 pkt header len 352 u16 hdrlen; //the WLAN Header Len 353 u32 pktlen; //the original 802.3 pkt raw_data len (not include ether_hdr data) 354 u32 last_txcmdsz; 355 u8 nr_frags; 356 u8 encrypt; //when 0 indicate no encrypt. when non-zero, indicate the encrypt algorith 357 u8 iv_len; 358 u8 icv_len; 359 u8 iv[18]; 360 u8 icv[16]; 361 u8 priority; 362 u8 ack_policy; 363 u8 mac_id; 364 u8 vcs_mode; //virtual carrier sense method 365 u8 dst[ETH_ALEN]; 366 u8 src[ETH_ALEN]; 367 u8 ta[ETH_ALEN]; 368 u8 ra[ETH_ALEN]; 369 u8 key_idx; 370 u8 qos_en; 371 u8 ht_en; 372 u8 raid;//rate adpative id 373 u8 bwmode; 374 u8 ch_offset;//PRIME_CHNL_OFFSET 375 u8 sgi;//short GI 376 u8 ampdu_en;//tx ampdu enable 377 u8 ampdu_spacing; //ampdu_min_spacing for peer sta's rx 378 u8 mdata;//more data bit 379 u8 pctrl;//per packet txdesc control enable 380 u8 triggered;//for ap mode handling Power Saving sta 381 u8 qsel; 382 u8 order;//order bit 383 u8 eosp; 384 u8 rate; 385 u8 intel_proxim; 386 u8 retry_ctrl; 387 u8 mbssid; 388 u8 ldpc; 389 u8 stbc; 390 struct sta_info * psta; 391 #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX 392 u8 hw_tcp_csum; 393 #endif 394 395 u8 rtsen; 396 u8 cts2self; 397 union Keytype dot11tkiptxmickey; 398 //union Keytype dot11tkiprxmickey; 399 union Keytype dot118021x_UncstKey; 400 401 #ifdef CONFIG_TDLS 402 u8 direct_link; 403 struct sta_info *ptdls_sta; 404 #endif //CONFIG_TDLS 405 u8 key_type; 406 u8 icmp_pkt; 407 408 }; 409 #endif 410 411 #ifdef PLATFORM_FREEBSD 412 #define ETH_ALEN 6 /* Octets in one ethernet addr */ 413 #define ETH_HLEN 14 /* Total octets in header. */ 414 #define ETH_P_IP 0x0800 /* Internet Protocol packet */ 415 416 /*struct rtw_ieee80211_hdr { 417 uint16_t frame_control; 418 uint16_t duration_id; 419 u8 addr1[6]; 420 u8 addr2[6]; 421 u8 addr3[6]; 422 uint16_t seq_ctrl; 423 u8 addr4[6]; 424 } ;*/ 425 #endif //PLATFORM_FREEBSD 426 427 #define WLANHDR_OFFSET 64 428 429 #define NULL_FRAMETAG (0x0) 430 #define DATA_FRAMETAG 0x01 431 #define L2_FRAMETAG 0x02 432 #define MGNT_FRAMETAG 0x03 433 #define AMSDU_FRAMETAG 0x04 434 435 #define EII_FRAMETAG 0x05 436 #define IEEE8023_FRAMETAG 0x06 437 438 #define MP_FRAMETAG 0x07 439 440 #define TXAGG_FRAMETAG 0x08 441 442 enum { 443 XMITBUF_DATA = 0, 444 XMITBUF_MGNT = 1, 445 XMITBUF_CMD = 2, 446 }; 447 448 bool rtw_xmit_ac_blocked(_adapter *adapter); 449 450 struct submit_ctx{ 451 u32 submit_time; /* */ 452 u32 timeout_ms; /* <0: not synchronous, 0: wait forever, >0: up to ms waiting */ 453 int status; /* status for operation */ 454 #ifdef PLATFORM_LINUX 455 struct completion done; 456 #endif 457 }; 458 459 enum { 460 RTW_SCTX_SUBMITTED = -1, 461 RTW_SCTX_DONE_SUCCESS = 0, 462 RTW_SCTX_DONE_UNKNOWN, 463 RTW_SCTX_DONE_TIMEOUT, 464 RTW_SCTX_DONE_BUF_ALLOC, 465 RTW_SCTX_DONE_BUF_FREE, 466 RTW_SCTX_DONE_WRITE_PORT_ERR, 467 RTW_SCTX_DONE_TX_DESC_NA, 468 RTW_SCTX_DONE_TX_DENY, 469 RTW_SCTX_DONE_CCX_PKT_FAIL, 470 RTW_SCTX_DONE_DRV_STOP, 471 RTW_SCTX_DONE_DEV_REMOVE, 472 RTW_SCTX_DONE_CMD_ERROR, 473 }; 474 475 476 void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms); 477 int rtw_sctx_wait(struct submit_ctx *sctx, const char *msg); 478 void rtw_sctx_done_err(struct submit_ctx **sctx, int status); 479 void rtw_sctx_done(struct submit_ctx **sctx); 480 481 struct xmit_buf 482 { 483 _list list; 484 485 _adapter *padapter; 486 487 u8 *pallocated_buf; 488 489 u8 *pbuf; 490 491 void *priv_data; 492 493 u16 buf_tag; // 0: Normal xmitbuf, 1: extension xmitbuf, 2:cmd xmitbuf 494 u16 flags; 495 u32 alloc_sz; 496 497 u32 len; 498 499 struct submit_ctx *sctx; 500 501 #ifdef CONFIG_USB_HCI 502 503 //u32 sz[8]; 504 u32 ff_hwaddr; 505 506 #if defined(PLATFORM_OS_XP)||defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) 507 PURB pxmit_urb[8]; 508 dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ 509 #endif 510 511 #ifdef PLATFORM_OS_XP 512 PIRP pxmit_irp[8]; 513 #endif 514 515 #ifdef PLATFORM_OS_CE 516 USB_TRANSFER usb_transfer_write_port; 517 #endif 518 519 u8 bpending[8]; 520 521 sint last[8]; 522 523 #endif 524 525 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 526 u8 *phead; 527 u8 *pdata; 528 u8 *ptail; 529 u8 *pend; 530 u32 ff_hwaddr; 531 u8 pg_num; 532 u8 agg_num; 533 #ifdef PLATFORM_OS_XP 534 PMDL pxmitbuf_mdl; 535 PIRP pxmitbuf_irp; 536 PSDBUS_REQUEST_PACKET pxmitbuf_sdrp; 537 #endif 538 #endif 539 540 #ifdef CONFIG_PCI_HCI 541 struct tx_desc *desc; 542 #endif 543 544 #if defined(DBG_XMIT_BUF )|| defined(DBG_XMIT_BUF_EXT) 545 u8 no; 546 #endif 547 548 }; 549 550 551 struct xmit_frame 552 { 553 _list list; 554 555 struct pkt_attrib attrib; 556 557 _pkt *pkt; 558 559 int frame_tag; 560 561 _adapter *padapter; 562 563 u8 *buf_addr; 564 565 struct xmit_buf *pxmitbuf; 566 567 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 568 u8 pg_num; 569 u8 agg_num; 570 #endif 571 572 #ifdef CONFIG_USB_HCI 573 #ifdef CONFIG_USB_TX_AGGREGATION 574 u8 agg_num; 575 #endif 576 s8 pkt_offset; 577 #endif 578 579 #ifdef CONFIG_XMIT_ACK 580 u8 ack_report; 581 #endif 582 583 u8 *alloc_addr; /* the actual address this xmitframe allocated */ 584 u8 ext_tag; /* 0:data, 1:mgmt */ 585 586 }; 587 588 struct tx_servq { 589 _list tx_pending; 590 _queue sta_pending; 591 int qcnt; 592 }; 593 594 595 struct sta_xmit_priv 596 { 597 _lock lock; 598 sint option; 599 sint apsd_setting; //When bit mask is on, the associated edca queue supports APSD. 600 601 602 //struct tx_servq blk_q[MAX_NUMBLKS]; 603 struct tx_servq be_q; //priority == 0,3 604 struct tx_servq bk_q; //priority == 1,2 605 struct tx_servq vi_q; //priority == 4,5 606 struct tx_servq vo_q; //priority == 6,7 607 _list legacy_dz; 608 _list apsd; 609 610 u16 txseq_tid[16]; 611 612 //uint sta_tx_bytes; 613 //u64 sta_tx_pkts; 614 //uint sta_tx_fail; 615 616 617 }; 618 619 620 struct hw_txqueue { 621 volatile sint head; 622 volatile sint tail; 623 volatile sint free_sz; //in units of 64 bytes 624 volatile sint free_cmdsz; 625 volatile sint txsz[8]; 626 uint ff_hwaddr; 627 uint cmd_hwaddr; 628 sint ac_tag; 629 }; 630 631 struct agg_pkt_info{ 632 u16 offset; 633 u16 pkt_len; 634 }; 635 636 enum cmdbuf_type { 637 CMDBUF_BEACON = 0x00, 638 CMDBUF_RSVD, 639 CMDBUF_MAX 640 }; 641 642 u8 rtw_get_hwseq_no(_adapter *padapter); 643 644 struct xmit_priv { 645 646 _lock lock; 647 648 _sema xmit_sema; 649 /*_sema terminate_xmitthread_sema;*/ 650 _completion xmitthread_comp; 651 652 //_queue blk_strms[MAX_NUMBLKS]; 653 _queue be_pending; 654 _queue bk_pending; 655 _queue vi_pending; 656 _queue vo_pending; 657 _queue bm_pending; 658 659 //_queue legacy_dz_queue; 660 //_queue apsd_queue; 661 662 u8 *pallocated_frame_buf; 663 u8 *pxmit_frame_buf; 664 uint free_xmitframe_cnt; 665 _queue free_xmit_queue; 666 667 //uint mapping_addr; 668 //uint pkt_sz; 669 670 u8 *xframe_ext_alloc_addr; 671 u8 *xframe_ext; 672 uint free_xframe_ext_cnt; 673 _queue free_xframe_ext_queue; 674 675 //struct hw_txqueue be_txqueue; 676 //struct hw_txqueue bk_txqueue; 677 //struct hw_txqueue vi_txqueue; 678 //struct hw_txqueue vo_txqueue; 679 //struct hw_txqueue bmc_txqueue; 680 681 uint frag_len; 682 683 _adapter *adapter; 684 685 u8 vcs_setting; 686 u8 vcs; 687 u8 vcs_type; 688 //u16 rts_thresh; 689 690 u64 tx_bytes; 691 u64 tx_pkts; 692 u64 tx_drop; 693 u64 last_tx_pkts; 694 695 struct hw_xmit *hwxmits; 696 u8 hwxmit_entry; 697 698 u8 wmm_para_seq[4];//sequence for wmm ac parameter strength from large to small. it's value is 0->vo, 1->vi, 2->be, 3->bk. 699 700 #ifdef CONFIG_USB_HCI 701 _sema tx_retevt;//all tx return event; 702 u8 txirp_cnt;// 703 704 #ifdef PLATFORM_OS_CE 705 USB_TRANSFER usb_transfer_write_port; 706 // USB_TRANSFER usb_transfer_write_mem; 707 #endif 708 #ifdef PLATFORM_LINUX 709 struct tasklet_struct xmit_tasklet; 710 #endif 711 #ifdef PLATFORM_FREEBSD 712 struct task xmit_tasklet; 713 #endif 714 //per AC pending irp 715 int beq_cnt; 716 int bkq_cnt; 717 int viq_cnt; 718 int voq_cnt; 719 720 #endif 721 722 #ifdef CONFIG_PCI_HCI 723 // Tx 724 struct rtw_tx_ring tx_ring[PCI_MAX_TX_QUEUE_COUNT]; 725 int txringcount[PCI_MAX_TX_QUEUE_COUNT]; 726 u8 beaconDMAing; //flag of indicating beacon is transmiting to HW by DMA 727 #ifdef PLATFORM_LINUX 728 struct tasklet_struct xmit_tasklet; 729 #endif 730 #endif 731 732 #if defined (CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 733 #ifdef CONFIG_SDIO_TX_TASKLET 734 #ifdef PLATFORM_LINUX 735 struct tasklet_struct xmit_tasklet; 736 #endif /* PLATFORM_LINUX */ 737 #else 738 _thread_hdl_ SdioXmitThread; 739 _sema SdioXmitSema; 740 /*_sema SdioXmitTerminateSema;*/ 741 _completion sdio_xmit_thread_comp; 742 #endif /* CONFIG_SDIO_TX_TASKLET */ 743 #endif /* CONFIG_SDIO_HCI */ 744 745 _queue free_xmitbuf_queue; 746 _queue pending_xmitbuf_queue; 747 u8 *pallocated_xmitbuf; 748 u8 *pxmitbuf; 749 uint free_xmitbuf_cnt; 750 751 _queue free_xmit_extbuf_queue; 752 u8 *pallocated_xmit_extbuf; 753 u8 *pxmit_extbuf; 754 uint free_xmit_extbuf_cnt; 755 756 struct xmit_buf pcmd_xmitbuf[CMDBUF_MAX]; 757 u8 hw_ssn_seq_no;//mapping to REG_HW_SEQ 0,1,2,3 758 u16 nqos_ssn; 759 #ifdef CONFIG_TX_EARLY_MODE 760 761 #ifdef CONFIG_SDIO_HCI 762 #define MAX_AGG_PKT_NUM 20 763 #else 764 #define MAX_AGG_PKT_NUM 256 //Max tx ampdu coounts 765 #endif 766 767 struct agg_pkt_info agg_pkt[MAX_AGG_PKT_NUM]; 768 #endif 769 770 #ifdef CONFIG_XMIT_ACK 771 int ack_tx; 772 _mutex ack_tx_mutex; 773 struct submit_ctx ack_tx_ops; 774 u8 seq_no; 775 #endif 776 _lock lock_sctx; 777 u8 stop_req; 778 }; 779 780 extern struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, 781 enum cmdbuf_type buf_type); 782 #define rtw_alloc_cmdxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_RSVD) 783 #if defined(CONFIG_RTL8192E) && defined(CONFIG_PCI_HCI) 784 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8192ee(struct xmit_priv *pxmitpriv, 785 enum cmdbuf_type buf_type); 786 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8192ee(p, CMDBUF_BEACON) 787 #else 788 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_BEACON) 789 #endif 790 791 extern struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv); 792 extern s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 793 794 extern struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv); 795 extern s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 796 797 void rtw_count_tx_stats(_adapter *padapter, struct xmit_frame *pxmitframe, int sz); 798 extern void rtw_update_protection(_adapter *padapter, u8 *ie, uint ie_len); 799 static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta); 800 static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta); 801 extern s32 rtw_make_wlanhdr(_adapter *padapter, u8 *hdr, struct pkt_attrib *pattrib); 802 extern s32 rtw_put_snap(u8 *data, u16 h_proto); 803 804 extern struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv); 805 struct xmit_frame *rtw_alloc_xmitframe_ext(struct xmit_priv *pxmitpriv); 806 struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv); 807 extern s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe); 808 extern void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue); 809 struct tx_servq *rtw_get_sta_pending(_adapter *padapter, struct sta_info *psta, sint up, u8 *ac); 810 extern s32 rtw_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe); 811 extern struct xmit_frame* rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, sint entry); 812 813 extern s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe); 814 extern u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib); 815 #define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue(&f->attrib) 816 extern s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); 817 #ifdef CONFIG_IEEE80211W 818 extern s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); 819 #endif //CONFIG_IEEE80211W 820 #ifdef CONFIG_TDLS 821 extern struct tdls_txmgmt *ptxmgmt; 822 s32 rtw_xmit_tdls_coalesce(_adapter *padapter, struct xmit_frame *pxmitframe, struct tdls_txmgmt *ptxmgmt); 823 s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib); 824 #endif 825 s32 _rtw_init_hw_txqueue(struct hw_txqueue* phw_txqueue, u8 ac_tag); 826 void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv); 827 828 829 s32 rtw_txframes_pending(_adapter *padapter); 830 s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib); 831 void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry); 832 833 834 s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter); 835 void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv); 836 837 838 void rtw_alloc_hwxmits(_adapter *padapter); 839 void rtw_free_hwxmits(_adapter *padapter); 840 841 842 s32 rtw_xmit(_adapter *padapter, _pkt **pkt); 843 bool xmitframe_hiq_filter(struct xmit_frame *xmitframe); 844 #if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS) 845 sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe); 846 void stop_sta_xmit(_adapter *padapter, struct sta_info *psta); 847 void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta); 848 void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta); 849 #endif 850 851 u8 query_ra_short_GI(struct sta_info *psta); 852 853 u8 qos_acm(u8 acm_mask, u8 priority); 854 855 #ifdef CONFIG_XMIT_THREAD_MODE 856 void enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 857 void enqueue_pending_xmitbuf_to_head(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 858 struct xmit_buf* dequeue_pending_xmitbuf(struct xmit_priv *pxmitpriv); 859 struct xmit_buf* dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpriv); 860 sint check_pending_xmitbuf(struct xmit_priv *pxmitpriv); 861 thread_return rtw_xmit_thread(thread_context context); 862 #endif 863 864 static void do_queue_select(_adapter * padapter, struct pkt_attrib * pattrib); 865 u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe); 866 867 #ifdef CONFIG_XMIT_ACK 868 int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms); 869 void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status); 870 #endif //CONFIG_XMIT_ACK 871 872 873 //include after declaring struct xmit_buf, in order to avoid warning 874 #include <xmit_osdep.h> 875 876 #endif //_RTL871X_XMIT_H_ 877 878