5 #include <linux/completion.h>
6 #include <linux/if_ether.h>
8 #include <net/mac80211.h>
9 #include "ecrnx_compat.h"
12 #define ESWIN_FLAG_CORE_REGISTERED 1
14 #define ESWIN_NR_VIF 2
15 #define ESWIN_NR_VIF_HW_QUEUE 4
18 #define ESWIN_STATE_BOOT 1
19 #define ESWIN_STATE_INIT 2
20 #define ESWIN_STATE_STOP 3
21 #define ESWIN_STATE_CLOSING 4
22 #define ESWIN_STATE_CLOSEED 5
23 #define ESWIN_STATE_START 6
24 #define ESWIN_STATE_RUNNING 7
27 #define WIM_RESP_TIMEOUT (msecs_to_jiffies(100))
29 enum ESWIN_SCAN_MODE {
30 ESWIN_SCAN_MODE_IDLE = 0,
31 ESWIN_SCAN_MODE_SCANNING,
32 ESWIN_SCAN_MODE_ABORTING,
40 uint32_t tx_head_size;
41 uint32_t rx_head_size;
42 uint32_t payload_align;
46 struct eswin_capabilities {
48 uint16_t listen_interval;
49 uint16_t bss_max_idle;
50 uint8_t bss_max_idle_options;
53 struct eswin_max_idle {
58 struct timer_list keep_alive_timer;
60 unsigned long idle_period; /* jiffies */
61 struct timer_list timer;
65 /* Private txq driver data structure */
67 u16 hw_queue; /* 0: AC_BK, 1: AC_BE, 2: AC_VI, 3: AC_VO */
68 struct list_head list;
69 struct sk_buff_head queue; /* own queue */
70 unsigned long nr_fw_queueud;
71 unsigned long nr_push_allowed;
72 struct ieee80211_vif vif;
73 struct ieee80211_sta sta;
77 struct tx_buff_node * next;
82 struct tx_buff_queue {
83 struct tx_buff_node * head;
84 struct tx_buff_node * tail;
89 #define ESWIN_QUEUE_MAX (ESWIN_NR_VIF_HW_QUEUE*ESWIN_NR_VIF + 3)
91 typedef int (*usb_rx_cb_t)(void *priv, struct sk_buff *skb, unsigned char ep);
92 typedef int (*usb_data_cfm_cb_t)(void *priv, void *host_id);
95 void *umac_priv; //mac drv data.
96 struct ieee80211_hw *hw;
97 struct ieee80211_vif *vif[ESWIN_NR_VIF];
104 bool ampdu_supported;
106 bool amsdu_supported;
114 usb_rx_cb_t rx_callback;
115 usb_data_cfm_cb_t data_cfm_callback;
116 usb_data_cfm_cb_t msg_cfm_callback;
118 //struct sx_buff_queue queue[ESWIN_NR_VIF]; /* 0: frame, 1: wim */
119 struct tx_buff_queue tx_queue;
120 struct tx_buff_node tx_node[64];
121 struct tx_buff_node * tx_node_head;
124 struct work_struct work;
126 struct eswin_txq ntxq[ESWIN_QUEUE_MAX];
129 struct mutex state_mtx;
130 enum ESWIN_SCAN_MODE scan_mode;
131 struct workqueue_struct *workqueue;
132 struct delayed_work scan_timeout;
134 //struct work_struct register_work;
135 struct delayed_work register_work;
138 unsigned long dev_flags;
139 struct mac_address mac_addr[ESWIN_NR_VIF];
140 struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
144 /* Move to vif or sta driver data */
153 struct fwinfo_t fwinfo;
154 struct eswin_capabilities cap;
156 /* power management */
163 bool ps_poll_pending;
170 struct list_head txq;
171 /* 0: AC_BK, 1: AC_BE, 2: AC_VI, 3: AC_VO */
172 atomic_t tx_credit[IEEE80211_NUM_ACS*3];
173 atomic_t tx_pend[IEEE80211_NUM_ACS*3];
175 // struct completion wim_responded;
176 // struct sk_buff *last_wim_responded;
179 struct delayed_work roc_finish;
183 struct dentry *debugfs;
186 u8 drv_priv[0] __aligned(sizeof(void *));
190 /* vif driver data structure */
194 struct net_device *dev;
197 struct delayed_work scan_timeout;
203 spinlock_t preassoc_sta_lock;
204 struct list_head preassoc_sta_list;
210 #define to_ieee80211_vif(v) \
211 container_of((void *)v, struct ieee80211_vif, drv_priv)
213 #define to_i_vif(v) ((struct eswin_vif *) (v)->drv_priv)
215 static inline int hw_vifindex(struct ieee80211_vif *vif)
217 struct eswin_vif *i_vif;
222 i_vif = to_i_vif(vif);
226 /* sta driver data structure */
229 struct ieee80211_vif *vif;
230 /*struct ieee80211_sta *sta;*/
232 enum ieee80211_sta_state state;
233 struct list_head list;
236 struct ieee80211_key_conf *ptk;
237 struct ieee80211_key_conf *gtk;
239 /* BSS max idle period */
240 struct eswin_capabilities cap;
241 struct eswin_max_idle max_idle;
244 #define to_ieee80211_sta(s) \
245 container_of((void *)s, struct ieee80211_sta, drv_priv)
247 #define to_i_sta(s) ((struct eswin_sta *) (s)->drv_priv)
251 struct eswin_sta_handler {
252 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
253 struct ieee80211_sta *sta,
254 enum ieee80211_sta_state old_state,
255 enum ieee80211_sta_state new_state);
261 static struct eswin_sta_handler __stah_ ## fn \
262 __attribute((__used__)) \
263 __attribute((__section__("nrc.sta"))) = { \
267 extern struct eswin_sta_handler __sta_h_start, __sta_h_end;
273 struct eswin_trx_data {
275 struct ieee80211_vif *vif;
276 struct ieee80211_sta *sta;
282 #define NL80211_IFTYPE_ALL (BIT(NUM_NL80211_IFTYPES)-1)
283 int eswin_core_register(struct eswin *tr);
284 void eswin_core_unregister(struct eswin *tr);
285 struct eswin * eswin_core_create(size_t priv_size, struct device *dev, struct usb_ops * ops);
286 void eswin_core_destroy(struct eswin *tr);
288 extern int power_save;
289 extern int disable_cqm;
290 #ifdef CONFIG_ECRNX_WIFO_CAIL
291 extern bool amt_mode;
293 extern bool set_gain;
295 extern bool register_status;