Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
net
wireless
rt2x00
rt2x00queue.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2004 - 2010 Ivo van Doorn <
[email protected]
>
3
<http://rt2x00.serialmonkey.com>
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the
17
Free Software Foundation, Inc.,
18
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
*/
20
21
/*
22
Module: rt2x00
23
Abstract: rt2x00 queue datastructures and routines
24
*/
25
26
#ifndef RT2X00QUEUE_H
27
#define RT2X00QUEUE_H
28
29
#include <linux/prefetch.h>
30
41
#define DATA_FRAME_SIZE 2432
42
#define MGMT_FRAME_SIZE 256
43
#define AGGREGATION_SIZE 3840
44
59
enum
data_queue_qid
{
60
QID_AC_VO
= 0,
61
QID_AC_VI
= 1,
62
QID_AC_BE
= 2,
63
QID_AC_BK
= 3,
64
QID_HCCA
= 4,
65
QID_MGMT
= 13,
66
QID_RX
= 14,
67
QID_OTHER
= 15,
68
QID_BEACON
,
69
QID_ATIM
,
70
};
71
84
enum
skb_frame_desc_flags
{
85
SKBDESC_DMA_MAPPED_RX
= 1 << 0,
86
SKBDESC_DMA_MAPPED_TX
= 1 << 1,
87
SKBDESC_IV_STRIPPED
= 1 << 2,
88
SKBDESC_NOT_MAC80211
= 1 << 3,
89
SKBDESC_DESC_IN_SKB
= 1 << 4,
90
};
91
109
struct
skb_frame_desc
{
110
u8
flags
;
111
112
u8
desc_len
;
113
u8
tx_rate_idx
;
114
u8
tx_rate_flags
;
115
116
void
*
desc
;
117
118
__le32
iv
[2];
119
120
dma_addr_t
skb_dma
;
121
122
struct
queue_entry *
entry
;
123
};
124
129
static
inline
struct
skb_frame_desc
* get_skb_frame_desc(
struct
sk_buff
*
skb
)
130
{
131
BUILD_BUG_ON
(
sizeof
(
struct
skb_frame_desc
) >
132
IEEE80211_TX_INFO_DRIVER_DATA_SIZE
);
133
return
(
struct
skb_frame_desc
*)&IEEE80211_SKB_CB(skb)->driver_data;
134
}
135
147
enum
rxdone_entry_desc_flags
{
148
RXDONE_SIGNAL_PLCP
=
BIT
(0),
149
RXDONE_SIGNAL_BITRATE
=
BIT
(1),
150
RXDONE_SIGNAL_MCS
=
BIT
(2),
151
RXDONE_MY_BSS
=
BIT
(3),
152
RXDONE_CRYPTO_IV
=
BIT
(4),
153
RXDONE_CRYPTO_ICV
=
BIT
(5),
154
RXDONE_L2PAD
=
BIT
(6),
155
};
156
162
#define RXDONE_SIGNAL_MASK \
163
( RXDONE_SIGNAL_PLCP | RXDONE_SIGNAL_BITRATE | RXDONE_SIGNAL_MCS )
164
182
struct
rxdone_entry_desc
{
183
u64
timestamp
;
184
int
signal
;
185
int
rssi
;
186
int
size
;
187
int
flags
;
188
int
dev_flags
;
189
u16
rate_mode
;
190
u8
cipher
;
191
u8
cipher_status
;
192
193
__le32
iv
[2];
194
__le32
icv
;
195
};
196
214
enum
txdone_entry_desc_flags
{
215
TXDONE_UNKNOWN
,
216
TXDONE_SUCCESS
,
217
TXDONE_FALLBACK
,
218
TXDONE_FAILURE
,
219
TXDONE_EXCESSIVE_RETRY
,
220
TXDONE_AMPDU
,
221
};
222
232
struct
txdone_entry_desc
{
233
unsigned
long
flags
;
234
int
retry
;
235
};
236
258
enum
txentry_desc_flags
{
259
ENTRY_TXD_RTS_FRAME
,
260
ENTRY_TXD_CTS_FRAME
,
261
ENTRY_TXD_GENERATE_SEQ
,
262
ENTRY_TXD_FIRST_FRAGMENT
,
263
ENTRY_TXD_MORE_FRAG
,
264
ENTRY_TXD_REQ_TIMESTAMP
,
265
ENTRY_TXD_BURST
,
266
ENTRY_TXD_ACK
,
267
ENTRY_TXD_RETRY_MODE
,
268
ENTRY_TXD_ENCRYPT
,
269
ENTRY_TXD_ENCRYPT_PAIRWISE
,
270
ENTRY_TXD_ENCRYPT_IV
,
271
ENTRY_TXD_ENCRYPT_MMIC
,
272
ENTRY_TXD_HT_AMPDU
,
273
ENTRY_TXD_HT_BW_40
,
274
ENTRY_TXD_HT_SHORT_GI
,
275
ENTRY_TXD_HT_MIMO_PS
,
276
};
277
303
struct
txentry_desc
{
304
unsigned
long
flags
;
305
306
u16
length
;
307
u16
header_length
;
308
309
union
{
310
struct
{
311
u16
length_high
;
312
u16
length_low
;
313
u16
signal
;
314
u16
service
;
315
enum
ifs
ifs
;
316
}
plcp
;
317
318
struct
{
319
u16
mcs
;
320
u8
stbc
;
321
u8
ba_size
;
322
u8
mpdu_density
;
323
enum
txop
txop
;
324
int
wcid
;
325
}
ht
;
326
}
u
;
327
328
enum
rate_modulation
rate_mode
;
329
330
short
retry_limit
;
331
332
enum
cipher
cipher
;
333
u16
key_idx
;
334
u16
iv_offset
;
335
u16
iv_len
;
336
};
337
356
enum
queue_entry_flags
{
357
ENTRY_BCN_ASSIGNED
,
358
ENTRY_OWNER_DEVICE_DATA
,
359
ENTRY_DATA_PENDING
,
360
ENTRY_DATA_IO_FAILED
,
361
ENTRY_DATA_STATUS_PENDING
,
362
};
363
376
struct
queue_entry {
377
unsigned
long
flags
;
378
unsigned
long
last_action;
379
380
struct
data_queue
*
queue
;
381
382
struct
sk_buff
*
skb
;
383
384
unsigned
int
entry_idx;
385
386
void
*priv_data;
387
};
388
402
enum
queue_index
{
403
Q_INDEX
,
404
Q_INDEX_DMA_DONE
,
405
Q_INDEX_DONE
,
406
Q_INDEX_MAX
,
407
};
408
421
enum
data_queue_flags
{
422
QUEUE_STARTED
,
423
QUEUE_PAUSED
,
424
};
425
455
struct
data_queue
{
456
struct
rt2x00_dev
*
rt2x00dev
;
457
struct
queue_entry *
entries
;
458
459
enum
data_queue_qid
qid
;
460
unsigned
long
flags
;
461
462
struct
mutex
status_lock
;
463
spinlock_t
tx_lock
;
464
spinlock_t
index_lock
;
465
466
unsigned
int
count
;
467
unsigned
short
limit
;
468
unsigned
short
threshold
;
469
unsigned
short
length
;
470
unsigned
short
index
[
Q_INDEX_MAX
];
471
472
unsigned
short
txop
;
473
unsigned
short
aifs
;
474
unsigned
short
cw_min
;
475
unsigned
short
cw_max
;
476
477
unsigned
short
data_size
;
478
unsigned
short
desc_size
;
479
480
unsigned
short
usb_endpoint
;
481
unsigned
short
usb_maxpacket
;
482
};
483
495
struct
data_queue_desc
{
496
unsigned
short
entry_num
;
497
unsigned
short
data_size
;
498
unsigned
short
desc_size
;
499
unsigned
short
priv_size
;
500
};
501
510
#define queue_end(__dev) \
511
&(__dev)->rx[(__dev)->data_queues]
512
521
#define tx_queue_end(__dev) \
522
&(__dev)->tx[(__dev)->ops->tx_queues]
523
534
#define queue_next(__queue) \
535
&(__queue)[1]
536
545
#define queue_loop(__entry, __start, __end) \
546
for ((__entry) = (__start); \
547
prefetch(queue_next(__entry)), (__entry) != (__end);\
548
(__entry) = queue_next(__entry))
549
557
#define queue_for_each(__dev, __entry) \
558
queue_loop(__entry, (__dev)->rx, queue_end(__dev))
559
568
#define tx_queue_for_each(__dev, __entry) \
569
queue_loop(__entry, (__dev)->tx, tx_queue_end(__dev))
570
579
#define txall_queue_for_each(__dev, __entry) \
580
queue_loop(__entry, (__dev)->tx, queue_end(__dev))
581
596
bool
rt2x00queue_for_each_entry
(
struct
data_queue
*
queue
,
597
enum
queue_index
start
,
598
enum
queue_index
end
,
599
bool
(*
fn
)(
struct
queue_entry *
entry
));
600
605
static
inline
int
rt2x00queue_empty(
struct
data_queue
*queue)
606
{
607
return
queue->
length
== 0;
608
}
609
614
static
inline
int
rt2x00queue_full(
struct
data_queue
*queue)
615
{
616
return
queue->
length
== queue->
limit
;
617
}
618
623
static
inline
int
rt2x00queue_available(
struct
data_queue
*queue)
624
{
625
return
queue->
limit
- queue->
length
;
626
}
627
632
static
inline
int
rt2x00queue_threshold(
struct
data_queue
*queue)
633
{
634
return
rt2x00queue_available(queue) < queue->
threshold
;
635
}
640
static
inline
int
rt2x00queue_dma_timeout(
struct
queue_entry *
entry
)
641
{
642
if
(!
test_bit
(
ENTRY_OWNER_DEVICE_DATA
, &entry->flags))
643
return
false
;
644
return
time_after
(jiffies, entry->last_action +
msecs_to_jiffies
(100));
645
}
646
653
static
inline
void
_rt2x00_desc_read(
__le32
*
desc
,
const
u8
word
,
__le32
*
value
)
654
{
655
*value = desc[
word
];
656
}
657
665
static
inline
void
rt2x00_desc_read(
__le32
*
desc
,
const
u8
word
,
u32
*
value
)
666
{
667
__le32
tmp
;
668
_rt2x00_desc_read(desc, word, &tmp);
669
*value =
le32_to_cpu
(tmp);
670
}
671
679
static
inline
void
_rt2x00_desc_write(
__le32
*
desc
,
const
u8
word
,
__le32
value
)
680
{
681
desc[
word
] =
value
;
682
}
683
690
static
inline
void
rt2x00_desc_write(
__le32
*
desc
,
const
u8
word
,
u32
value
)
691
{
692
_rt2x00_desc_write(desc, word,
cpu_to_le32
(value));
693
}
694
695
#endif
/* RT2X00QUEUE_H */
Generated on Thu Jan 10 2013 14:12:55 for Linux Kernel by
1.8.2