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) || defined(CONFIG_PLATFORM_ARM_SUN50IW1P1) 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*14) 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 407 u8 icmp_pkt; 408 409 #ifdef CONFIG_BEAMFORMING 410 u16 txbf_p_aid;/*beamforming Partial_AID*/ 411 u16 txbf_g_id;/*beamforming Group ID*/ 412 #endif 413 414 }; 415 #endif 416 417 #define WLANHDR_OFFSET 64 418 419 #define NULL_FRAMETAG (0x0) 420 #define DATA_FRAMETAG 0x01 421 #define L2_FRAMETAG 0x02 422 #define MGNT_FRAMETAG 0x03 423 #define AMSDU_FRAMETAG 0x04 424 425 #define EII_FRAMETAG 0x05 426 #define IEEE8023_FRAMETAG 0x06 427 428 #define MP_FRAMETAG 0x07 429 430 #define TXAGG_FRAMETAG 0x08 431 432 enum { 433 XMITBUF_DATA = 0, 434 XMITBUF_MGNT = 1, 435 XMITBUF_CMD = 2, 436 }; 437 438 bool rtw_xmit_ac_blocked(_adapter *adapter); 439 440 struct submit_ctx{ 441 u32 submit_time; /* */ 442 u32 timeout_ms; /* <0: not synchronous, 0: wait forever, >0: up to ms waiting */ 443 int status; /* status for operation */ 444 #ifdef PLATFORM_LINUX 445 struct completion done; 446 #endif 447 }; 448 449 enum { 450 RTW_SCTX_SUBMITTED = -1, 451 RTW_SCTX_DONE_SUCCESS = 0, 452 RTW_SCTX_DONE_UNKNOWN, 453 RTW_SCTX_DONE_TIMEOUT, 454 RTW_SCTX_DONE_BUF_ALLOC, 455 RTW_SCTX_DONE_BUF_FREE, 456 RTW_SCTX_DONE_WRITE_PORT_ERR, 457 RTW_SCTX_DONE_TX_DESC_NA, 458 RTW_SCTX_DONE_TX_DENY, 459 RTW_SCTX_DONE_CCX_PKT_FAIL, 460 RTW_SCTX_DONE_DRV_STOP, 461 RTW_SCTX_DONE_DEV_REMOVE, 462 RTW_SCTX_DONE_CMD_ERROR, 463 }; 464 465 466 void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms); 467 int rtw_sctx_wait(struct submit_ctx *sctx, const char *msg); 468 void rtw_sctx_done_err(struct submit_ctx **sctx, int status); 469 void rtw_sctx_done(struct submit_ctx **sctx); 470 471 struct xmit_buf 472 { 473 _list list; 474 475 _adapter *padapter; 476 477 u8 *pallocated_buf; 478 479 u8 *pbuf; 480 481 void *priv_data; 482 483 u16 buf_tag; // 0: Normal xmitbuf, 1: extension xmitbuf, 2:cmd xmitbuf 484 u16 flags; 485 u32 alloc_sz; 486 487 u32 len; 488 489 struct submit_ctx *sctx; 490 491 #ifdef CONFIG_USB_HCI 492 493 //u32 sz[8]; 494 u32 ff_hwaddr; 495 496 #if defined(PLATFORM_OS_XP)||defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) 497 PURB pxmit_urb[8]; 498 dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ 499 #endif 500 501 #ifdef PLATFORM_OS_XP 502 PIRP pxmit_irp[8]; 503 #endif 504 505 #ifdef PLATFORM_OS_CE 506 USB_TRANSFER usb_transfer_write_port; 507 #endif 508 509 u8 bpending[8]; 510 511 sint last[8]; 512 513 #endif 514 515 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 516 u8 *phead; 517 u8 *pdata; 518 u8 *ptail; 519 u8 *pend; 520 u32 ff_hwaddr; 521 u8 pg_num; 522 u8 agg_num; 523 #ifdef PLATFORM_OS_XP 524 PMDL pxmitbuf_mdl; 525 PIRP pxmitbuf_irp; 526 PSDBUS_REQUEST_PACKET pxmitbuf_sdrp; 527 #endif 528 #endif 529 530 #ifdef CONFIG_PCI_HCI 531 struct tx_desc *desc; 532 #endif 533 534 #if defined(DBG_XMIT_BUF )|| defined(DBG_XMIT_BUF_EXT) 535 u8 no; 536 #endif 537 538 }; 539 540 541 struct xmit_frame 542 { 543 _list list; 544 545 struct pkt_attrib attrib; 546 547 _pkt *pkt; 548 549 int frame_tag; 550 551 _adapter *padapter; 552 553 u8 *buf_addr; 554 555 struct xmit_buf *pxmitbuf; 556 557 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 558 u8 pg_num; 559 u8 agg_num; 560 #endif 561 562 #ifdef CONFIG_USB_HCI 563 #ifdef CONFIG_USB_TX_AGGREGATION 564 u8 agg_num; 565 #endif 566 s8 pkt_offset; 567 #endif 568 569 #ifdef CONFIG_XMIT_ACK 570 u8 ack_report; 571 #endif 572 573 u8 *alloc_addr; /* the actual address this xmitframe allocated */ 574 u8 ext_tag; /* 0:data, 1:mgmt */ 575 576 }; 577 578 struct tx_servq { 579 _list tx_pending; 580 _queue sta_pending; 581 int qcnt; 582 }; 583 584 585 struct sta_xmit_priv 586 { 587 _lock lock; 588 sint option; 589 sint apsd_setting; //When bit mask is on, the associated edca queue supports APSD. 590 591 592 //struct tx_servq blk_q[MAX_NUMBLKS]; 593 struct tx_servq be_q; //priority == 0,3 594 struct tx_servq bk_q; //priority == 1,2 595 struct tx_servq vi_q; //priority == 4,5 596 struct tx_servq vo_q; //priority == 6,7 597 _list legacy_dz; 598 _list apsd; 599 600 u16 txseq_tid[16]; 601 602 //uint sta_tx_bytes; 603 //u64 sta_tx_pkts; 604 //uint sta_tx_fail; 605 606 607 }; 608 609 610 struct hw_txqueue { 611 volatile sint head; 612 volatile sint tail; 613 volatile sint free_sz; //in units of 64 bytes 614 volatile sint free_cmdsz; 615 volatile sint txsz[8]; 616 uint ff_hwaddr; 617 uint cmd_hwaddr; 618 sint ac_tag; 619 }; 620 621 struct agg_pkt_info{ 622 u16 offset; 623 u16 pkt_len; 624 }; 625 626 enum cmdbuf_type { 627 CMDBUF_BEACON = 0x00, 628 CMDBUF_RSVD, 629 CMDBUF_MAX 630 }; 631 632 u8 rtw_get_hwseq_no(_adapter *padapter); 633 634 struct xmit_priv { 635 636 _lock lock; 637 638 _sema xmit_sema; 639 _sema terminate_xmitthread_sema; 640 641 //_queue blk_strms[MAX_NUMBLKS]; 642 _queue be_pending; 643 _queue bk_pending; 644 _queue vi_pending; 645 _queue vo_pending; 646 _queue bm_pending; 647 648 //_queue legacy_dz_queue; 649 //_queue apsd_queue; 650 651 u8 *pallocated_frame_buf; 652 u8 *pxmit_frame_buf; 653 uint free_xmitframe_cnt; 654 _queue free_xmit_queue; 655 656 //uint mapping_addr; 657 //uint pkt_sz; 658 659 u8 *xframe_ext_alloc_addr; 660 u8 *xframe_ext; 661 uint free_xframe_ext_cnt; 662 _queue free_xframe_ext_queue; 663 664 //struct hw_txqueue be_txqueue; 665 //struct hw_txqueue bk_txqueue; 666 //struct hw_txqueue vi_txqueue; 667 //struct hw_txqueue vo_txqueue; 668 //struct hw_txqueue bmc_txqueue; 669 670 uint frag_len; 671 672 _adapter *adapter; 673 674 u8 vcs_setting; 675 u8 vcs; 676 u8 vcs_type; 677 //u16 rts_thresh; 678 679 u64 tx_bytes; 680 u64 tx_pkts; 681 u64 tx_drop; 682 u64 last_tx_pkts; 683 684 struct hw_xmit *hwxmits; 685 u8 hwxmit_entry; 686 687 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. 688 689 #ifdef CONFIG_USB_HCI 690 _sema tx_retevt;//all tx return event; 691 u8 txirp_cnt;// 692 693 #ifdef PLATFORM_OS_CE 694 USB_TRANSFER usb_transfer_write_port; 695 // USB_TRANSFER usb_transfer_write_mem; 696 #endif 697 #ifdef PLATFORM_LINUX 698 struct tasklet_struct xmit_tasklet; 699 #endif 700 #ifdef PLATFORM_FREEBSD 701 struct task xmit_tasklet; 702 #endif 703 //per AC pending irp 704 int beq_cnt; 705 int bkq_cnt; 706 int viq_cnt; 707 int voq_cnt; 708 709 #endif 710 711 #ifdef CONFIG_PCI_HCI 712 // Tx 713 struct rtw_tx_ring tx_ring[PCI_MAX_TX_QUEUE_COUNT]; 714 int txringcount[PCI_MAX_TX_QUEUE_COUNT]; 715 u8 beaconDMAing; //flag of indicating beacon is transmiting to HW by DMA 716 #ifdef PLATFORM_LINUX 717 struct tasklet_struct xmit_tasklet; 718 #endif 719 #endif 720 721 #if defined (CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 722 #ifdef CONFIG_SDIO_TX_TASKLET 723 #ifdef PLATFORM_LINUX 724 struct tasklet_struct xmit_tasklet; 725 #endif /* PLATFORM_LINUX */ 726 #else 727 _thread_hdl_ SdioXmitThread; 728 _sema SdioXmitSema; 729 _sema SdioXmitTerminateSema; 730 #endif /* CONFIG_SDIO_TX_TASKLET */ 731 #endif /* CONFIG_SDIO_HCI */ 732 733 _queue free_xmitbuf_queue; 734 _queue pending_xmitbuf_queue; 735 u8 *pallocated_xmitbuf; 736 u8 *pxmitbuf; 737 uint free_xmitbuf_cnt; 738 739 _queue free_xmit_extbuf_queue; 740 u8 *pallocated_xmit_extbuf; 741 u8 *pxmit_extbuf; 742 uint free_xmit_extbuf_cnt; 743 744 struct xmit_buf pcmd_xmitbuf[CMDBUF_MAX]; 745 u8 hw_ssn_seq_no;//mapping to REG_HW_SEQ 0,1,2,3 746 u16 nqos_ssn; 747 #ifdef CONFIG_TX_EARLY_MODE 748 749 #ifdef CONFIG_SDIO_HCI 750 #define MAX_AGG_PKT_NUM 20 751 #else 752 #define MAX_AGG_PKT_NUM 256 //Max tx ampdu coounts 753 #endif 754 755 struct agg_pkt_info agg_pkt[MAX_AGG_PKT_NUM]; 756 #endif 757 758 #ifdef CONFIG_XMIT_ACK 759 int ack_tx; 760 _mutex ack_tx_mutex; 761 struct submit_ctx ack_tx_ops; 762 u8 seq_no; 763 #endif 764 _lock lock_sctx; 765 }; 766 767 extern struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, 768 enum cmdbuf_type buf_type); 769 #define rtw_alloc_cmdxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_RSVD) 770 #if defined(CONFIG_RTL8192E) && defined(CONFIG_PCI_HCI) 771 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8192ee(struct xmit_priv *pxmitpriv, 772 enum cmdbuf_type buf_type); 773 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8192ee(p, CMDBUF_BEACON) 774 #else 775 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_BEACON) 776 #endif 777 778 extern struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv); 779 extern s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 780 781 extern struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv); 782 extern s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 783 784 void rtw_count_tx_stats(_adapter *padapter, struct xmit_frame *pxmitframe, int sz); 785 extern void rtw_update_protection(_adapter *padapter, u8 *ie, uint ie_len); 786 static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta); 787 static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta); 788 extern s32 rtw_make_wlanhdr(_adapter *padapter, u8 *hdr, struct pkt_attrib *pattrib); 789 extern s32 rtw_put_snap(u8 *data, u16 h_proto); 790 791 extern struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv); 792 struct xmit_frame *rtw_alloc_xmitframe_ext(struct xmit_priv *pxmitpriv); 793 struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv); 794 extern s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe); 795 extern void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue); 796 struct tx_servq *rtw_get_sta_pending(_adapter *padapter, struct sta_info *psta, sint up, u8 *ac); 797 extern s32 rtw_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe); 798 extern struct xmit_frame* rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, sint entry); 799 800 extern s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe); 801 extern u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib); 802 #define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue(&f->attrib) 803 extern s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); 804 #ifdef CONFIG_IEEE80211W 805 extern s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); 806 #endif //CONFIG_IEEE80211W 807 #ifdef CONFIG_TDLS 808 extern struct tdls_txmgmt *ptxmgmt; 809 s32 rtw_xmit_tdls_coalesce(_adapter *padapter, struct xmit_frame *pxmitframe, struct tdls_txmgmt *ptxmgmt); 810 s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib); 811 #endif 812 s32 _rtw_init_hw_txqueue(struct hw_txqueue* phw_txqueue, u8 ac_tag); 813 void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv); 814 815 816 s32 rtw_txframes_pending(_adapter *padapter); 817 s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib); 818 void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry); 819 820 821 s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter); 822 void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv); 823 824 825 void rtw_alloc_hwxmits(_adapter *padapter); 826 void rtw_free_hwxmits(_adapter *padapter); 827 828 s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev); 829 830 s32 rtw_xmit(_adapter *padapter, _pkt **pkt); 831 bool xmitframe_hiq_filter(struct xmit_frame *xmitframe); 832 #if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS) 833 sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe); 834 void stop_sta_xmit(_adapter *padapter, struct sta_info *psta); 835 void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta); 836 void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta); 837 #endif 838 839 u8 query_ra_short_GI(struct sta_info *psta); 840 841 u8 qos_acm(u8 acm_mask, u8 priority); 842 843 #ifdef CONFIG_XMIT_THREAD_MODE 844 void enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 845 void enqueue_pending_xmitbuf_to_head(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); 846 struct xmit_buf* dequeue_pending_xmitbuf(struct xmit_priv *pxmitpriv); 847 struct xmit_buf* dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpriv); 848 sint check_pending_xmitbuf(struct xmit_priv *pxmitpriv); 849 thread_return rtw_xmit_thread(thread_context context); 850 #endif 851 852 static void do_queue_select(_adapter * padapter, struct pkt_attrib * pattrib); 853 u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe); 854 855 #ifdef CONFIG_XMIT_ACK 856 int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms); 857 void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status); 858 #endif //CONFIG_XMIT_ACK 859 860 861 //include after declaring struct xmit_buf, in order to avoid warning 862 #include <xmit_osdep.h> 863 864 #endif //_RTL871X_XMIT_H_ 865 866