xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/ssv6xxx/smac/dev.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
3  * Copyright (c) 2015 iComm Corporation
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 3 of the License, or
8  * (at your option) any later version.
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _DEV_H_
18 #define _DEV_H_
19 #include <linux/version.h>
20 #include <linux/device.h>
21 #include <linux/interrupt.h>
22 #ifdef CONFIG_SSV_SUPPORT_ANDROID
23 #include <linux/wakelock.h>
24 #ifdef CONFIG_HAS_EARLYSUSPEND
25 #include <linux/earlysuspend.h>
26 #endif
27 #endif
28 #include <net/mac80211.h>
29 #include "ampdu.h"
30 #include "ssv_rc_common.h"
31 #include "drv_comm.h"
32 #include "sec.h"
33 #include "p2p.h"
34 #include <linux/kthread.h>
35 #define SSV6200_MAX_HW_MAC_ADDR 2
36 #define SSV6200_MAX_VIF 2
37 #define SSV6200_RX_BA_MAX_SESSIONS 1
38 #define SSV6200_OPMODE_STA 0
39 #define SSV6200_OPMODE_AP 1
40 #define SSV6200_OPMODE_IBSS 2
41 #define SSV6200_OPMODE_WDS 3
42 #define SSV6200_USE_HW_WSID(_sta_idx) ((_sta_idx == 0) || (_sta_idx == 1))
43 #define HW_MAX_RATE_TRIES 7
44 #define MAC_DECITBL1_SIZE 16
45 #define MAC_DECITBL2_SIZE 9
46 #define RX_11B_CCA_IN_SCAN 0x20230050
47 //#define WATCHDOG_TIMEOUT (10*HZ)
48 #define WATCHDOG_TIMEOUT (99999*HZ)
49 #ifndef USE_GENERIC_DECI_TBL
50 extern u16 ap_deci_tbl[];
51 extern u16 sta_deci_tbl[];
52 #else
53 extern u16 generic_deci_tbl[];
54 #define ap_deci_tbl generic_deci_tbl
55 #define sta_deci_tbl generic_deci_tbl
56 #endif
57 #define HT_SIGNAL_EXT 6
58 #define HT_SIFS_TIME 10
59 #define BITS_PER_BYTE 8
60 #define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1)
61 #define ACK_LEN (14)
62 #define BA_LEN (32)
63 #define RTS_LEN (20)
64 #define CTS_LEN (14)
65 #define L_STF 8
66 #define L_LTF 8
67 #define L_SIG 4
68 #define HT_SIG 8
69 #define HT_STF 4
70 #define HT_LTF(_ns) (4 * (_ns))
71 #define SYMBOL_TIME(_ns) ((_ns) << 2)
72 #define SYMBOL_TIME_HALFGI(_ns) (((_ns) * 18 + 4) / 5)
73 #define CCK_SIFS_TIME 10
74 #define CCK_PREAMBLE_BITS 144
75 #define CCK_PLCP_BITS 48
76 #define OFDM_SIFS_TIME 16
77 #define OFDM_PREAMBLE_TIME 20
78 #define OFDM_PLCP_BITS 22
79 #define OFDM_SYMBOL_TIME 4
80 #define WMM_AC_VO 0
81 #define WMM_AC_VI 1
82 #define WMM_AC_BE 2
83 #define WMM_AC_BK 3
84 #define WMM_NUM_AC 4
85 #define WMM_TID_NUM 8
86 #define TXQ_EDCA_0 0x01
87 #define TXQ_EDCA_1 0x02
88 #define TXQ_EDCA_2 0x04
89 #define TXQ_EDCA_3 0x08
90 #define TXQ_MGMT 0x10
91 #define IS_SSV_HT(dsc) ((dsc)->rate_idx >= 15)
92 #define IS_SSV_SHORT_GI(dsc) ((dsc)->rate_idx>=23 && (dsc)->rate_idx<=30)
93 #define IS_SSV_HT_GF(dsc) ((dsc)->rate_idx >= 31)
94 #define IS_SSV_SHORT_PRE(dsc) ((dsc)->rate_idx>=4 && (dsc)->rate_idx<=14)
95 #define SMAC_REG_WRITE(_s,_r,_v) \
96         (_s)->hci.hci_ops->hci_write_word(_r,_v)
97 #define SMAC_REG_READ(_s,_r,_v) \
98         (_s)->hci.hci_ops->hci_read_word(_r, _v)
99 #define SMAC_LOAD_FW(_s,_r,_v) \
100         (_s)->hci.hci_ops->hci_load_fw(_r, _v)
101 #define SMAC_IFC_RESET(_s) (_s)->hci.hci_ops->hci_interface_reset()
102 #define SMAC_REG_CONFIRM(_s,_r,_v) \
103 { \
104     u32 _regval; \
105     SMAC_REG_READ(_s, _r, &_regval); \
106     if (_regval != (_v)) { \
107         printk("ERROR!!Please check interface!\n"); \
108         printk("[0x%08x]: 0x%08x!=0x%08x\n", \
109         (_r), (_v), _regval); \
110         printk("SOS!SOS!\n"); \
111         return -1; \
112     } \
113 }
114 #define SMAC_REG_SET_BITS(_sh,_reg,_set,_clr) \
115 ({ \
116     int ret; \
117     u32 _regval; \
118     ret = SMAC_REG_READ(_sh, _reg, &_regval); \
119     _regval &= ~(_clr); \
120     _regval |= (_set); \
121     if (ret == 0) \
122         ret = SMAC_REG_WRITE(_sh, _reg, _regval); \
123     ret; \
124 })
125 #define HCI_START(_sh) \
126     (_sh)->hci.hci_ops->hci_start()
127 #define HCI_STOP(_sh) \
128     (_sh)->hci.hci_ops->hci_stop()
129 #define HCI_SEND(_sh,_sk,_q) \
130     (_sh)->hci.hci_ops->hci_tx(_sk, _q, 0)
131 #define HCI_PAUSE(_sh,_mk) \
132     (_sh)->hci.hci_ops->hci_tx_pause(_mk)
133 #define HCI_RESUME(_sh,_mk) \
134     (_sh)->hci.hci_ops->hci_tx_resume(_mk)
135 #define HCI_TXQ_FLUSH(_sh,_mk) \
136     (_sh)->hci.hci_ops->hci_txq_flush(_mk)
137 #define HCI_TXQ_FLUSH_BY_STA(_sh,_aid) \
138   (_sh)->hci.hci_ops->hci_txq_flush_by_sta(_aid)
139 #define HCI_TXQ_EMPTY(_sh,_txqid) \
140   (_sh)->hci.hci_ops->hci_txq_empty(_txqid)
141 #define HCI_WAKEUP_PMU(_sh) \
142     (_sh)->hci.hci_ops->hci_pmu_wakeup()
143 #define HCI_SEND_CMD(_sh,_sk) \
144         (_sh)->hci.hci_ops->hci_send_cmd(_sk)
145 #define SSV6XXX_SET_HW_TABLE(sh_,tbl_) \
146 ({ \
147     int ret = 0; \
148     u32 i=0; \
149     for(; i<sizeof(tbl_)/sizeof(struct ssv6xxx_dev_table); i++) { \
150         ret = SMAC_REG_WRITE(sh_, tbl_[i].address, tbl_[i].data); \
151         if (ret) break; \
152     } \
153     ret; \
154 })
155 #define SSV6XXX_USE_HW_DECRYPT(_priv) (_priv->has_hw_decrypt)
156 #define SSV6XXX_USE_SW_DECRYPT(_priv) (SSV6XXX_USE_LOCAL_SW_DECRYPT(_priv) || SSV6XXX_USE_MAC80211_DECRYPT(_priv))
157 #define SSV6XXX_USE_LOCAL_SW_DECRYPT(_priv) (_priv->need_sw_decrypt)
158 #define SSV6XXX_USE_MAC80211_DECRYPT(_priv) (_priv->use_mac80211_decrypt)
159 struct ssv_softc;
160 #ifdef CONFIG_P2P_NOA
161 struct ssv_p2p_noa;
162 #endif
163 #define SSV6200_HT_TX_STREAMS 1
164 #define SSV6200_HT_RX_STREAMS 1
165 #define SSV6200_RX_HIGHEST_RATE 72
166 enum PWRSV_STATUS{
167     PWRSV_DISABLE,
168     PWRSV_ENABLE,
169     PWRSV_PREPARE,
170 };
171 #ifdef CONFIG_SSV_RSSI
172 struct rssi_res_st {
173     struct list_head rssi_list;
174     unsigned long cache_jiffies;
175     s32 rssi;
176     s32 timeout;
177     u8 bssid[ETH_ALEN];
178 };
179 #endif
180 struct ssv_hw {
181     struct ssv_softc *sc;
182     struct ssv6xxx_platform_data *priv;
183     struct ssv6xxx_hci_info hci;
184     char chip_id[24];
185     u64 chip_tag;
186     u32 tx_desc_len;
187     u32 rx_desc_len;
188     u32 rx_pinfo_pad;
189     u32 tx_page_available;
190     u32 ampdu_divider;
191     u8 page_count[SSV6200_ID_NUMBER];
192 #ifdef SSV6200_ECO
193     u32 hw_buf_ptr[SSV_RC_MAX_STA];
194     u32 hw_sec_key[SSV_RC_MAX_STA];
195 #else
196     u32 hw_buf_ptr;
197     u32 hw_sec_key;
198 #endif
199     u32 hw_pinfo;
200     struct ssv6xxx_cfg cfg;
201     u32 n_addresses;
202     struct mac_address maddr[SSV6200_MAX_HW_MAC_ADDR];
203 #if defined CONFIG_SSV_CABRIO_E
204     u8 ipd_channel_touch;
205     struct ssv6xxx_ch_cfg *p_ch_cfg;
206     u32 ch_cfg_size;
207 #endif
208 };
209 struct ssv_tx {
210     u16 seq_no;
211     int hw_txqid[WMM_NUM_AC];
212     int ac_txqid[WMM_NUM_AC];
213     u32 flow_ctrl_status;
214     u32 tx_pkt[SSV_HW_TXQ_NUM];
215     u32 tx_frag[SSV_HW_TXQ_NUM];
216     struct list_head ampdu_tx_que;
217     spinlock_t ampdu_tx_que_lock;
218     u16 ampdu_tx_group_id;
219 };
220 struct ssv_rx {
221     struct sk_buff *rx_buf;
222     spinlock_t rxq_lock;
223     struct sk_buff_head rxq_head;
224     u32 rxq_count;
225 };
226 #ifdef MULTI_THREAD_ENCRYPT
227 struct ssv_encrypt_task_list {
228     struct task_struct* encrypt_task;
229     wait_queue_head_t encrypt_wait_q;
230     volatile int started;
231     volatile int running;
232     volatile int paused;
233     volatile int cpu_offline;
234     u32 cpu_no;
235     struct list_head list;
236 };
237 #endif
238 #define SSV6XXX_GET_STA_INFO(_sc,_s) \
239     &(_sc)->sta_info[((struct ssv_sta_priv_data *)((_s)->drv_priv))->sta_idx]
240 #define STA_FLAG_VALID 0x00001
241 #define STA_FLAG_QOS 0x00002
242 #define STA_FLAG_AMPDU 0x00004
243 #define STA_FLAG_ENCRYPT 0x00008
244 struct ssv_sta_info {
245     u16 aid;
246     u16 s_flags;
247     int hw_wsid;
248     struct ieee80211_sta *sta;
249     struct ieee80211_vif *vif;
250     bool sleeping;
251     bool tim_set;
252     #if 0
253     struct ssv_crypto_ops *crypt;
254     void *crypt_priv;
255     u32 KeySelect;
256     bool ampdu_ccmp_encrypt;
257     #endif
258     #ifdef CONFIG_SSV6XXX_DEBUGFS
259     struct dentry *debugfs_dir;
260  #endif
261 };
262 struct ssv_vif_info {
263     struct ieee80211_vif *vif;
264     struct ssv_vif_priv_data *vif_priv;
265     enum nl80211_iftype if_type;
266     struct ssv6xxx_hw_sec sramKey;
267     #ifdef CONFIG_SSV6XXX_DEBUGFS
268     struct dentry *debugfs_dir;
269     #endif
270 };
271 struct ssv_sta_priv_data {
272     int sta_idx;
273     int rc_idx;
274     int rx_data_rate;
275     struct ssv_sta_info *sta_info;
276     struct list_head list;
277     u32 ampdu_mib_total_BA_counter;
278     AMPDU_TID ampdu_tid[WMM_TID_NUM];
279     bool has_hw_encrypt;
280     bool need_sw_encrypt;
281     bool has_hw_decrypt;
282     bool need_sw_decrypt;
283     bool use_mac80211_decrypt;
284     u8 group_key_idx;
285     #ifdef USE_LOCAL_CRYPTO
286     struct ssv_crypto_data crypto_data;
287     #endif
288     u32 beacon_rssi;
289 };
290 struct ssv_vif_priv_data {
291     int vif_idx;
292     struct list_head sta_list;
293     u32 sta_asleep_mask;
294     u32 pair_cipher;
295     u32 group_cipher;
296     bool is_security_valid;
297     bool has_hw_encrypt;
298     bool need_sw_encrypt;
299     bool has_hw_decrypt;
300     bool need_sw_decrypt;
301     bool use_mac80211_decrypt;
302     bool force_sw_encrypt;
303     u8 group_key_idx;
304     #ifdef USE_LOCAL_CRYPTO
305     struct ssv_crypto_data crypto_data;
306     #endif
307 };
308 #define SC_OP_INVALID 0x00000001
309 #define SC_OP_HW_RESET 0x00000002
310 #define SC_OP_OFFCHAN 0x00000004
311 #define SC_OP_FIXED_RATE 0x00000008
312 #define SC_OP_SHORT_PREAMBLE 0x00000010
313 struct ssv6xxx_beacon_info {
314  u32 pubf_addr;
315  u16 len;
316  u8 tim_offset;
317  u8 tim_cnt;
318 };
319 #define SSV6200_MAX_BCAST_QUEUE_LEN 16
320 struct ssv6xxx_bcast_txq {
321     spinlock_t txq_lock;
322     struct sk_buff_head qhead;
323     int cur_qsize;
324 };
325 #ifdef DEBUG_AMPDU_FLUSH
326 typedef struct AMPDU_TID_st AMPDU_TID;
327 #define MAX_TID (24)
328 #endif
329 struct ssv_softc {
330     struct ieee80211_hw *hw;
331     struct device *dev;
332     u32 restart_counter;
333     bool force_triger_reset;
334     unsigned long sdio_throughput_timestamp;
335     unsigned long sdio_rx_evt_size;
336 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
337     struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
338 #else
339     struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
340 #endif
341     struct ieee80211_channel *cur_channel;
342     u16 hw_chan;
343     struct mutex mutex;
344     struct ssv_hw *sh;
345     struct ssv_tx tx;
346     struct ssv_rx rx;
347     struct ssv_vif_info vif_info[SSV_NUM_VIF];
348     struct ssv_sta_info sta_info[SSV_NUM_STA];
349     struct ieee80211_vif *ap_vif;
350     u8 nvif;
351     u32 sc_flags;
352     void *rc;
353     int max_rate_idx;
354     struct workqueue_struct *rc_sample_workqueue;
355     struct sk_buff_head rc_report_queue;
356     struct work_struct rc_sample_work;
357     #ifdef DEBUG_AMPDU_FLUSH
358     struct AMPDU_TID_st *tid[MAX_TID];
359     #endif
360     u16 rc_sample_sechedule;
361     u16 *mac_deci_tbl;
362     struct workqueue_struct *config_wq;
363     bool bq4_dtim;
364     struct work_struct set_tim_work;
365     u8 enable_beacon;
366     u8 beacon_interval;
367     u8 beacon_dtim_cnt;
368     u8 beacon_usage;
369     struct ssv6xxx_beacon_info beacon_info[2];
370     struct sk_buff *beacon_buf;
371     struct work_struct bcast_start_work;
372     struct delayed_work bcast_stop_work;
373     struct delayed_work bcast_tx_work;
374     struct delayed_work thermal_monitor_work;
375     struct workqueue_struct *thermal_wq;
376     int is_sar_enabled;
377     bool aid0_bit_set;
378     u8 hw_mng_used;
379     struct ssv6xxx_bcast_txq bcast_txq;
380     int bcast_interval;
381     u8 bssid[6];
382     struct mutex mem_mutex;
383     spinlock_t ps_state_lock;
384     u8 hw_wsid_bit;
385     #if 0
386     struct work_struct ampdu_tx_encry_work;
387     bool ampdu_encry_work_scheduled;
388     bool ampdu_ccmp_encrypt;
389     struct work_struct sync_hwkey_work;
390     bool sync_hwkey_write;
391     struct ssv_sta_info *key_sync_sta_info;
392     AMPDU_REKEY_PAUSE_STATE ampdu_rekey_pause;
393     #endif
394     int rx_ba_session_count;
395     struct ieee80211_sta *rx_ba_sta;
396     u8 rx_ba_bitmap;
397     u8 ba_ra_addr[ETH_ALEN];
398     u16 ba_tid;
399     u16 ba_ssn;
400     struct work_struct set_ampdu_rx_add_work;
401  struct work_struct set_ampdu_rx_del_work;
402     bool isAssoc;
403     u16 channel_center_freq;
404 //#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
405     bool bScanning;
406 //#endif
407     int ps_status;
408     u16 ps_aid;
409 #ifdef CONFIG_SSV_SUPPORT_ANDROID
410 #ifdef CONFIG_HAS_EARLYSUSPEND
411     struct early_suspend early_suspend;
412 #endif
413 #ifdef CONFIG_HAS_WAKELOCK
414     struct wake_lock ssv_wake_lock_;
415 #endif
416 #endif
417     u16 tx_wait_q_woken;
418     wait_queue_head_t tx_wait_q;
419     struct sk_buff_head tx_skb_q;
420 #ifdef CONFIG_SSV6XXX_DEBUGFS
421     u32 max_tx_skb_q_len;
422 #endif
423     struct task_struct *tx_task;
424     bool tx_q_empty;
425     struct sk_buff_head tx_done_q;
426     u16 rx_wait_q_woken;
427     wait_queue_head_t rx_wait_q;
428     struct sk_buff_head rx_skb_q;
429     struct task_struct *rx_task;
430 #ifdef MULTI_THREAD_ENCRYPT
431     struct list_head encrypt_task_head;
432     struct notifier_block cpu_nfb;
433     struct sk_buff_head preprocess_q;
434     struct sk_buff_head crypted_q;
435     spinlock_t crypt_st_lock;
436 #ifdef CONFIG_SSV6XXX_DEBUGFS
437     u32 max_preprocess_q_len;
438     u32 max_crypted_q_len;
439 #endif
440 #endif
441     bool dbg_rx_frame;
442     bool dbg_tx_frame;
443 #ifdef CONFIG_SSV6XXX_DEBUGFS
444     struct dentry *debugfs_dir;
445 #endif
446 #ifdef CONFIG_P2P_NOA
447     struct ssv_p2p_noa p2p_noa;
448 #endif
449     struct timer_list watchdog_timeout;
450     u32 watchdog_flag;
451     wait_queue_head_t fw_wait_q;
452     u32 iq_cali_done;
453     u32 sr_bhvr;
454 };
455 enum {
456     IQ_CALI_RUNNING,
457     IQ_CALI_OK,
458     IQ_CALI_FAILED
459 };
460 enum {
461     WD_SLEEP,
462     WD_BARKING,
463     WD_KICKED,
464     WD_MAX
465 };
466 void ssv6xxx_txbuf_free_skb(struct sk_buff *skb , void *args);
467 void ssv6200_rx_process(struct work_struct *work);
468 #if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX)
469 int ssv6200_rx(struct sk_buff_head *rx_skb_q, void *args);
470 #else
471 int ssv6200_rx(struct sk_buff *rx_skb, void *args);
472 #endif
473 void ssv6xxx_tx_cb(struct sk_buff_head *skb_head, void *args);
474 #ifdef RATE_CONTROL_REALTIME_UPDATA
475 void ssv6xxx_tx_rate_update(struct sk_buff *skb, void *args);
476 #endif
477 int ssv6200_tx_flow_control(void *dev, int hw_txqid, bool fc_en, int debug);
478 void ssv6xxx_tx_q_empty_cb (u32 txq_no, void *);
479 int ssv6xxx_rf_disable(struct ssv_hw *sh);
480 int ssv6xxx_rf_enable(struct ssv_hw *sh);
481 int ssv6xxx_set_channel(struct ssv_softc *sc, int ch);
482 #ifdef CONFIG_SSV_SMARTLINK
483 int ssv6xxx_get_channel(struct ssv_softc *sc, int *pch);
484 int ssv6xxx_set_promisc(struct ssv_softc *sc, int accept);
485 int ssv6xxx_get_promisc(struct ssv_softc *sc, int *paccept);
486 #endif
487 int ssv6xxx_tx_task (void *data);
488 int ssv6xxx_rx_task (void *data);
489 u32 ssv6xxx_pbuf_alloc(struct ssv_softc *sc, int size, int type);
490 bool ssv6xxx_pbuf_free(struct ssv_softc *sc, u32 pbuf_addr);
491 void ssv6xxx_add_txinfo(struct ssv_softc *sc, struct sk_buff *skb);
492 void ssv6xxx_update_txinfo (struct ssv_softc *sc, struct sk_buff *skb);
493 int ssv6xxx_update_decision_table(struct ssv_softc *sc);
494 void ssv6xxx_ps_callback_func(unsigned long data);
495 void ssv6xxx_enable_ps(struct ssv_softc *sc);
496 void ssv6xxx_disable_ps(struct ssv_softc *sc);
497 int ssv6xxx_watchdog_controller(struct ssv_hw *sh ,u8 flag);
498 int ssv6xxx_skb_encrypt(struct sk_buff *mpdu,struct ssv_softc *sc);
499 int ssv6xxx_skb_decrypt(struct sk_buff *mpdu, struct ieee80211_sta *sta,struct ssv_softc *sc);
500 void ssv6200_sync_hw_key_sequence(struct ssv_softc *sc, struct ssv_sta_info* sta_info, bool bWrite);
501 struct ieee80211_sta *ssv6xxx_find_sta_by_rx_skb (struct ssv_softc *sc, struct sk_buff *skb);
502 struct ieee80211_sta *ssv6xxx_find_sta_by_addr (struct ssv_softc *sc, u8 addr[6]);
503 void ssv6xxx_foreach_sta (struct ssv_softc *sc,
504                           void (*sta_func)(struct ssv_softc *,
505                                            struct ssv_sta_info *,
506                                            void *),
507                           void *param);
508 void ssv6xxx_foreach_vif_sta (struct ssv_softc *sc,
509                               struct ssv_vif_info *vif_info,
510                               void (*sta_func)(struct ssv_softc *,
511                                                struct ssv_vif_info *,
512                                                struct ssv_sta_info *,
513                                                void *),
514                               void *param);
515 #ifdef CONFIG_SSV_SUPPORT_ANDROID
516 #ifdef CONFIG_HAS_EARLYSUSPEND
517 void ssv6xxx_early_suspend(struct early_suspend *h);
518 void ssv6xxx_late_resume(struct early_suspend *h);
519 #endif
520 #endif
521 #ifdef USE_LOCAL_CRYPTO
522 #ifdef MULTI_THREAD_ENCRYPT
523 struct ssv_crypto_data *ssv6xxx_skb_get_tx_cryptops(struct sk_buff *mpdu);
524 struct ssv_crypto_data *ssv6xxx_skb_get_rx_cryptops(struct ssv_softc *sc,
525                                                     struct ieee80211_sta *sta,
526                                                     struct sk_buff *mpdu);
527 int ssv6xxx_skb_pre_encrypt(struct sk_buff *mpdu, struct ssv_softc *sc);
528 int ssv6xxx_skb_pre_decrypt(struct sk_buff *mpdu, struct ieee80211_sta *sta, struct ssv_softc *sc);
529 int ssv6xxx_encrypt_task (void *data);
530 #endif
531 #ifdef HAS_CRYPTO_LOCK
532     #define INIT_WRITE_CRYPTO_DATA(data, init) \
533         struct ssv_crypto_data *data = (init); \
534         unsigned long data##_flags;
535     #define START_WRITE_CRYPTO_DATA(data) \
536         do { \
537             write_lock_irqsave(&(data)->lock, data##_flags); \
538         } while (0)
539     #define END_WRITE_CRYPTO_DATA(data) \
540         do { \
541             write_unlock_irqrestore(&(data)->lock, data##_flags); \
542         } while (0)
543     #define START_READ_CRYPTO_DATA(data) \
544         do { \
545             read_lock(&(data)->lock); \
546         } while (0)
547     #define END_READ_CRYPTO_DATA(data) \
548         do { \
549             read_unlock(&(data)->lock); \
550         } while (0)
551 #else
552     #define INIT_WRITE_CRYPTO_DATA(data, init) \
553         struct ssv_crypto_data *data = (init);
554     #define START_WRITE_CRYPTO_DATA(data) do { } while (0)
555     #define END_WRITE_CRYPTO_DATA(data) do { } while (0)
556     #define START_READ_CRYPTO_DATA(data) do { } while (0)
557     #define END_READ_CRYPTO_DATA(data) do { } while (0)
558 #endif
559 #endif
560 #ifdef CONFIG_SSV6XXX_DEBUGFS
561 ssize_t ssv6xxx_tx_queue_status_dump (struct ssv_softc *sc, char *status_buf,
562                                       ssize_t buf_size);
563 #endif
564 #endif
565