rtw_xmit.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  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. #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
  23. //#define MAX_XMITBUF_SZ (30720)// (2048)
  24. #ifdef CONFIG_TX_AGGREGATION
  25. #define MAX_XMITBUF_SZ (20480) // 20k
  26. #else
  27. #define MAX_XMITBUF_SZ (12288) //12k 1536*8
  28. #endif
  29. #if defined CONFIG_SDIO_HCI
  30. #define NR_XMITBUFF (16)
  31. #endif
  32. #if defined(CONFIG_GSPI_HCI)
  33. #define NR_XMITBUFF (128)
  34. #endif
  35. #elif defined (CONFIG_USB_HCI)
  36. #ifdef CONFIG_USB_TX_AGGREGATION
  37. #ifdef CONFIG_PLATFORM_ARM_SUNxI
  38. #define MAX_XMITBUF_SZ (12288) //12k 1536*8
  39. #elif defined (CONFIG_PLATFORM_MSTAR_TITANIA12)
  40. #define MAX_XMITBUF_SZ 7680 // 7.5k
  41. #else
  42. #define MAX_XMITBUF_SZ (20480) // 20k
  43. #endif
  44. #else
  45. #define MAX_XMITBUF_SZ (2048)
  46. #endif
  47. #ifdef CONFIG_SINGLE_XMIT_BUF
  48. #define NR_XMITBUFF (1)
  49. #else
  50. #define NR_XMITBUFF (4)
  51. #endif //CONFIG_SINGLE_XMIT_BUF
  52. #elif defined (CONFIG_PCI_HCI)
  53. #define MAX_XMITBUF_SZ (1664)
  54. #define NR_XMITBUFF (128)
  55. #endif
  56. #ifdef PLATFORM_OS_CE
  57. #define XMITBUF_ALIGN_SZ 4
  58. #else
  59. #ifdef CONFIG_PCI_HCI
  60. #define XMITBUF_ALIGN_SZ 4
  61. #else
  62. #define XMITBUF_ALIGN_SZ 512
  63. #endif
  64. #endif
  65. // xmit extension buff defination
  66. #define MAX_XMIT_EXTBUF_SZ (1536)
  67. #define NR_XMIT_EXTBUFF (32)
  68. #define MAX_NUMBLKS (1)
  69. #define XMIT_VO_QUEUE (0)
  70. #define XMIT_VI_QUEUE (1)
  71. #define XMIT_BE_QUEUE (2)
  72. #define XMIT_BK_QUEUE (3)
  73. #define VO_QUEUE_INX 0
  74. #define VI_QUEUE_INX 1
  75. #define BE_QUEUE_INX 2
  76. #define BK_QUEUE_INX 3
  77. #define BCN_QUEUE_INX 4
  78. #define MGT_QUEUE_INX 5
  79. #define HIGH_QUEUE_INX 6
  80. #define TXCMD_QUEUE_INX 7
  81. #define HW_QUEUE_ENTRY 8
  82. #ifdef CONFIG_PCI_HCI
  83. //#define TXDESC_NUM 64
  84. #define TXDESC_NUM 128
  85. #define TXDESC_NUM_BE_QUEUE 128
  86. #endif
  87. #define WEP_IV(pattrib_iv, dot11txpn, keyidx)\
  88. do{\
  89. pattrib_iv[0] = dot11txpn._byte_.TSC0;\
  90. pattrib_iv[1] = dot11txpn._byte_.TSC1;\
  91. pattrib_iv[2] = dot11txpn._byte_.TSC2;\
  92. pattrib_iv[3] = ((keyidx & 0x3)<<6);\
  93. dot11txpn.val = (dot11txpn.val == 0xffffff) ? 0: (dot11txpn.val+1);\
  94. }while(0)
  95. #define TKIP_IV(pattrib_iv, dot11txpn, keyidx)\
  96. do{\
  97. pattrib_iv[0] = dot11txpn._byte_.TSC1;\
  98. pattrib_iv[1] = (dot11txpn._byte_.TSC1 | 0x20) & 0x7f;\
  99. pattrib_iv[2] = dot11txpn._byte_.TSC0;\
  100. pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
  101. pattrib_iv[4] = dot11txpn._byte_.TSC2;\
  102. pattrib_iv[5] = dot11txpn._byte_.TSC3;\
  103. pattrib_iv[6] = dot11txpn._byte_.TSC4;\
  104. pattrib_iv[7] = dot11txpn._byte_.TSC5;\
  105. dot11txpn.val = dot11txpn.val == 0xffffffffffffULL ? 0: (dot11txpn.val+1);\
  106. }while(0)
  107. #define AES_IV(pattrib_iv, dot11txpn, keyidx)\
  108. do{\
  109. pattrib_iv[0] = dot11txpn._byte_.TSC0;\
  110. pattrib_iv[1] = dot11txpn._byte_.TSC1;\
  111. pattrib_iv[2] = 0;\
  112. pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
  113. pattrib_iv[4] = dot11txpn._byte_.TSC2;\
  114. pattrib_iv[5] = dot11txpn._byte_.TSC3;\
  115. pattrib_iv[6] = dot11txpn._byte_.TSC4;\
  116. pattrib_iv[7] = dot11txpn._byte_.TSC5;\
  117. dot11txpn.val = dot11txpn.val == 0xffffffffffffULL ? 0: (dot11txpn.val+1);\
  118. }while(0)
  119. #define HWXMIT_ENTRY 4
  120. #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)|| defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8723B)
  121. #define TXDESC_SIZE 40
  122. #else
  123. #define TXDESC_SIZE 32
  124. #endif
  125. #ifdef CONFIG_TX_EARLY_MODE
  126. #define EARLY_MODE_INFO_SIZE 8
  127. #endif
  128. #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
  129. #define TXDESC_OFFSET TXDESC_SIZE
  130. #endif
  131. #ifdef CONFIG_USB_HCI
  132. #define PACKET_OFFSET_SZ (8)
  133. #define TXDESC_OFFSET (TXDESC_SIZE + PACKET_OFFSET_SZ)
  134. #endif
  135. #ifdef CONFIG_PCI_HCI
  136. #define TXDESC_OFFSET 0
  137. #define TX_DESC_NEXT_DESC_OFFSET 40
  138. #endif
  139. enum TXDESC_SC{
  140. SC_DONT_CARE = 0x00,
  141. SC_UPPER= 0x01,
  142. SC_LOWER=0x02,
  143. SC_DUPLICATE=0x03
  144. };
  145. #ifdef CONFIG_PCI_HCI
  146. #define TXDESC_64_BYTES
  147. #elif defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8723B)
  148. #define TXDESC_40_BYTES
  149. #endif
  150. struct tx_desc
  151. {
  152. unsigned int txdw0;
  153. unsigned int txdw1;
  154. unsigned int txdw2;
  155. unsigned int txdw3;
  156. unsigned int txdw4;
  157. unsigned int txdw5;
  158. unsigned int txdw6;
  159. unsigned int txdw7;
  160. #if defined(TXDESC_40_BYTES) || defined(TXDESC_64_BYTES)
  161. unsigned int txdw8;
  162. unsigned int txdw9;
  163. #endif // TXDESC_40_BYTES
  164. #ifdef TXDESC_64_BYTES
  165. unsigned int txdw10;
  166. unsigned int txdw11;
  167. // 2008/05/15 MH Because PCIE HW memory R/W 4K limit. And now, our descriptor
  168. // size is 40 bytes. If you use more than 102 descriptor( 103*40>4096), HW will execute
  169. // memoryR/W CRC error. And then all DMA fetch will fail. We must decrease descriptor
  170. // number or enlarge descriptor size as 64 bytes.
  171. unsigned int txdw12;
  172. unsigned int txdw13;
  173. unsigned int txdw14;
  174. unsigned int txdw15;
  175. #endif
  176. };
  177. union txdesc {
  178. struct tx_desc txdesc;
  179. unsigned int value[TXDESC_SIZE>>2];
  180. };
  181. #ifdef CONFIG_PCI_HCI
  182. #define PCI_MAX_TX_QUEUE_COUNT 8
  183. struct rtw_tx_ring {
  184. struct tx_desc *desc;
  185. dma_addr_t dma;
  186. unsigned int idx;
  187. unsigned int entries;
  188. _queue queue;
  189. u32 qlen;
  190. };
  191. #endif
  192. struct hw_xmit {
  193. //_lock xmit_lock;
  194. //_list pending;
  195. _queue *sta_queue;
  196. //struct hw_txqueue *phwtxqueue;
  197. //sint txcmdcnt;
  198. int accnt;
  199. };
  200. #if 0
  201. struct pkt_attrib
  202. {
  203. u8 type;
  204. u8 subtype;
  205. u8 bswenc;
  206. u8 dhcp_pkt;
  207. u16 ether_type;
  208. int pktlen; //the original 802.3 pkt raw_data len (not include ether_hdr data)
  209. int pkt_hdrlen; //the original 802.3 pkt header len
  210. int hdrlen; //the WLAN Header Len
  211. int nr_frags;
  212. int last_txcmdsz;
  213. int encrypt; //when 0 indicate no encrypt. when non-zero, indicate the encrypt algorith
  214. u8 iv[8];
  215. int iv_len;
  216. u8 icv[8];
  217. int icv_len;
  218. int priority;
  219. int ack_policy;
  220. int mac_id;
  221. int vcs_mode; //virtual carrier sense method
  222. u8 dst[ETH_ALEN];
  223. u8 src[ETH_ALEN];
  224. u8 ta[ETH_ALEN];
  225. u8 ra[ETH_ALEN];
  226. u8 key_idx;
  227. u8 qos_en;
  228. u8 ht_en;
  229. u8 raid;//rate adpative id
  230. u8 bwmode;
  231. u8 ch_offset;//PRIME_CHNL_OFFSET
  232. u8 sgi;//short GI
  233. u8 ampdu_en;//tx ampdu enable
  234. u8 mdata;//more data bit
  235. u8 eosp;
  236. u8 triggered;//for ap mode handling Power Saving sta
  237. u32 qsel;
  238. u16 seqnum;
  239. struct sta_info * psta;
  240. #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
  241. u8 hw_tcp_csum;
  242. #endif
  243. };
  244. #else
  245. //reduce size
  246. struct pkt_attrib
  247. {
  248. u8 type;
  249. u8 subtype;
  250. u8 bswenc;
  251. u8 dhcp_pkt;
  252. u16 ether_type;
  253. u16 seqnum;
  254. u16 pkt_hdrlen; //the original 802.3 pkt header len
  255. u16 hdrlen; //the WLAN Header Len
  256. u32 pktlen; //the original 802.3 pkt raw_data len (not include ether_hdr data)
  257. u32 last_txcmdsz;
  258. u8 nr_frags;
  259. u8 encrypt; //when 0 indicate no encrypt. when non-zero, indicate the encrypt algorith
  260. u8 iv_len;
  261. u8 icv_len;
  262. u8 iv[18];
  263. u8 icv[16];
  264. u8 priority;
  265. u8 ack_policy;
  266. u8 mac_id;
  267. u8 vcs_mode; //virtual carrier sense method
  268. u8 dst[ETH_ALEN];
  269. u8 src[ETH_ALEN];
  270. u8 ta[ETH_ALEN];
  271. u8 ra[ETH_ALEN];
  272. u8 key_idx;
  273. u8 qos_en;
  274. u8 ht_en;
  275. u8 raid;//rate adpative id
  276. u8 bwmode;
  277. u8 ch_offset;//PRIME_CHNL_OFFSET
  278. u8 sgi;//short GI
  279. u8 ampdu_en;//tx ampdu enable
  280. u8 mdata;//more data bit
  281. u8 pctrl;//per packet txdesc control enable
  282. u8 triggered;//for ap mode handling Power Saving sta
  283. u8 qsel;
  284. u8 eosp;
  285. u8 rate;
  286. u8 intel_proxim;
  287. u8 retry_ctrl;
  288. u8 mbssid;
  289. u8 ldpc;
  290. u8 stbc;
  291. struct sta_info * psta;
  292. #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
  293. u8 hw_tcp_csum;
  294. #endif
  295. u8 rtsen;
  296. u8 cts2self;
  297. union Keytype dot11tkiptxmickey;
  298. //union Keytype dot11tkiprxmickey;
  299. union Keytype dot118021x_UncstKey;
  300. };
  301. #endif
  302. #ifdef PLATFORM_FREEBSD
  303. #define ETH_ALEN 6 /* Octets in one ethernet addr */
  304. #define ETH_HLEN 14 /* Total octets in header. */
  305. #define ETH_P_IP 0x0800 /* Internet Protocol packet */
  306. /*struct rtw_ieee80211_hdr {
  307. uint16_t frame_control;
  308. uint16_t duration_id;
  309. u8 addr1[6];
  310. u8 addr2[6];
  311. u8 addr3[6];
  312. uint16_t seq_ctrl;
  313. u8 addr4[6];
  314. } ;*/
  315. #endif //PLATFORM_FREEBSD
  316. #define WLANHDR_OFFSET 64
  317. #define NULL_FRAMETAG (0x0)
  318. #define DATA_FRAMETAG 0x01
  319. #define L2_FRAMETAG 0x02
  320. #define MGNT_FRAMETAG 0x03
  321. #define AMSDU_FRAMETAG 0x04
  322. #define EII_FRAMETAG 0x05
  323. #define IEEE8023_FRAMETAG 0x06
  324. #define MP_FRAMETAG 0x07
  325. #define TXAGG_FRAMETAG 0x08
  326. enum {
  327. XMITBUF_DATA = 0,
  328. XMITBUF_MGNT = 1,
  329. XMITBUF_CMD = 2,
  330. };
  331. struct submit_ctx{
  332. u32 submit_time; /* */
  333. u32 timeout_ms; /* <0: not synchronous, 0: wait forever, >0: up to ms waiting */
  334. int status; /* status for operation */
  335. #ifdef PLATFORM_LINUX
  336. struct completion done;
  337. #endif
  338. };
  339. enum {
  340. RTW_SCTX_SUBMITTED = -1,
  341. RTW_SCTX_DONE_SUCCESS = 0,
  342. RTW_SCTX_DONE_UNKNOWN,
  343. RTW_SCTX_DONE_TIMEOUT,
  344. RTW_SCTX_DONE_BUF_ALLOC,
  345. RTW_SCTX_DONE_BUF_FREE,
  346. RTW_SCTX_DONE_WRITE_PORT_ERR,
  347. RTW_SCTX_DONE_TX_DESC_NA,
  348. RTW_SCTX_DONE_TX_DENY,
  349. RTW_SCTX_DONE_CCX_PKT_FAIL,
  350. RTW_SCTX_DONE_DRV_STOP,
  351. RTW_SCTX_DONE_DEV_REMOVE,
  352. };
  353. void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
  354. int rtw_sctx_wait(struct submit_ctx *sctx);
  355. void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
  356. void rtw_sctx_done(struct submit_ctx **sctx);
  357. struct xmit_buf
  358. {
  359. _list list;
  360. _adapter *padapter;
  361. u8 *pallocated_buf;
  362. u8 *pbuf;
  363. void *priv_data;
  364. u16 buf_tag; // 0: Normal xmitbuf, 1: extension xmitbuf, 2:cmd xmitbuf
  365. u16 flags;
  366. u32 alloc_sz;
  367. u32 len;
  368. struct submit_ctx *sctx;
  369. #ifdef CONFIG_USB_HCI
  370. //u32 sz[8];
  371. u32 ff_hwaddr;
  372. #if defined(PLATFORM_OS_XP)||defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
  373. PURB pxmit_urb[8];
  374. dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */
  375. #endif
  376. #ifdef PLATFORM_OS_XP
  377. PIRP pxmit_irp[8];
  378. #endif
  379. #ifdef PLATFORM_OS_CE
  380. USB_TRANSFER usb_transfer_write_port;
  381. #endif
  382. u8 bpending[8];
  383. sint last[8];
  384. #endif
  385. #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
  386. u8 *phead;
  387. u8 *pdata;
  388. u8 *ptail;
  389. u8 *pend;
  390. u32 ff_hwaddr;
  391. u8 pg_num;
  392. u8 agg_num;
  393. #ifdef PLATFORM_OS_XP
  394. PMDL pxmitbuf_mdl;
  395. PIRP pxmitbuf_irp;
  396. PSDBUS_REQUEST_PACKET pxmitbuf_sdrp;
  397. #endif
  398. #endif
  399. #if defined(DBG_XMIT_BUF )|| defined(DBG_XMIT_BUF_EXT)
  400. u8 no;
  401. #endif
  402. };
  403. struct xmit_frame
  404. {
  405. _list list;
  406. struct pkt_attrib attrib;
  407. _pkt *pkt;
  408. int frame_tag;
  409. _adapter *padapter;
  410. u8 *buf_addr;
  411. struct xmit_buf *pxmitbuf;
  412. #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
  413. u8 pg_num;
  414. u8 agg_num;
  415. #endif
  416. #ifdef CONFIG_USB_HCI
  417. #ifdef CONFIG_USB_TX_AGGREGATION
  418. u8 agg_num;
  419. #endif
  420. s8 pkt_offset;
  421. #ifdef CONFIG_RTL8192D
  422. u8 EMPktNum;
  423. u16 EMPktLen[5];//The max value by HW
  424. #endif
  425. #endif
  426. #ifdef CONFIG_XMIT_ACK
  427. u8 ack_report;
  428. #endif
  429. u8 *alloc_addr; /* the actual address this xmitframe allocated */
  430. u8 ext_tag; /* 0:data, 1:mgmt */
  431. };
  432. struct tx_servq {
  433. _list tx_pending;
  434. _queue sta_pending;
  435. int qcnt;
  436. };
  437. struct sta_xmit_priv
  438. {
  439. _lock lock;
  440. sint option;
  441. sint apsd_setting; //When bit mask is on, the associated edca queue supports APSD.
  442. //struct tx_servq blk_q[MAX_NUMBLKS];
  443. struct tx_servq be_q; //priority == 0,3
  444. struct tx_servq bk_q; //priority == 1,2
  445. struct tx_servq vi_q; //priority == 4,5
  446. struct tx_servq vo_q; //priority == 6,7
  447. _list legacy_dz;
  448. _list apsd;
  449. u16 txseq_tid[16];
  450. //uint sta_tx_bytes;
  451. //u64 sta_tx_pkts;
  452. //uint sta_tx_fail;
  453. };
  454. struct hw_txqueue {
  455. volatile sint head;
  456. volatile sint tail;
  457. volatile sint free_sz; //in units of 64 bytes
  458. volatile sint free_cmdsz;
  459. volatile sint txsz[8];
  460. uint ff_hwaddr;
  461. uint cmd_hwaddr;
  462. sint ac_tag;
  463. };
  464. struct agg_pkt_info{
  465. u16 offset;
  466. u16 pkt_len;
  467. };
  468. struct xmit_priv {
  469. _lock lock;
  470. _sema xmit_sema;
  471. _sema terminate_xmitthread_sema;
  472. //_queue blk_strms[MAX_NUMBLKS];
  473. _queue be_pending;
  474. _queue bk_pending;
  475. _queue vi_pending;
  476. _queue vo_pending;
  477. _queue bm_pending;
  478. //_queue legacy_dz_queue;
  479. //_queue apsd_queue;
  480. u8 *pallocated_frame_buf;
  481. u8 *pxmit_frame_buf;
  482. uint free_xmitframe_cnt;
  483. _queue free_xmit_queue;
  484. //uint mapping_addr;
  485. //uint pkt_sz;
  486. u8 *xframe_ext_alloc_addr;
  487. u8 *xframe_ext;
  488. uint free_xframe_ext_cnt;
  489. _queue free_xframe_ext_queue;
  490. //struct hw_txqueue be_txqueue;
  491. //struct hw_txqueue bk_txqueue;
  492. //struct hw_txqueue vi_txqueue;
  493. //struct hw_txqueue vo_txqueue;
  494. //struct hw_txqueue bmc_txqueue;
  495. uint frag_len;
  496. _adapter *adapter;
  497. u8 vcs_setting;
  498. u8 vcs;
  499. u8 vcs_type;
  500. //u16 rts_thresh;
  501. u64 tx_bytes;
  502. u64 tx_pkts;
  503. u64 tx_drop;
  504. u64 last_tx_bytes;
  505. u64 last_tx_pkts;
  506. struct hw_xmit *hwxmits;
  507. u8 hwxmit_entry;
  508. 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.
  509. #ifdef CONFIG_USB_HCI
  510. _sema tx_retevt;//all tx return event;
  511. u8 txirp_cnt;//
  512. #ifdef PLATFORM_OS_CE
  513. USB_TRANSFER usb_transfer_write_port;
  514. // USB_TRANSFER usb_transfer_write_mem;
  515. #endif
  516. #ifdef PLATFORM_LINUX
  517. struct tasklet_struct xmit_tasklet;
  518. #endif
  519. #ifdef PLATFORM_FREEBSD
  520. struct task xmit_tasklet;
  521. #endif
  522. //per AC pending irp
  523. int beq_cnt;
  524. int bkq_cnt;
  525. int viq_cnt;
  526. int voq_cnt;
  527. #endif
  528. #ifdef CONFIG_PCI_HCI
  529. // Tx
  530. struct rtw_tx_ring tx_ring[PCI_MAX_TX_QUEUE_COUNT];
  531. int txringcount[PCI_MAX_TX_QUEUE_COUNT];
  532. u8 beaconDMAing; //flag of indicating beacon is transmiting to HW by DMA
  533. #ifdef PLATFORM_LINUX
  534. struct tasklet_struct xmit_tasklet;
  535. #endif
  536. #endif
  537. #ifdef CONFIG_SDIO_HCI
  538. #ifdef CONFIG_SDIO_TX_TASKLET
  539. #ifdef PLATFORM_LINUX
  540. struct tasklet_struct xmit_tasklet;
  541. #endif
  542. #endif
  543. #endif
  544. _queue free_xmitbuf_queue;
  545. _queue pending_xmitbuf_queue;
  546. u8 *pallocated_xmitbuf;
  547. u8 *pxmitbuf;
  548. uint free_xmitbuf_cnt;
  549. _queue free_xmit_extbuf_queue;
  550. u8 *pallocated_xmit_extbuf;
  551. u8 *pxmit_extbuf;
  552. uint free_xmit_extbuf_cnt;
  553. struct xmit_buf pcmd_xmitbuf;
  554. u16 nqos_ssn;
  555. #ifdef CONFIG_TX_EARLY_MODE
  556. #ifdef CONFIG_SDIO_HCI
  557. #define MAX_AGG_PKT_NUM 20
  558. #else
  559. #define MAX_AGG_PKT_NUM 256 //Max tx ampdu coounts
  560. #endif
  561. struct agg_pkt_info agg_pkt[MAX_AGG_PKT_NUM];
  562. #endif
  563. #ifdef CONFIG_XMIT_ACK
  564. int ack_tx;
  565. _mutex ack_tx_mutex;
  566. struct submit_ctx ack_tx_ops;
  567. #endif
  568. _lock lock_sctx;
  569. };
  570. extern struct xmit_frame *rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, u32 buffsize);
  571. extern void rtw_free_cmdxmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe);
  572. extern struct xmit_buf *rtw_alloc_cmd_xmitbuf(struct xmit_priv *pxmitpriv, u32 buffsize);
  573. extern s32 rtw_free_cmd_xmitbuf(struct xmit_priv *pxmitpriv);
  574. extern struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv);
  575. extern s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
  576. extern struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv);
  577. extern s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
  578. void rtw_count_tx_stats(_adapter *padapter, struct xmit_frame *pxmitframe, int sz);
  579. extern void rtw_update_protection(_adapter *padapter, u8 *ie, uint ie_len);
  580. extern s32 rtw_make_wlanhdr(_adapter *padapter, u8 *hdr, struct pkt_attrib *pattrib);
  581. extern s32 rtw_put_snap(u8 *data, u16 h_proto);
  582. extern struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv);
  583. struct xmit_frame *rtw_alloc_xmitframe_ext(struct xmit_priv *pxmitpriv);
  584. struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv);
  585. extern s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe);
  586. extern void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue);
  587. struct tx_servq *rtw_get_sta_pending(_adapter *padapter, struct sta_info *psta, sint up, u8 *ac);
  588. extern s32 rtw_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
  589. extern struct xmit_frame* rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, sint entry);
  590. extern s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe);
  591. extern u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib);
  592. #define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue(&f->attrib)
  593. extern s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe);
  594. #ifdef CONFIG_TDLS
  595. s32 rtw_xmit_tdls_coalesce(_adapter *padapter, struct xmit_frame *pxmitframe, u8 action);
  596. #endif
  597. s32 _rtw_init_hw_txqueue(struct hw_txqueue* phw_txqueue, u8 ac_tag);
  598. void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
  599. s32 rtw_txframes_pending(_adapter *padapter);
  600. s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib);
  601. void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry);
  602. s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter);
  603. void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv);
  604. void rtw_alloc_hwxmits(_adapter *padapter);
  605. void rtw_free_hwxmits(_adapter *padapter);
  606. s32 rtw_xmit(_adapter *padapter, _pkt **pkt);
  607. #if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS)
  608. sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe);
  609. void stop_sta_xmit(_adapter *padapter, struct sta_info *psta);
  610. void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta);
  611. void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta);
  612. #endif
  613. u8 qos_acm(u8 acm_mask, u8 priority);
  614. #ifdef CONFIG_XMIT_THREAD_MODE
  615. void enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
  616. struct xmit_buf* dequeue_pending_xmitbuf(struct xmit_priv *pxmitpriv);
  617. struct xmit_buf* dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpriv);
  618. sint check_pending_xmitbuf(struct xmit_priv *pxmitpriv);
  619. thread_return rtw_xmit_thread(thread_context context);
  620. #endif
  621. u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe);
  622. #ifdef CONFIG_XMIT_ACK
  623. int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms);
  624. void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);
  625. #endif //CONFIG_XMIT_ACK
  626. //include after declaring struct xmit_buf, in order to avoid warning
  627. #include <xmit_osdep.h>
  628. #endif //_RTL871X_XMIT_H_