~ubuntu-branches/ubuntu/natty/linux-backports-modules-2.6.38/natty-proposed

« back to all changes in this revision

Viewing changes to updates/compat-wireless-2.6.37/drivers/net/wireless/ath/carl9170/carl9170.h

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Tim Gardner
  • Date: 2011-06-08 10:44:09 UTC
  • Revision ID: james.westby@ubuntu.com-20110608104409-fnl8carkdo15bwsz
Tags: 2.6.38-10.6
[ Tim Gardner ]

Shorten compat-wireless package name to cw to accomodate
CDROM file name length restrictions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Atheros CARL9170 driver
3
 
 *
4
 
 * Driver specific definitions
5
 
 *
6
 
 * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
7
 
 * Copyright 2009, 2010, Christian Lamparter <chunkeey@googlemail.com>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License as published by
11
 
 * the Free Software Foundation; either version 2 of the License, or
12
 
 * (at your option) any later version.
13
 
 *
14
 
 * This program is distributed in the hope that it will be useful,
15
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 * GNU General Public License for more details.
18
 
 *
19
 
 * You should have received a copy of the GNU General Public License
20
 
 * along with this program; see the file COPYING.  If not, see
21
 
 * http://www.gnu.org/licenses/.
22
 
 *
23
 
 * This file incorporates work covered by the following copyright and
24
 
 * permission notice:
25
 
 *    Copyright (c) 2007-2008 Atheros Communications, Inc.
26
 
 *
27
 
 *    Permission to use, copy, modify, and/or distribute this software for any
28
 
 *    purpose with or without fee is hereby granted, provided that the above
29
 
 *    copyright notice and this permission notice appear in all copies.
30
 
 *
31
 
 *    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
32
 
 *    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
33
 
 *    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
34
 
 *    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
35
 
 *    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
36
 
 *    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
37
 
 *    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38
 
 */
39
 
#ifndef __CARL9170_H
40
 
#define __CARL9170_H
41
 
 
42
 
#include <linux/kernel.h>
43
 
#include <linux/firmware.h>
44
 
#include <linux/completion.h>
45
 
#include <linux/spinlock.h>
46
 
#include <net/cfg80211.h>
47
 
#include <net/mac80211.h>
48
 
#include <linux/usb.h>
49
 
#ifdef CONFIG_CARL9170_LEDS
50
 
#include <linux/leds.h>
51
 
#endif /* CONFIG_CARL170_LEDS */
52
 
#ifdef CONFIG_CARL9170_WPC
53
 
#include <linux/input.h>
54
 
#endif /* CONFIG_CARL9170_WPC */
55
 
#include "eeprom.h"
56
 
#include "wlan.h"
57
 
#include "hw.h"
58
 
#include "fwdesc.h"
59
 
#include "fwcmd.h"
60
 
#include "../regd.h"
61
 
 
62
 
#ifdef CONFIG_CARL9170_DEBUGFS
63
 
#include "debug.h"
64
 
#endif /* CONFIG_CARL9170_DEBUGFS */
65
 
 
66
 
#define CARL9170FW_NAME "carl9170-1.fw"
67
 
 
68
 
#define PAYLOAD_MAX     (CARL9170_MAX_CMD_LEN / 4 - 1)
69
 
 
70
 
enum carl9170_rf_init_mode {
71
 
        CARL9170_RFI_NONE,
72
 
        CARL9170_RFI_WARM,
73
 
        CARL9170_RFI_COLD,
74
 
};
75
 
 
76
 
#define CARL9170_MAX_RX_BUFFER_SIZE             8192
77
 
 
78
 
enum carl9170_device_state {
79
 
        CARL9170_UNKNOWN_STATE,
80
 
        CARL9170_STOPPED,
81
 
        CARL9170_IDLE,
82
 
        CARL9170_STARTED,
83
 
};
84
 
 
85
 
#define CARL9170_NUM_TID                16
86
 
#define WME_BA_BMP_SIZE                 64
87
 
#define CARL9170_TX_USER_RATE_TRIES     3
88
 
 
89
 
#define WME_AC_BE   2
90
 
#define WME_AC_BK   3
91
 
#define WME_AC_VI   1
92
 
#define WME_AC_VO   0
93
 
 
94
 
#define TID_TO_WME_AC(_tid)                             \
95
 
        ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
96
 
         (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
97
 
         (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
98
 
         WME_AC_VO)
99
 
 
100
 
#define SEQ_DIFF(_start, _seq) \
101
 
        (((_start) - (_seq)) & 0x0fff)
102
 
#define SEQ_PREV(_seq) \
103
 
        (((_seq) - 1) & 0x0fff)
104
 
#define SEQ_NEXT(_seq) \
105
 
        (((_seq) + 1) & 0x0fff)
106
 
#define BAW_WITHIN(_start, _bawsz, _seqno) \
107
 
        ((((_seqno) - (_start)) & 0xfff) < (_bawsz))
108
 
 
109
 
enum carl9170_tid_state {
110
 
        CARL9170_TID_STATE_INVALID,
111
 
        CARL9170_TID_STATE_KILLED,
112
 
        CARL9170_TID_STATE_SHUTDOWN,
113
 
        CARL9170_TID_STATE_SUSPEND,
114
 
        CARL9170_TID_STATE_PROGRESS,
115
 
        CARL9170_TID_STATE_IDLE,
116
 
        CARL9170_TID_STATE_XMIT,
117
 
};
118
 
 
119
 
#define CARL9170_BAW_BITS (2 * WME_BA_BMP_SIZE)
120
 
#define CARL9170_BAW_SIZE (BITS_TO_LONGS(CARL9170_BAW_BITS))
121
 
#define CARL9170_BAW_LEN (DIV_ROUND_UP(CARL9170_BAW_BITS, BITS_PER_BYTE))
122
 
 
123
 
struct carl9170_sta_tid {
124
 
        /* must be the first entry! */
125
 
        struct list_head list;
126
 
 
127
 
        /* temporary list for RCU unlink procedure */
128
 
        struct list_head tmp_list;
129
 
 
130
 
        /* lock for the following data structures */
131
 
        spinlock_t lock;
132
 
 
133
 
        unsigned int counter;
134
 
        enum carl9170_tid_state state;
135
 
        u8 tid;         /* TID number ( 0 - 15 ) */
136
 
        u16 max;        /* max. AMPDU size */
137
 
 
138
 
        u16 snx;        /* awaiting _next_ frame */
139
 
        u16 hsn;        /* highest _queued_ sequence */
140
 
        u16 bsn;        /* base of the tx/agg bitmap */
141
 
        unsigned long bitmap[CARL9170_BAW_SIZE];
142
 
 
143
 
        /* Preaggregation reorder queue */
144
 
        struct sk_buff_head queue;
145
 
};
146
 
 
147
 
#define CARL9170_QUEUE_TIMEOUT          256
148
 
#define CARL9170_BUMP_QUEUE             1000
149
 
#define CARL9170_TX_TIMEOUT             2500
150
 
#define CARL9170_JANITOR_DELAY          128
151
 
#define CARL9170_QUEUE_STUCK_TIMEOUT    5500
152
 
 
153
 
#define CARL9170_NUM_TX_AGG_MAX         30
154
 
 
155
 
/*
156
 
 * Tradeoff between stability/latency and speed.
157
 
 *
158
 
 * AR9170_TXQ_DEPTH is devised by dividing the amount of available
159
 
 * tx buffers with the size of a full ethernet frame + overhead.
160
 
 *
161
 
 * Naturally: The higher the limit, the faster the device CAN send.
162
 
 * However, even a slight over-commitment at the wrong time and the
163
 
 * hardware is doomed to send all already-queued frames at suboptimal
164
 
 * rates. This in turn leads to an enourmous amount of unsuccessful
165
 
 * retries => Latency goes up, whereas the throughput goes down. CRASH!
166
 
 */
167
 
#define CARL9170_NUM_TX_LIMIT_HARD      ((AR9170_TXQ_DEPTH * 3) / 2)
168
 
#define CARL9170_NUM_TX_LIMIT_SOFT      (AR9170_TXQ_DEPTH)
169
 
 
170
 
struct carl9170_tx_queue_stats {
171
 
        unsigned int count;
172
 
        unsigned int limit;
173
 
        unsigned int len;
174
 
};
175
 
 
176
 
struct carl9170_vif {
177
 
        unsigned int id;
178
 
        struct ieee80211_vif *vif;
179
 
};
180
 
 
181
 
struct carl9170_vif_info {
182
 
        struct list_head list;
183
 
        bool active;
184
 
        unsigned int id;
185
 
        struct sk_buff *beacon;
186
 
        bool enable_beacon;
187
 
};
188
 
 
189
 
#define AR9170_NUM_RX_URBS      16
190
 
#define AR9170_NUM_RX_URBS_MUL  2
191
 
#define AR9170_NUM_TX_URBS      8
192
 
#define AR9170_NUM_RX_URBS_POOL (AR9170_NUM_RX_URBS_MUL * AR9170_NUM_RX_URBS)
193
 
 
194
 
enum carl9170_device_features {
195
 
        CARL9170_WPS_BUTTON             = BIT(0),
196
 
        CARL9170_ONE_LED                = BIT(1),
197
 
};
198
 
 
199
 
#ifdef CONFIG_CARL9170_LEDS
200
 
struct ar9170;
201
 
 
202
 
struct carl9170_led {
203
 
        struct ar9170 *ar;
204
 
        struct led_classdev l;
205
 
        char name[32];
206
 
        unsigned int toggled;
207
 
        bool last_state;
208
 
        bool registered;
209
 
};
210
 
#endif /* CONFIG_CARL9170_LEDS */
211
 
 
212
 
enum carl9170_restart_reasons {
213
 
        CARL9170_RR_NO_REASON = 0,
214
 
        CARL9170_RR_FATAL_FIRMWARE_ERROR,
215
 
        CARL9170_RR_TOO_MANY_FIRMWARE_ERRORS,
216
 
        CARL9170_RR_WATCHDOG,
217
 
        CARL9170_RR_STUCK_TX,
218
 
        CARL9170_RR_SLOW_SYSTEM,
219
 
        CARL9170_RR_COMMAND_TIMEOUT,
220
 
        CARL9170_RR_TOO_MANY_PHY_ERRORS,
221
 
        CARL9170_RR_LOST_RSP,
222
 
        CARL9170_RR_INVALID_RSP,
223
 
        CARL9170_RR_USER_REQUEST,
224
 
 
225
 
        __CARL9170_RR_LAST,
226
 
};
227
 
 
228
 
enum carl9170_erp_modes {
229
 
        CARL9170_ERP_INVALID,
230
 
        CARL9170_ERP_AUTO,
231
 
        CARL9170_ERP_MAC80211,
232
 
        CARL9170_ERP_OFF,
233
 
        CARL9170_ERP_CTS,
234
 
        CARL9170_ERP_RTS,
235
 
        __CARL9170_ERP_NUM,
236
 
};
237
 
 
238
 
struct ar9170 {
239
 
        struct ath_common common;
240
 
        struct ieee80211_hw *hw;
241
 
        struct mutex mutex;
242
 
        enum carl9170_device_state state;
243
 
        spinlock_t state_lock;
244
 
        enum carl9170_restart_reasons last_reason;
245
 
        bool registered;
246
 
 
247
 
        /* USB */
248
 
        struct usb_device *udev;
249
 
        struct usb_interface *intf;
250
 
        struct usb_anchor rx_anch;
251
 
        struct usb_anchor rx_work;
252
 
        struct usb_anchor rx_pool;
253
 
        struct usb_anchor tx_wait;
254
 
        struct usb_anchor tx_anch;
255
 
        struct usb_anchor tx_cmd;
256
 
        struct usb_anchor tx_err;
257
 
        struct tasklet_struct usb_tasklet;
258
 
        atomic_t tx_cmd_urbs;
259
 
        atomic_t tx_anch_urbs;
260
 
        atomic_t rx_anch_urbs;
261
 
        atomic_t rx_work_urbs;
262
 
        atomic_t rx_pool_urbs;
263
 
        kernel_ulong_t features;
264
 
 
265
 
        /* firmware settings */
266
 
        struct completion fw_load_wait;
267
 
        struct completion fw_boot_wait;
268
 
        struct {
269
 
                const struct carl9170fw_desc_head *desc;
270
 
                const struct firmware *fw;
271
 
                unsigned int offset;
272
 
                unsigned int address;
273
 
                unsigned int cmd_bufs;
274
 
                unsigned int api_version;
275
 
                unsigned int vif_num;
276
 
                unsigned int err_counter;
277
 
                unsigned int bug_counter;
278
 
                u32 beacon_addr;
279
 
                unsigned int beacon_max_len;
280
 
                bool rx_stream;
281
 
                bool tx_stream;
282
 
                bool rx_filter;
283
 
                unsigned int mem_blocks;
284
 
                unsigned int mem_block_size;
285
 
                unsigned int rx_size;
286
 
        } fw;
287
 
 
288
 
        /* reset / stuck frames/queue detection */
289
 
        struct work_struct restart_work;
290
 
        unsigned int restart_counter;
291
 
        unsigned long queue_stop_timeout[__AR9170_NUM_TXQ];
292
 
        unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ];
293
 
        bool needs_full_reset;
294
 
        atomic_t pending_restarts;
295
 
 
296
 
        /* interface mode settings */
297
 
        struct list_head vif_list;
298
 
        unsigned long vif_bitmap;
299
 
        unsigned int vifs;
300
 
        struct carl9170_vif vif_priv[AR9170_MAX_VIRTUAL_MAC];
301
 
 
302
 
        /* beaconing */
303
 
        spinlock_t beacon_lock;
304
 
        unsigned int global_pretbtt;
305
 
        unsigned int global_beacon_int;
306
 
        struct carl9170_vif_info *beacon_iter;
307
 
        unsigned int beacon_enabled;
308
 
 
309
 
        /* cryptographic engine */
310
 
        u64 usedkeys;
311
 
        bool rx_software_decryption;
312
 
        bool disable_offload;
313
 
 
314
 
        /* filter settings */
315
 
        u64 cur_mc_hash;
316
 
        u32 cur_filter;
317
 
        unsigned int filter_state;
318
 
        unsigned int rx_filter_caps;
319
 
        bool sniffer_enabled;
320
 
 
321
 
        /* MAC */
322
 
        enum carl9170_erp_modes erp_mode;
323
 
 
324
 
        /* PHY */
325
 
        struct ieee80211_channel *channel;
326
 
        int noise[4];
327
 
        unsigned int chan_fail;
328
 
        unsigned int total_chan_fail;
329
 
        u8 heavy_clip;
330
 
        u8 ht_settings;
331
 
 
332
 
        /* power calibration data */
333
 
        u8 power_5G_leg[4];
334
 
        u8 power_2G_cck[4];
335
 
        u8 power_2G_ofdm[4];
336
 
        u8 power_5G_ht20[8];
337
 
        u8 power_5G_ht40[8];
338
 
        u8 power_2G_ht20[8];
339
 
        u8 power_2G_ht40[8];
340
 
 
341
 
#ifdef CONFIG_CARL9170_LEDS
342
 
        /* LED */
343
 
        struct delayed_work led_work;
344
 
        struct carl9170_led leds[AR9170_NUM_LEDS];
345
 
#endif /* CONFIG_CARL9170_LEDS */
346
 
 
347
 
        /* qos queue settings */
348
 
        spinlock_t tx_stats_lock;
349
 
        struct carl9170_tx_queue_stats tx_stats[__AR9170_NUM_TXQ];
350
 
        struct ieee80211_tx_queue_params edcf[5];
351
 
        struct completion tx_flush;
352
 
 
353
 
        /* CMD */
354
 
        int cmd_seq;
355
 
        int readlen;
356
 
        u8 *readbuf;
357
 
        spinlock_t cmd_lock;
358
 
        struct completion cmd_wait;
359
 
        union {
360
 
                __le32 cmd_buf[PAYLOAD_MAX + 1];
361
 
                struct carl9170_cmd cmd;
362
 
                struct carl9170_rsp rsp;
363
 
        };
364
 
 
365
 
        /* statistics */
366
 
        unsigned int tx_dropped;
367
 
        unsigned int tx_ack_failures;
368
 
        unsigned int tx_fcs_errors;
369
 
        unsigned int rx_dropped;
370
 
 
371
 
        /* EEPROM */
372
 
        struct ar9170_eeprom eeprom;
373
 
 
374
 
        /* tx queuing */
375
 
        struct sk_buff_head tx_pending[__AR9170_NUM_TXQ];
376
 
        struct sk_buff_head tx_status[__AR9170_NUM_TXQ];
377
 
        struct delayed_work tx_janitor;
378
 
        unsigned long tx_janitor_last_run;
379
 
        bool tx_schedule;
380
 
 
381
 
        /* tx ampdu */
382
 
        struct work_struct ampdu_work;
383
 
        spinlock_t tx_ampdu_list_lock;
384
 
        struct carl9170_sta_tid *tx_ampdu_iter;
385
 
        struct list_head tx_ampdu_list;
386
 
        atomic_t tx_ampdu_upload;
387
 
        atomic_t tx_ampdu_scheduler;
388
 
        atomic_t tx_total_pending;
389
 
        atomic_t tx_total_queued;
390
 
        unsigned int tx_ampdu_list_len;
391
 
        int current_density;
392
 
        int current_factor;
393
 
        bool tx_ampdu_schedule;
394
 
 
395
 
        /* internal memory management */
396
 
        spinlock_t mem_lock;
397
 
        unsigned long *mem_bitmap;
398
 
        atomic_t mem_free_blocks;
399
 
        atomic_t mem_allocs;
400
 
 
401
 
        /* rxstream mpdu merge */
402
 
        struct ar9170_rx_head rx_plcp;
403
 
        bool rx_has_plcp;
404
 
        struct sk_buff *rx_failover;
405
 
        int rx_failover_missing;
406
 
 
407
 
#ifdef CONFIG_CARL9170_WPC
408
 
        struct {
409
 
                bool pbc_state;
410
 
                struct input_dev *pbc;
411
 
                char name[32];
412
 
                char phys[32];
413
 
        } wps;
414
 
#endif /* CONFIG_CARL9170_WPC */
415
 
 
416
 
#ifdef CONFIG_CARL9170_DEBUGFS
417
 
        struct carl9170_debug debug;
418
 
        struct dentry *debug_dir;
419
 
#endif /* CONFIG_CARL9170_DEBUGFS */
420
 
 
421
 
        /* PSM */
422
 
        struct work_struct ps_work;
423
 
        struct {
424
 
                unsigned int dtim_counter;
425
 
                unsigned long last_beacon;
426
 
                unsigned long last_action;
427
 
                unsigned long last_slept;
428
 
                unsigned int sleep_ms;
429
 
                unsigned int off_override;
430
 
                bool state;
431
 
        } ps;
432
 
};
433
 
 
434
 
enum carl9170_ps_off_override_reasons {
435
 
        PS_OFF_VIF      = BIT(0),
436
 
        PS_OFF_BCN      = BIT(1),
437
 
        PS_OFF_5GHZ     = BIT(2),
438
 
};
439
 
 
440
 
struct carl9170_ba_stats {
441
 
        u8 ampdu_len;
442
 
        u8 ampdu_ack_len;
443
 
        bool clear;
444
 
};
445
 
 
446
 
struct carl9170_sta_info {
447
 
        bool ht_sta;
448
 
        unsigned int ampdu_max_len;
449
 
        struct carl9170_sta_tid *agg[CARL9170_NUM_TID];
450
 
        struct carl9170_ba_stats stats[CARL9170_NUM_TID];
451
 
};
452
 
 
453
 
struct carl9170_tx_info {
454
 
        unsigned long timeout;
455
 
        struct ar9170 *ar;
456
 
        struct kref ref;
457
 
};
458
 
 
459
 
#define CHK_DEV_STATE(a, s)     (((struct ar9170 *)a)->state >= (s))
460
 
#define IS_INITIALIZED(a)       (CHK_DEV_STATE(a, CARL9170_STOPPED))
461
 
#define IS_ACCEPTING_CMD(a)     (CHK_DEV_STATE(a, CARL9170_IDLE))
462
 
#define IS_STARTED(a)           (CHK_DEV_STATE(a, CARL9170_STARTED))
463
 
 
464
 
static inline void __carl9170_set_state(struct ar9170 *ar,
465
 
        enum carl9170_device_state newstate)
466
 
{
467
 
        ar->state = newstate;
468
 
}
469
 
 
470
 
static inline void carl9170_set_state(struct ar9170 *ar,
471
 
        enum carl9170_device_state newstate)
472
 
{
473
 
        unsigned long flags;
474
 
 
475
 
        spin_lock_irqsave(&ar->state_lock, flags);
476
 
        __carl9170_set_state(ar, newstate);
477
 
        spin_unlock_irqrestore(&ar->state_lock, flags);
478
 
}
479
 
 
480
 
static inline void carl9170_set_state_when(struct ar9170 *ar,
481
 
        enum carl9170_device_state min, enum carl9170_device_state newstate)
482
 
{
483
 
        unsigned long flags;
484
 
 
485
 
        spin_lock_irqsave(&ar->state_lock, flags);
486
 
        if (CHK_DEV_STATE(ar, min))
487
 
                __carl9170_set_state(ar, newstate);
488
 
        spin_unlock_irqrestore(&ar->state_lock, flags);
489
 
}
490
 
 
491
 
/* exported interface */
492
 
void *carl9170_alloc(size_t priv_size);
493
 
int carl9170_register(struct ar9170 *ar);
494
 
void carl9170_unregister(struct ar9170 *ar);
495
 
void carl9170_free(struct ar9170 *ar);
496
 
void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r);
497
 
void carl9170_ps_check(struct ar9170 *ar);
498
 
 
499
 
/* USB back-end */
500
 
int carl9170_usb_open(struct ar9170 *ar);
501
 
void carl9170_usb_stop(struct ar9170 *ar);
502
 
void carl9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb);
503
 
void carl9170_usb_handle_tx_err(struct ar9170 *ar);
504
 
int carl9170_exec_cmd(struct ar9170 *ar, const enum carl9170_cmd_oids,
505
 
                      u32 plen, void *payload, u32 rlen, void *resp);
506
 
int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd,
507
 
                        const bool free_buf);
508
 
int carl9170_usb_restart(struct ar9170 *ar);
509
 
void carl9170_usb_reset(struct ar9170 *ar);
510
 
 
511
 
/* MAC */
512
 
int carl9170_init_mac(struct ar9170 *ar);
513
 
int carl9170_set_qos(struct ar9170 *ar);
514
 
int carl9170_update_multicast(struct ar9170 *ar, const u64 mc_hast);
515
 
int carl9170_mod_virtual_mac(struct ar9170 *ar, const unsigned int id,
516
 
                             const u8 *mac);
517
 
int carl9170_set_operating_mode(struct ar9170 *ar);
518
 
int carl9170_set_beacon_timers(struct ar9170 *ar);
519
 
int carl9170_set_dyn_sifs_ack(struct ar9170 *ar);
520
 
int carl9170_set_rts_cts_rate(struct ar9170 *ar);
521
 
int carl9170_set_ampdu_settings(struct ar9170 *ar);
522
 
int carl9170_set_slot_time(struct ar9170 *ar);
523
 
int carl9170_set_mac_rates(struct ar9170 *ar);
524
 
int carl9170_set_hwretry_limit(struct ar9170 *ar, const u32 max_retry);
525
 
int carl9170_update_beacon(struct ar9170 *ar, const bool submit);
526
 
int carl9170_upload_key(struct ar9170 *ar, const u8 id, const u8 *mac,
527
 
        const u8 ktype, const u8 keyidx, const u8 *keydata, const int keylen);
528
 
int carl9170_disable_key(struct ar9170 *ar, const u8 id);
529
 
 
530
 
/* RX */
531
 
void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len);
532
 
void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len);
533
 
 
534
 
/* TX */
535
 
int carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
536
 
void carl9170_tx_janitor(struct work_struct *work);
537
 
void carl9170_tx_process_status(struct ar9170 *ar,
538
 
                                const struct carl9170_rsp *cmd);
539
 
void carl9170_tx_status(struct ar9170 *ar, struct sk_buff *skb,
540
 
                        const bool success);
541
 
void carl9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb);
542
 
void carl9170_tx_drop(struct ar9170 *ar, struct sk_buff *skb);
543
 
void carl9170_tx_scheduler(struct ar9170 *ar);
544
 
void carl9170_tx_get_skb(struct sk_buff *skb);
545
 
int carl9170_tx_put_skb(struct sk_buff *skb);
546
 
 
547
 
/* LEDs */
548
 
#ifdef CONFIG_CARL9170_LEDS
549
 
int carl9170_led_register(struct ar9170 *ar);
550
 
void carl9170_led_unregister(struct ar9170 *ar);
551
 
#endif /* CONFIG_CARL9170_LEDS */
552
 
int carl9170_led_init(struct ar9170 *ar);
553
 
int carl9170_led_set_state(struct ar9170 *ar, const u32 led_state);
554
 
 
555
 
/* PHY / RF */
556
 
int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
557
 
        enum nl80211_channel_type bw, enum carl9170_rf_init_mode rfi);
558
 
int carl9170_get_noisefloor(struct ar9170 *ar);
559
 
 
560
 
/* FW */
561
 
int carl9170_parse_firmware(struct ar9170 *ar);
562
 
int carl9170_fw_fix_eeprom(struct ar9170 *ar);
563
 
 
564
 
extern struct ieee80211_rate __carl9170_ratetable[];
565
 
extern int modparam_noht;
566
 
 
567
 
static inline struct ar9170 *carl9170_get_priv(struct carl9170_vif *carl_vif)
568
 
{
569
 
        return container_of(carl_vif, struct ar9170,
570
 
                            vif_priv[carl_vif->id]);
571
 
}
572
 
 
573
 
static inline struct ieee80211_hdr *carl9170_get_hdr(struct sk_buff *skb)
574
 
{
575
 
        return (void *)((struct _carl9170_tx_superframe *)
576
 
                skb->data)->frame_data;
577
 
}
578
 
 
579
 
static inline u16 get_seq_h(struct ieee80211_hdr *hdr)
580
 
{
581
 
        return le16_to_cpu(hdr->seq_ctrl) >> 4;
582
 
}
583
 
 
584
 
static inline u16 carl9170_get_seq(struct sk_buff *skb)
585
 
{
586
 
        return get_seq_h(carl9170_get_hdr(skb));
587
 
}
588
 
 
589
 
static inline u16 get_tid_h(struct ieee80211_hdr *hdr)
590
 
{
591
 
        return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK;
592
 
}
593
 
 
594
 
static inline u16 carl9170_get_tid(struct sk_buff *skb)
595
 
{
596
 
        return get_tid_h(carl9170_get_hdr(skb));
597
 
}
598
 
 
599
 
static inline struct ieee80211_vif *
600
 
carl9170_get_vif(struct carl9170_vif_info *priv)
601
 
{
602
 
        return container_of((void *)priv, struct ieee80211_vif, drv_priv);
603
 
}
604
 
 
605
 
/* Protected by ar->mutex or RCU */
606
 
static inline struct ieee80211_vif *carl9170_get_main_vif(struct ar9170 *ar)
607
 
{
608
 
        struct carl9170_vif_info *cvif;
609
 
 
610
 
        list_for_each_entry_rcu(cvif, &ar->vif_list, list) {
611
 
                if (cvif->active)
612
 
                        return carl9170_get_vif(cvif);
613
 
        }
614
 
 
615
 
        return NULL;
616
 
}
617
 
 
618
 
static inline bool is_main_vif(struct ar9170 *ar, struct ieee80211_vif *vif)
619
 
{
620
 
        bool ret;
621
 
 
622
 
        rcu_read_lock();
623
 
        ret = (carl9170_get_main_vif(ar) == vif);
624
 
        rcu_read_unlock();
625
 
        return ret;
626
 
}
627
 
 
628
 
#endif /* __CARL9170_H */