From: Florian Schilhabel Date: Wed, 14 Jul 2010 12:42:43 +0000 (+0200) Subject: staging: rtl8192su: update rtl819x_set_channel_map() X-Git-Tag: firefly_0821_release~9833^2~1255^2~1^2~155 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d54713991107f3f29acb9b579569de9196ab2890;p=firefly-linux-kernel-4.4.55.git staging: rtl8192su: update rtl819x_set_channel_map() This function is now on par with the latest realtek drivers. Signed-off-by: Florian Schilhabel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211.h b/drivers/staging/rtl8192su/ieee80211/ieee80211.h index bcb2b12a8398..8a20323cbce6 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211.h @@ -1120,9 +1120,12 @@ enum { COUNTRY_CODE_MKK = 5, COUNTRY_CODE_MKK1 = 6, COUNTRY_CODE_ISRAEL = 7, - COUNTRY_CODE_TELEC, - COUNTRY_CODE_MIC, - COUNTRY_CODE_GLOBAL_DOMAIN + COUNTRY_CODE_TELEC = 8, + COUNTRY_CODE_MIC = 9, + COUNTRY_CODE_GLOBAL_DOMAIN = 10, + COUNTRY_CODE_WORLD_WIDE_13 = 11, + COUNTRY_CODE_TELEC_NETGEAR = 12, + COUNTRY_CODE_MAX }; #include "ieee80211_r8192s.h" @@ -1295,6 +1298,10 @@ struct ieee80211_device { */ void *pDot11dInfo; bool bGlobalDomain; + + u8 IbssStartChnl; + u8 ibss_maxjoin_chal; + int rate; /* current rate */ int basic_rate; //FIXME: pleace callback, see if redundant with softmac_features diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c index 4f1f2f08b2d7..c2028b433bcf 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c @@ -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)) 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 the user specified the AP MAC, we need also the essid @@ -2362,7 +2364,7 @@ void ieee80211_start_ibss_wq(struct work_struct *work) // if((IS_DOT11D_ENABLE(ieee)) && (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 * 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 diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c index a076f56df7c4..90ab1aa5f8a0 100644 --- a/drivers/staging/rtl8192su/r8192U_core.c +++ b/drivers/staging/rtl8192su/r8192U_core.c @@ -254,53 +254,49 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv) { int i, max_chan=-1, min_chan=-1; 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; - //acturally 8225 & 8256 rf chip only support B,G,24N mode - if ((priv->rf_chip == RF_8225) || (priv->rf_chip == RF_8256) || (priv->rf_chip == RF_6052)) - { - min_chan = 1; - max_chan = 14; - } - else - { - RT_TRACE(COMP_ERR, "unknown rf chip, can't set channel map in function:%s()\n", __FUNCTION__); - } - if (ChannelPlan[channel_plan].Len != 0){ - // 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 max_chan) - break; - GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; - } - } - break; - } - 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; - break; + + ieee->bGlobalDomain = false; + switch (priv->rf_chip) { + case RF_8225: + case RF_8256: + case RF_6052: + min_chan = 1; + max_chan = 14; + break; + default: + pr_err("%s(): unknown rf chip, can't set channel map\n", + __func__); + break; + } + if (ChannelPlan[channel_plan].Len != 0) { + memset(GET_DOT11D_INFO(ieee)->channel_map, 0, + sizeof(GET_DOT11D_INFO(ieee)->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) + break; + GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; } - default: - break; + } + switch (channel_plan) { + case COUNTRY_CODE_GLOBAL_DOMAIN: + 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; + default: + ieee->IbssStartChnl = 1; + ieee->ibss_maxjoin_chal = 14; + break; } return; }