blob: b8c96cf18de5806c89b31d9bb39fd9a839557203 [file] [log] [blame]
Henk de Groot68c0bdf2009-09-27 11:12:52 +02001/*******************************************************************************
2 * Agere Systems Inc.
3 * Wireless device driver for Linux (wlags49).
4 *
5 * Copyright (c) 1998-2003 Agere Systems Inc.
6 * All rights reserved.
7 * http://www.agere.com
8 *
9 * Initially developed by TriplePoint, Inc.
10 * http://www.triplepoint.com
11 *
12 *------------------------------------------------------------------------------
13 *
14 * This file defines routines required to parse configuration parameters
15 * listed in a config file, if that config file exists.
16 *
17 *------------------------------------------------------------------------------
18 *
19 * SOFTWARE LICENSE
20 *
21 * This software is provided subject to the following terms and conditions,
22 * which you should read carefully before using the software. Using this
23 * software indicates your acceptance of these terms and conditions. If you do
24 * not agree with these terms and conditions, do not use the software.
25 *
Al Virod36b6912011-12-29 17:09:01 -050026 * Copyright © 2003 Agere Systems Inc.
Henk de Groot68c0bdf2009-09-27 11:12:52 +020027 * All rights reserved.
28 *
29 * Redistribution and use in source or binary forms, with or without
30 * modifications, are permitted provided that the following conditions are met:
31 *
32 * . Redistributions of source code must retain the above copyright notice, this
33 * list of conditions and the following Disclaimer as comments in the code as
34 * well as in the documentation and/or other materials provided with the
35 * distribution.
36 *
37 * . Redistributions in binary form must reproduce the above copyright notice,
38 * this list of conditions and the following Disclaimer in the documentation
39 * and/or other materials provided with the distribution.
40 *
41 * . Neither the name of Agere Systems Inc. nor the names of the contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * Disclaimer
46 *
Al Virod36b6912011-12-29 17:09:01 -050047 * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
Henk de Groot68c0bdf2009-09-27 11:12:52 +020048 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
49 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
50 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
51 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
52 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
53 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
55 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
57 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
58 * DAMAGE.
59 *
60 ******************************************************************************/
61
Henk de Groot68c0bdf2009-09-27 11:12:52 +020062/* Only include this file if USE_PROFILE is defined */
63#ifdef USE_PROFILE
64
65
66
67
68/*******************************************************************************
69 * constant definitions
70 ******************************************************************************/
71
72
73/* Allow support for calling system fcns to parse config file */
74#define __KERNEL_SYSCALLS__
75
76
77
78
79/*******************************************************************************
80 * include files
81 ******************************************************************************/
82#include <wl_version.h>
83
84#include <linux/netdevice.h>
85#include <linux/etherdevice.h>
86#include <linux/unistd.h>
87#include <asm/uaccess.h>
88#include <limits.h>
89
90#define BIN_DL 1
91
92#include <debug.h>
93#include <hcf.h>
Prashant P. Shah801de522010-05-10 22:18:24 +053094/* #include <hcfdef.h> */
Henk de Groot68c0bdf2009-09-27 11:12:52 +020095
96#include <wl_if.h>
97#include <wl_internal.h>
98#include <wl_util.h>
99#include <wl_enc.h>
100#include <wl_main.h>
101#include <wl_profile.h>
102
103
104/*******************************************************************************
105 * global variables
106 ******************************************************************************/
107
108/* Definition needed to prevent unresolved external in unistd.h */
109static int errno;
110
111#if DBG
112extern p_u32 DebugFlag;
113extern dbg_info_t *DbgInfo;
114#endif
115
Prashant P. Shahd101b952010-05-09 22:41:16 +0530116int parse_yes_no(char *value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200117
118
Prashant P. Shahd101b952010-05-09 22:41:16 +0530119int parse_yes_no(char *value)
120{
Prashant P. Shah801de522010-05-10 22:18:24 +0530121int rc = 0; /* default to NO for invalid parameters */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200122
Prashant P. Shahd101b952010-05-09 22:41:16 +0530123 if (strlen(value) == 1) {
124 if ((value[0] | ('Y'^'y')) == 'y')
125 rc = 1;
Prashant P. Shah801de522010-05-10 22:18:24 +0530126 /* } else { */
127 /* this should not be debug time info, it is an enduser data entry error ;? */
128 /* DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MICROWAVE_ROBUSTNESS); */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200129 }
130 return rc;
Prashant P. Shah801de522010-05-10 22:18:24 +0530131} /* parse_yes_no */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200132
133
134/*******************************************************************************
135 * parse_config()
136 *******************************************************************************
137 *
138 * DESCRIPTION:
139 *
140 * This function opens the device's config file and parses the options from
141 * it, so that it can properly configure itself. If no configuration file
142 * or configuration is present, then continue to use the options already
143 * parsed from config.opts or wireless.opts.
144 *
145 * PARAMETERS:
146 *
147 * dev - a pointer to the device's net_device structure
148 *
149 * RETURNS:
150 *
151 * N/A
152 *
153 ******************************************************************************/
Prashant P. Shahd101b952010-05-09 22:41:16 +0530154void parse_config(struct net_device *dev)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200155{
156 int file_desc;
Prashant P. Shah801de522010-05-10 22:18:24 +0530157#if 0 /* BIN_DL */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530158 int rc;
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200159 char *cp = NULL;
Prashant P. Shah801de522010-05-10 22:18:24 +0530160#endif /* BIN_DL */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200161 char buffer[MAX_LINE_SIZE];
162 char filename[MAX_LINE_SIZE];
163 mm_segment_t fs;
164 struct wl_private *wvlan_config = NULL;
165 ENCSTRCT sEncryption;
166 /*------------------------------------------------------------------------*/
167
Prashant P. Shahd101b952010-05-09 22:41:16 +0530168 DBG_FUNC("parse_config");
169 DBG_ENTER(DbgInfo);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200170
171 /* Get the wavelan specific info for this device */
Kulikov Vasiliy82942ca2010-06-29 14:16:33 +0400172 wvlan_config = dev->priv;
Prashant P. Shahd101b952010-05-09 22:41:16 +0530173 if (wvlan_config == NULL) {
174 DBG_ERROR(DbgInfo, "Wavelan specific info struct not present?\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200175 return;
176 }
177
178 /* setup the default encryption string */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530179 strcpy(wvlan_config->szEncryption, DEF_CRYPT_STR);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200180
181 /* Obtain a user-space process context, storing the original context */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530182 fs = get_fs();
183 set_fs(get_ds());
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200184
185 /* Determine the filename for this device and attempt to open it */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530186 sprintf(filename, "%s%s", ROOT_CONFIG_FILENAME, dev->name);
187 file_desc = open(filename, O_RDONLY, 0);
188 if (file_desc != -1) {
189 DBG_TRACE(DbgInfo, "Wireless config file found. Parsing options...\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200190
191 /* Read out the options */
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530192 while (readline(file_desc, buffer))
Prashant P. Shahd101b952010-05-09 22:41:16 +0530193 translate_option(buffer, wvlan_config);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200194 /* Close the file */
Prashant P. Shah801de522010-05-10 22:18:24 +0530195 close(file_desc); /* ;?even if file_desc == -1 ??? */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200196 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530197 DBG_TRACE(DbgInfo, "No iwconfig file found for this device; "
198 "config.opts or wireless.opts will be used\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200199 }
200 /* Return to the original context */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530201 set_fs(fs);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200202
203 /* convert the WEP keys, if read in as key1, key2, type of data */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530204 if (wvlan_config->EnableEncryption) {
205 memset(&sEncryption, 0, sizeof(sEncryption));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200206
Prashant P. Shahd101b952010-05-09 22:41:16 +0530207 wl_wep_decode(CRYPT_CODE, &sEncryption,
208 wvlan_config->szEncryption);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200209
210 /* the Linux driver likes to use 1-4 for the key IDs, and then
211 convert to 0-3 when sending to the card. The Windows code
212 base used 0-3 in the API DLL, which was ported to Linux. For
213 the sake of the user experience, we decided to keep 0-3 as the
214 numbers used in the DLL; and will perform the +1 conversion here.
215 We could have converted the entire Linux driver, but this is
216 less obtrusive. This may be a "todo" to convert the whole driver */
217 sEncryption.wEnabled = wvlan_config->EnableEncryption;
218 sEncryption.wTxKeyID = wvlan_config->TransmitKeyID - 1;
219
Prashant P. Shahd101b952010-05-09 22:41:16 +0530220 memcpy(&sEncryption.EncStr, &wvlan_config->DefaultKeys,
221 sizeof(CFG_DEFAULT_KEYS_STRCT));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200222
Prashant P. Shahd101b952010-05-09 22:41:16 +0530223 memset(wvlan_config->szEncryption, 0, sizeof(wvlan_config->szEncryption));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200224
Prashant P. Shahd101b952010-05-09 22:41:16 +0530225 wl_wep_code(CRYPT_CODE, wvlan_config->szEncryption, &sEncryption,
226 sizeof(sEncryption));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200227 }
228
229 /* decode the encryption string for the call to wl_commit() */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530230 wl_wep_decode(CRYPT_CODE, &sEncryption, wvlan_config->szEncryption);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200231
232 wvlan_config->TransmitKeyID = sEncryption.wTxKeyID + 1;
233 wvlan_config->EnableEncryption = sEncryption.wEnabled;
234
Prashant P. Shahd101b952010-05-09 22:41:16 +0530235 memcpy(&wvlan_config->DefaultKeys, &sEncryption.EncStr,
236 sizeof(CFG_DEFAULT_KEYS_STRCT));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200237
Prashant P. Shah801de522010-05-10 22:18:24 +0530238#if 0 /* BIN_DL */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200239 /* Obtain a user-space process context, storing the original context */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530240 fs = get_fs();
241 set_fs(get_ds());
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200242
Prashant P. Shah801de522010-05-10 22:18:24 +0530243 /* ;?just to fake something */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530244 strcpy(/*wvlan_config->fw_image_*/filename, "/etc/agere/fw.bin");
245 file_desc = open(/*wvlan_config->fw_image_*/filename, 0, 0);
246 if (file_desc == -1) {
247 DBG_ERROR(DbgInfo, "No image file found\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200248 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530249 DBG_TRACE(DbgInfo, "F/W image file found\n");
Prashant P. Shah801de522010-05-10 22:18:24 +0530250#define DHF_ALLOC_SIZE 96000 /* just below 96K, let's hope it suffices for now and for the future */
Jesper Juhl5ef3df52010-11-09 00:10:44 +0100251 cp = vmalloc(DHF_ALLOC_SIZE);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530252 if (cp == NULL) {
253 DBG_ERROR(DbgInfo, "error in vmalloc\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200254 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530255 rc = read(file_desc, cp, DHF_ALLOC_SIZE);
256 if (rc == DHF_ALLOC_SIZE) {
257 DBG_ERROR(DbgInfo, "buffer too small, %d\n", DHF_ALLOC_SIZE);
258 } else if (rc > 0) {
259 DBG_TRACE(DbgInfo, "read O.K.: %d bytes %.12s\n", rc, cp);
260 rc = read(file_desc, &cp[rc], 1);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530261 if (rc == 0)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530262 DBG_TRACE(DbgInfo, "no more to read\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200263 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530264 if (rc != 0) {
265 DBG_ERROR(DbgInfo, "file not read in one swoop or other error"\
266 ", give up, too complicated, rc = %0X\n", rc);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200267 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530268 vfree(cp);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200269 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530270 close(file_desc);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200271 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530272 set_fs(fs); /* Return to the original context */
Prashant P. Shah801de522010-05-10 22:18:24 +0530273#endif /* BIN_DL */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200274
Prashant P. Shahd101b952010-05-09 22:41:16 +0530275 DBG_LEAVE(DbgInfo);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200276 return;
Prashant P. Shah801de522010-05-10 22:18:24 +0530277} /* parse_config */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200278
279/*******************************************************************************
280 * readline()
281 *******************************************************************************
282 *
283 * DESCRIPTION:
284 *
285 * This function reads in data from a given file one line at a time,
286 * converting the detected newline character '\n' to a null '\0'. Note that
287 * the file descriptor must be valid before calling this function.
288 *
289 * PARAMETERS:
290 *
291 * filedesc - the file descriptor for the open configuration file
292 * buffer - a buffer pointer, passed in by the caller, to which the
293 * line will be stored.
294 *
295 * RETURNS:
296 *
297 * the number of bytes read
298 * -1 on error
299 *
300 ******************************************************************************/
Prashant P. Shahd101b952010-05-09 22:41:16 +0530301int readline(int filedesc, char *buffer)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200302{
303 int result = -1;
304 int bytes_read = 0;
305 /*------------------------------------------------------------------------*/
306
307 /* Make sure the file descriptor is good */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530308 if (filedesc != -1) {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200309 /* Read in from the file byte by byte until a newline is reached */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530310 while ((result = read(filedesc, &buffer[bytes_read], 1)) == 1) {
311 if (buffer[bytes_read] == '\n') {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200312 buffer[bytes_read] = '\0';
313 bytes_read++;
314 break;
315 }
316 bytes_read++;
317 }
318 }
319
320 /* Return the number of bytes read */
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530321 if (result == -1)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200322 return result;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530323 else
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200324 return bytes_read;
Prashant P. Shah801de522010-05-10 22:18:24 +0530325} /* readline */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200326/*============================================================================*/
327
328/*******************************************************************************
329 * translate_option()
330 *******************************************************************************
331 *
332 * DESCRIPTION:
333 *
334 * This function takes a line read in from the config file and parses out
335 * the key/value pairs. It then determines which key has been parsed and sets
336 * the card's configuration based on the value given.
337 *
338 * PARAMETERS:
339 *
340 * buffer - a buffer containing a line to translate
341 * config - a pointer to the device's private adapter structure
342 *
343 * RETURNS:
344 *
345 * N/A
346 *
347 ******************************************************************************/
Prashant P. Shahd101b952010-05-09 22:41:16 +0530348void translate_option(char *buffer, struct wl_private *lp)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200349{
350 unsigned int value_convert = 0;
351 int string_length = 0;
352 char *key = NULL;
353 char *value = NULL;
354 u_char mac_value[ETH_ALEN];
355 /*------------------------------------------------------------------------*/
356
Prashant P. Shahd101b952010-05-09 22:41:16 +0530357 DBG_FUNC("translate_option");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200358
Prashant P. Shahd101b952010-05-09 22:41:16 +0530359 if (buffer == NULL || lp == NULL) {
360 DBG_ERROR(DbgInfo, "Config file buffer and/or wavelan buffer ptr NULL\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200361 return;
362 }
363
Prashant P. Shahd101b952010-05-09 22:41:16 +0530364 ParseConfigLine(buffer, &key, &value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200365
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530366 if (key == NULL || value == NULL)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200367 return;
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200368
369 /* Determine which key it is and perform the appropriate action */
370
371 /* Configuration parameters used in all scenarios */
372#if DBG
373 /* handle DebugFlag as early as possible so it starts its influence as early
374 * as possible
375 */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530376 if (strcmp(key, PARM_NAME_DEBUG_FLAG) == 0) {
377 if (DebugFlag == ~0) { /* if DebugFlag is not specified on the command line */
378 if (DbgInfo->DebugFlag == 0) { /* if pc_debug did not set DebugFlag (i.e.pc_debug is
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200379 * not specified or specified outside the 4-8 range
380 */
381 DbgInfo->DebugFlag |= DBG_DEFAULTS;
382 }
383 } else {
Prashant P. Shah801de522010-05-10 22:18:24 +0530384 DbgInfo->DebugFlag = simple_strtoul(value, NULL, 0); /* ;?DebugFlag; */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200385 }
Prashant P. Shah801de522010-05-10 22:18:24 +0530386 DbgInfo->DebugFlag = simple_strtoul(value, NULL, 0); /* ;?Delete ASAP */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200387 }
388#endif /* DBG */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530389 if (strcmp(key, PARM_NAME_AUTH_KEY_MGMT_SUITE) == 0) {
390 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_AUTH_KEY_MGMT_SUITE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200391
Andy Shevchenko9f648592010-01-14 15:07:23 +0200392 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530393 if ((value_convert >= PARM_MIN_AUTH_KEY_MGMT_SUITE) || (value_convert <= PARM_MAX_AUTH_KEY_MGMT_SUITE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200394 lp->AuthKeyMgmtSuite = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530395 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530396 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTH_KEY_MGMT_SUITE);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530397 } else if (strcmp(key, PARM_NAME_BRSC_2GHZ) == 0) {
398 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_2GHZ, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200399
Andy Shevchenko9f648592010-01-14 15:07:23 +0200400 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530401 if ((value_convert >= PARM_MIN_BRSC) || (value_convert <= PARM_MAX_BRSC))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200402 lp->brsc[0] = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530403 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530404 DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_2GHZ);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530405 } else if (strcmp(key, PARM_NAME_BRSC_5GHZ) == 0) {
406 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_5GHZ, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200407
Andy Shevchenko9f648592010-01-14 15:07:23 +0200408 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530409 if ((value_convert >= PARM_MIN_BRSC) || (value_convert <= PARM_MAX_BRSC))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200410 lp->brsc[1] = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530411 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530412 DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_5GHZ);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530413 } else if ((strcmp(key, PARM_NAME_DESIRED_SSID) == 0) || (strcmp(key, PARM_NAME_OWN_SSID) == 0)) {
414 DBG_TRACE(DbgInfo, "SSID, value: %s\n", value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200415
Prashant P. Shahd101b952010-05-09 22:41:16 +0530416 memset(lp->NetworkName, 0, (PARM_MAX_NAME_LEN + 1));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200417
418 /* Make sure the value isn't too long */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530419 string_length = strlen(value);
420 if (string_length > PARM_MAX_NAME_LEN) {
421 DBG_WARNING(DbgInfo, "SSID too long; will be truncated\n");
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200422 string_length = PARM_MAX_NAME_LEN;
423 }
424
Prashant P. Shahd101b952010-05-09 22:41:16 +0530425 memcpy(lp->NetworkName, value, string_length);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200426 }
427#if 0
Prashant P. Shahd101b952010-05-09 22:41:16 +0530428 else if (strcmp(key, PARM_NAME_DOWNLOAD_FIRMWARE) == 0) {
429 DBG_TRACE(DbgInfo, "DOWNLOAD_FIRMWARE, value: %s\n", value);
430 memset(lp->fw_image_filename, 0, (MAX_LINE_SIZE + 1));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200431 /* Make sure the value isn't too long */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530432 string_length = strlen(value);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530433 if (string_length > MAX_LINE_SIZE)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530434 DBG_WARNING(DbgInfo, "F/W image file name too long; will be ignored\n");
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530435 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530436 memcpy(lp->fw_image_filename, value, string_length);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200437 }
438#endif
Prashant P. Shahd101b952010-05-09 22:41:16 +0530439 else if (strcmp(key, PARM_NAME_ENABLE_ENCRYPTION) == 0) {
440 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_ENABLE_ENCRYPTION, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200441
Andy Shevchenko9f648592010-01-14 15:07:23 +0200442 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530443 if ((value_convert >= PARM_MIN_ENABLE_ENCRYPTION) && (value_convert <= PARM_MAX_ENABLE_ENCRYPTION))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200444 lp->EnableEncryption = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530445 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530446 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_ENABLE_ENCRYPTION);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530447 } else if (strcmp(key, PARM_NAME_ENCRYPTION) == 0) {
448 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_ENCRYPTION, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200449
Prashant P. Shahd101b952010-05-09 22:41:16 +0530450 memset(lp->szEncryption, 0, sizeof(lp->szEncryption));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200451
452 /* Make sure the value isn't too long */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530453 string_length = strlen(value);
454 if (string_length > sizeof(lp->szEncryption)) {
455 DBG_WARNING(DbgInfo, "%s too long; will be truncated\n", PARM_NAME_ENCRYPTION);
456 string_length = sizeof(lp->szEncryption);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200457 }
458
Prashant P. Shahd101b952010-05-09 22:41:16 +0530459 memcpy(lp->szEncryption, value, string_length);
460 } else if (strcmp(key, PARM_NAME_KEY1) == 0) {
461 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY1, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200462
Prashant P. Shahd101b952010-05-09 22:41:16 +0530463 if (is_valid_key_string(value)) {
464 memset(lp->DefaultKeys.key[0].key, 0, MAX_KEY_SIZE);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200465
Prashant P. Shahd101b952010-05-09 22:41:16 +0530466 key_string2key(value, &lp->DefaultKeys.key[0]);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200467 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530468 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY1);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200469 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530470 } else if (strcmp(key, PARM_NAME_KEY2) == 0) {
471 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY2, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200472
Prashant P. Shahd101b952010-05-09 22:41:16 +0530473 if (is_valid_key_string(value)) {
474 memset(lp->DefaultKeys.key[1].key, 0, MAX_KEY_SIZE);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200475
Prashant P. Shahd101b952010-05-09 22:41:16 +0530476 key_string2key(value, &lp->DefaultKeys.key[1]);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200477 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530478 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY2);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200479 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530480 } else if (strcmp(key, PARM_NAME_KEY3) == 0) {
481 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY3, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200482
Prashant P. Shahd101b952010-05-09 22:41:16 +0530483 if (is_valid_key_string(value)) {
484 memset(lp->DefaultKeys.key[2].key, 0, MAX_KEY_SIZE);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200485
Prashant P. Shahd101b952010-05-09 22:41:16 +0530486 key_string2key(value, &lp->DefaultKeys.key[2]);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200487 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530488 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY3);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200489 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530490 } else if (strcmp(key, PARM_NAME_KEY4) == 0) {
491 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY4, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200492
Prashant P. Shahd101b952010-05-09 22:41:16 +0530493 if (is_valid_key_string(value)) {
494 memset(lp->DefaultKeys.key[3].key, 0, MAX_KEY_SIZE);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200495
Prashant P. Shahd101b952010-05-09 22:41:16 +0530496 key_string2key(value, &lp->DefaultKeys.key[3]);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200497 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530498 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY4);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200499 }
500 }
501 /* New Parameters for WARP */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530502 else if (strcmp(key, PARM_NAME_LOAD_BALANCING) == 0) {
503 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_LOAD_BALANCING, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200504 lp->loadBalancing = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530505 } else if (strcmp(key, PARM_NAME_MEDIUM_DISTRIBUTION) == 0) {
506 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MEDIUM_DISTRIBUTION, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200507 lp->mediumDistribution = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530508 } else if (strcmp(key, PARM_NAME_MICROWAVE_ROBUSTNESS) == 0) {
509 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MICROWAVE_ROBUSTNESS, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200510 lp->MicrowaveRobustness = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530511 } else if (strcmp(key, PARM_NAME_MULTICAST_RATE) == 0) {
512 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RATE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200513
Andy Shevchenko9f648592010-01-14 15:07:23 +0200514 value_convert = simple_strtoul(value, NULL, 0);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200515
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530516 if ((value_convert >= PARM_MIN_MULTICAST_RATE) && (value_convert <= PARM_MAX_MULTICAST_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200517 lp->MulticastRate[0] = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530518 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530519 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MULTICAST_RATE);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530520 } else if (strcmp(key, PARM_NAME_OWN_CHANNEL) == 0) {
521 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_CHANNEL, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200522
Andy Shevchenko9f648592010-01-14 15:07:23 +0200523 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530524 if (wl_is_a_valid_chan(value_convert)) {
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530525 if (value_convert > 14)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200526 value_convert = value_convert | 0x100;
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200527 lp->Channel = value_convert;
528 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530529 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_CHANNEL);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200530 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530531 } else if (strcmp(key, PARM_NAME_OWN_NAME) == 0) {
532 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_NAME, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200533
Prashant P. Shahd101b952010-05-09 22:41:16 +0530534 memset(lp->StationName, 0, (PARM_MAX_NAME_LEN + 1));
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200535
536 /* Make sure the value isn't too long */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530537 string_length = strlen(value);
538 if (string_length > PARM_MAX_NAME_LEN) {
539 DBG_WARNING(DbgInfo, "%s too long; will be truncated\n", PARM_NAME_OWN_NAME);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200540 string_length = PARM_MAX_NAME_LEN;
541 }
542
Prashant P. Shahd101b952010-05-09 22:41:16 +0530543 memcpy(lp->StationName, value, string_length);
544 } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD) == 0) {
545 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200546
Andy Shevchenko9f648592010-01-14 15:07:23 +0200547 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530548 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200549 lp->RTSThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530550 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530551 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530552 } else if (strcmp(key, PARM_NAME_SRSC_2GHZ) == 0) {
553 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_2GHZ, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200554
Andy Shevchenko9f648592010-01-14 15:07:23 +0200555 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530556 if ((value_convert >= PARM_MIN_SRSC) || (value_convert <= PARM_MAX_SRSC))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200557 lp->srsc[0] = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530558 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530559 DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_2GHZ);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530560 } else if (strcmp(key, PARM_NAME_SRSC_5GHZ) == 0) {
561 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_5GHZ, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200562
Andy Shevchenko9f648592010-01-14 15:07:23 +0200563 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530564 if ((value_convert >= PARM_MIN_SRSC) || (value_convert <= PARM_MAX_SRSC))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200565 lp->srsc[1] = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530566 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530567 DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_5GHZ);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530568 } else if (strcmp(key, PARM_NAME_SYSTEM_SCALE) == 0) {
569 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_SYSTEM_SCALE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200570
Andy Shevchenko9f648592010-01-14 15:07:23 +0200571 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530572 if ((value_convert >= PARM_MIN_SYSTEM_SCALE) && (value_convert <= PARM_MAX_SYSTEM_SCALE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200573 lp->DistanceBetweenAPs = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530574 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530575 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_SYSTEM_SCALE);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530576 } else if (strcmp(key, PARM_NAME_TX_KEY) == 0) {
577 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_KEY, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200578
Andy Shevchenko9f648592010-01-14 15:07:23 +0200579 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530580 if ((value_convert >= PARM_MIN_TX_KEY) && (value_convert <= PARM_MAX_TX_KEY))
Andy Shevchenko9f648592010-01-14 15:07:23 +0200581 lp->TransmitKeyID = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530582 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530583 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_KEY);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530584 } else if (strcmp(key, PARM_NAME_TX_RATE) == 0) {
585 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200586
Andy Shevchenko9f648592010-01-14 15:07:23 +0200587 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530588 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200589 lp->TxRateControl[0] = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530590 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530591 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530592 } else if (strcmp(key, PARM_NAME_TX_POW_LEVEL) == 0) {
593 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_POW_LEVEL, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200594
Andy Shevchenko9f648592010-01-14 15:07:23 +0200595 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530596 if ((value_convert >= PARM_MIN_TX_POW_LEVEL) || (value_convert <= PARM_MAX_TX_POW_LEVEL))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200597 lp->txPowLevel = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530598 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530599 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_POW_LEVEL);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200600 }
601
602 /* Need to add? : Country code, Short/Long retry */
603
604 /* Configuration parameters specific to STA mode */
Prashant P. Shah801de522010-05-10 22:18:24 +0530605#if 1 /* ;? (HCF_TYPE) & HCF_TYPE_STA */
606/* ;?seems reasonable that even an AP-only driver could afford this small additional footprint */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530607 if (CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_STA) {
Prashant P. Shah801de522010-05-10 22:18:24 +0530608 /* ;?should we return an error status in AP mode */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530609 if (strcmp(key, PARM_NAME_PORT_TYPE) == 0) {
610 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PORT_TYPE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200611
Andy Shevchenko9f648592010-01-14 15:07:23 +0200612 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530613 if ((value_convert == PARM_MIN_PORT_TYPE) || (value_convert == PARM_MAX_PORT_TYPE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200614 lp->PortType = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530615 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530616 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PORT_TYPE);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530617 } else if (strcmp(key, PARM_NAME_PM_ENABLED) == 0) {
618 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PM_ENABLED, value);
Andy Shevchenko9f648592010-01-14 15:07:23 +0200619 value_convert = simple_strtoul(value, NULL, 0);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200620 /* ;? how about wl_main.c containing
Prashant P. Shahd101b952010-05-09 22:41:16 +0530621 * VALID_PARAM(PARM_PM_ENABLED <= WVLAN_PM_STATE_STANDARD ||
622 * (PARM_PM_ENABLED & 0x7FFF) <= WVLAN_PM_STATE_STANDARD);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200623 */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530624 if ((value_convert & 0x7FFF) <= PARM_MAX_PM_ENABLED) {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200625 lp->PMEnabled = value_convert;
626 } else {
Prashant P. Shahd101b952010-05-09 22:41:16 +0530627 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_ENABLED);
Prashant P. Shah801de522010-05-10 22:18:24 +0530628 /* ;?this is a data entry error, hence not a DBG_WARNING */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200629 }
Prashant P. Shahd101b952010-05-09 22:41:16 +0530630 } else if (strcmp(key, PARM_NAME_CREATE_IBSS) == 0) {
631 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_CREATE_IBSS, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200632 lp->CreateIBSS = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530633 } else if (strcmp(key, PARM_NAME_MULTICAST_RX) == 0) {
634 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RX, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200635 lp->MulticastReceive = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530636 } else if (strcmp(key, PARM_NAME_MAX_SLEEP) == 0) {
637 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MAX_SLEEP, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200638
Andy Shevchenko9f648592010-01-14 15:07:23 +0200639 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530640 if ((value_convert >= 0) && (value_convert <= 65535))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200641 lp->MaxSleepDuration = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530642 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530643 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MAX_SLEEP);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530644 } else if (strcmp(key, PARM_NAME_NETWORK_ADDR) == 0) {
645 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_NETWORK_ADDR, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200646
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530647 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530648 memcpy(lp->MACAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530649 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530650 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_NETWORK_ADDR);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530651 } else if (strcmp(key, PARM_NAME_AUTHENTICATION) == 0) {
652 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_AUTHENTICATION, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200653
Andy Shevchenko9f648592010-01-14 15:07:23 +0200654 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530655 if ((value_convert >= PARM_MIN_AUTHENTICATION) && (value_convert <= PARM_MAX_AUTHENTICATION))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200656 lp->authentication = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530657 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530658 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTHENTICATION);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530659 } else if (strcmp(key, PARM_NAME_OWN_ATIM_WINDOW) == 0) {
660 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_ATIM_WINDOW, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200661
Andy Shevchenko9f648592010-01-14 15:07:23 +0200662 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530663 if ((value_convert >= PARM_MIN_OWN_ATIM_WINDOW) && (value_convert <= PARM_MAX_OWN_ATIM_WINDOW))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200664 lp->atimWindow = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530665 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530666 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_ATIM_WINDOW);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530667 } else if (strcmp(key, PARM_NAME_PM_HOLDOVER_DURATION) == 0) {
668 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PM_HOLDOVER_DURATION, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200669
Andy Shevchenko9f648592010-01-14 15:07:23 +0200670 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530671 if ((value_convert >= PARM_MIN_PM_HOLDOVER_DURATION) && (value_convert <= PARM_MAX_PM_HOLDOVER_DURATION))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200672 lp->holdoverDuration = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530673 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530674 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_HOLDOVER_DURATION);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530675 } else if (strcmp(key, PARM_NAME_PROMISCUOUS_MODE) == 0) {
676 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PROMISCUOUS_MODE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200677 lp->promiscuousMode = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530678 } else if (strcmp(key, PARM_NAME_CONNECTION_CONTROL) == 0) {
679 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_CONNECTION_CONTROL, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200680
Andy Shevchenko9f648592010-01-14 15:07:23 +0200681 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530682 if ((value_convert >= PARM_MIN_CONNECTION_CONTROL) && (value_convert <= PARM_MAX_CONNECTION_CONTROL))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200683 lp->connectionControl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530684 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530685 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_CONNECTION_CONTROL);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200686 }
687
688 /* Need to add? : Probe Data Rate */
689 }
690#endif /* (HCF_TYPE) & HCF_TYPE_STA */
691
692 /* Configuration parameters specific to AP mode */
Prashant P. Shah801de522010-05-10 22:18:24 +0530693#if 1 /* ;? (HCF_TYPE) & HCF_TYPE_AP */
694 /* ;?should we restore this to allow smaller memory footprint */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530695 if (CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP) {
696 if (strcmp(key, PARM_NAME_OWN_DTIM_PERIOD) == 0) {
697 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_DTIM_PERIOD, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200698
Andy Shevchenko9f648592010-01-14 15:07:23 +0200699 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530700 if (value_convert >= PARM_MIN_OWN_DTIM_PERIOD)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200701 lp->DTIMPeriod = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530702 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530703 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_DTIM_PERIOD);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530704 } else if (strcmp(key, PARM_NAME_REJECT_ANY) == 0) {
705 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_REJECT_ANY, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200706 lp->RejectAny = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530707 } else if (strcmp(key, PARM_NAME_EXCLUDE_UNENCRYPTED) == 0) {
708 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_EXCLUDE_UNENCRYPTED, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200709 lp->ExcludeUnencrypted = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530710 } else if (strcmp(key, PARM_NAME_MULTICAST_PM_BUFFERING) == 0) {
711 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_PM_BUFFERING, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200712 lp->ExcludeUnencrypted = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530713 } else if (strcmp(key, PARM_NAME_INTRA_BSS_RELAY) == 0) {
714 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_INTRA_BSS_RELAY, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200715 lp->ExcludeUnencrypted = parse_yes_no(value);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530716 } else if (strcmp(key, PARM_NAME_OWN_BEACON_INTERVAL) == 0) {
717 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_BEACON_INTERVAL, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200718
Andy Shevchenko9f648592010-01-14 15:07:23 +0200719 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530720 if (value_convert >= PARM_MIN_OWN_BEACON_INTERVAL)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200721 lp->ownBeaconInterval = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530722 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530723 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_BEACON_INTERVAL);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530724 } else if (strcmp(key, PARM_NAME_COEXISTENCE) == 0) {
725 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_COEXISTENCE, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200726
Andy Shevchenko9f648592010-01-14 15:07:23 +0200727 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530728 if (value_convert >= PARM_MIN_COEXISTENCE)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200729 lp->coexistence = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530730 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530731 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_COEXISTENCE);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200732 }
733
734#ifdef USE_WDS
Prashant P. Shahd101b952010-05-09 22:41:16 +0530735 else if (strcmp(key, PARM_NAME_RTS_THRESHOLD1) == 0) {
736 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD1, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200737
Andy Shevchenko9f648592010-01-14 15:07:23 +0200738 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530739 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200740 lp->wds_port[0].rtsThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530741 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530742 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD1);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530743 } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD2) == 0) {
744 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD2, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200745
Andy Shevchenko9f648592010-01-14 15:07:23 +0200746 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530747 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200748 lp->wds_port[1].rtsThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530749 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530750 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD2);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530751 } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD3) == 0) {
752 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD3, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200753
Andy Shevchenko9f648592010-01-14 15:07:23 +0200754 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530755 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200756 lp->wds_port[2].rtsThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530757 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530758 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD3);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530759 } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD4) == 0) {
760 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD4, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200761
Andy Shevchenko9f648592010-01-14 15:07:23 +0200762 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530763 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200764 lp->wds_port[3].rtsThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530765 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530766 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD4);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530767 } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD5) == 0) {
768 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD5, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200769
Andy Shevchenko9f648592010-01-14 15:07:23 +0200770 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530771 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200772 lp->wds_port[4].rtsThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530773 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530774 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD5);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530775 } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD6) == 0) {
776 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD6, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200777
Andy Shevchenko9f648592010-01-14 15:07:23 +0200778 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530779 if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200780 lp->wds_port[5].rtsThreshold = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530781 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530782 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD6);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530783 } else if (strcmp(key, PARM_NAME_TX_RATE1) == 0) {
784 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE1, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200785
Andy Shevchenko9f648592010-01-14 15:07:23 +0200786 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530787 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200788 lp->wds_port[0].txRateCntl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530789 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530790 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE1);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530791 } else if (strcmp(key, PARM_NAME_TX_RATE2) == 0) {
792 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE2, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200793
Andy Shevchenko9f648592010-01-14 15:07:23 +0200794 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530795 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200796 lp->wds_port[1].txRateCntl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530797 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530798 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE2);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530799 } else if (strcmp(key, PARM_NAME_TX_RATE3) == 0) {
800 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE3, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200801
Andy Shevchenko9f648592010-01-14 15:07:23 +0200802 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530803 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200804 lp->wds_port[2].txRateCntl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530805 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530806 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE3);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530807 } else if (strcmp(key, PARM_NAME_TX_RATE4) == 0) {
808 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE4, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200809
Andy Shevchenko9f648592010-01-14 15:07:23 +0200810 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530811 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200812 lp->wds_port[3].txRateCntl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530813 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530814 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE4);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530815 } else if (strcmp(key, PARM_NAME_TX_RATE5) == 0) {
816 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE5, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200817
Andy Shevchenko9f648592010-01-14 15:07:23 +0200818 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530819 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200820 lp->wds_port[4].txRateCntl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530821 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530822 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE5);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530823 } else if (strcmp(key, PARM_NAME_TX_RATE6) == 0) {
824 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE6, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200825
Andy Shevchenko9f648592010-01-14 15:07:23 +0200826 value_convert = simple_strtoul(value, NULL, 0);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530827 if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE))
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200828 lp->wds_port[5].txRateCntl = value_convert;
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530829 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530830 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE6);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530831 } else if (strcmp(key, PARM_NAME_WDS_ADDRESS1) == 0) {
832 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS1, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200833
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530834 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530835 memcpy(lp->wds_port[0].wdsAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530836 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530837 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS1);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530838 } else if (strcmp(key, PARM_NAME_WDS_ADDRESS2) == 0) {
839 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS2, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200840
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530841 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530842 memcpy(lp->wds_port[1].wdsAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530843 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530844 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS2);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530845 } else if (strcmp(key, PARM_NAME_WDS_ADDRESS3) == 0) {
846 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS3, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200847
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530848 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530849 memcpy(lp->wds_port[2].wdsAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530850 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530851 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS3);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530852 } else if (strcmp(key, PARM_NAME_WDS_ADDRESS4) == 0) {
853 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS4, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200854
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530855 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530856 memcpy(lp->wds_port[3].wdsAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530857 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530858 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS4);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530859 } else if (strcmp(key, PARM_NAME_WDS_ADDRESS5) == 0) {
860 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS5, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200861
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530862 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530863 memcpy(lp->wds_port[4].wdsAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530864 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530865 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS5);
Prashant P. Shahd101b952010-05-09 22:41:16 +0530866 } else if (strcmp(key, PARM_NAME_WDS_ADDRESS6) == 0) {
867 DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS6, value);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200868
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530869 if (parse_mac_address(value, mac_value) == ETH_ALEN)
Prashant P. Shahd101b952010-05-09 22:41:16 +0530870 memcpy(lp->wds_port[5].wdsAddress, mac_value, ETH_ALEN);
Prashant P. Shahce7f6382010-05-09 22:41:46 +0530871 else
Prashant P. Shahd101b952010-05-09 22:41:16 +0530872 DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS6);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200873 }
874#endif /* USE_WDS */
875 }
876#endif /* (HCF_TYPE) & HCF_TYPE_AP */
877
878 return;
Prashant P. Shah801de522010-05-10 22:18:24 +0530879} /* translate_option */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200880/*============================================================================*/
881
882/*******************************************************************************
883 * parse_mac_address()
884 *******************************************************************************
885 *
886 * DESCRIPTION:
887 *
888 * This function will parse a mac address string and convert it to a byte
889 * array.
890 *
891 * PARAMETERS:
892 *
893 * value - the MAC address, represented as a string
894 * byte_array - the MAC address, represented as a byte array of length
895 * ETH_ALEN
896 *
897 * RETURNS:
898 *
899 * The number of bytes in the final MAC address, should equal to ETH_ALEN.
900 *
901 ******************************************************************************/
Prashant P. Shahd101b952010-05-09 22:41:16 +0530902int parse_mac_address(char *value, u_char *byte_array)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200903{
904 int value_offset = 0;
905 int array_offset = 0;
906 int field_offset = 0;
907 char byte_field[3];
908 /*------------------------------------------------------------------------*/
909
Prashant P. Shahd101b952010-05-09 22:41:16 +0530910 memset(byte_field, '\0', 3);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200911
Prashant P. Shahd101b952010-05-09 22:41:16 +0530912 while (value[value_offset] != '\0') {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200913 /* Skip over the colon chars seperating the bytes, if they exist */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530914 if (value[value_offset] == ':') {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200915 value_offset++;
916 continue;
917 }
918
919 byte_field[field_offset] = value[value_offset];
920 field_offset++;
921 value_offset++;
922
923 /* Once the byte_field is filled, convert it and store it */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530924 if (field_offset == 2) {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200925 byte_field[field_offset] = '\0';
Prashant P. Shahd101b952010-05-09 22:41:16 +0530926 byte_array[array_offset] = simple_strtoul(byte_field, NULL, 16);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200927 field_offset = 0;
928 array_offset++;
929 }
930 }
931
932 /* Use the array_offset as a check; 6 bytes should be written to the
933 byte_array */
934 return array_offset;
Prashant P. Shah801de522010-05-10 22:18:24 +0530935} /* parse_mac_address */
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200936/*============================================================================*/
937
938/*******************************************************************************
939 * ParseConfigLine()
940 *******************************************************************************
941 *
942 * DESCRIPTION:
943 *
944 * Parses a line from the configuration file into an L-val and an R-val,
945 * representing a key/value pair.
946 *
947 * PARAMETERS:
948 *
949 * pszLine - the line from the config file to parse
950 * ppszLVal - the resulting L-val (Key)
951 * ppszRVal - the resulting R-val (Value)
952 *
953 * RETURNS:
954 *
955 * N/A
956 *
957 ******************************************************************************/
Prashant P. Shahd101b952010-05-09 22:41:16 +0530958void ParseConfigLine(char *pszLine, char **ppszLVal, char **ppszRVal)
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200959{
960 int i;
961 int size;
962 /*------------------------------------------------------------------------*/
963
Prashant P. Shahd101b952010-05-09 22:41:16 +0530964 DBG_FUNC("ParseConfigLine");
965 DBG_ENTER(DbgInfo);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200966
967 /* get a snapshot of our string size */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530968 size = strlen(pszLine);
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200969 *ppszLVal = NULL;
970 *ppszRVal = NULL;
971
Prashant P. Shahd101b952010-05-09 22:41:16 +0530972 if (pszLine[0] != '#' && /* skip the line if it is a comment */
973 pszLine[0] != '\n' && /* if it's an empty UNIX line, do nothing */
974 !(pszLine[0] == '\r' && pszLine[1] == '\n') /* if it's an empty MS-DOS line, do nothing */
975 ) {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200976 /* advance past any whitespace, and assign the L-value */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530977 for (i = 0; i < size; i++) {
978 if (pszLine[i] != ' ') {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200979 *ppszLVal = &pszLine[i];
980 break;
981 }
982 }
983 /* advance to the end of the l-value*/
Prashant P. Shahd101b952010-05-09 22:41:16 +0530984 for (i++; i < size; i++) {
985 if (pszLine[i] == ' ' || pszLine[i] == '=') {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200986 pszLine[i] = '\0';
987 break;
988 }
989 }
990 /* make any whitespace and the equal sign a NULL character, and
991 advance to the R-Value */
Prashant P. Shahd101b952010-05-09 22:41:16 +0530992 for (i++; i < size; i++) {
993 if (pszLine[i] == ' ' || pszLine[i] == '=') {
Henk de Groot68c0bdf2009-09-27 11:12:52 +0200994 pszLine[i] = '\0';
995 continue;
996 }
997 *ppszRVal = &pszLine[i];
998 break;
999 }
1000 /* make the line ending character(s) a NULL */
Prashant P. Shahd101b952010-05-09 22:41:16 +05301001 for (i++; i < size; i++) {
Prashant P. Shahce7f6382010-05-09 22:41:46 +05301002 if (pszLine[i] == '\n')
Henk de Groot68c0bdf2009-09-27 11:12:52 +02001003 pszLine[i] = '\0';
Prashant P. Shahce7f6382010-05-09 22:41:46 +05301004 if ((pszLine[i] == '\r') && (pszLine[i+1] == '\n'))
Henk de Groot68c0bdf2009-09-27 11:12:52 +02001005 pszLine[i] = '\0';
Henk de Groot68c0bdf2009-09-27 11:12:52 +02001006 }
1007 }
Prashant P. Shahd101b952010-05-09 22:41:16 +05301008 DBG_LEAVE(DbgInfo);
Prashant P. Shah801de522010-05-10 22:18:24 +05301009} /* ParseConfigLine */
Henk de Groot68c0bdf2009-09-27 11:12:52 +02001010/*============================================================================*/
1011
Prashant P. Shah801de522010-05-10 22:18:24 +05301012#endif /* USE_PROFILE */