2008-12-02 20:13:57 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* GPL LICENSE SUMMARY
|
|
|
|
*
|
|
|
|
* Copyright(c) 2008 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
|
|
|
* USA
|
|
|
|
*
|
|
|
|
* The full GNU General Public License is included in this distribution
|
|
|
|
* in the file called LICENSE.GPL.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
2008-12-09 19:28:58 +00:00
|
|
|
* Intel Linux Wireless <ilw@linux.intel.com>
|
2008-12-02 20:13:57 +00:00
|
|
|
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <net/mac80211.h>
|
|
|
|
#include "iwl-dev.h"
|
|
|
|
#include "iwl-debug.h"
|
|
|
|
#include "iwl-commands.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* iwl_check_rxon_cmd - validate RXON structure is valid
|
|
|
|
*
|
|
|
|
* NOTE: This is really only useful during development and can eventually
|
|
|
|
* be #ifdef'd out once the driver is stable and folks aren't actively
|
|
|
|
* making changes
|
|
|
|
*/
|
2008-12-19 02:37:09 +00:00
|
|
|
int iwl_agn_check_rxon_cmd(struct iwl_priv *priv)
|
2008-12-02 20:13:57 +00:00
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
int counter = 1;
|
2008-12-19 02:37:09 +00:00
|
|
|
struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
|
2008-12-02 20:13:57 +00:00
|
|
|
|
|
|
|
if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
|
|
|
|
error |= le32_to_cpu(rxon->flags &
|
|
|
|
(RXON_FLG_TGJ_NARROW_BAND_MSK |
|
|
|
|
RXON_FLG_RADAR_DETECT_MSK));
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check 24G fields %d | %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
counter++, error);
|
|
|
|
} else {
|
|
|
|
error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
|
|
|
|
0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check 52 fields %d | %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
counter++, error);
|
|
|
|
error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check 52 CCK %d | %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
counter++, error);
|
|
|
|
}
|
|
|
|
error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
|
2008-12-02 20:13:57 +00:00
|
|
|
|
|
|
|
/* make sure basic rates 6Mbps and 1Mbps are supported */
|
|
|
|
error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
|
|
|
|
((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
|
2008-12-02 20:13:57 +00:00
|
|
|
|
|
|
|
error |= (le16_to_cpu(rxon->assoc_id) > 2007);
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
|
2008-12-02 20:13:57 +00:00
|
|
|
|
|
|
|
error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
|
|
|
|
== (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check CCK and short slot %d | %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
counter++, error);
|
|
|
|
|
|
|
|
error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
|
|
|
|
== (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
counter++, error);
|
|
|
|
|
|
|
|
error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
|
|
|
|
RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
counter++, error);
|
|
|
|
|
|
|
|
if (error)
|
2008-12-19 02:37:32 +00:00
|
|
|
IWL_WARN(priv, "Tuning to channel %d\n",
|
2008-12-02 20:13:57 +00:00
|
|
|
le16_to_cpu(rxon->channel));
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|