d15abc062825ec11f4af580051b28427d52874a6
[pandora-kernel.git] / drivers / staging / brcm80211 / brcmfmac / wl_iw.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _wl_iw_h_
18 #define _wl_iw_h_
19
20 #include <linux/wireless.h>
21
22 #include <typedefs.h>
23 #include <proto/ethernet.h>
24 #include <wlioctl.h>
25
26 #define WL_SCAN_PARAMS_SSID_MAX 10
27 #define GET_SSID        "SSID="
28 #define GET_CHANNEL     "CH="
29 #define GET_NPROBE                      "NPROBE="
30 #define GET_ACTIVE_ASSOC_DWELL          "ACTIVE="
31 #define GET_PASSIVE_ASSOC_DWELL "PASSIVE="
32 #define GET_HOME_DWELL          "HOME="
33 #define GET_SCAN_TYPE                   "TYPE="
34
35 #define BAND_GET_CMD                            "BANDGET"
36 #define BAND_SET_CMD                            "BANDSET"
37 #define DTIM_SKIP_GET_CMD                       "DTIMSKIPGET"
38 #define DTIM_SKIP_SET_CMD                       "DTIMSKIPSET"
39 #define SETSUSPEND_CMD                          "SETSUSPENDOPT"
40 #define PNOSSIDCLR_SET_CMD                      "PNOSSIDCLR"
41 #define PNOSETUP_SET_CMD                        "PNOSETUP"
42 #define PNOENABLE_SET_CMD                       "PNOFORCE"
43 #define PNODEBUG_SET_CMD                        "PNODEBUG"
44
45 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
46 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
47
48 typedef struct wl_iw_extra_params {
49         int target_channel;
50 } wl_iw_extra_params_t;
51
52 #define WL_IW_RSSI_MINVAL               -200
53 #define WL_IW_RSSI_NO_SIGNAL    -91
54 #define WL_IW_RSSI_VERY_LOW     -80
55 #define WL_IW_RSSI_LOW          -70
56 #define WL_IW_RSSI_GOOD         -68
57 #define WL_IW_RSSI_VERY_GOOD    -58
58 #define WL_IW_RSSI_EXCELLENT    -57
59 #define WL_IW_RSSI_INVALID       0
60 #define MAX_WX_STRING 80
61 #define WL_IW_SET_ACTIVE_SCAN   (SIOCIWFIRSTPRIV+1)
62 #define WL_IW_GET_RSSI                  (SIOCIWFIRSTPRIV+3)
63 #define WL_IW_SET_PASSIVE_SCAN  (SIOCIWFIRSTPRIV+5)
64 #define WL_IW_GET_LINK_SPEED    (SIOCIWFIRSTPRIV+7)
65 #define WL_IW_GET_CURR_MACADDR  (SIOCIWFIRSTPRIV+9)
66 #define WL_IW_SET_STOP                          (SIOCIWFIRSTPRIV+11)
67 #define WL_IW_SET_START                 (SIOCIWFIRSTPRIV+13)
68
69 #define WL_SET_AP_CFG           (SIOCIWFIRSTPRIV+15)
70 #define WL_AP_STA_LIST          (SIOCIWFIRSTPRIV+17)
71 #define WL_AP_MAC_FLTR          (SIOCIWFIRSTPRIV+19)
72 #define WL_AP_BSS_START         (SIOCIWFIRSTPRIV+21)
73 #define AP_LPB_CMD              (SIOCIWFIRSTPRIV+23)
74 #define WL_AP_STOP              (SIOCIWFIRSTPRIV+25)
75 #define WL_FW_RELOAD            (SIOCIWFIRSTPRIV+27)
76 #define WL_COMBO_SCAN            (SIOCIWFIRSTPRIV+29)
77 #define WL_AP_SPARE3            (SIOCIWFIRSTPRIV+31)
78 #define G_SCAN_RESULTS          (8*1024)
79 #define WE_ADD_EVENT_FIX        0x80
80 #define          G_WLAN_SET_ON  0
81 #define          G_WLAN_SET_OFF 1
82
83 #define CHECK_EXTRA_FOR_NULL(extra) \
84 if (!extra) { \
85         WL_ERROR(("%s: error : extra is null pointer\n", __func__)); \
86         return -EINVAL; \
87 }
88
89 typedef struct wl_iw {
90         char nickname[IW_ESSID_MAX_SIZE];
91
92         struct iw_statistics wstats;
93
94         int spy_num;
95         u32 pwsec;
96         u32 gwsec;
97         bool privacy_invoked;
98
99         struct ether_addr spy_addr[IW_MAX_SPY];
100         struct iw_quality spy_qual[IW_MAX_SPY];
101         void *wlinfo;
102         dhd_pub_t *pub;
103 } wl_iw_t;
104
105 #if WIRELESS_EXT > 12
106 #include <net/iw_handler.h>
107 extern const struct iw_handler_def wl_iw_handler_def;
108 #endif
109
110 extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
111 extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data);
112 extern int wl_iw_get_wireless_stats(struct net_device *dev,
113                                     struct iw_statistics *wstats);
114 int wl_iw_attach(struct net_device *dev, void *dhdp);
115 void wl_iw_detach(void);
116 extern int net_os_set_suspend_disable(struct net_device *dev, int val);
117 extern int net_os_set_suspend(struct net_device *dev, int val);
118 extern int net_os_set_dtim_skip(struct net_device *dev, int val);
119 extern int net_os_set_packet_filter(struct net_device *dev, int val);
120
121 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
122         iwe_stream_add_event(info, stream, ends, iwe, extra)
123 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
124         iwe_stream_add_value(info, event, value, ends, iwe, event_len)
125 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
126         iwe_stream_add_point(info, stream, ends, iwe, extra)
127
128 extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
129 extern int dhd_pno_clean(dhd_pub_t *dhd);
130 extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid,
131                        unsigned char scan_fr);
132 extern int dhd_pno_get_status(dhd_pub_t *dhd);
133 extern int dhd_dev_pno_reset(struct net_device *dev);
134 extern int dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t *ssids_local,
135                            int nssid, unsigned char scan_fr);
136 extern int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled);
137 extern int dhd_dev_get_pno_status(struct net_device *dev);
138
139 #define PNO_TLV_PREFIX                  'S'
140 #define PNO_TLV_VERSION                 1
141 #define PNO_TLV_SUBVERSION              0
142 #define PNO_TLV_RESERVED                0
143 #define PNO_TLV_TYPE_SSID_IE            'S'
144 #define PNO_TLV_TYPE_TIME               'T'
145 #define  PNO_EVENT_UP                   "PNO_EVENT"
146
147 typedef struct cmd_tlv {
148         char prefix;
149         char version;
150         char subver;
151         char reserved;
152 } cmd_tlv_t;
153 #endif                          /* _wl_iw_h_ */