/*
* Marvell Wireless LAN device driver: CFG80211
*
* Copyright (C) 2011, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this File in
* accordance with the terms and conditions of the License, a copy of which
* is available by writing to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
* this warranty disclaimer.
*/
#include "cfg80211.h"
#include "main.h"
/*
* This function maps the nl802.11 channel type into driver channel type.
*
* The mapping is as follows -
* NL80211_CHAN_NO_HT -> NO_SEC_CHANNEL
* NL80211_CHAN_HT20 -> NO_SEC_CHANNEL
* NL80211_CHAN_HT40PLUS -> SEC_CHANNEL_ABOVE
* NL80211_CHAN_HT40MINUS -> SEC_CHANNEL_BELOW
* Others -> NO_SEC_CHANNEL
*/
static int
mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
channel_type)
{
switch (channel_type) {
case NL80211_CHAN_NO_HT:
case NL80211_CHAN_HT20:
return NO_SEC_CHANNEL;
case NL80211_CHAN_HT40PLUS:
return SEC_CHANNEL_ABOVE;
case NL80211_CHAN_HT40MINUS:
return SEC_CHANNEL_BELOW;
default:
return NO_SEC_CHANNEL;
}
}
/*
* This function maps the driver channel type into nl802.11 channel type.
*
* The mapping is as follows -
* NO_SEC_CHANNEL -> NL80211_CHAN_HT20
* SEC_CHANNEL_ABOVE -> NL80211_CHAN_HT40PLUS
* SEC_CHANNEL_BELOW -> NL80211_CHAN_HT40MINUS
* Others -> NL80211_CHAN_HT20
*/
static enum nl80211_channel_type
mwifiex_channels_to_cfg80211_channel_type(int channel_type)
{
switch (channel_type) {
case NO_SEC_CHANNEL:
return NL80211_CHAN_HT20;
case SEC_CHANNEL_ABOVE:
return NL80211_CHAN_HT40PLUS;
case SEC_CHANNEL_BELOW:
return NL80211_CHAN_HT40MINUS;
default:
return NL80211_CHAN_HT20;
}
}
/*
* This function checks whether WEP is set.
*/
static int
mwifiex_is_alg_wep(u32 cipher)
{
switch (cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
return 1