29 #define _RTL8712_XMIT_C_
37 static void dump_xframe(
struct _adapter *padapter,
39 static void update_txdesc(
struct xmit_frame *pxmitframe,
uint *pmem,
int sz);
43 phw_txqueue->
ac_tag = ac_tag;
91 return ptxservq->
qcnt;
134 switch (pattrib->
qsel) {
166 struct list_head *xmitframe_plist, *xmitframe_phead;
169 xmitframe_phead = get_list_head(pframe_queue);
170 xmitframe_plist =
get_next(xmitframe_phead);
171 if ((end_of_queue_search(xmitframe_phead, xmitframe_plist)) ==
false) {
174 list_delete(&pxmitframe->
list);
191 int j,
tmp, acirp_cnt[4];
194 inx[0] = 0; acirp_cnt[0] = pxmitpriv->
voq_cnt;
195 inx[1] = 1; acirp_cnt[1] = pxmitpriv->
viq_cnt;
196 inx[2] = 2; acirp_cnt[2] = pxmitpriv->
beq_cnt;
197 inx[3] = 3; acirp_cnt[3] = pxmitpriv->
bkq_cnt;
198 for (i = 0; i < 4; i++) {
199 for (j = i + 1; j < 4; j++) {
200 if (acirp_cnt[j] < acirp_cnt[i]) {
202 acirp_cnt[
i] = acirp_cnt[
j];
211 for (i = 0; i <
entry; i++) {
212 phwxmit = phwxmit_i + inx[
i];
213 sta_phead = get_list_head(phwxmit->
sta_queue);
215 while ((end_of_queue_search(sta_phead, sta_plist)) ==
false) {
219 pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit,
220 ptxservq, pframe_queue);
223 goto exit_dequeue_xframe_ex;
227 if (_queue_empty(pframe_queue)) {
233 exit_dequeue_xframe_ex:
234 spin_unlock_irqrestore(&pxmitpriv->
lock, irqL0);
241 unsigned int qsel = 0;
248 if (qsel == 0 || qsel == 3)
250 else if (qsel == 1 || qsel == 2)
252 else if (qsel == 4 || qsel == 5)
254 else if (qsel == 6 || qsel == 7)
259 pattrib->
qsel = qsel;
262 #ifdef CONFIG_R8712_TX_AGGR
263 u8 r8712_construct_txaggr_cmd_desc(
struct xmit_buf *pxmitbuf)
280 u8 r8712_construct_txaggr_cmd_hdr(
struct xmit_buf *pxmitbuf)
292 (pcmdpriv->cmd_seq << 24));
298 u8 r8712_append_mpdu_unit(
struct xmit_buf *pxmitbuf,
303 int last_txcmdsz = 0;
310 if (pxmitframe->
attrib.ether_type != 0x0806) {
311 if ((pxmitframe->
attrib.ether_type != 0x888e) &&
312 (pxmitframe->
attrib.dhcp_pkt != 1)) {
314 pxmitframe->
attrib.priority);
317 pxmitframe->
last[0] = 1;
318 update_txdesc(pxmitframe, (
uint *)(pxmitframe->
buf_addr),
319 pxmitframe->
attrib.last_txcmdsz);
321 last_txcmdsz = pxmitframe->
attrib.last_txcmdsz;
322 padding_sz = (8 - (last_txcmdsz % 8));
323 if ((last_txcmdsz % 8) != 0) {
325 for (i = 0; i < padding_sz; i++)
330 ((ptx_desc->
txdw0&0x0000ffff)+
331 ((
TXDESC_SIZE+last_txcmdsz+padding_sz)&0x0000ffff)));
337 u8 r8712_xmitframe_aggr_1st(
struct xmit_buf *pxmitbuf,
347 r8712_construct_txaggr_cmd_desc(pxmitbuf);
348 r8712_construct_txaggr_cmd_hdr(pxmitbuf);
349 if (r8712_append_mpdu_unit(pxmitbuf, pxmitframe) ==
_SUCCESS)
355 u16 r8712_xmitframe_aggr_next(
struct xmit_buf *pxmitbuf,
363 (((
struct tx_desc *)pxmitbuf->
pbuf)->txdw0 & 0x0000ffff);
364 if (r8712_append_mpdu_unit(pxmitbuf, pxmitframe) ==
_SUCCESS) {
371 (((
struct tx_desc *)pxmitbuf->
pbuf)->txdw0 & 0x0000ffff);
374 u8 r8712_dump_aggr_xframe(
struct xmit_buf *pxmitbuf,
382 u16 total_length = (
u16) (ptxdesc->txdw0 & 0xffff);
387 (pcmd_hdr->
cmd_dw0&0xffff0000));
392 pxmitframe->
last[0] = 1;
415 static void update_txdesc(
struct xmit_frame *pxmitframe,
uint *pmem,
int sz)
425 #ifdef CONFIG_R8712_TX_AGGR
428 u8 blnSetTxDescOffset;
429 sint bmcst = IS_MCAST(pattrib->
ra);
439 blnSetTxDescOffset = 1;
441 blnSetTxDescOffset = 0;
444 blnSetTxDescOffset = 1;
446 blnSetTxDescOffset = 0;
448 if (blnSetTxDescOffset) {
462 #ifdef CONFIG_R8712_TX_AGGR
467 qsel = (
uint)(pattrib->
qsel & 0x0000001f);
481 qsel = (
uint)(pattrib->
qsel & 0x0000001f);
487 (pcmdpriv->cmd_seq << 24);
490 pattrib->
qsel = 0x13;
492 qsel = (
uint)(pattrib->
qsel & 0x0000001f);
505 PrivacyKeyIndex << 17) &
553 if (pattrib->
pctrl == 1) {
555 ptxdesc_mp = &txdesc_mp;
569 ptxdesc->
txdw1 |= (0x05) & 0x1f;
570 qsel = (
uint)(pattrib->
qsel & 0x0000001f);
616 #ifdef CONFIG_R8712_TX_AGGR
624 if (pxmitbuf ==
NULL) {
628 #ifdef CONFIG_R8712_TX_AGGR
633 pxmitframe = dequeue_xframe_ex(pxmitpriv, phwxmits, hwentry);
635 if (pxmitframe !=
NULL) {
637 #ifdef CONFIG_R8712_TX_AGGR
641 if (AGGR_NR_HIGH_BOUND > 1)
642 p2ndxmitframe = dequeue_xframe_ex(pxmitpriv, phwxmits,
648 if (p2ndxmitframe !=
NULL)
653 r8712_xmitframe_aggr_1st(pxmitbuf, pxmitframe);
654 if (p2ndxmitframe !=
NULL) {
656 total_length = r8712_xmitframe_aggr_next(
657 pxmitbuf, p2ndxmitframe);
659 p2ndxmitframe = dequeue_xframe_ex(
660 pxmitpriv, phwxmits, hwentry);
661 if (p2ndxmitframe !=
NULL)
663 r8712_xmitframe_aggr_next(
668 }
while (total_length <= 0x1800 &&
669 pxmitbuf->
aggr_nr <= AGGR_NR_HIGH_BOUND);
672 r8712_dump_aggr_xframe(pxmitbuf, pxmitframe);
678 if (pxmitframe->
attrib.priority <= 15)
680 pxmitframe->
pkt, pxmitframe);
686 dump_xframe(padapter, pxmitframe);
699 static void dump_xframe(
struct _adapter *padapter,
709 if (pxmitframe->
attrib.ether_type != 0x0806) {
710 if (pxmitframe->
attrib.ether_type != 0x888e)
714 for (t = 0; t < pattrib->
nr_frags; t++) {
717 sz = sz - 4 - (psecuritypriv->
sw_encrypt ? 0 :
719 pxmitframe->
last[
t] = 0;
722 pxmitframe->
last[
t] = 1;
724 update_txdesc(pxmitframe, (
uint *)mem_addr, sz);
728 ff_hwaddr = get_ff_hwaddr(pxmitframe);
729 #ifdef CONFIG_R8712_TX_AGGR
731 (
unsigned char *)pxmitframe);
734 (
unsigned char *)pxmitframe);
748 dump_xframe(padapter, pxmitframe);