Commit d5471399 authored by Florian Schilhabel's avatar Florian Schilhabel Committed by Greg Kroah-Hartman

staging: rtl8192su: update rtl819x_set_channel_map()

This function is now on par with the latest realtek drivers.
Signed-off-by: default avatarFlorian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 638b5acd
...@@ -1120,9 +1120,12 @@ enum { ...@@ -1120,9 +1120,12 @@ enum {
COUNTRY_CODE_MKK = 5, COUNTRY_CODE_MKK = 5,
COUNTRY_CODE_MKK1 = 6, COUNTRY_CODE_MKK1 = 6,
COUNTRY_CODE_ISRAEL = 7, COUNTRY_CODE_ISRAEL = 7,
COUNTRY_CODE_TELEC, COUNTRY_CODE_TELEC = 8,
COUNTRY_CODE_MIC, COUNTRY_CODE_MIC = 9,
COUNTRY_CODE_GLOBAL_DOMAIN COUNTRY_CODE_GLOBAL_DOMAIN = 10,
COUNTRY_CODE_WORLD_WIDE_13 = 11,
COUNTRY_CODE_TELEC_NETGEAR = 12,
COUNTRY_CODE_MAX
}; };
#include "ieee80211_r8192s.h" #include "ieee80211_r8192s.h"
...@@ -1295,6 +1298,10 @@ struct ieee80211_device { ...@@ -1295,6 +1298,10 @@ struct ieee80211_device {
*/ */
void *pDot11dInfo; void *pDot11dInfo;
bool bGlobalDomain; bool bGlobalDomain;
u8 IbssStartChnl;
u8 ibss_maxjoin_chal;
int rate; /* current rate */ int rate; /* current rate */
int basic_rate; int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features //FIXME: pleace callback, see if redundant with softmac_features
......
...@@ -1432,6 +1432,8 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee ...@@ -1432,6 +1432,8 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS)) if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return; return;
if ((ieee->iw_mode == IW_MODE_ADHOC) && (net->channel > ieee->ibss_maxjoin_chal))
return;
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid /* if the user specified the AP MAC, we need also the essid
...@@ -2362,7 +2364,7 @@ void ieee80211_start_ibss_wq(struct work_struct *work) ...@@ -2362,7 +2364,7 @@ void ieee80211_start_ibss_wq(struct work_struct *work)
// if((IS_DOT11D_ENABLE(ieee)) && (ieee->state == IEEE80211_NOLINK)) // if((IS_DOT11D_ENABLE(ieee)) && (ieee->state == IEEE80211_NOLINK))
if (ieee->state == IEEE80211_NOLINK) if (ieee->state == IEEE80211_NOLINK)
ieee->current_network.channel = 6; ieee->current_network.channel = ieee->IbssStartChnl;
/* if not then the state is not linked. Maybe the user swithced to /* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after * ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no * being very few time in managed mode (so the card have had no
......
...@@ -254,52 +254,48 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv) ...@@ -254,52 +254,48 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv)
{ {
int i, max_chan=-1, min_chan=-1; int i, max_chan=-1, min_chan=-1;
struct ieee80211_device* ieee = priv->ieee80211; struct ieee80211_device* ieee = priv->ieee80211;
switch (channel_plan)
{
case COUNTRY_CODE_FCC:
case COUNTRY_CODE_IC:
case COUNTRY_CODE_ETSI:
case COUNTRY_CODE_SPAIN:
case COUNTRY_CODE_FRANCE:
case COUNTRY_CODE_MKK:
case COUNTRY_CODE_MKK1:
case COUNTRY_CODE_ISRAEL:
case COUNTRY_CODE_TELEC:
case COUNTRY_CODE_MIC:
{
Dot11d_Init(ieee);
ieee->bGlobalDomain = false; ieee->bGlobalDomain = false;
//acturally 8225 & 8256 rf chip only support B,G,24N mode switch (priv->rf_chip) {
if ((priv->rf_chip == RF_8225) || (priv->rf_chip == RF_8256) || (priv->rf_chip == RF_6052)) case RF_8225:
{ case RF_8256:
case RF_6052:
min_chan = 1; min_chan = 1;
max_chan = 14; max_chan = 14;
break;
default:
pr_err("%s(): unknown rf chip, can't set channel map\n",
__func__);
break;
} }
else if (ChannelPlan[channel_plan].Len != 0) {
{ memset(GET_DOT11D_INFO(ieee)->channel_map, 0,
RT_TRACE(COMP_ERR, "unknown rf chip, can't set channel map in function:%s()\n", __FUNCTION__); sizeof(GET_DOT11D_INFO(ieee)->channel_map));
}
if (ChannelPlan[channel_plan].Len != 0){ for (i = 0; i < ChannelPlan[channel_plan].Len; i++) {
// Clear old channel map
memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map));
// Set new channel map
for (i=0;i<ChannelPlan[channel_plan].Len;i++)
{
if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan) if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan)
break; break;
GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1;
} }
} }
break; switch (channel_plan) {
}
case COUNTRY_CODE_GLOBAL_DOMAIN: case COUNTRY_CODE_GLOBAL_DOMAIN:
{
GET_DOT11D_INFO(ieee)->bEnabled = 0;//this flag enabled to follow 11d country IE setting, otherwise, it shall follow global domain settings.
Dot11d_Reset(ieee);
ieee->bGlobalDomain = true; ieee->bGlobalDomain = true;
for (i = 12; i <= 14; i++)
GET_DOT11D_INFO(ieee)->channel_map[i] = 2;
ieee->IbssStartChnl = 10;
ieee->ibss_maxjoin_chal = 11;
break;
case COUNTRY_CODE_WORLD_WIDE_13:
printk(KERN_INFO "world wide 13\n");
for (i = 12; i <= 13; i++)
GET_DOT11D_INFO(ieee)->channel_map[i] = 2;
ieee->IbssStartChnl = 10;
ieee->ibss_maxjoin_chal = 11;
break; break;
}
default: default:
ieee->IbssStartChnl = 1;
ieee->ibss_maxjoin_chal = 14;
break; break;
} }
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment