aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c166
1 files changed, 0 insertions, 166 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index d991f8e3d9ec..6028fc466575 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -26,11 +26,9 @@
26#include "fwil_types.h" 26#include "fwil_types.h"
27#include "tracepoint.h" 27#include "tracepoint.h"
28 28
29#define PKTFILTER_BUF_SIZE 128
30#define BRCMF_DEFAULT_BCN_TIMEOUT 3 29#define BRCMF_DEFAULT_BCN_TIMEOUT 3
31#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 30#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
32#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 31#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40
33#define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00"
34 32
35/* boost value for RSSI_DELTA in preferred join selection */ 33/* boost value for RSSI_DELTA in preferred join selection */
36#define BRCMF_JOIN_PREF_RSSI_BOOST 8 34#define BRCMF_JOIN_PREF_RSSI_BOOST 8
@@ -86,165 +84,6 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
86 return p != NULL; 84 return p != NULL;
87} 85}
88 86
89/* Convert user's input in hex pattern to byte-size mask */
90static int brcmf_c_pattern_atoh(char *src, char *dst)
91{
92 int i;
93 if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
94 brcmf_err("Mask invalid format. Needs to start with 0x\n");
95 return -EINVAL;
96 }
97 src = src + 2; /* Skip past 0x */
98 if (strlen(src) % 2 != 0) {
99 brcmf_err("Mask invalid format. Length must be even.\n");
100 return -EINVAL;
101 }
102 for (i = 0; *src != '\0'; i++) {
103 unsigned long res;
104 char num[3];
105 strncpy(num, src, 2);
106 num[2] = '\0';
107 if (kstrtoul(num, 16, &res))
108 return -EINVAL;
109 dst[i] = (u8)res;
110 src += 2;
111 }
112 return i;
113}
114
115static void
116brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable,
117 int master_mode)
118{
119 unsigned long res;
120 char *argv;
121 char *arg_save = NULL, *arg_org = NULL;
122 s32 err;
123 struct brcmf_pkt_filter_enable_le enable_parm;
124
125 arg_save = kstrdup(arg, GFP_ATOMIC);
126 if (!arg_save)
127 goto fail;
128
129 arg_org = arg_save;
130
131 argv = strsep(&arg_save, " ");
132
133 if (argv == NULL) {
134 brcmf_err("No args provided\n");
135 goto fail;
136 }
137
138 /* Parse packet filter id. */
139 enable_parm.id = 0;
140 if (!kstrtoul(argv, 0, &res))
141 enable_parm.id = cpu_to_le32((u32)res);
142
143 /* Enable/disable the specified filter. */
144 enable_parm.enable = cpu_to_le32(enable);
145
146 err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_enable", &enable_parm,
147 sizeof(enable_parm));
148 if (err)
149 brcmf_err("Set pkt_filter_enable error (%d)\n", err);
150
151 /* Control the master mode */
152 err = brcmf_fil_iovar_int_set(ifp, "pkt_filter_mode", master_mode);
153 if (err)
154 brcmf_err("Set pkt_filter_mode error (%d)\n", err);
155
156fail:
157 kfree(arg_org);
158}
159
160static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg)
161{
162 struct brcmf_pkt_filter_le *pkt_filter;
163 unsigned long res;
164 int buf_len;
165 s32 err;
166 u32 mask_size;
167 u32 pattern_size;
168 char *argv[8], *buf = NULL;
169 int i = 0;
170 char *arg_save = NULL, *arg_org = NULL;
171
172 arg_save = kstrdup(arg, GFP_ATOMIC);
173 if (!arg_save)
174 goto fail;
175
176 arg_org = arg_save;
177
178 buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC);
179 if (!buf)
180 goto fail;
181
182 argv[i] = strsep(&arg_save, " ");
183 while (argv[i]) {
184 i++;
185 if (i >= 8) {
186 brcmf_err("Too many parameters\n");
187 goto fail;
188 }
189 argv[i] = strsep(&arg_save, " ");
190 }
191
192 if (i != 6) {
193 brcmf_err("Not enough args provided %d\n", i);
194 goto fail;
195 }
196
197 pkt_filter = (struct brcmf_pkt_filter_le *)buf;
198
199 /* Parse packet filter id. */
200 pkt_filter->id = 0;
201 if (!kstrtoul(argv[0], 0, &res))
202 pkt_filter->id = cpu_to_le32((u32)res);
203
204 /* Parse filter polarity. */
205 pkt_filter->negate_match = 0;
206 if (!kstrtoul(argv[1], 0, &res))
207 pkt_filter->negate_match = cpu_to_le32((u32)res);
208
209 /* Parse filter type. */
210 pkt_filter->type = 0;
211 if (!kstrtoul(argv[2], 0, &res))
212 pkt_filter->type = cpu_to_le32((u32)res);
213
214 /* Parse pattern filter offset. */
215 pkt_filter->u.pattern.offset = 0;
216 if (!kstrtoul(argv[3], 0, &res))
217 pkt_filter->u.pattern.offset = cpu_to_le32((u32)res);
218
219 /* Parse pattern filter mask. */
220 mask_size = brcmf_c_pattern_atoh(argv[4],
221 (char *)pkt_filter->u.pattern.mask_and_pattern);
222
223 /* Parse pattern filter pattern. */
224 pattern_size = brcmf_c_pattern_atoh(argv[5],
225 (char *)&pkt_filter->u.pattern.mask_and_pattern[mask_size]);
226
227 if (mask_size != pattern_size) {
228 brcmf_err("Mask and pattern not the same size\n");
229 goto fail;
230 }
231
232 pkt_filter->u.pattern.size_bytes = cpu_to_le32(mask_size);
233 buf_len = offsetof(struct brcmf_pkt_filter_le,
234 u.pattern.mask_and_pattern);
235 buf_len += mask_size + pattern_size;
236
237 err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_add", pkt_filter,
238 buf_len);
239 if (err)
240 brcmf_err("Set pkt_filter_add error (%d)\n", err);
241
242fail:
243 kfree(arg_org);
244
245 kfree(buf);
246}
247
248int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) 87int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
249{ 88{
250 s8 eventmask[BRCMF_EVENTING_MASK_LEN]; 89 s8 eventmask[BRCMF_EVENTING_MASK_LEN];
@@ -356,11 +195,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
356 goto done; 195 goto done;
357 } 196 }
358 197
359 /* Setup packet filter */
360 brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER);
361 brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER,
362 0, true);
363
364 /* do bus specific preinit here */ 198 /* do bus specific preinit here */
365 err = brcmf_bus_preinit(ifp->drvr->bus_if); 199 err = brcmf_bus_preinit(ifp->drvr->bus_if);
366done: 200done: