• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Linux Wireless Extensions support
3  *
4  * Copyright (C) 1999-2017, Broadcom Corporation
5  *
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  *
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions of
16  * the license of that module.  An independent module is a module which is not
17  * derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  *
20  *      Notwithstanding the above, under no circumstances may you combine this
21  * software in any way with any other Broadcom software provided under a license
22  * other than the GPL, without Broadcom's express prior written consent.
23  *
24  *
25  * <<Broadcom-WL-IPTag/Open:>>
26  *
27  * $Id: wl_iw.h 514727 2014-11-12 03:02:48Z $
28  */
29 
30 #ifndef _wl_iw_h_
31 #define _wl_iw_h_
32 
33 #include <linux/wireless.h>
34 
35 #include <typedefs.h>
36 #include <ethernet.h>
37 #include <wlioctl.h>
38 #include <dngl_stats.h>
39 #include <dhd.h>
40 
41 #define WL_SCAN_PARAMS_SSID_MAX     10
42 #define GET_SSID            "SSID="
43 #define GET_CHANNEL            "CH="
44 #define GET_NPROBE             "NPROBE="
45 #define GET_ACTIVE_ASSOC_DWELL      "ACTIVE="
46 #define GET_PASSIVE_ASSOC_DWELL      "PASSIVE="
47 #define GET_HOME_DWELL          "HOME="
48 #define GET_SCAN_TYPE            "TYPE="
49 
50 #define BAND_GET_CMD                "GETBAND"
51 #define BAND_SET_CMD                "SETBAND"
52 #define DTIM_SKIP_GET_CMD            "DTIMSKIPGET"
53 #define DTIM_SKIP_SET_CMD            "DTIMSKIPSET"
54 #define SETSUSPEND_CMD                "SETSUSPENDOPT"
55 #define PNOSSIDCLR_SET_CMD            "PNOSSIDCLR"
56 /* Lin - Is the extra space needed? */
57 #define PNOSETUP_SET_CMD            "PNOSETUP " /* TLV command has extra end space */
58 #define PNOENABLE_SET_CMD            "PNOFORCE"
59 #define PNODEBUG_SET_CMD            "PNODEBUG"
60 #define TXPOWER_SET_CMD            "TXPOWER"
61 
62 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
63 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
64 
65 /* Structure to keep global parameters */
66 typedef struct wl_iw_extra_params {
67     int     target_channel; /* target channel */
68 } wl_iw_extra_params_t;
69 
70 /* ============================================== */
71 /* Defines from wlc_pub.h */
72 #define    WL_IW_RSSI_MINVAL        -200    /* Low value, e.g. for forcing roam */
73 #define    WL_IW_RSSI_NO_SIGNAL    -91    /* NDIS RSSI link quality cutoffs */
74 #define    WL_IW_RSSI_VERY_LOW    -80    /* Very low quality cutoffs */
75 #define    WL_IW_RSSI_LOW        -70    /* Low quality cutoffs */
76 #define    WL_IW_RSSI_GOOD        -68    /* Good quality cutoffs */
77 #define    WL_IW_RSSI_VERY_GOOD    -58    /* Very good quality cutoffs */
78 #define    WL_IW_RSSI_EXCELLENT    -57    /* Excellent quality cutoffs */
79 #define    WL_IW_RSSI_INVALID     0    /* invalid RSSI value */
80 #define MAX_WX_STRING 80
81 #define SSID_FMT_BUF_LEN    ((4 * 32) + 1)
82 #define isprint(c) bcm_isprint(c)
83 #define WL_IW_SET_ACTIVE_SCAN    (SIOCIWFIRSTPRIV+1)
84 #define WL_IW_GET_RSSI            (SIOCIWFIRSTPRIV+3)
85 #define WL_IW_SET_PASSIVE_SCAN    (SIOCIWFIRSTPRIV+5)
86 #define WL_IW_GET_LINK_SPEED    (SIOCIWFIRSTPRIV+7)
87 #define WL_IW_GET_CURR_MACADDR    (SIOCIWFIRSTPRIV+9)
88 #define WL_IW_SET_STOP                (SIOCIWFIRSTPRIV+11)
89 #define WL_IW_SET_START            (SIOCIWFIRSTPRIV+13)
90 
91 #define         G_SCAN_RESULTS 8*1024
92 #define         WE_ADD_EVENT_FIX    0x80
93 #define          G_WLAN_SET_ON    0
94 #define          G_WLAN_SET_OFF    1
95 
96 
97 typedef struct wl_iw {
98     char nickname[IW_ESSID_MAX_SIZE];
99 
100     struct iw_statistics wstats;
101 
102     int spy_num;
103     uint32 pwsec;            /* pairwise wsec setting */
104     uint32 gwsec;            /* group wsec setting  */
105     bool privacy_invoked;         /* IW_AUTH_PRIVACY_INVOKED setting */
106     struct ether_addr spy_addr[IW_MAX_SPY];
107     struct iw_quality spy_qual[IW_MAX_SPY];
108     void  *wlinfo;
109 } wl_iw_t;
110 
111 struct wl_ctrl {
112     struct timer_list *timer;
113     struct net_device *dev;
114     long sysioc_pid;
115     struct semaphore sysioc_sem;
116     struct completion sysioc_exited;
117 };
118 
119 
120 #if WIRELESS_EXT > 12
121 #include <net/iw_handler.h>
122 extern const struct iw_handler_def wl_iw_handler_def;
123 #endif /* WIRELESS_EXT > 12 */
124 
125 extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
126 extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
127 extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
128 int wl_iw_send_priv_event(struct net_device *dev, char *flag);
129 #ifdef WL_ESCAN
130 int wl_iw_handle_scanresults_ies(char **event_p, char *end,
131     struct iw_request_info *info, wl_bss_info_t *bi);
132 #else
133 int wl_iw_attach(struct net_device *dev, dhd_pub_t *dhdp);
134 void wl_iw_detach(dhd_pub_t *dhdp);
135 void wl_iw_down(dhd_pub_t *dhdp);
136 #endif
137 
138 #define CSCAN_COMMAND                "CSCAN "
139 #define CSCAN_TLV_PREFIX             'S'
140 #define CSCAN_TLV_VERSION            1
141 #define CSCAN_TLV_SUBVERSION            0
142 #define CSCAN_TLV_TYPE_SSID_IE          'S'
143 #define CSCAN_TLV_TYPE_CHANNEL_IE   'C'
144 #define CSCAN_TLV_TYPE_NPROBE_IE     'N'
145 #define CSCAN_TLV_TYPE_ACTIVE_IE      'A'
146 #define CSCAN_TLV_TYPE_PASSIVE_IE    'P'
147 #define CSCAN_TLV_TYPE_HOME_IE         'H'
148 #define CSCAN_TLV_TYPE_STYPE_IE        'T'
149 
150 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
151 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
152     iwe_stream_add_event(info, stream, ends, iwe, extra)
153 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
154     iwe_stream_add_value(info, event, value, ends, iwe, event_len)
155 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
156     iwe_stream_add_point(info, stream, ends, iwe, extra)
157 #else
158 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
159     iwe_stream_add_event(stream, ends, iwe, extra)
160 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
161     iwe_stream_add_value(event, value, ends, iwe, event_len)
162 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
163     iwe_stream_add_point(stream, ends, iwe, extra)
164 #endif
165 
166 #endif /* _wl_iw_h_ */
167