Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * GPL LICENSE SUMMARY |
| 4 | * |
Reinette Chatre | 01f8162 | 2009-01-08 10:20:02 -0800 | [diff] [blame] | 5 | * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved. |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 6 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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, |
| 19 | * USA |
| 20 | * |
| 21 | * The full GNU General Public License is included in this distribution |
| 22 | * in the file called LICENSE.GPL. |
| 23 | * |
| 24 | * Contact Information: |
Winkler, Tomas | 759ef89 | 2008-12-09 11:28:58 -0800 | [diff] [blame] | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 27 | *****************************************************************************/ |
| 28 | |
| 29 | #include <linux/kernel.h> |
| 30 | #include <net/mac80211.h> |
| 31 | #include "iwl-dev.h" |
| 32 | #include "iwl-debug.h" |
| 33 | #include "iwl-commands.h" |
| 34 | |
| 35 | |
| 36 | /** |
| 37 | * iwl_check_rxon_cmd - validate RXON structure is valid |
| 38 | * |
| 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 |
| 41 | * making changes |
| 42 | */ |
Samuel Ortiz | a3139c5 | 2008-12-19 10:37:09 +0800 | [diff] [blame] | 43 | int iwl_agn_check_rxon_cmd(struct iwl_priv *priv) |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 44 | { |
| 45 | int error = 0; |
| 46 | int counter = 1; |
Samuel Ortiz | a3139c5 | 2008-12-19 10:37:09 +0800 | [diff] [blame] | 47 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 48 | |
| 49 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { |
| 50 | error |= le32_to_cpu(rxon->flags & |
| 51 | (RXON_FLG_TGJ_NARROW_BAND_MSK | |
| 52 | RXON_FLG_RADAR_DETECT_MSK)); |
| 53 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 54 | IWL_WARN(priv, "check 24G fields %d | %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 55 | counter++, error); |
| 56 | } else { |
| 57 | error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ? |
| 58 | 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK); |
| 59 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 60 | IWL_WARN(priv, "check 52 fields %d | %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 61 | counter++, error); |
| 62 | error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK); |
| 63 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 64 | IWL_WARN(priv, "check 52 CCK %d | %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 65 | counter++, error); |
| 66 | } |
| 67 | error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1; |
| 68 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 69 | IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error); |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 70 | |
| 71 | /* make sure basic rates 6Mbps and 1Mbps are supported */ |
| 72 | error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) && |
| 73 | ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0)); |
| 74 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 75 | IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error); |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 76 | |
| 77 | error |= (le16_to_cpu(rxon->assoc_id) > 2007); |
| 78 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 79 | IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error); |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 80 | |
| 81 | error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) |
| 82 | == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)); |
| 83 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 84 | IWL_WARN(priv, "check CCK and short slot %d | %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 85 | counter++, error); |
| 86 | |
| 87 | error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) |
| 88 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)); |
| 89 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 90 | IWL_WARN(priv, "check CCK & auto detect %d | %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 91 | counter++, error); |
| 92 | |
| 93 | error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | |
| 94 | RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK); |
| 95 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 96 | IWL_WARN(priv, "check TGG and auto detect %d | %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 97 | counter++, error); |
| 98 | |
| 99 | if (error) |
Winkler, Tomas | 39aadf8 | 2008-12-19 10:37:32 +0800 | [diff] [blame] | 100 | IWL_WARN(priv, "Tuning to channel %d\n", |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 101 | le16_to_cpu(rxon->channel)); |
| 102 | |
| 103 | if (error) { |
Winkler, Tomas | 15b1687 | 2008-12-19 10:37:33 +0800 | [diff] [blame] | 104 | IWL_ERR(priv, "Not a valid iwl_rxon_assoc_cmd field values\n"); |
Winkler, Tomas | 8f5c87d | 2008-12-02 12:13:57 -0800 | [diff] [blame] | 105 | return -1; |
| 106 | } |
| 107 | return 0; |
| 108 | } |
| 109 | |