1 /*******************************************************************************
3 * Wireless device driver for Linux (wlags49).
5 * Copyright (c) 1998-2003 Agere Systems Inc.
9 * Initially developed by TriplePoint, Inc.
10 * http://www.triplepoint.com
12 *------------------------------------------------------------------------------
14 * This file defines handling routines for the private IOCTLs
16 *------------------------------------------------------------------------------
20 * This software is provided subject to the following terms and conditions,
21 * which you should read carefully before using the software. Using this
22 * software indicates your acceptance of these terms and conditions. If you do
23 * not agree with these terms and conditions, do not use the software.
25 * Copyright © 2003 Agere Systems Inc.
26 * All rights reserved.
28 * Redistribution and use in source or binary forms, with or without
29 * modifications, are permitted provided that the following conditions are met:
31 * . Redistributions of source code must retain the above copyright notice, this
32 * list of conditions and the following Disclaimer as comments in the code as
33 * well as in the documentation and/or other materials provided with the
36 * . Redistributions in binary form must reproduce the above copyright notice,
37 * this list of conditions and the following Disclaimer in the documentation
38 * and/or other materials provided with the distribution.
40 * . Neither the name of Agere Systems Inc. nor the names of the contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED
\93AS IS
\94 AND ANY EXPRESS OR IMPLIED WARRANTIES,
47 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
48 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
49 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
50 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
51 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
52 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
53 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
54 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
56 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
59 ******************************************************************************/
61 /*******************************************************************************
63 ******************************************************************************/
64 #include <wl_version.h>
66 #include <linux/if_arp.h>
67 #include <linux/ioport.h>
68 #include <linux/slab.h>
69 #include <linux/delay.h>
70 #include <linux/uaccess.h>
77 #include <wl_internal.h>
82 #include <wl_netdev.h>
84 int wvlan_uil_connect(struct uilreq *urq, struct wl_private *lp);
85 int wvlan_uil_disconnect(struct uilreq *urq, struct wl_private *lp);
86 int wvlan_uil_action(struct uilreq *urq, struct wl_private *lp);
87 int wvlan_uil_block(struct uilreq *urq, struct wl_private *lp);
88 int wvlan_uil_unblock(struct uilreq *urq, struct wl_private *lp);
89 int wvlan_uil_send_diag_msg(struct uilreq *urq, struct wl_private *lp);
90 int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp);
91 int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp);
93 int cfg_driver_info(struct uilreq *urq, struct wl_private *lp);
94 int cfg_driver_identity(struct uilreq *urq, struct wl_private *lp);
97 /* If USE_UIL is not defined, then none of the UIL Interface code below will
98 be included in the build */
101 /*******************************************************************************
103 *******************************************************************************
107 * The handler function for the UIL interface.
111 * urq - a pointer to the UIL request buffer
112 * lp - a pointer to the device's private adapter structure
117 * errno value otherwise
119 ******************************************************************************/
120 int wvlan_uil(struct uilreq *urq, struct wl_private *lp)
124 switch (urq->command) {
125 case UIL_FUN_CONNECT:
126 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_CONNECT\n");
127 ioctl_ret = wvlan_uil_connect(urq, lp);
129 case UIL_FUN_DISCONNECT:
130 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_DISCONNECT\n");
131 ioctl_ret = wvlan_uil_disconnect(urq, lp);
134 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_ACTION\n");
135 ioctl_ret = wvlan_uil_action(urq, lp);
137 case UIL_FUN_SEND_DIAG_MSG:
138 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_SEND_DIAG_MSG\n");
139 ioctl_ret = wvlan_uil_send_diag_msg(urq, lp);
141 case UIL_FUN_GET_INFO:
142 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_GET_INFO\n");
143 ioctl_ret = wvlan_uil_get_info(urq, lp);
145 case UIL_FUN_PUT_INFO:
146 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_PUT_INFO\n");
147 ioctl_ret = wvlan_uil_put_info(urq, lp);
150 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- UNSUPPORTED UIL CODE: 0x%X", urq->command);
151 ioctl_ret = -EOPNOTSUPP;
156 /*============================================================================*/
161 /*******************************************************************************
162 * wvlan_uil_connect()
163 *******************************************************************************
167 * Connect to the UIL in order to make a request.
171 * urq - a pointer to the UIL request buffer
172 * lp - a pointer to the device's private adapter structure
177 * UIL_ERR_xxx value otherwise
179 ******************************************************************************/
180 int wvlan_uil_connect(struct uilreq *urq, struct wl_private *lp)
184 if (!(lp->flags & WVLAN2_UIL_CONNECTED)) {
185 lp->flags |= WVLAN2_UIL_CONNECTED;
186 urq->hcfCtx = &(lp->hcfCtx);
187 urq->result = UIL_SUCCESS;
189 DBG_WARNING(DbgInfo, "UIL_ERR_IN_USE\n");
190 urq->result = UIL_ERR_IN_USE;
194 } /* wvlan_uil_connect */
195 /*============================================================================*/
200 /*******************************************************************************
201 * wvlan_uil_disconnect()
202 *******************************************************************************
206 * Disconnect from the UIL after a request has been completed.
210 * urq - a pointer to the UIL request buffer
211 * lp - a pointer to the device's private adapter structure
216 * UIL_ERR_xxx value otherwise
218 ******************************************************************************/
219 int wvlan_uil_disconnect(struct uilreq *urq, struct wl_private *lp)
223 if (urq->hcfCtx == &(lp->hcfCtx)) {
224 if (lp->flags & WVLAN2_UIL_CONNECTED) {
225 lp->flags &= ~WVLAN2_UIL_CONNECTED;
227 if (lp->flags & WVLAN2_UIL_BUSY) {
228 lp->flags &= ~WVLAN2_UIL_BUSY;
229 netif_start_queue(lp->dev);
235 urq->result = UIL_SUCCESS;
237 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
238 urq->result = UIL_ERR_WRONG_IFB;
242 } /* wvlan_uil_disconnect */
243 /*============================================================================*/
248 /*******************************************************************************
250 *******************************************************************************
254 * Handler for the UIL_ACT_xxx subcodes associated with UIL_FUN_ACTION
258 * urq - a pointer to the UIL request buffer
259 * lp - a pointer to the device's private adapter structure
264 * UIL_ERR_xxx value otherwise
266 ******************************************************************************/
267 int wvlan_uil_action(struct uilreq *urq, struct wl_private *lp)
272 if (urq->hcfCtx == &(lp->hcfCtx)) {
273 /* Make sure there's an LTV in the request buffer */
274 ltv = (ltv_t *)urq->data;
276 /* Switch on the Type field of the LTV contained in the request
280 DBG_TRACE(DbgInfo, "UIL_ACT_BLOCK\n");
281 result = wvlan_uil_block(urq, lp);
283 case UIL_ACT_UNBLOCK:
284 DBG_TRACE(DbgInfo, "UIL_ACT_UNBLOCK\n");
285 result = wvlan_uil_unblock(urq, lp);
288 DBG_TRACE(DbgInfo, "UIL_ACT_SCAN\n");
289 urq->result = hcf_action(&(lp->hcfCtx), MDD_ACT_SCAN);
292 DBG_TRACE(DbgInfo, "UIL_ACT_APPLY\n");
293 urq->result = wl_apply(lp);
296 DBG_TRACE(DbgInfo, "UIL_ACT_RESET\n");
297 urq->result = wl_go(lp);
300 DBG_WARNING(DbgInfo, "Unknown action code: 0x%x\n", ltv->typ);
304 DBG_ERROR(DbgInfo, "Bad LTV for this action\n");
305 urq->result = UIL_ERR_LEN;
308 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
309 urq->result = UIL_ERR_WRONG_IFB;
313 } /* wvlan_uil_action */
314 /*============================================================================*/
319 /*******************************************************************************
321 *******************************************************************************
325 * Sets a block in the driver to prevent access to the card by other
330 * urq - a pointer to the UIL request buffer
331 * lp - a pointer to the device's private adapter structure
336 * UIL_ERR_xxx value otherwise
338 ******************************************************************************/
340 int wvlan_uil_block(struct uilreq *urq, struct wl_private *lp)
344 if (urq->hcfCtx == &(lp->hcfCtx)) {
345 if (capable(CAP_NET_ADMIN)) {
346 lp->flags |= WVLAN2_UIL_BUSY;
347 netif_stop_queue(lp->dev);
348 WL_WDS_NETIF_STOP_QUEUE(lp);
349 urq->result = UIL_SUCCESS;
351 DBG_ERROR(DbgInfo, "EPERM\n");
352 urq->result = UIL_FAILURE;
356 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
357 urq->result = UIL_ERR_WRONG_IFB;
361 } /* wvlan_uil_block */
362 /*============================================================================*/
367 /*******************************************************************************
368 * wvlan_uil_unblock()
369 *******************************************************************************
373 * Unblocks the driver to restore access to the card by other processes.
377 * urq - a pointer to the UIL request buffer
378 * lp - a pointer to the device's private adapter structure
383 * UIL_ERR_xxx value otherwise
385 ******************************************************************************/
386 int wvlan_uil_unblock(struct uilreq *urq, struct wl_private *lp)
390 if (urq->hcfCtx == &(lp->hcfCtx)) {
391 if (capable(CAP_NET_ADMIN)) {
392 if (lp->flags & WVLAN2_UIL_BUSY) {
393 lp->flags &= ~WVLAN2_UIL_BUSY;
394 netif_wake_queue(lp->dev);
395 WL_WDS_NETIF_WAKE_QUEUE(lp);
398 DBG_ERROR(DbgInfo, "EPERM\n");
399 urq->result = UIL_FAILURE;
403 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
404 urq->result = UIL_ERR_WRONG_IFB;
408 } /* wvlan_uil_unblock */
409 /*============================================================================*/
414 /*******************************************************************************
415 * wvlan_uil_send_diag_msg()
416 *******************************************************************************
420 * Sends a diagnostic message to the card.
424 * urq - a pointer to the UIL request buffer
425 * lp - a pointer to the device's private adapter structure
430 * UIL_ERR_xxx value otherwise
432 ******************************************************************************/
433 int wvlan_uil_send_diag_msg(struct uilreq *urq, struct wl_private *lp)
438 if (urq->hcfCtx == &(lp->hcfCtx)) {
439 if (capable(CAP_NET_ADMIN)) {
440 if ((urq->data != NULL) && (urq->len != 0)) {
441 if (lp->hcfCtx.IFB_RscInd != 0) {
444 /* Verify the user buffer */
445 result = verify_area(VERIFY_READ, urq->data, urq->len);
447 DBG_ERROR(DbgInfo, "verify_area failed, result: %d\n", result);
448 urq->result = UIL_FAILURE;
452 data = kmalloc(urq->len, GFP_KERNEL);
454 memset(Descp, 0, sizeof(DESC_STRCT));
455 memcpy(data, urq->data, urq->len);
457 Descp[0].buf_addr = (wci_bufp)data;
458 Descp[0].BUF_CNT = urq->len;
459 Descp[0].next_desc_addr = 0; /* terminate list */
461 hcf_send_msg(&(lp->hcfCtx), &Descp[0], HCF_PORT_0);
464 DBG_ERROR(DbgInfo, "ENOMEM\n");
465 urq->result = UIL_FAILURE;
471 urq->result = UIL_ERR_BUSY;
475 urq->result = UIL_FAILURE;
478 DBG_ERROR(DbgInfo, "EPERM\n");
479 urq->result = UIL_FAILURE;
483 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
484 urq->result = UIL_ERR_WRONG_IFB;
488 } /* wvlan_uil_send_diag_msg */
489 /*============================================================================*/
492 /*******************************************************************************
493 * wvlan_uil_put_info()
494 *******************************************************************************
498 * Sends a specific RID directly to the driver to set configuration info.
502 * urq - a pointer to the UIL request buffer
503 * lp - a pointer to the device's private adapter structure
508 * UIL_ERR_xxx value otherwise
510 ******************************************************************************/
511 int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp)
515 bool_t ltvAllocated = FALSE;
516 ENCSTRCT sEncryption;
520 hcf_16 hcfPort = HCF_PORT_0;
523 if (urq->hcfCtx == &(lp->hcfCtx)) {
524 if (capable(CAP_NET_ADMIN)) {
525 if ((urq->data != NULL) && (urq->len != 0)) {
526 /* Make sure that we have at least a command and length to send. */
527 if (urq->len < (sizeof(hcf_16) * 2)) {
528 urq->len = sizeof(lp->ltvRecord);
529 urq->result = UIL_ERR_LEN;
530 DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n");
531 DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
535 /* Verify the user buffer */
536 result = verify_area(VERIFY_READ, urq->data, urq->len);
538 urq->result = UIL_FAILURE;
539 DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n");
543 /* Get only the command and length information. */
544 copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2);
546 /* Make sure the incoming LTV record length is within the bounds of the
548 if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) {
549 urq->len = sizeof(lp->ltvRecord);
550 urq->result = UIL_ERR_LEN;
551 DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
555 /* If the requested length is greater than the size of our local
556 LTV record, try to allocate it from the kernel stack.
557 Otherwise, we just use our local LTV record. */
558 if (urq->len > sizeof(lp->ltvRecord)) {
559 pLtv = kmalloc(urq->len, GFP_KERNEL);
563 DBG_ERROR(DbgInfo, "Alloc FAILED\n");
564 urq->len = sizeof(lp->ltvRecord);
565 urq->result = UIL_ERR_LEN;
570 pLtv = &(lp->ltvRecord);
573 /* Copy the data from the user's buffer into the local LTV
575 copy_from_user(pLtv, urq->data, urq->len);
578 /* We need to snoop the commands to see if there is anything we
579 need to store for the purposes of a reset or start/stop
580 sequence. Perform endian translation as needed */
582 case CFG_CNF_PORT_TYPE:
583 lp->PortType = pLtv->u.u16[0];
584 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
586 case CFG_CNF_OWN_MAC_ADDR:
587 /* TODO: determine if we are going to store anything based on this */
589 case CFG_CNF_OWN_CHANNEL:
590 lp->Channel = pLtv->u.u16[0];
591 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
593 /* CFG_CNF_OWN_SSID currently same as CNF_DESIRED_SSID. Do we
594 need separate storage for this? */
595 /* case CFG_CNF_OWN_SSID: */
596 case CFG_CNF_OWN_ATIM_WINDOW:
597 lp->atimWindow = pLtv->u.u16[0];
598 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
600 case CFG_CNF_SYSTEM_SCALE:
601 lp->DistanceBetweenAPs = pLtv->u.u16[0];
602 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
604 case CFG_CNF_MAX_DATA_LEN:
605 /* TODO: determine if we are going to store anything based
608 case CFG_CNF_PM_ENABLED:
609 lp->PMEnabled = pLtv->u.u16[0];
610 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
612 case CFG_CNF_MCAST_RX:
613 lp->MulticastReceive = pLtv->u.u16[0];
614 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
616 case CFG_CNF_MAX_SLEEP_DURATION:
617 lp->MaxSleepDuration = pLtv->u.u16[0];
618 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
620 case CFG_CNF_HOLDOVER_DURATION:
621 lp->holdoverDuration = pLtv->u.u16[0];
622 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
624 case CFG_CNF_OWN_NAME:
625 memset(lp->StationName, 0, sizeof(lp->StationName));
626 len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName));
627 strlcpy(lp->StationName, &pLtv->u.u8[2], len);
628 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
630 case CFG_CNF_LOAD_BALANCING:
631 lp->loadBalancing = pLtv->u.u16[0];
632 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
634 case CFG_CNF_MEDIUM_DISTRIBUTION:
635 lp->mediumDistribution = pLtv->u.u16[0];
636 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
639 case CFG_CNF_TX_POW_LVL:
640 lp->txPowLevel = pLtv->u.u16[0];
641 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
643 /* case CFG_CNF_SHORT_RETRY_LIMIT: */ /* Short Retry Limit */
644 /* case 0xFC33: */ /* Long Retry Limit */
645 case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */
646 lp->srsc[0] = pLtv->u.u16[0];
647 lp->srsc[1] = pLtv->u.u16[1];
648 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
649 pLtv->u.u16[1] = CNV_INT_TO_LITTLE(pLtv->u.u16[1]);
651 case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */
652 lp->brsc[0] = pLtv->u.u16[0];
653 lp->brsc[1] = pLtv->u.u16[1];
654 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
655 pLtv->u.u16[1] = CNV_INT_TO_LITTLE(pLtv->u.u16[1]);
657 case CFG_CNF_CONNECTION_CNTL:
658 lp->connectionControl = pLtv->u.u16[0];
659 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
661 /* case CFG_PROBE_DATA_RATE: */
662 #endif /* HERMES25 */
664 #if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */
665 /* ;?should we restore this to allow smaller memory footprint */
667 case CFG_CNF_OWN_DTIM_PERIOD:
668 lp->DTIMPeriod = pLtv->u.u16[0];
669 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
672 case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */
673 lp->ownBeaconInterval = pLtv->u.u16[0];
674 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
677 case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence behavior */
678 lp->coexistence = pLtv->u.u16[0];
679 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
682 case CFG_CNF_WDS_ADDR1:
683 memcpy(&lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
684 hcfPort = HCF_PORT_1;
686 case CFG_CNF_WDS_ADDR2:
687 memcpy(&lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
688 hcfPort = HCF_PORT_2;
690 case CFG_CNF_WDS_ADDR3:
691 memcpy(&lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
692 hcfPort = HCF_PORT_3;
694 case CFG_CNF_WDS_ADDR4:
695 memcpy(&lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
696 hcfPort = HCF_PORT_4;
698 case CFG_CNF_WDS_ADDR5:
699 memcpy(&lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
700 hcfPort = HCF_PORT_5;
702 case CFG_CNF_WDS_ADDR6:
703 memcpy(&lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
704 hcfPort = HCF_PORT_6;
708 case CFG_CNF_MCAST_PM_BUF:
709 lp->multicastPMBuffering = pLtv->u.u16[0];
710 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
712 case CFG_CNF_REJECT_ANY:
713 lp->RejectAny = pLtv->u.u16[0];
714 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
718 case CFG_CNF_ENCRYPTION:
719 lp->EnableEncryption = pLtv->u.u16[0];
720 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
722 case CFG_CNF_AUTHENTICATION:
723 lp->authentication = pLtv->u.u16[0];
724 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
726 #if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */
727 /* ;?should we restore this to allow smaller memory footprint */
729 /* case CFG_CNF_EXCL_UNENCRYPTED:
730 lp->ExcludeUnencrypted = pLtv->u.u16[0];
731 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
733 case CFG_CNF_MCAST_RATE:
734 /* TODO: determine if we are going to store anything based on this */
736 case CFG_CNF_INTRA_BSS_RELAY:
737 lp->intraBSSRelay = pLtv->u.u16[0];
738 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
742 case CFG_CNF_MICRO_WAVE:
743 /* TODO: determine if we are going to store anything based on this */
745 /*case CFG_CNF_LOAD_BALANCING:*/
746 /* TODO: determine if we are going to store anything based on this */
748 /* case CFG_CNF_MEDIUM_DISTRIBUTION: */
749 /* TODO: determine if we are going to store anything based on this */
751 /* case CFG_CNF_RX_ALL_GROUP_ADDRESS: */
752 /* TODO: determine if we are going to store anything based on this */
754 /* case CFG_CNF_COUNTRY_INFO: */
755 /* TODO: determine if we are going to store anything based on this */
757 case CFG_CNF_OWN_SSID:
758 /* case CNF_DESIRED_SSID: */
759 case CFG_DESIRED_SSID:
760 memset(lp->NetworkName, 0, sizeof(lp->NetworkName));
761 memcpy((void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
762 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
764 /* take care of the special network name "ANY" case */
765 if ((strlen(&pLtv->u.u8[2]) == 0) ||
766 (strcmp(&pLtv->u.u8[2], "ANY") == 0) ||
767 (strcmp(&pLtv->u.u8[2], "any") == 0)) {
768 /* set the SSID_STRCT llen field (u16[0]) to zero, and the
769 effectually null the string u8[2] */
775 /* TODO: determine if we are going to store anything based on this */
777 case CFG_CREATE_IBSS:
778 lp->CreateIBSS = pLtv->u.u16[0];
779 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
782 lp->RTSThreshold = pLtv->u.u16[0];
783 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
785 case CFG_TX_RATE_CNTL:
786 lp->TxRateControl[0] = pLtv->u.u16[0];
787 lp->TxRateControl[1] = pLtv->u.u16[1];
788 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
789 pLtv->u.u16[1] = CNV_INT_TO_LITTLE(pLtv->u.u16[1]);
791 case CFG_PROMISCUOUS_MODE:
792 /* TODO: determine if we are going to store anything based on this */
794 /* case CFG_WAKE_ON_LAN: */
795 /* TODO: determine if we are going to store anything based on this */
797 #if 1 /* ;? #if (HCF_TYPE) & HCF_TYPE_AP */
798 /* ;?should we restore this to allow smaller memory footprint */
800 lp->RTSThreshold = pLtv->u.u16[0];
801 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
803 case CFG_TX_RATE_CNTL0:
804 /*;?no idea what this should be, get going so comment it out lp->TxRateControl = pLtv->u.u16[0];*/
805 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
809 lp->wds_port[0].rtsThreshold = pLtv->u.u16[0];
810 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
811 hcfPort = HCF_PORT_1;
814 lp->wds_port[1].rtsThreshold = pLtv->u.u16[0];
815 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
816 hcfPort = HCF_PORT_2;
819 lp->wds_port[2].rtsThreshold = pLtv->u.u16[0];
820 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
821 hcfPort = HCF_PORT_3;
824 lp->wds_port[3].rtsThreshold = pLtv->u.u16[0];
825 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
826 hcfPort = HCF_PORT_4;
829 lp->wds_port[4].rtsThreshold = pLtv->u.u16[0];
830 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
831 hcfPort = HCF_PORT_5;
834 lp->wds_port[5].rtsThreshold = pLtv->u.u16[0];
835 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
836 hcfPort = HCF_PORT_6;
838 case CFG_TX_RATE_CNTL1:
839 lp->wds_port[0].txRateCntl = pLtv->u.u16[0];
840 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
841 hcfPort = HCF_PORT_1;
843 case CFG_TX_RATE_CNTL2:
844 lp->wds_port[1].txRateCntl = pLtv->u.u16[0];
845 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
846 hcfPort = HCF_PORT_2;
848 case CFG_TX_RATE_CNTL3:
849 lp->wds_port[2].txRateCntl = pLtv->u.u16[0];
850 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
851 hcfPort = HCF_PORT_3;
853 case CFG_TX_RATE_CNTL4:
854 lp->wds_port[3].txRateCntl = pLtv->u.u16[0];
855 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
856 hcfPort = HCF_PORT_4;
858 case CFG_TX_RATE_CNTL5:
859 lp->wds_port[4].txRateCntl = pLtv->u.u16[0];
860 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
861 hcfPort = HCF_PORT_5;
863 case CFG_TX_RATE_CNTL6:
864 lp->wds_port[5].txRateCntl = pLtv->u.u16[0];
865 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
866 hcfPort = HCF_PORT_6;
869 #endif /* (HCF_TYPE) & HCF_TYPE_AP */
871 case CFG_DEFAULT_KEYS:
873 CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv;
875 pKeys->key[0].len = CNV_INT_TO_LITTLE(pKeys->key[0].len);
876 pKeys->key[1].len = CNV_INT_TO_LITTLE(pKeys->key[1].len);
877 pKeys->key[2].len = CNV_INT_TO_LITTLE(pKeys->key[2].len);
878 pKeys->key[3].len = CNV_INT_TO_LITTLE(pKeys->key[3].len);
880 memcpy((void *)&(lp->DefaultKeys), (void *)pKeys,
881 sizeof(CFG_DEFAULT_KEYS_STRCT));
885 lp->TransmitKeyID = pLtv->u.u16[0];
886 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
889 /* TODO: determine if we are going to store anything based on this */
892 /* TODO: determine if we are going to store anything based on this */
894 /* these RIDS are Info RIDs, and should they be allowed for puts??? */
895 case CFG_MAX_LOAD_TIME:
897 /* case CFG_HSI_SUP_RANGE: */
898 case CFG_NIC_SERIAL_NUMBER:
899 case CFG_NIC_IDENTITY:
900 case CFG_NIC_MFI_SUP_RANGE:
901 case CFG_NIC_CFI_SUP_RANGE:
902 case CFG_NIC_TEMP_TYPE:
903 case CFG_NIC_PROFILE:
904 case CFG_FW_IDENTITY:
905 case CFG_FW_SUP_RANGE:
906 case CFG_MFI_ACT_RANGES_STA:
907 case CFG_CFI_ACT_RANGES_STA:
911 case CFG_COMMS_QUALITY:
912 case CFG_CUR_TX_RATE:
913 case CFG_CUR_BEACON_INTERVAL:
914 case CFG_CUR_SCALE_THRH:
915 case CFG_PROTOCOL_RSP_TIME:
916 case CFG_CUR_SHORT_RETRY_LIMIT:
917 case CFG_CUR_LONG_RETRY_LIMIT:
918 case CFG_MAX_TX_LIFETIME:
919 case CFG_MAX_RX_LIFETIME:
920 case CFG_CF_POLLABLE:
921 case CFG_AUTHENTICATION_ALGORITHMS:
922 case CFG_PRIVACY_OPT_IMPLEMENTED:
923 /* case CFG_CURRENT_REMOTE_RATES: */
924 /* case CFG_CURRENT_USED_RATES: */
925 /* case CFG_CURRENT_SYSTEM_SCALE: */
926 /* case CFG_CURRENT_TX_RATE1: */
927 /* case CFG_CURRENT_TX_RATE2: */
928 /* case CFG_CURRENT_TX_RATE3: */
929 /* case CFG_CURRENT_TX_RATE4: */
930 /* case CFG_CURRENT_TX_RATE5: */
931 /* case CFG_CURRENT_TX_RATE6: */
932 case CFG_NIC_MAC_ADDR:
934 /* case CFG_CURRENT_COUNTRY_INFO: */
936 case CFG_CUR_CHANNEL:
937 /* case CFG_CURRENT_POWER_STATE: */
938 /* case CFG_CCAMODE: */
939 case CFG_SUPPORTED_DATA_RATES:
942 /*;? lp->DownloadFirmware = (pLtv->u.u16[0]) + 1; */
943 DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported\n");
945 case CFG_ENCRYPT_STRING:
946 /* TODO: ENDIAN TRANSLATION HERE??? */
947 memset(lp->szEncryption, 0, sizeof(lp->szEncryption));
948 memcpy((void *)lp->szEncryption, (void *)&pLtv->u.u8[0],
949 (pLtv->len * sizeof(hcf_16)));
950 wl_wep_decode(CRYPT_CODE, &sEncryption,
953 /* the Linux driver likes to use 1-4 for the key IDs, and then
954 convert to 0-3 when sending to the card. The Windows code
955 base used 0-3 in the API DLL, which was ported to Linux. For
956 the sake of the user experience, we decided to keep 0-3 as the
957 numbers used in the DLL; and will perform the +1 conversion here.
958 We could have converted the entire Linux driver, but this is
959 less obtrusive. This may be a "todo" to convert the whole driver */
960 lp->TransmitKeyID = sEncryption.wTxKeyID + 1;
961 lp->EnableEncryption = sEncryption.wEnabled;
963 memcpy(&lp->DefaultKeys, &sEncryption.EncStr,
964 sizeof(CFG_DEFAULT_KEYS_STRCT));
966 /*case CFG_COUNTRY_STRING:
967 memset(lp->countryString, 0, sizeof(lp->countryString));
968 memcpy((void *)lp->countryString, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
972 case CFG_DRIVER_ENABLE:
973 lp->driverEnable = pLtv->u.u16[0];
974 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
976 case CFG_WOLAS_ENABLE:
977 lp->wolasEnable = pLtv->u.u16[0];
978 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
980 case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE:
981 lp->AuthKeyMgmtSuite = pLtv->u.u16[0];
982 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
984 case CFG_DISASSOCIATE_ADDR:
985 pLtv->u.u16[ETH_ALEN / 2] = CNV_INT_TO_LITTLE(pLtv->u.u16[ETH_ALEN / 2]);
987 case CFG_ADD_TKIP_DEFAULT_KEY:
988 case CFG_REMOVE_TKIP_DEFAULT_KEY:
989 /* Endian convert the Tx Key Information */
990 pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]);
992 case CFG_ADD_TKIP_MAPPED_KEY:
994 case CFG_REMOVE_TKIP_MAPPED_KEY:
996 /* some RIDs just can't be put */
1003 /* This code will prevent Static Configuration Entities from
1004 being sent to the card, as they require a call to
1005 UIL_ACT_APPLY to take effect. Dynamic Entities will be sent
1007 switch (pLtv->typ) {
1008 case CFG_CNF_PORT_TYPE:
1009 case CFG_CNF_OWN_MAC_ADDR:
1010 case CFG_CNF_OWN_CHANNEL:
1011 case CFG_CNF_OWN_SSID:
1012 case CFG_CNF_OWN_ATIM_WINDOW:
1013 case CFG_CNF_SYSTEM_SCALE:
1014 case CFG_CNF_MAX_DATA_LEN:
1015 case CFG_CNF_PM_ENABLED:
1016 case CFG_CNF_MCAST_RX:
1017 case CFG_CNF_MAX_SLEEP_DURATION:
1018 case CFG_CNF_HOLDOVER_DURATION:
1019 case CFG_CNF_OWN_NAME:
1020 case CFG_CNF_LOAD_BALANCING:
1021 case CFG_CNF_MEDIUM_DISTRIBUTION:
1023 case CFG_CNF_TX_POW_LVL:
1024 case CFG_CNF_CONNECTION_CNTL:
1025 /*case CFG_PROBE_DATA_RATE: */
1026 #endif /* HERMES25 */
1027 #if 1 /*;? (HCF_TYPE) & HCF_TYPE_AP */
1028 /*;?should we restore this to allow smaller memory footprint */
1029 case CFG_CNF_OWN_DTIM_PERIOD:
1031 case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */
1034 case CFG_CNF_WDS_ADDR1:
1035 case CFG_CNF_WDS_ADDR2:
1036 case CFG_CNF_WDS_ADDR3:
1037 case CFG_CNF_WDS_ADDR4:
1038 case CFG_CNF_WDS_ADDR5:
1039 case CFG_CNF_WDS_ADDR6:
1041 case CFG_CNF_MCAST_PM_BUF:
1042 case CFG_CNF_REJECT_ANY:
1045 case CFG_CNF_ENCRYPTION:
1046 case CFG_CNF_AUTHENTICATION:
1047 #if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */
1048 /* ;?should we restore this to allow smaller memory footprint */
1050 case CFG_CNF_EXCL_UNENCRYPTED:
1051 case CFG_CNF_MCAST_RATE:
1052 case CFG_CNF_INTRA_BSS_RELAY:
1055 case CFG_CNF_MICRO_WAVE:
1056 /* case CFG_CNF_LOAD_BALANCING: */
1057 /* case CFG_CNF_MEDIUM_DISTRIBUTION: */
1058 /* case CFG_CNF_RX_ALL_GROUP_ADDRESS: */
1059 /* case CFG_CNF_COUNTRY_INFO: */
1060 /* case CFG_COUNTRY_STRING: */
1062 case CFG_ENCRYPT_STRING:
1063 /* case CFG_DRIVER_ENABLE: */
1064 case CFG_WOLAS_ENABLE:
1068 /* Deal with this dynamic MSF RID, as it's required for WPA */
1069 case CFG_DRIVER_ENABLE:
1070 if (lp->driverEnable) {
1071 hcf_cntl(&(lp->hcfCtx), HCF_CNTL_ENABLE | HCF_PORT_0);
1072 hcf_cntl(&(lp->hcfCtx), HCF_CNTL_CONNECT);
1074 hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISABLE | HCF_PORT_0);
1075 hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISCONNECT);
1080 urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
1088 urq->result = UIL_FAILURE;
1091 DBG_ERROR(DbgInfo, "EPERM\n");
1092 urq->result = UIL_FAILURE;
1096 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
1097 urq->result = UIL_ERR_WRONG_IFB;
1101 } /* wvlan_uil_put_info */
1103 /*============================================================================*/
1105 /*******************************************************************************
1106 * wvlan_uil_get_info()
1107 *******************************************************************************
1111 * Sends a specific RID directly to the driver to retrieve configuration
1116 * urq - a pointer to the UIL request buffer
1117 * lp - a pointer to the device's private adapter structure
1122 * UIL_ERR_xxx value otherwise
1124 ******************************************************************************/
1125 int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp)
1130 if (urq->hcfCtx == &(lp->hcfCtx)) {
1131 if ((urq->data != NULL) && (urq->len != 0)) {
1133 bool_t ltvAllocated = FALSE;
1135 /* Make sure that we have at least a command and length */
1136 if (urq->len < (sizeof(hcf_16) * 2)) {
1137 urq->len = sizeof(lp->ltvRecord);
1138 DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n");
1139 DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
1140 urq->result = UIL_ERR_LEN;
1144 /* Verify the user's LTV record header. */
1145 result = verify_area(VERIFY_READ, urq->data, sizeof(hcf_16) * 2);
1147 DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n");
1148 urq->result = UIL_FAILURE;
1152 /* Get only the command and length information. */
1153 result = copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2);
1155 /* Make sure the incoming LTV record length is within the bounds of
1156 the IOCTL length. */
1157 if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) {
1158 DBG_ERROR(DbgInfo, "Incoming LTV too big\n");
1159 urq->len = sizeof(lp->ltvRecord);
1160 urq->result = UIL_ERR_LEN;
1164 /* Determine if hcf_get_info() is needed or not */
1165 switch (lp->ltvRecord.typ) {
1166 case CFG_NIC_IDENTITY:
1167 memcpy(&lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof(lp->NICIdentity));
1169 case CFG_PRI_IDENTITY:
1170 memcpy(&lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof(lp->PrimaryIdentity));
1173 DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported, so is get useful ????\n");
1174 lp->ltvRecord.u.u16[0] =
1175 CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP;
1177 /* case CFG_DRV_INFO: */
1178 case CFG_ENCRYPT_STRING:
1179 case CFG_COUNTRY_STRING:
1180 case CFG_DRIVER_ENABLE:
1181 case CFG_WOLAS_ENABLE:
1182 /* TODO: determine if we're going to support these */
1183 urq->result = UIL_FAILURE;
1186 DBG_TRACE(DbgInfo, "Intercept CFG_DRV_INFO\n");
1187 result = cfg_driver_info(urq, lp);
1189 case CFG_DRV_IDENTITY:
1190 DBG_TRACE(DbgInfo, "Intercept CFG_DRV_IDENTITY\n");
1191 result = cfg_driver_identity(urq, lp);
1194 /* IFB can be a security hole */
1195 if (!capable(CAP_NET_ADMIN)) {
1200 /* Else fall through to the default */
1202 case CFG_FW_IDENTITY: /* For Hermes-1, this is cached */
1205 /* Verify the user buffer */
1206 result = verify_area(VERIFY_WRITE, urq->data, urq->len);
1208 DBG_ERROR(DbgInfo, "verify_area(), VERIFY_WRITE FAILED\n");
1209 urq->result = UIL_FAILURE;
1213 /* If the requested length is greater than the size of our local
1214 LTV record, try to allocate it from the kernel stack.
1215 Otherwise, we just use our local LTV record. */
1216 if (urq->len > sizeof(lp->ltvRecord)) {
1217 pLtv = kmalloc(urq->len, GFP_KERNEL);
1219 ltvAllocated = TRUE;
1221 /* Copy the command/length information into the new buffer. */
1222 memcpy(pLtv, &(lp->ltvRecord), sizeof(hcf_16) * 2);
1224 urq->len = sizeof(lp->ltvRecord);
1225 urq->result = UIL_ERR_LEN;
1226 DBG_ERROR(DbgInfo, "kmalloc FAILED\n");
1227 DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
1232 pLtv = &(lp->ltvRecord);
1236 urq->result = hcf_get_info(&(lp->hcfCtx), (LTVP) pLtv);
1239 /* Copy the LTV into the user's buffer. */
1240 /*copy_to_user(urq->data, pLtv, urq->len); */
1247 /* urq->result = UIL_SUCCESS; */
1251 /* Handle endian conversion of special fields */
1252 switch (lp->ltvRecord.typ) {
1253 /* simple int gets just need the first hcf_16 byte flipped */
1254 case CFG_CNF_PORT_TYPE:
1255 case CFG_CNF_OWN_CHANNEL:
1256 case CFG_CNF_OWN_ATIM_WINDOW:
1257 case CFG_CNF_SYSTEM_SCALE:
1258 case CFG_CNF_MAX_DATA_LEN:
1259 case CFG_CNF_PM_ENABLED:
1260 case CFG_CNF_MCAST_RX:
1261 case CFG_CNF_MAX_SLEEP_DURATION:
1262 case CFG_CNF_HOLDOVER_DURATION:
1263 case CFG_CNF_OWN_DTIM_PERIOD:
1264 case CFG_CNF_MCAST_PM_BUF:
1265 case CFG_CNF_REJECT_ANY:
1266 case CFG_CNF_ENCRYPTION:
1267 case CFG_CNF_AUTHENTICATION:
1268 case CFG_CNF_EXCL_UNENCRYPTED:
1269 case CFG_CNF_INTRA_BSS_RELAY:
1270 case CFG_CNF_MICRO_WAVE:
1271 case CFG_CNF_LOAD_BALANCING:
1272 case CFG_CNF_MEDIUM_DISTRIBUTION:
1274 case CFG_CNF_TX_POW_LVL:
1275 case CFG_CNF_CONNECTION_CNTL:
1276 case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */
1277 case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence Behavior */
1278 /*case CFG_CNF_RX_ALL_GROUP_ADDRESS: */
1279 #endif /* HERMES25 */
1280 case CFG_CREATE_IBSS:
1282 case CFG_PROMISCUOUS_MODE:
1283 /*case CFG_WAKE_ON_LAN: */
1291 case CFG_TX_RATE_CNTL0:
1292 case CFG_TX_RATE_CNTL1:
1293 case CFG_TX_RATE_CNTL2:
1294 case CFG_TX_RATE_CNTL3:
1295 case CFG_TX_RATE_CNTL4:
1296 case CFG_TX_RATE_CNTL5:
1297 case CFG_TX_RATE_CNTL6:
1300 case CFG_MAX_LOAD_TIME:
1301 case CFG_NIC_TEMP_TYPE:
1303 case CFG_CUR_TX_RATE:
1304 case CFG_CUR_BEACON_INTERVAL:
1305 case CFG_PROTOCOL_RSP_TIME:
1306 case CFG_CUR_SHORT_RETRY_LIMIT:
1307 case CFG_CUR_LONG_RETRY_LIMIT:
1308 case CFG_MAX_TX_LIFETIME:
1309 case CFG_MAX_RX_LIFETIME:
1310 case CFG_CF_POLLABLE:
1311 case CFG_PRIVACY_OPT_IMPLEMENTED:
1312 /* case CFG_CURRENT_REMOTE_RATES: */
1313 /* case CFG_CURRENT_USED_RATES: */
1314 /* case CFG_CURRENT_SYSTEM_SCALE: */
1315 /* case CFG_CURRENT_TX_RATE1: */
1316 /* case CFG_CURRENT_TX_RATE2: */
1317 /* case CFG_CURRENT_TX_RATE3: */
1318 /* case CFG_CURRENT_TX_RATE4: */
1319 /* case CFG_CURRENT_TX_RATE5: */
1320 /* case CFG_CURRENT_TX_RATE6: */
1322 case CFG_CUR_CHANNEL:
1323 /* case CFG_CURRENT_POWER_STATE: */
1324 /* case CFG_CCAMODE: */
1325 /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); */
1327 /* name string gets just need the first hcf_16 byte flipped (length of string) */
1328 case CFG_CNF_OWN_SSID:
1329 case CFG_CNF_OWN_NAME:
1330 /* case CNF_DESIRED_SSID: */
1331 case CFG_DESIRED_SSID:
1334 lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]);
1336 /* non-length counted strings need no byte flipping */
1337 case CFG_CNF_OWN_MAC_ADDR:
1338 /* this case is no longer valid: CFG_CNF_WDS_ADDR */
1339 case CFG_CNF_WDS_ADDR1:
1340 case CFG_CNF_WDS_ADDR2:
1341 case CFG_CNF_WDS_ADDR3:
1342 case CFG_CNF_WDS_ADDR4:
1343 case CFG_CNF_WDS_ADDR5:
1344 case CFG_CNF_WDS_ADDR6:
1345 case CFG_GROUP_ADDR:
1346 case CFG_NIC_SERIAL_NUMBER:
1348 case CFG_NIC_MAC_ADDR:
1349 case CFG_SUPPORTED_DATA_RATES: /* need to ensure we can treat this as a string */
1351 /* case CFG_CNF_COUNTRY_INFO: */ /* special case, see page 75 of 022486, Rev C. */
1352 /* case CFG_CURRENT_COUNTRY_INFO: */ /* special case, see page 101 of 022486, Rev C. */
1354 lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]);
1355 lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]);
1357 for(i = 4; i < lp->ltvRecord.len; i++) {
1358 lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]);
1363 case CFG_DEFAULT_KEYS:
1365 CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)&lp->ltvRecord.u.u8[0];
1367 pKeys[0].len = CNV_INT_TO_LITTLE(pKeys[0].len);
1368 pKeys[1].len = CNV_INT_TO_LITTLE(pKeys[1].len);
1369 pKeys[2].len = CNV_INT_TO_LITTLE(pKeys[2].len);
1370 pKeys[3].len = CNV_INT_TO_LITTLE(pKeys[3].len);
1373 case CFG_CNF_MCAST_RATE:
1374 case CFG_TX_RATE_CNTL:
1375 case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */
1376 case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */
1377 lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]);
1378 lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]);
1381 case CFG_NIC_IDENTITY:
1382 case CFG_COMMS_QUALITY:
1384 lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]);
1385 lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]);
1386 lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]);
1388 case CFG_FW_IDENTITY:
1389 lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]);
1390 lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]);
1391 lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]);
1392 lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]);
1394 /* case CFG_HSI_SUP_RANGE: */
1395 case CFG_NIC_MFI_SUP_RANGE:
1396 case CFG_NIC_CFI_SUP_RANGE:
1397 case CFG_NIC_PROFILE:
1398 case CFG_FW_SUP_RANGE:
1399 lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]);
1400 lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]);
1401 lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]);
1402 lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]);
1403 lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[4]);
1405 case CFG_MFI_ACT_RANGES_STA:
1406 case CFG_CFI_ACT_RANGES_STA:
1407 case CFG_CUR_SCALE_THRH:
1408 case CFG_AUTHENTICATION_ALGORITHMS:
1409 for (i = 0; i < (lp->ltvRecord.len - 1); i++)
1410 lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]);
1412 /* done at init time, and endian handled then */
1413 case CFG_PRI_IDENTITY:
1416 /* wvlanEndianTranslateMailbox(pLtv); */
1418 /* MSF and HCF RIDS */
1422 case CFG_ENCRYPT_STRING:
1423 case CFG_COUNTRY_STRING:
1424 case CFG_DRIVER_ENABLE:
1425 case CFG_WOLAS_ENABLE:
1430 /* Copy the LTV into the user's buffer. */
1431 copy_to_user(urq->data, &(lp->ltvRecord), urq->len);
1434 kfree(&(lp->ltvRecord));
1435 urq->result = UIL_SUCCESS;
1437 urq->result = UIL_FAILURE;
1440 DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
1441 urq->result = UIL_ERR_WRONG_IFB;
1445 } /* wvlan_uil_get_info */
1446 /*============================================================================*/
1452 /*******************************************************************************
1454 *******************************************************************************
1458 * Retrieves driver information.
1462 * urq - a pointer to the UIL request buffer
1463 * lp - a pointer to the device's private adapter structure
1468 * UIL_ERR_xxx value otherwise
1470 ******************************************************************************/
1471 int cfg_driver_info(struct uilreq *urq, struct wl_private *lp)
1475 /* Make sure that user buffer can handle the driver information buffer */
1476 if (urq->len < sizeof(lp->driverInfo)) {
1477 urq->len = sizeof(lp->driverInfo);
1478 urq->result = UIL_ERR_LEN;
1482 /* Verify the user buffer. */
1483 result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverInfo));
1485 urq->result = UIL_FAILURE;
1489 lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat;
1491 /* Copy the driver information into the user's buffer. */
1492 urq->result = UIL_SUCCESS;
1493 copy_to_user(urq->data, &(lp->driverInfo), sizeof(lp->driverInfo));
1496 } /* cfg_driver_info */
1497 /*============================================================================*/
1502 /*******************************************************************************
1503 * cfg_driver_identity()
1504 *******************************************************************************
1508 * Retrieves ID information from the card.
1512 * urq - a pointer to the UIL request buffer
1513 * lp - a pointer to the device's private adapter structure
1518 * UIL_ERR_xxx value otherwise
1520 ******************************************************************************/
1521 int cfg_driver_identity(struct uilreq *urq, struct wl_private *lp)
1525 /* Make sure that user buffer can handle the driver identity structure. */
1526 if (urq->len < sizeof(lp->driverIdentity)) {
1527 urq->len = sizeof(lp->driverIdentity);
1528 urq->result = UIL_ERR_LEN;
1532 /* Verify the user buffer. */
1533 result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverIdentity));
1535 urq->result = UIL_FAILURE;
1539 /* Copy the driver identity into the user's buffer. */
1540 urq->result = UIL_SUCCESS;
1541 copy_to_user(urq->data, &(lp->driverIdentity), sizeof(lp->driverIdentity));
1544 } /* cfg_driver_identity */
1545 /*============================================================================*/
1548 #endif /* USE_UIL */
1551 /* If WIRELESS_EXT is not defined, then the functions that follow will not be
1552 included in the build. */
1553 /* NOTE: Are these still even needed? */
1557 /*******************************************************************************
1558 * wvlan_set_netname()
1559 *******************************************************************************
1563 * Set the ESSID of the card.
1567 * wrq - a pointer to the wireless request buffer
1568 * lp - a pointer to the device's private adapter structure
1573 * errno value otherwise
1575 ******************************************************************************/
1576 int wvlan_set_netname(struct net_device *dev,
1577 struct iw_request_info *info,
1578 union iwreq_data *wrqu,
1581 struct wl_private *lp = wl_priv(dev);
1582 unsigned long flags;
1585 wl_lock(lp, &flags);
1587 memset(lp->NetworkName, 0, sizeof(lp->NetworkName));
1588 memcpy(lp->NetworkName, extra, wrqu->data.length);
1590 /* Commit the adapter parameters */
1592 wl_unlock(lp, &flags);
1595 } /* wvlan_set_netname */
1596 /*============================================================================*/
1601 /*******************************************************************************
1602 * wvlan_get_netname()
1603 *******************************************************************************
1607 * Get the ESSID of the card.
1611 * wrq - a pointer to the wireless request buffer
1612 * lp - a pointer to the device's private adapter structure
1617 * errno value otherwise
1619 ******************************************************************************/
1620 int wvlan_get_netname(struct net_device *dev,
1621 struct iw_request_info *info,
1622 union iwreq_data *wrqu,
1625 struct wl_private *lp = wl_priv(dev);
1626 unsigned long flags;
1631 wl_lock(lp, &flags);
1633 /* Get the current network name */
1634 lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16));
1635 lp->ltvRecord.typ = CFG_CUR_SSID;
1637 status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord));
1639 if (status == HCF_SUCCESS) {
1640 pName = (wvName_t *)&(lp->ltvRecord.u.u32);
1642 memset(extra, '\0', HCF_MAX_NAME_LEN);
1643 wrqu->data.length = pName->length;
1645 memcpy(extra, pName->name, pName->length);
1650 wl_unlock(lp, &flags);
1653 } /* wvlan_get_netname */
1654 /*============================================================================*/
1659 /*******************************************************************************
1660 * wvlan_set_station_nickname()
1661 *******************************************************************************
1665 * Set the card's station nickname.
1669 * wrq - a pointer to the wireless request buffer
1670 * lp - a pointer to the device's private adapter structure
1675 * errno value otherwise
1677 ******************************************************************************/
1678 int wvlan_set_station_nickname(struct net_device *dev,
1679 struct iw_request_info *info,
1680 union iwreq_data *wrqu,
1683 struct wl_private *lp = wl_priv(dev);
1684 unsigned long flags;
1688 wl_lock(lp, &flags);
1690 memset(lp->StationName, 0, sizeof(lp->StationName));
1691 len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName));
1692 strlcpy(lp->StationName, extra, len);
1694 /* Commit the adapter parameters */
1696 wl_unlock(lp, &flags);
1699 } /* wvlan_set_station_nickname */
1700 /*============================================================================*/
1705 /*******************************************************************************
1706 * wvlan_get_station_nickname()
1707 *******************************************************************************
1711 * Get the card's station nickname.
1715 * wrq - a pointer to the wireless request buffer
1716 * lp - a pointer to the device's private adapter structure
1721 * errno value otherwise
1723 ******************************************************************************/
1724 int wvlan_get_station_nickname(struct net_device *dev,
1725 struct iw_request_info *info,
1726 union iwreq_data *wrqu,
1729 struct wl_private *lp = wl_priv(dev);
1730 unsigned long flags;
1735 wl_lock(lp, &flags);
1737 /* Get the current station name */
1738 lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16));
1739 lp->ltvRecord.typ = CFG_CNF_OWN_NAME;
1741 status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord));
1743 if (status == HCF_SUCCESS) {
1744 pName = (wvName_t *)&(lp->ltvRecord.u.u32);
1746 memset(extra, '\0', HCF_MAX_NAME_LEN);
1747 wrqu->data.length = pName->length;
1748 memcpy(extra, pName->name, pName->length);
1753 wl_unlock(lp, &flags);
1757 } /* wvlan_get_station_nickname */
1758 /*============================================================================*/
1763 /*******************************************************************************
1764 * wvlan_set_porttype()
1765 *******************************************************************************
1769 * Set the card's porttype
1773 * wrq - a pointer to the wireless request buffer
1774 * lp - a pointer to the device's private adapter structure
1779 * errno value otherwise
1781 ******************************************************************************/
1782 int wvlan_set_porttype(struct net_device *dev,
1783 struct iw_request_info *info,
1784 union iwreq_data *wrqu,
1787 struct wl_private *lp = wl_priv(dev);
1788 unsigned long flags;
1792 wl_lock(lp, &flags);
1794 /* Validate the new value */
1795 portType = *((__u32 *)extra);
1797 if (!((portType == 1) || (portType == 3))) {
1802 lp->PortType = portType;
1804 /* Commit the adapter parameters */
1808 wl_unlock(lp, &flags);
1814 /*============================================================================*/
1817 /*******************************************************************************
1818 * wvlan_get_porttype()
1819 *******************************************************************************
1823 * Get the card's porttype
1827 * wrq - a pointer to the wireless request buffer
1828 * lp - a pointer to the device's private adapter structure
1833 * errno value otherwise
1835 ******************************************************************************/
1836 int wvlan_get_porttype(struct net_device *dev,
1837 struct iw_request_info *info,
1838 union iwreq_data *wrqu,
1841 struct wl_private *lp = wl_priv(dev);
1842 unsigned long flags;
1846 __u32 *pData = (__u32 *)extra;
1848 wl_lock(lp, &flags);
1850 /* Get the current port type */
1851 lp->ltvRecord.len = 1 + (sizeof(*pPortType) / sizeof(hcf_16));
1852 lp->ltvRecord.typ = CFG_CNF_PORT_TYPE;
1854 status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord));
1856 if (status == HCF_SUCCESS) {
1857 pPortType = (hcf_16 *)&(lp->ltvRecord.u.u32);
1859 *pData = CNV_LITTLE_TO_INT(*pPortType);
1864 wl_unlock(lp, &flags);
1868 } /* wvlan_get_porttype */
1869 /*============================================================================*/
1871 #endif /* WIRELESS_EXT */
1877 /*******************************************************************************
1879 *******************************************************************************
1883 * IOCTL handler for RTS commands
1887 * rrq - a pointer to the rts request buffer
1888 * lp - a pointer to the device's private adapter structure
1893 * errno value otherwise
1895 ******************************************************************************/
1896 int wvlan_rts(struct rtsreq *rrq, __u32 io_base)
1900 DBG_PRINT("io_base: 0x%08x\n", io_base);
1903 case WL_IOCTL_RTS_READ:
1904 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_READ\n");
1905 rrq->data[0] = IN_PORT_WORD(io_base + rrq->reg);
1906 DBG_TRACE(DbgInfo, " reg 0x%04x ==> 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0]));
1908 case WL_IOCTL_RTS_WRITE:
1909 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_WRITE\n");
1910 OUT_PORT_WORD(io_base + rrq->reg, rrq->data[0]);
1911 DBG_TRACE(DbgInfo, " reg 0x%04x <== 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0]));
1913 case WL_IOCTL_RTS_BATCH_READ:
1914 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_READ\n");
1915 IN_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len);
1916 DBG_TRACE(DbgInfo, " reg 0x%04x ==> %d bytes\n", rrq->reg, rrq->len * sizeof(__u16));
1918 case WL_IOCTL_RTS_BATCH_WRITE:
1919 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_WRITE\n");
1920 OUT_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len);
1921 DBG_TRACE(DbgInfo, " reg 0x%04x <== %d bytes\n", rrq->reg, rrq->len * sizeof(__u16));
1925 DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- UNSUPPORTED RTS CODE: 0x%X", rrq->typ);
1926 ioctl_ret = -EOPNOTSUPP;
1932 /*============================================================================*/
1934 #endif /* USE_RTS */