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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
/*
* Common private data for ST-Ericsson CW1200 drivers
*
* Copyright (c) 2010, ST-Ericsson
* Author: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
*
* Based on the mac80211 Prism54 code, which is
* Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
*
* Based on the islsm (softmac prism54) driver, which is:
* Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
*
* 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 CW1200_H
#define CW1200_H
#include <linux/wait.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/atomic.h>
#include <net/mac80211.h>
#include "queue.h"
#include "wsm.h"
#include "scan.h"
#include "txrx.h"
#include "ht.h"
/* Debug switches */
/* Dump all WSM (HI) messages. Quite a lot of logs. */
/* #define CW1200_DEBUG_ENABLE_WSM_DUMPS */
/* Enable WSM logs. Useful for low-level debugging (WSM HI control flow). */
/* #define CW1200_DEBUG_ENABLE_WSM_LOGS */
/* Enable BH logs. Useful for ultra-level debugging (interrupts and so on). */
/* #define CW1200_DEBUG_ENABLE_BH_LOGS */
/* Enable TX/RX logs. */
/* #define CW1200_TXRX_DEBUG */
/* extern */ struct sbus_ops;
/* extern */ struct task_struct;
#ifdef CW1200_TXRX_DEBUG
#define txrx_printk(...) printk(__VA_ARGS__)
#else
#define txrx_printk(...)
#endif
#define CW1200_MAX_CTRL_FRAME_LEN (0x1000)
#define CW1200_MAX_STA_IN_AP_MODE (5)
enum cw1200_join_status {
CW1200_JOIN_STATUS_MONITOR = 0,
CW1200_JOIN_STATUS_STA,
CW1200_JOIN_STATUS_AP,
};
struct cw1200_common {
struct cw1200_queue tx_queue[4];
struct ieee80211_hw *hw;
struct ieee80211_vif *vif;
struct device *pdev;
struct workqueue_struct *workqueue;
struct mutex conf_mutex;
const struct sbus_ops *sbus_ops;
struct sbus_priv *sbus_priv;
/* HW type (HIF_...) */
int hw_type;
int hw_revision;
/* firmware/hardware info */
unsigned int tx_hdr_len;
/* Radio data */
int output_power;
int noise;
/* calibration, output power limit and rssi<->dBm conversation data */
/* BBP/MAC state */
struct ieee80211_rate *rates;
u8 mac_addr[ETH_ALEN];
struct ieee80211_channel *channel;
u8 bssid[ETH_ALEN];
struct wsm_edca_params edca;
struct wsm_association_mode association_mode;
struct wsm_set_bss_params bss_params;
struct cw1200_ht_info ht_info;
struct wsm_set_pm powersave_mode;
int cqm_rssi_thold;
unsigned cqm_rssi_hyst;
unsigned cqm_tx_failure_thold;
unsigned cqm_tx_failure_count;
int cqm_link_loss_count;
int cqm_beacon_loss_count;
int channel_switch_in_progress;
wait_queue_head_t channel_switch_done;
u8 long_frame_max_tx_count;
u8 short_frame_max_tx_count;
int mode;
bool enable_beacon;
size_t ssid_length;
u8 ssid[IEEE80211_MAX_SSID_LEN];
/* BH */
atomic_t bh_rx;
atomic_t bh_tx;
atomic_t bh_term;
struct task_struct *bh_thread;
int bh_error;
wait_queue_head_t bh_wq;
int buf_id_tx; /* byte */
int buf_id_rx; /* byte */
int wsm_rx_seq; /* byte */
int wsm_tx_seq; /* byte */
int hw_bufs_used;
wait_queue_head_t hw_bufs_used_wq;
struct sk_buff *skb_cache;
/* WSM */
struct wsm_caps wsm_caps;
struct mutex wsm_cmd_mux;
struct wsm_buf wsm_cmd_buf;
struct wsm_cmd wsm_cmd;
wait_queue_head_t wsm_cmd_wq;
wait_queue_head_t wsm_startup_done;
struct wsm_cbc wsm_cbc;
atomic_t tx_lock;
/* Scan status */
struct cw1200_scan scan;
/* WSM Join */
enum cw1200_join_status join_status;
u8 join_bssid[ETH_ALEN];
const struct wsm_tx *join_pending_frame;
struct work_struct join_work;
struct delayed_work join_timeout;
struct work_struct unjoin_work;
int join_dtim_period;
/* TX/RX and security */
s8 wep_default_key_id;
struct work_struct wep_key_work;
u32 key_map;
struct wsm_add_key keys[WSM_KEY_MAX_INDEX + 1];
unsigned long rx_timestamp;
/* AP powersave */
u32 link_id_map;
u32 tx_suspend_mask[4];
u32 sta_asleep_mask;
bool suspend_multicast;
struct work_struct set_tim_work;
/* WSM events and CQM implementation */
spinlock_t event_queue_lock;
struct list_head event_queue;
struct work_struct event_handler;
struct delayed_work bss_loss_work;
struct delayed_work connection_loss_work;
#ifdef CW1200_FIRMWARE_DOES_NOT_SUPPORT_KEEPALIVE
struct delayed_work keep_alive_work;
unsigned long last_activity_time;
#endif
struct work_struct tx_failure_work;
int delayed_link_loss;
/* TX rate policy cache */
struct tx_policy_cache tx_policy_cache;
struct work_struct tx_policy_upload_work;
/* cryptographic engine information */
/* bit field of glowing LEDs */
u16 softled_state;
/* statistics */
struct ieee80211_low_level_stats stats;
};
struct cw1200_sta_priv {
int link_id;
};
/* interfaces for the drivers */
int cw1200_probe(const struct sbus_ops *sbus_ops,
struct sbus_priv *sbus,
struct device *pdev,
struct cw1200_common **pself);
void cw1200_release(struct cw1200_common *self);
#define CW1200_DBG_MSG 0x00000001
#define CW1200_DBG_NIY 0x00000002
#define CW1200_DBG_SBUS 0x00000004
#define CW1200_DBG_INIT 0x00000008
#define CW1200_DBG_ERROR 0x00000010
#define CW1200_DBG_LEVEL 0xFFFFFFFF
#define cw1200_dbg(level, ...) \
do { \
if ((level) & CW1200_DBG_LEVEL) \
printk(KERN_DEBUG __VA_ARGS__); \
} while (0)
#define STUB() \
do { \
cw1200_dbg(CW1200_DBG_NIY, "%s: STUB at line %d.\n", \
__func__, __LINE__); \
} while (0)
#endif /* CW1200_H */
|