]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: rtl8192su: update rtl819x_set_channel_map()
authorFlorian Schilhabel <florian.c.schilhabel@googlemail.com>
Wed, 14 Jul 2010 12:42:43 +0000 (14:42 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Jul 2010 18:57:49 +0000 (11:57 -0700)
This function is now on par with the latest realtek drivers.

Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192su/ieee80211/ieee80211.h
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192su/r8192U_core.c

index bcb2b12a8398d6d3d8b1e1c09f89f61be0fe2a5f..8a20323cbce68d78d9c09c3978519ae0734ff219 100644 (file)
@@ -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
index 4f1f2f08b2d7d77c347d7b4579054d47bbcf4e46..c2028b433bcfca07b505fc9e2491660fab5b0a79 100644 (file)
@@ -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
index a076f56df7c4a3720d1347f976c08fc40e95c085..90ab1aa5f8a0dc0d81e0d95d183731d2811ae280 100644 (file)
@@ -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<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;
-                               }
-                       }
-                       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;
 }