109 lines
3.4 KiB
C
109 lines
3.4 KiB
C
/******************************************************************************
|
|
*
|
|
* 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:
|
|
* Tomas Winkler <tomas.winkler@intel.com>
|
|
* 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
|
|
*/
|
|
int iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
|
|
{
|
|
int error = 0;
|
|
int counter = 1;
|
|
|
|
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)
|
|
IWL_WARNING("check 24G fields %d | %d\n",
|
|
counter++, error);
|
|
} else {
|
|
error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
|
|
0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
|
|
if (error)
|
|
IWL_WARNING("check 52 fields %d | %d\n",
|
|
counter++, error);
|
|
error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
|
|
if (error)
|
|
IWL_WARNING("check 52 CCK %d | %d\n",
|
|
counter++, error);
|
|
}
|
|
error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
|
|
if (error)
|
|
IWL_WARNING("check mac addr %d | %d\n", counter++, error);
|
|
|
|
/* 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)
|
|
IWL_WARNING("check basic rate %d | %d\n", counter++, error);
|
|
|
|
error |= (le16_to_cpu(rxon->assoc_id) > 2007);
|
|
if (error)
|
|
IWL_WARNING("check assoc id %d | %d\n", counter++, error);
|
|
|
|
error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
|
|
== (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
|
|
if (error)
|
|
IWL_WARNING("check CCK and short slot %d | %d\n",
|
|
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)
|
|
IWL_WARNING("check CCK & auto detect %d | %d\n",
|
|
counter++, error);
|
|
|
|
error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
|
|
RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
|
|
if (error)
|
|
IWL_WARNING("check TGG and auto detect %d | %d\n",
|
|
counter++, error);
|
|
|
|
if (error)
|
|
IWL_WARNING("Tuning to channel %d\n",
|
|
le16_to_cpu(rxon->channel));
|
|
|
|
if (error) {
|
|
IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n");
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
|