1 /******************************************************************************
5 * Copyright(c) 2008 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
29 #include <linux/kernel.h>
30 #include <net/mac80211.h>
32 #include "iwl-debug.h"
33 #include "iwl-commands.h"
37 * iwl_check_rxon_cmd - validate RXON structure is valid
39 * NOTE: This is really only useful during development and can eventually
40 * be #ifdef'd out once the driver is stable and folks aren't actively
43 int iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
48 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
49 error |= le32_to_cpu(rxon->flags &
50 (RXON_FLG_TGJ_NARROW_BAND_MSK |
51 RXON_FLG_RADAR_DETECT_MSK));
53 IWL_WARNING("check 24G fields %d | %d\n",
56 error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
57 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
59 IWL_WARNING("check 52 fields %d | %d\n",
61 error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
63 IWL_WARNING("check 52 CCK %d | %d\n",
66 error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
68 IWL_WARNING("check mac addr %d | %d\n", counter++, error);
70 /* make sure basic rates 6Mbps and 1Mbps are supported */
71 error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
72 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
74 IWL_WARNING("check basic rate %d | %d\n", counter++, error);
76 error |= (le16_to_cpu(rxon->assoc_id) > 2007);
78 IWL_WARNING("check assoc id %d | %d\n", counter++, error);
80 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
81 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
83 IWL_WARNING("check CCK and short slot %d | %d\n",
86 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
87 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
89 IWL_WARNING("check CCK & auto detect %d | %d\n",
92 error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
93 RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
95 IWL_WARNING("check TGG and auto detect %d | %d\n",
99 IWL_WARNING("Tuning to channel %d\n",
100 le16_to_cpu(rxon->channel));
103 IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n");