diff options
Diffstat (limited to 'drivers/net/wireless/libertas/ioctl.c')
-rw-r--r-- | drivers/net/wireless/libertas/ioctl.c | 286 |
1 files changed, 188 insertions, 98 deletions
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c index a8f76c358992..f41081585564 100644 --- a/drivers/net/wireless/libertas/ioctl.c +++ b/drivers/net/wireless/libertas/ioctl.c | |||
@@ -30,6 +30,7 @@ | |||
30 | static int wlan_set_region(wlan_private * priv, u16 region_code) | 30 | static int wlan_set_region(wlan_private * priv, u16 region_code) |
31 | { | 31 | { |
32 | int i; | 32 | int i; |
33 | int ret = 0; | ||
33 | 34 | ||
34 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { | 35 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { |
35 | // use the region code to search for the index | 36 | // use the region code to search for the index |
@@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code) | |||
42 | 43 | ||
43 | // if it's unidentified region code | 44 | // if it's unidentified region code |
44 | if (i >= MRVDRV_MAX_REGION_CODE) { | 45 | if (i >= MRVDRV_MAX_REGION_CODE) { |
45 | lbs_pr_debug(1, "region Code not identified\n"); | 46 | lbs_deb_ioctl("region Code not identified\n"); |
46 | LEAVE(); | 47 | ret = -1; |
47 | return -1; | 48 | goto done; |
48 | } | 49 | } |
49 | 50 | ||
50 | if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { | 51 | if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { |
51 | LEAVE(); | 52 | ret = -EINVAL; |
52 | return -EINVAL; | ||
53 | } | 53 | } |
54 | 54 | ||
55 | return 0; | 55 | done: |
56 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
57 | return ret; | ||
56 | } | 58 | } |
57 | 59 | ||
58 | static inline int hex2int(char c) | 60 | static inline int hex2int(char c) |
@@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
125 | char ethaddrs_str[18]; | 127 | char ethaddrs_str[18]; |
126 | char *pos; | 128 | char *pos; |
127 | u8 ethaddr[ETH_ALEN]; | 129 | u8 ethaddr[ETH_ALEN]; |
130 | int ret; | ||
131 | |||
132 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
128 | 133 | ||
129 | ENTER(); | ||
130 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, | 134 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, |
131 | sizeof(ethaddrs_str))) | 135 | sizeof(ethaddrs_str))) |
132 | return -EFAULT; | 136 | return -EFAULT; |
@@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
136 | return -EINVAL; | 140 | return -EINVAL; |
137 | } | 141 | } |
138 | 142 | ||
139 | lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str); | 143 | lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str); |
140 | LEAVE(); | 144 | ret = libertas_prepare_and_send_command(priv, cmd_bt_access, |
141 | return (libertas_prepare_and_send_command(priv, cmd_bt_access, | ||
142 | cmd_act_bt_access_add, | 145 | cmd_act_bt_access_add, |
143 | cmd_option_waitforrsp, 0, ethaddr)); | 146 | cmd_option_waitforrsp, 0, ethaddr); |
147 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
148 | return ret; | ||
144 | } | 149 | } |
145 | 150 | ||
146 | /** | 151 | /** |
@@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
156 | u8 ethaddr[ETH_ALEN]; | 161 | u8 ethaddr[ETH_ALEN]; |
157 | char *pos; | 162 | char *pos; |
158 | 163 | ||
159 | ENTER(); | 164 | lbs_deb_enter(LBS_DEB_IOCTL); |
165 | |||
160 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, | 166 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, |
161 | sizeof(ethaddrs_str))) | 167 | sizeof(ethaddrs_str))) |
162 | return -EFAULT; | 168 | return -EFAULT; |
@@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
166 | return -EINVAL; | 172 | return -EINVAL; |
167 | } | 173 | } |
168 | 174 | ||
169 | lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str); | 175 | lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str); |
170 | 176 | ||
171 | return (libertas_prepare_and_send_command(priv, | 177 | return (libertas_prepare_and_send_command(priv, |
172 | cmd_bt_access, | 178 | cmd_bt_access, |
173 | cmd_act_bt_access_del, | 179 | cmd_act_bt_access_del, |
174 | cmd_option_waitforrsp, 0, ethaddr)); | 180 | cmd_option_waitforrsp, 0, ethaddr)); |
175 | LEAVE(); | 181 | |
182 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
176 | return 0; | 183 | return 0; |
177 | } | 184 | } |
178 | 185 | ||
@@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
183 | */ | 190 | */ |
184 | static int wlan_bt_reset_ioctl(wlan_private * priv) | 191 | static int wlan_bt_reset_ioctl(wlan_private * priv) |
185 | { | 192 | { |
186 | ENTER(); | 193 | lbs_deb_enter(LBS_DEB_IOCTL); |
187 | 194 | ||
188 | lbs_pr_alert( "BT: resetting\n"); | 195 | lbs_pr_alert( "BT: resetting\n"); |
189 | 196 | ||
@@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv) | |||
192 | cmd_act_bt_access_reset, | 199 | cmd_act_bt_access_reset, |
193 | cmd_option_waitforrsp, 0, NULL)); | 200 | cmd_option_waitforrsp, 0, NULL)); |
194 | 201 | ||
195 | LEAVE(); | 202 | lbs_deb_leave(LBS_DEB_IOCTL); |
196 | return 0; | 203 | return 0; |
197 | } | 204 | } |
198 | 205 | ||
@@ -209,17 +216,17 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
209 | struct iwreq *wrq = (struct iwreq *)req; | 216 | struct iwreq *wrq = (struct iwreq *)req; |
210 | /* used to pass id and store the bt entry returned by the FW */ | 217 | /* used to pass id and store the bt entry returned by the FW */ |
211 | union { | 218 | union { |
212 | int id; | 219 | u32 id; |
213 | char addr1addr2[2 * ETH_ALEN]; | 220 | char addr1addr2[2 * ETH_ALEN]; |
214 | } param; | 221 | } param; |
215 | static char outstr[64]; | 222 | static char outstr[64]; |
216 | char *pbuf = outstr; | 223 | char *pbuf = outstr; |
217 | int ret; | 224 | int ret; |
218 | 225 | ||
219 | ENTER(); | 226 | lbs_deb_enter(LBS_DEB_IOCTL); |
220 | 227 | ||
221 | if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { | 228 | if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { |
222 | lbs_pr_debug(1, "Copy from user failed\n"); | 229 | lbs_deb_ioctl("Copy from user failed\n"); |
223 | return -1; | 230 | return -1; |
224 | } | 231 | } |
225 | param.id = simple_strtoul(outstr, NULL, 10); | 232 | param.id = simple_strtoul(outstr, NULL, 10); |
@@ -234,7 +241,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
234 | if (ret == 0) { | 241 | if (ret == 0) { |
235 | addr1 = param.addr1addr2; | 242 | addr1 = param.addr1addr2; |
236 | 243 | ||
237 | pos = sprintf(pbuf, "ignoring traffic from "); | 244 | pos = sprintf(pbuf, "BT includes node "); |
238 | pbuf += pos; | 245 | pbuf += pos; |
239 | pos = eth_addr2str(addr1, pbuf); | 246 | pos = eth_addr2str(addr1, pbuf); |
240 | pbuf += pos; | 247 | pbuf += pos; |
@@ -246,11 +253,70 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
246 | wrq->u.data.length = strlen(outstr); | 253 | wrq->u.data.length = strlen(outstr); |
247 | if (copy_to_user(wrq->u.data.pointer, (char *)outstr, | 254 | if (copy_to_user(wrq->u.data.pointer, (char *)outstr, |
248 | wrq->u.data.length)) { | 255 | wrq->u.data.length)) { |
249 | lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n"); | 256 | lbs_deb_ioctl("BT_LIST: Copy to user failed!\n"); |
250 | return -EFAULT; | 257 | return -EFAULT; |
251 | } | 258 | } |
252 | 259 | ||
253 | LEAVE(); | 260 | lbs_deb_leave(LBS_DEB_IOCTL); |
261 | return 0 ; | ||
262 | } | ||
263 | |||
264 | /** | ||
265 | * @brief Sets inverted state of blacklist (non-zero if inverted) | ||
266 | * @param priv A pointer to wlan_private structure | ||
267 | * @param req A pointer to ifreq structure | ||
268 | * @return 0 --success, otherwise fail | ||
269 | */ | ||
270 | static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req) | ||
271 | { | ||
272 | int ret; | ||
273 | struct iwreq *wrq = (struct iwreq *)req; | ||
274 | union { | ||
275 | u32 id; | ||
276 | char addr1addr2[2 * ETH_ALEN]; | ||
277 | } param; | ||
278 | |||
279 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
280 | |||
281 | param.id = SUBCMD_DATA(wrq) ; | ||
282 | ret = libertas_prepare_and_send_command(priv, cmd_bt_access, | ||
283 | cmd_act_bt_access_set_invert, | ||
284 | cmd_option_waitforrsp, 0, | ||
285 | (char *)¶m); | ||
286 | if (ret != 0) | ||
287 | return -EFAULT; | ||
288 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * @brief Gets inverted state of blacklist (non-zero if inverted) | ||
294 | * @param priv A pointer to wlan_private structure | ||
295 | * @param req A pointer to ifreq structure | ||
296 | * @return 0 --success, otherwise fail | ||
297 | */ | ||
298 | static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req) | ||
299 | { | ||
300 | struct iwreq *wrq = (struct iwreq *)req; | ||
301 | int ret; | ||
302 | union { | ||
303 | u32 id; | ||
304 | char addr1addr2[2 * ETH_ALEN]; | ||
305 | } param; | ||
306 | |||
307 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
308 | |||
309 | ret = libertas_prepare_and_send_command(priv, cmd_bt_access, | ||
310 | cmd_act_bt_access_get_invert, | ||
311 | cmd_option_waitforrsp, 0, | ||
312 | (char *)¶m); | ||
313 | |||
314 | if (ret == 0) | ||
315 | wrq->u.param.value = le32_to_cpu(param.id); | ||
316 | else | ||
317 | return -EFAULT; | ||
318 | |||
319 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
254 | return 0; | 320 | return 0; |
255 | } | 321 | } |
256 | 322 | ||
@@ -278,8 +344,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
278 | char in_str[128]; | 344 | char in_str[128]; |
279 | static struct cmd_ds_fwt_access fwt_access; | 345 | static struct cmd_ds_fwt_access fwt_access; |
280 | char *ptr; | 346 | char *ptr; |
347 | int ret; | ||
348 | |||
349 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
281 | 350 | ||
282 | ENTER(); | ||
283 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 351 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
284 | return -EFAULT; | 352 | return -EFAULT; |
285 | 353 | ||
@@ -297,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
297 | fwt_access.metric = | 365 | fwt_access.metric = |
298 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 366 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
299 | else | 367 | else |
300 | fwt_access.metric = FWT_DEFAULT_METRIC; | 368 | fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC); |
301 | 369 | ||
302 | if ((ptr = next_param(ptr))) | 370 | if ((ptr = next_param(ptr))) |
303 | fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); | 371 | fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); |
@@ -305,16 +373,21 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
305 | fwt_access.dir = FWT_DEFAULT_DIR; | 373 | fwt_access.dir = FWT_DEFAULT_DIR; |
306 | 374 | ||
307 | if ((ptr = next_param(ptr))) | 375 | if ((ptr = next_param(ptr))) |
376 | fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10); | ||
377 | else | ||
378 | fwt_access.rate = FWT_DEFAULT_RATE; | ||
379 | |||
380 | if ((ptr = next_param(ptr))) | ||
308 | fwt_access.ssn = | 381 | fwt_access.ssn = |
309 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 382 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
310 | else | 383 | else |
311 | fwt_access.ssn = FWT_DEFAULT_SSN; | 384 | fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN); |
312 | 385 | ||
313 | if ((ptr = next_param(ptr))) | 386 | if ((ptr = next_param(ptr))) |
314 | fwt_access.dsn = | 387 | fwt_access.dsn = |
315 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 388 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
316 | else | 389 | else |
317 | fwt_access.dsn = FWT_DEFAULT_DSN; | 390 | fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN); |
318 | 391 | ||
319 | if ((ptr = next_param(ptr))) | 392 | if ((ptr = next_param(ptr))) |
320 | fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); | 393 | fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); |
@@ -330,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
330 | fwt_access.expiration = | 403 | fwt_access.expiration = |
331 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 404 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
332 | else | 405 | else |
333 | fwt_access.expiration = FWT_DEFAULT_EXPIRATION; | 406 | fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION); |
334 | 407 | ||
335 | if ((ptr = next_param(ptr))) | 408 | if ((ptr = next_param(ptr))) |
336 | fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); | 409 | fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); |
@@ -341,27 +414,29 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
341 | fwt_access.snr = | 414 | fwt_access.snr = |
342 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 415 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
343 | else | 416 | else |
344 | fwt_access.snr = FWT_DEFAULT_SNR; | 417 | fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR); |
345 | 418 | ||
346 | #ifdef DEBUG | 419 | #ifdef DEBUG |
347 | { | 420 | { |
348 | char ethaddr1_str[18], ethaddr2_str[18]; | 421 | char ethaddr1_str[18], ethaddr2_str[18]; |
349 | eth_addr2str(fwt_access.da, ethaddr1_str); | 422 | eth_addr2str(fwt_access.da, ethaddr1_str); |
350 | eth_addr2str(fwt_access.ra, ethaddr2_str); | 423 | eth_addr2str(fwt_access.ra, ethaddr2_str); |
351 | lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, | 424 | lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, |
352 | fwt_access.dir, ethaddr2_str); | 425 | fwt_access.dir, ethaddr2_str); |
353 | lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", | 426 | lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", |
354 | fwt_access.ssn, fwt_access.dsn, fwt_access.metric, | 427 | fwt_access.ssn, fwt_access.dsn, fwt_access.metric, |
355 | fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, | 428 | fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, |
356 | fwt_access.sleepmode, fwt_access.snr); | 429 | fwt_access.sleepmode, fwt_access.snr); |
357 | } | 430 | } |
358 | #endif | 431 | #endif |
359 | 432 | ||
360 | LEAVE(); | 433 | ret = libertas_prepare_and_send_command(priv, cmd_fwt_access, |
361 | return (libertas_prepare_and_send_command(priv, cmd_fwt_access, | 434 | cmd_act_fwt_access_add, |
362 | cmd_act_fwt_access_add, | 435 | cmd_option_waitforrsp, 0, |
363 | cmd_option_waitforrsp, 0, | 436 | (void *)&fwt_access); |
364 | (void *)&fwt_access)); | 437 | |
438 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
439 | return ret; | ||
365 | } | 440 | } |
366 | 441 | ||
367 | /** | 442 | /** |
@@ -376,8 +451,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
376 | char in_str[64]; | 451 | char in_str[64]; |
377 | static struct cmd_ds_fwt_access fwt_access; | 452 | static struct cmd_ds_fwt_access fwt_access; |
378 | char *ptr; | 453 | char *ptr; |
454 | int ret; | ||
455 | |||
456 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
379 | 457 | ||
380 | ENTER(); | ||
381 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 458 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
382 | return -EFAULT; | 459 | return -EFAULT; |
383 | 460 | ||
@@ -399,20 +476,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
399 | #ifdef DEBUG | 476 | #ifdef DEBUG |
400 | { | 477 | { |
401 | char ethaddr1_str[18], ethaddr2_str[18]; | 478 | char ethaddr1_str[18], ethaddr2_str[18]; |
402 | lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str); | 479 | lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str); |
403 | eth_addr2str(fwt_access.da, ethaddr1_str); | 480 | eth_addr2str(fwt_access.da, ethaddr1_str); |
404 | eth_addr2str(fwt_access.ra, ethaddr2_str); | 481 | eth_addr2str(fwt_access.ra, ethaddr2_str); |
405 | lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, | 482 | lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, |
406 | ethaddr2_str, fwt_access.dir); | 483 | ethaddr2_str, fwt_access.dir); |
407 | } | 484 | } |
408 | #endif | 485 | #endif |
409 | 486 | ||
410 | LEAVE(); | 487 | ret = libertas_prepare_and_send_command(priv, |
411 | return (libertas_prepare_and_send_command(priv, | 488 | cmd_fwt_access, |
412 | cmd_fwt_access, | 489 | cmd_act_fwt_access_del, |
413 | cmd_act_fwt_access_del, | 490 | cmd_option_waitforrsp, 0, |
414 | cmd_option_waitforrsp, 0, | 491 | (void *)&fwt_access); |
415 | (void *)&fwt_access)); | 492 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); |
493 | return ret; | ||
416 | } | 494 | } |
417 | 495 | ||
418 | 496 | ||
@@ -427,15 +505,18 @@ static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf) | |||
427 | buf += eth_addr2str(fwt_access.da, buf); | 505 | buf += eth_addr2str(fwt_access.da, buf); |
428 | buf += sprintf(buf, " "); | 506 | buf += sprintf(buf, " "); |
429 | buf += eth_addr2str(fwt_access.ra, buf); | 507 | buf += eth_addr2str(fwt_access.ra, buf); |
508 | buf += sprintf(buf, " %u", fwt_access.valid); | ||
430 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric)); | 509 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric)); |
431 | buf += sprintf(buf, " %u", fwt_access.dir); | 510 | buf += sprintf(buf, " %u", fwt_access.dir); |
511 | buf += sprintf(buf, " %u", fwt_access.rate); | ||
432 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn)); | 512 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn)); |
433 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn)); | 513 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn)); |
434 | buf += sprintf(buf, " %u", fwt_access.hopcount); | 514 | buf += sprintf(buf, " %u", fwt_access.hopcount); |
435 | buf += sprintf(buf, " %u", fwt_access.ttl); | 515 | buf += sprintf(buf, " %u", fwt_access.ttl); |
436 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration)); | 516 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration)); |
437 | buf += sprintf(buf, " %u", fwt_access.sleepmode); | 517 | buf += sprintf(buf, " %u", fwt_access.sleepmode); |
438 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.snr)); | 518 | buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr)); |
519 | buf += eth_addr2str(fwt_access.prec, buf); | ||
439 | } | 520 | } |
440 | 521 | ||
441 | /** | 522 | /** |
@@ -453,7 +534,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
453 | static char out_str[128]; | 534 | static char out_str[128]; |
454 | int ret; | 535 | int ret; |
455 | 536 | ||
456 | ENTER(); | 537 | lbs_deb_enter(LBS_DEB_IOCTL); |
538 | |||
457 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 539 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
458 | return -EFAULT; | 540 | return -EFAULT; |
459 | 541 | ||
@@ -465,9 +547,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
465 | #ifdef DEBUG | 547 | #ifdef DEBUG |
466 | { | 548 | { |
467 | char ethaddr1_str[18]; | 549 | char ethaddr1_str[18]; |
468 | lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str); | 550 | lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str); |
469 | eth_addr2str(fwt_access.da, ethaddr1_str); | 551 | eth_addr2str(fwt_access.da, ethaddr1_str); |
470 | lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); | 552 | lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); |
471 | } | 553 | } |
472 | #endif | 554 | #endif |
473 | 555 | ||
@@ -485,11 +567,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
485 | wrq->u.data.length = strlen(out_str); | 567 | wrq->u.data.length = strlen(out_str); |
486 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 568 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
487 | wrq->u.data.length)) { | 569 | wrq->u.data.length)) { |
488 | lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n"); | 570 | lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n"); |
489 | return -EFAULT; | 571 | return -EFAULT; |
490 | } | 572 | } |
491 | 573 | ||
492 | LEAVE(); | 574 | lbs_deb_leave(LBS_DEB_IOCTL); |
493 | return 0; | 575 | return 0; |
494 | } | 576 | } |
495 | 577 | ||
@@ -500,7 +582,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
500 | */ | 582 | */ |
501 | static int wlan_fwt_reset_ioctl(wlan_private * priv) | 583 | static int wlan_fwt_reset_ioctl(wlan_private * priv) |
502 | { | 584 | { |
503 | lbs_pr_debug(1, "FWT: resetting\n"); | 585 | lbs_deb_ioctl("FWT: resetting\n"); |
504 | 586 | ||
505 | return (libertas_prepare_and_send_command(priv, | 587 | return (libertas_prepare_and_send_command(priv, |
506 | cmd_fwt_access, | 588 | cmd_fwt_access, |
@@ -522,18 +604,21 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
522 | char *ptr = in_str; | 604 | char *ptr = in_str; |
523 | static char out_str[128]; | 605 | static char out_str[128]; |
524 | char *pbuf = out_str; | 606 | char *pbuf = out_str; |
525 | int ret; | 607 | int ret = 0; |
526 | 608 | ||
527 | ENTER(); | 609 | lbs_deb_enter(LBS_DEB_IOCTL); |
528 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 610 | |
529 | return -EFAULT; | 611 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) { |
612 | ret = -EFAULT; | ||
613 | goto out; | ||
614 | } | ||
530 | 615 | ||
531 | fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 616 | fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
532 | 617 | ||
533 | #ifdef DEBUG | 618 | #ifdef DEBUG |
534 | { | 619 | { |
535 | lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str); | 620 | lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str); |
536 | lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); | 621 | lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); |
537 | } | 622 | } |
538 | #endif | 623 | #endif |
539 | 624 | ||
@@ -549,12 +634,16 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
549 | wrq->u.data.length = strlen(out_str); | 634 | wrq->u.data.length = strlen(out_str); |
550 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 635 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
551 | wrq->u.data.length)) { | 636 | wrq->u.data.length)) { |
552 | lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n"); | 637 | lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n"); |
553 | return -EFAULT; | 638 | ret = -EFAULT; |
639 | goto out; | ||
554 | } | 640 | } |
555 | 641 | ||
556 | LEAVE(); | 642 | ret = 0; |
557 | return 0; | 643 | |
644 | out: | ||
645 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
646 | return ret; | ||
558 | } | 647 | } |
559 | 648 | ||
560 | /** | 649 | /** |
@@ -573,7 +662,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) | |||
573 | char *pbuf = out_str; | 662 | char *pbuf = out_str; |
574 | int ret; | 663 | int ret; |
575 | 664 | ||
576 | ENTER(); | 665 | lbs_deb_enter(LBS_DEB_IOCTL); |
666 | |||
577 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 667 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
578 | return -EFAULT; | 668 | return -EFAULT; |
579 | 669 | ||
@@ -581,8 +671,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) | |||
581 | 671 | ||
582 | #ifdef DEBUG | 672 | #ifdef DEBUG |
583 | { | 673 | { |
584 | lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str); | 674 | lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str); |
585 | lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); | 675 | lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); |
586 | } | 676 | } |
587 | #endif | 677 | #endif |
588 | 678 | ||
@@ -591,28 +681,18 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) | |||
591 | cmd_option_waitforrsp, 0, (void *)&fwt_access); | 681 | cmd_option_waitforrsp, 0, (void *)&fwt_access); |
592 | 682 | ||
593 | if (ret == 0) { | 683 | if (ret == 0) { |
594 | pbuf += sprintf(pbuf, " "); | 684 | print_route(fwt_access, pbuf); |
595 | pbuf += eth_addr2str(fwt_access.da, pbuf); | ||
596 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.metric)); | ||
597 | pbuf += sprintf(pbuf, " %u", fwt_access.dir); | ||
598 | /* note that the firmware returns the nid in the id field */ | ||
599 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.id)); | ||
600 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.ssn)); | ||
601 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.dsn)); | ||
602 | pbuf += sprintf(pbuf, " hop %u", fwt_access.hopcount); | ||
603 | pbuf += sprintf(pbuf, " ttl %u", fwt_access.ttl); | ||
604 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.expiration)); | ||
605 | } else | 685 | } else |
606 | pbuf += sprintf(pbuf, " (null)"); | 686 | pbuf += sprintf(pbuf, " (null)"); |
607 | 687 | ||
608 | wrq->u.data.length = strlen(out_str); | 688 | wrq->u.data.length = strlen(out_str); |
609 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 689 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
610 | wrq->u.data.length)) { | 690 | wrq->u.data.length)) { |
611 | lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n"); | 691 | lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n"); |
612 | return -EFAULT; | 692 | return -EFAULT; |
613 | } | 693 | } |
614 | 694 | ||
615 | LEAVE(); | 695 | lbs_deb_leave(LBS_DEB_IOCTL); |
616 | return 0; | 696 | return 0; |
617 | } | 697 | } |
618 | 698 | ||
@@ -632,7 +712,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) | |||
632 | char *pbuf = out_str; | 712 | char *pbuf = out_str; |
633 | int ret; | 713 | int ret; |
634 | 714 | ||
635 | ENTER(); | 715 | lbs_deb_enter(LBS_DEB_IOCTL); |
716 | |||
636 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 717 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
637 | return -EFAULT; | 718 | return -EFAULT; |
638 | 719 | ||
@@ -641,8 +722,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) | |||
641 | 722 | ||
642 | #ifdef DEBUG | 723 | #ifdef DEBUG |
643 | { | 724 | { |
644 | lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str); | 725 | lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str); |
645 | lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); | 726 | lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); |
646 | } | 727 | } |
647 | #endif | 728 | #endif |
648 | 729 | ||
@@ -663,11 +744,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) | |||
663 | wrq->u.data.length = strlen(out_str); | 744 | wrq->u.data.length = strlen(out_str); |
664 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 745 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
665 | wrq->u.data.length)) { | 746 | wrq->u.data.length)) { |
666 | lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n"); | 747 | lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n"); |
667 | return -EFAULT; | 748 | return -EFAULT; |
668 | } | 749 | } |
669 | 750 | ||
670 | LEAVE(); | 751 | lbs_deb_leave(LBS_DEB_IOCTL); |
671 | return 0; | 752 | return 0; |
672 | } | 753 | } |
673 | 754 | ||
@@ -684,9 +765,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) | |||
684 | static struct cmd_ds_fwt_access fwt_access; | 765 | static struct cmd_ds_fwt_access fwt_access; |
685 | int ret; | 766 | int ret; |
686 | 767 | ||
687 | ENTER(); | 768 | lbs_deb_enter(LBS_DEB_IOCTL); |
688 | 769 | ||
689 | lbs_pr_debug(1, "FWT: cleaning up\n"); | 770 | lbs_deb_ioctl("FWT: cleaning up\n"); |
690 | 771 | ||
691 | memset(&fwt_access, 0, sizeof(fwt_access)); | 772 | memset(&fwt_access, 0, sizeof(fwt_access)); |
692 | 773 | ||
@@ -700,7 +781,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) | |||
700 | else | 781 | else |
701 | return -EFAULT; | 782 | return -EFAULT; |
702 | 783 | ||
703 | LEAVE(); | 784 | lbs_deb_leave(LBS_DEB_IOCTL); |
704 | return 0; | 785 | return 0; |
705 | } | 786 | } |
706 | 787 | ||
@@ -716,9 +797,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) | |||
716 | static struct cmd_ds_fwt_access fwt_access; | 797 | static struct cmd_ds_fwt_access fwt_access; |
717 | int ret; | 798 | int ret; |
718 | 799 | ||
719 | ENTER(); | 800 | lbs_deb_enter(LBS_DEB_IOCTL); |
720 | 801 | ||
721 | lbs_pr_debug(1, "FWT: getting time\n"); | 802 | lbs_deb_ioctl("FWT: getting time\n"); |
722 | 803 | ||
723 | memset(&fwt_access, 0, sizeof(fwt_access)); | 804 | memset(&fwt_access, 0, sizeof(fwt_access)); |
724 | 805 | ||
@@ -732,7 +813,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) | |||
732 | else | 813 | else |
733 | return -EFAULT; | 814 | return -EFAULT; |
734 | 815 | ||
735 | LEAVE(); | 816 | lbs_deb_leave(LBS_DEB_IOCTL); |
736 | return 0; | 817 | return 0; |
737 | } | 818 | } |
738 | 819 | ||
@@ -748,7 +829,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) | |||
748 | struct cmd_ds_mesh_access mesh_access; | 829 | struct cmd_ds_mesh_access mesh_access; |
749 | int ret; | 830 | int ret; |
750 | 831 | ||
751 | ENTER(); | 832 | lbs_deb_enter(LBS_DEB_IOCTL); |
752 | 833 | ||
753 | memset(&mesh_access, 0, sizeof(mesh_access)); | 834 | memset(&mesh_access, 0, sizeof(mesh_access)); |
754 | 835 | ||
@@ -762,7 +843,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) | |||
762 | else | 843 | else |
763 | return -EFAULT; | 844 | return -EFAULT; |
764 | 845 | ||
765 | LEAVE(); | 846 | lbs_deb_leave(LBS_DEB_IOCTL); |
766 | return 0; | 847 | return 0; |
767 | } | 848 | } |
768 | 849 | ||
@@ -777,13 +858,13 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) | |||
777 | struct cmd_ds_mesh_access mesh_access; | 858 | struct cmd_ds_mesh_access mesh_access; |
778 | int ret; | 859 | int ret; |
779 | 860 | ||
780 | ENTER(); | 861 | lbs_deb_enter(LBS_DEB_IOCTL); |
781 | 862 | ||
782 | if( (ttl > 0xff) || (ttl < 0) ) | 863 | if( (ttl > 0xff) || (ttl < 0) ) |
783 | return -EINVAL; | 864 | return -EINVAL; |
784 | 865 | ||
785 | memset(&mesh_access, 0, sizeof(mesh_access)); | 866 | memset(&mesh_access, 0, sizeof(mesh_access)); |
786 | mesh_access.data[0] = ttl; | 867 | mesh_access.data[0] = cpu_to_le32(ttl); |
787 | 868 | ||
788 | ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, | 869 | ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, |
789 | cmd_act_mesh_set_ttl, | 870 | cmd_act_mesh_set_ttl, |
@@ -793,7 +874,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) | |||
793 | if (ret != 0) | 874 | if (ret != 0) |
794 | ret = -EFAULT; | 875 | ret = -EFAULT; |
795 | 876 | ||
796 | LEAVE(); | 877 | lbs_deb_leave(LBS_DEB_IOCTL); |
797 | return ret; | 878 | return ret; |
798 | } | 879 | } |
799 | 880 | ||
@@ -815,9 +896,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
815 | wlan_adapter *adapter = priv->adapter; | 896 | wlan_adapter *adapter = priv->adapter; |
816 | struct iwreq *wrq = (struct iwreq *)req; | 897 | struct iwreq *wrq = (struct iwreq *)req; |
817 | 898 | ||
818 | ENTER(); | 899 | lbs_deb_enter(LBS_DEB_IOCTL); |
819 | 900 | ||
820 | lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); | 901 | lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); |
821 | switch (cmd) { | 902 | switch (cmd) { |
822 | case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ | 903 | case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ |
823 | switch (wrq->u.data.flags) { | 904 | switch (wrq->u.data.flags) { |
@@ -848,6 +929,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
848 | ret = wlan_mesh_set_ttl_ioctl(priv, idata); | 929 | ret = wlan_mesh_set_ttl_ioctl(priv, idata); |
849 | break; | 930 | break; |
850 | 931 | ||
932 | case WLAN_SUBCMD_BT_SET_INVERT: | ||
933 | ret = wlan_bt_set_invert_ioctl(priv, req); | ||
934 | break ; | ||
935 | |||
851 | default: | 936 | default: |
852 | ret = -EOPNOTSUPP; | 937 | ret = -EOPNOTSUPP; |
853 | break; | 938 | break; |
@@ -905,6 +990,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
905 | ret = wlan_mesh_get_ttl_ioctl(priv, req); | 990 | ret = wlan_mesh_get_ttl_ioctl(priv, req); |
906 | break; | 991 | break; |
907 | 992 | ||
993 | case WLAN_SUBCMD_BT_GET_INVERT: | ||
994 | ret = wlan_bt_get_invert_ioctl(priv, req); | ||
995 | break ; | ||
996 | |||
908 | default: | 997 | default: |
909 | ret = -EOPNOTSUPP; | 998 | ret = -EOPNOTSUPP; |
910 | 999 | ||
@@ -937,7 +1026,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
937 | (data, wrq->u.data.pointer, | 1026 | (data, wrq->u.data.pointer, |
938 | sizeof(int) * | 1027 | sizeof(int) * |
939 | wrq->u.data.length)) { | 1028 | wrq->u.data.length)) { |
940 | lbs_pr_debug(1, | 1029 | lbs_deb_ioctl( |
941 | "Copy from user failed\n"); | 1030 | "Copy from user failed\n"); |
942 | return -EFAULT; | 1031 | return -EFAULT; |
943 | } | 1032 | } |
@@ -970,7 +1059,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
970 | if (copy_to_user(wrq->u.data.pointer, data, | 1059 | if (copy_to_user(wrq->u.data.pointer, data, |
971 | sizeof(int) * | 1060 | sizeof(int) * |
972 | gpio->header.len)) { | 1061 | gpio->header.len)) { |
973 | lbs_pr_debug(1, "Copy to user failed\n"); | 1062 | lbs_deb_ioctl("Copy to user failed\n"); |
974 | return -EFAULT; | 1063 | return -EFAULT; |
975 | } | 1064 | } |
976 | 1065 | ||
@@ -984,7 +1073,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
984 | ret = -EINVAL; | 1073 | ret = -EINVAL; |
985 | break; | 1074 | break; |
986 | } | 1075 | } |
987 | LEAVE(); | 1076 | |
1077 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
988 | return ret; | 1078 | return ret; |
989 | } | 1079 | } |
990 | 1080 | ||