-
Notifications
You must be signed in to change notification settings - Fork 76
/
queue.h
139 lines (118 loc) · 4.61 KB
/
queue.h
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
131
132
133
134
135
136
137
138
139
/*
* queue operations for XRadio drivers
*
* Copyright (c) 2013, XRadio
* Author: XRadio
*
* 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 XRADIO_QUEUE_H_INCLUDED
#define XRADIO_QUEUE_H_INCLUDED
/* private */ struct xradio_queue_item;
/* extern */ struct sk_buff;
/* extern */ struct wsm_tx;
/* extern */ struct xradio_common;
/* extern */ struct xradio_vif;
/* extern */ struct ieee80211_tx_queue_stats;
/* extern */ struct xradio_txpriv;
/* forward */ struct xradio_queue_stats;
typedef void (*xradio_queue_skb_dtor_t)(struct xradio_common *priv,
struct sk_buff *skb,
const struct xradio_txpriv *txpriv);
struct xradio_queue {
struct xradio_queue_stats *stats;
size_t capacity;
size_t num_queued;
size_t num_queued_vif[XRWL_MAX_VIFS];
size_t num_pending;
size_t num_pending_vif[XRWL_MAX_VIFS];
size_t num_sent;
struct xradio_queue_item *pool;
struct list_head queue;
struct list_head free_pool;
struct list_head pending;
int tx_locked_cnt;
int *link_map_cache[XRWL_MAX_VIFS];
bool overfull;
spinlock_t lock;
u8 queue_id;
u8 generation;
struct timer_list gc;
unsigned long ttl;
};
struct xradio_queue_stats {
spinlock_t lock;
int *link_map_cache[XRWL_MAX_VIFS];
int num_queued[XRWL_MAX_VIFS];
size_t map_capacity;
wait_queue_head_t wait_link_id_empty;
xradio_queue_skb_dtor_t skb_dtor;
struct xradio_common *hw_priv;
};
struct xradio_txpriv {
u8 link_id;
u8 raw_link_id;
u8 tid;
u8 rate_id;
u8 offset;
u8 if_id;
u8 offchannel_if_id;
u8 use_bg_rate;
};
int xradio_queue_stats_init(struct xradio_queue_stats *stats,
size_t map_capacity,
xradio_queue_skb_dtor_t skb_dtor,
struct xradio_common *priv);
int xradio_queue_init(struct xradio_queue *queue,
struct xradio_queue_stats *stats,
u8 queue_id,
size_t capacity,
unsigned long ttl);
int xradio_queue_clear(struct xradio_queue *queue, int if_id);
void xradio_queue_stats_deinit(struct xradio_queue_stats *stats);
void xradio_queue_deinit(struct xradio_queue *queue);
size_t xradio_queue_get_num_queued(struct xradio_vif *priv,
struct xradio_queue *queue,
u32 link_id_map);
int xradio_queue_put(struct xradio_queue *queue,
struct sk_buff *skb, struct xradio_txpriv *txpriv);
int xradio_queue_get(struct xradio_queue *queue,
int if_id, u32 link_id_map,
struct wsm_tx **tx,
struct ieee80211_tx_info **tx_info,
struct xradio_txpriv **txpriv);
int xradio_queue_requeue(struct xradio_queue *queue, u32 packetID, bool check);
int xradio_queue_requeue_all(struct xradio_queue *queue);
int xradio_queue_remove(struct xradio_queue *queue,
u32 packetID);
int xradio_queue_get_skb(struct xradio_queue *queue, u32 packetID,
struct sk_buff **skb,
const struct xradio_txpriv **txpriv);
void xradio_queue_lock(struct xradio_queue *queue);
void xradio_queue_unlock(struct xradio_queue *queue);
bool xradio_queue_get_xmit_timestamp(struct xradio_queue *queue,
unsigned long *timestamp, int if_id,
u32 pending_frameID, u32 *Old_frame_ID);
bool xradio_query_txpkt_timeout(struct xradio_common *hw_priv, int if_id,
u32 pending_pkt_id, long *timeout);
bool xradio_queue_stats_is_empty(struct xradio_queue_stats *stats,
u32 link_id_map, int if_id);
static inline u8 xradio_queue_get_queue_id(u32 packetID)
{
return (packetID >> 16) & 0xF;
}
static inline u8 xradio_queue_get_if_id(u32 packetID)
{
return (packetID >> 20) & 0xF;
}
static inline u8 xradio_queue_get_link_id(u32 packetID)
{
return (packetID >> 24) & 0xF;
}
static inline u8 xradio_queue_get_generation(u32 packetID)
{
return (packetID >> 8) & 0xFF;
}
#endif /* XRADIO_QUEUE_H_INCLUDED */