1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
* Header file define some tx inline functions
*
* $Id: 8192cd_tx.h,v 1.2 2010/01/29 09:39:16 jimmylin Exp $
*
* Copyright (c) 2009 Realtek Semiconductor Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _8192CD_TX_H_
#define _8192CD_TX_H_
#include "./8192cd_cfg.h"
#include "./8192cd.h"
#include "./8192cd_util.h"
#ifdef CONFIG_RTK_MESH
#define rtl8192cd_wlantx(p,t) rtl8192cd_firetx(p, t)
#endif
enum _TX_QUEUE_ {
MGNT_QUEUE = 0,
BK_QUEUE = 1,
BE_QUEUE = 2,
VI_QUEUE = 3,
VO_QUEUE = 4,
HIGH_QUEUE = 5,
BEACON_QUEUE = 6
};
#define MCAST_QNUM HIGH_QUEUE
// the purpose if actually just to link up all the desc in the same q
static __inline__ void init_txdesc(struct rtl8192cd_priv *priv, struct tx_desc *pdesc,
unsigned long ringaddr, unsigned int i)
{
if (i == (NUM_TX_DESC - 1))
(pdesc + i)->Dword10 = set_desc(ringaddr); // NextDescAddress
else
(pdesc + i)->Dword10 = set_desc(ringaddr + (i+1) * sizeof(struct tx_desc)); // NextDescAddress
}
static __inline__ unsigned int get_mpdu_len(struct tx_insn *txcfg, unsigned int fr_len)
{
return (txcfg->hdr_len + txcfg->llc + txcfg->iv + txcfg->icv + txcfg->mic + _CRCLNG_ + fr_len);
}
#define txdesc_rollover(ptxdesc, ptxhead) (*ptxhead = (*ptxhead + 1) % NUM_TX_DESC)
#define txdesc_rollback(ptxhead) (*ptxhead = (*ptxhead == 0)? (NUM_TX_DESC - 1) : (*ptxhead - 1))
static __inline__ void tx_poll(struct rtl8192cd_priv *priv, int q_num)
{
unsigned char val = 0;
#ifdef CONFIG_RTL8671
#ifdef CONFIG_CPU_RLX4181
r3k_flush_dcache_range(0,0);
#endif
#endif
switch (q_num) {
case MGNT_QUEUE:
val = MGQ_POLL;
break;
case BK_QUEUE:
val = BKQ_POLL;
break;
case BE_QUEUE:
val = BEQ_POLL;
break;
case VI_QUEUE:
val = VIQ_POLL;
break;
case VO_QUEUE:
val = VOQ_POLL;
break;
case HIGH_QUEUE:
val = HQ_POLL;
break;
default:
break;
}
RTL_W8(PCIE_CTRL_REG, val);
}
#define desc_copy(dst, src) memcpy(dst, src, 32)
#define descinfo_copy(d, s) \
do { \
struct tx_desc_info *dst = (struct tx_desc_info *)d; \
struct tx_desc_info *src = (struct tx_desc_info *)s; \
dst->type = src->type; \
dst->len = src->len; \
dst->rate = src->rate; \
} while (0)
#ifdef WDS
#define DECLARE_TXINSN(A) struct tx_insn A; \
do { \
memset(&A, 0, sizeof(struct tx_insn)); \
A.wdsIdx = -1; \
} while (0)
#define DECLARE_TXCFG(P, TEMPLATE) struct tx_insn *P = &(TEMPLATE); \
do { \
memset(P, 0, sizeof(struct tx_insn)); \
P->wdsIdx = -1; \
} while (0)
#else
#define DECLARE_TXINSN(A) struct tx_insn A; \
do { \
memset(&A, 0, sizeof(struct tx_insn)); \
} while (0)
#define DECLARE_TXCFG(P, TEMPLATE) struct tx_insn* P = &(TEMPLATE); \
do { \
memset(P, 0, sizeof(struct tx_insn)); \
} while (0)
#endif // WDS
#endif // _8192CD_TX_H_
|