[PATCH] libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types
authorDan Williams <dcbw@redhat.com>
Thu, 2 Aug 2007 14:43:44 +0000 (10:43 -0400)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:49:38 +0000 (16:49 -0700)
Use standard BSS capability field constants from ieee80211.h.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/debugfs.c
drivers/net/wireless/libertas/dev.h
drivers/net/wireless/libertas/fw.c
drivers/net/wireless/libertas/hostcmd.h
drivers/net/wireless/libertas/join.c
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/scan.h
drivers/net/wireless/libertas/types.h

index 715cbda..e5cbfa8 100644 (file)
@@ -70,18 +70,18 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
 
        mutex_lock(&priv->adapter->lock);
        list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
-               u16 cap;
+               u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS);
+               u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY);
+               u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
 
-               memcpy(&cap, &iter_bss->cap, sizeof(cap));
                pos += snprintf(buf+pos, len-pos,
                        "%02u| %03d | %03ld | " MAC_FMT " |",
                        numscansdone, iter_bss->channel, iter_bss->rssi,
                        MAC_ARG(iter_bss->bssid));
-               pos += snprintf(buf+pos, len-pos, " %04x-", cap);
+               pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability);
                pos += snprintf(buf+pos, len-pos, "%c%c%c |",
-                               iter_bss->cap.ibss ? 'A' : 'I',
-                               iter_bss->cap.privacy ? 'P' : ' ',
-                               iter_bss->cap.spectrummgmt ? 'S' : ' ');
+                               ibss ? 'A' : 'I', privacy ? 'P' : ' ',
+                               spectrum_mgmt ? 'S' : ' ');
                pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
                pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
                pos += snprintf(buf+pos, len-pos, " %s\n",
index 785192b..675c65d 100644 (file)
@@ -275,7 +275,7 @@ struct _wlan_adapter {
        u8 adhoccreate;
 
        /** capability Info used in Association, start, join */
-       struct ieeetypes_capinfo capinfo;
+       u16 capability;
 
        /** MAC address information */
        u8 current_addr[ETH_ALEN];
index 2dc84ff..6c2b3c2 100644 (file)
@@ -217,10 +217,8 @@ static void wlan_init_adapter(wlan_private * priv)
        adapter->is_datarate_auto = 1;
        adapter->beaconperiod = MRVDRV_BEACON_INTERVAL;
 
-       // set default value of capinfo.
-#define SHORT_PREAMBLE_ALLOWED         1
-       memset(&adapter->capinfo, 0, sizeof(adapter->capinfo));
-       adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED;
+       // set default capabilities
+       adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
 
        adapter->psmode = wlan802_11powermodecam;
        adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
index 09b898f..1322552 100644 (file)
@@ -108,12 +108,6 @@ struct wlan_offset_value {
        u32 value;
 };
 
-struct WLAN_802_11_FIXED_IEs {
-       __le64 timestamp;
-       __le16 beaconinterval;
-       u16 capabilities; /* Actually struct ieeetypes_capinfo */
-};
-
 struct WLAN_802_11_VARIABLE_IEs {
        u8 elementid;
        u8 length;
@@ -237,7 +231,7 @@ struct cmd_ds_802_11_deauthenticate {
 
 struct cmd_ds_802_11_associate {
        u8 peerstaaddr[6];
-       struct ieeetypes_capinfo capinfo;
+       __le16 capability;
        __le16 listeninterval;
        __le16 bcnperiod;
        u8 dtimperiod;
@@ -469,22 +463,22 @@ struct cmd_ds_802_11_ad_hoc_start {
        union IEEEtypes_ssparamset ssparamset;
        union ieeetypes_phyparamset phyparamset;
        __le16 probedelay;
-       struct ieeetypes_capinfo cap;
+       __le16 capability;
        u8 datarate[G_SUPPORTED_RATES];
        u8 tlv_memory_size_pad[100];
 } __attribute__ ((packed));
 
 struct adhoc_bssdesc {
-       u8 BSSID[6];
-       u8 SSID[32];
-       u8 bsstype;
+       u8 bssid[6];
+       u8 ssid[32];
+       u8 type;
        __le16 beaconperiod;
        u8 dtimperiod;
        __le64 timestamp;
        __le64 localtime;
        union ieeetypes_phyparamset phyparamset;
        union IEEEtypes_ssparamset ssparamset;
-       struct ieeetypes_capinfo cap;
+       __le16 capability;
        u8 datarates[G_SUPPORTED_RATES];
 
        /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
@@ -494,7 +488,7 @@ struct adhoc_bssdesc {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_ad_hoc_join {
-       struct adhoc_bssdesc bssdescriptor;
+       struct adhoc_bssdesc bss;
        __le16 failtimeout;
        __le16 probedelay;
 
index 78ac306..2db7fbf 100644 (file)
@@ -17,8 +17,6 @@
 #include "dev.h"
 #include "assoc.h"
 
-#define AD_HOC_CAP_PRIVACY_ON 1
-
 /**
  *  @brief This function finds out the common rates between rate1 and rate2.
  *
@@ -121,7 +119,8 @@ int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req)
                goto done;
 
        /* set preamble to firmware */
-       if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble)
+       if (   (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+           && (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE))
                adapter->preamble = cmd_type_short_preamble;
        else
                adapter->preamble = cmd_type_long_preamble;
@@ -150,12 +149,12 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass
 
        adapter->adhoccreate = 1;
 
-       if (!adapter->capinfo.shortpreamble) {
-               lbs_deb_join("AdhocStart: Long preamble\n");
-               adapter->preamble = cmd_type_long_preamble;
-       } else {
+       if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) {
                lbs_deb_join("AdhocStart: Short preamble\n");
                adapter->preamble = cmd_type_short_preamble;
+       } else {
+               lbs_deb_join("AdhocStart: Long preamble\n");
+               adapter->preamble = cmd_type_long_preamble;
        }
 
        libertas_set_radio_control(priv);
@@ -205,9 +204,10 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso
                return -1;
        }
 
-       /*Use shortpreamble only when both creator and card supports
+       /* Use shortpreamble only when both creator and card supports
           short preamble */
-       if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
+       if (   !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+           || !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
                lbs_deb_join("AdhocJoin: Long preamble\n");
                adapter->preamble = cmd_type_long_preamble;
        } else {
@@ -357,7 +357,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
        /* set the listen interval */
        passo->listeninterval = cpu_to_le16(adapter->listeninterval);
 
-       pos += sizeof(passo->capinfo);
+       pos += sizeof(passo->capability);
        pos += sizeof(passo->listeninterval);
        pos += sizeof(passo->bcnperiod);
        pos += sizeof(passo->dtimperiod);
@@ -427,12 +427,6 @@ int libertas_cmd_80211_associate(wlan_private * priv,
        lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
                     cpu_to_le16(rates->header.len));
 
-       /* set IBSS field */
-       if (bss->mode == IW_MODE_INFRA) {
-#define CAPINFO_ESS_MODE 1
-               passo->capinfo.ess = CAPINFO_ESS_MODE;
-       }
-
        if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
                ret = -1;
                goto done;
@@ -440,12 +434,13 @@ int libertas_cmd_80211_associate(wlan_private * priv,
 
        cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
 
-       /* set the capability info at last */
-       memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo));
-       tmpcap &= CAPINFO_MASK;
-       lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
+       /* set the capability info */
+       tmpcap = (bss->capability & CAPINFO_MASK);
+       if (bss->mode == IW_MODE_INFRA)
+               tmpcap |= WLAN_CAPABILITY_ESS;
+       passo->capability = cpu_to_le16(tmpcap);
+       lbs_deb_join("ASSOC_CMD: capability=%4X CAPINFO_MASK=%4X\n",
                     tmpcap, CAPINFO_MASK);
-       memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
 
 done:
        lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
@@ -461,6 +456,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
        int cmdappendsize = 0;
        int i;
        struct assoc_request * assoc_req = pdata_buf;
+       u16 tmpcap = 0;
 
        lbs_deb_enter(LBS_DEB_JOIN);
 
@@ -518,19 +514,17 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
        adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
 
        /* set capability info */
-       adhs->cap.ess = 0;
-       adhs->cap.ibss = 1;
-
-       /* probedelay */
-       adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
-
-       /* set up privacy in adapter->scantable[i] */
+       tmpcap = WLAN_CAPABILITY_IBSS;
        if (assoc_req->secinfo.wep_enabled) {
                lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
-               adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
+               tmpcap |= WLAN_CAPABILITY_PRIVACY;
        } else {
                lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
        }
+       adhs->capability = cpu_to_le16(tmpcap);
+
+       /* probedelay */
+       adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
 
        memset(adhs->datarate, 0, sizeof(adhs->datarate));
 
@@ -585,67 +579,58 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
                                struct cmd_ds_command *cmd, void *pdata_buf)
 {
        wlan_adapter *adapter = priv->adapter;
-       struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj;
+       struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj;
        struct assoc_request * assoc_req = pdata_buf;
        struct bss_descriptor *bss = &assoc_req->bss;
        int cmdappendsize = 0;
        int ret = 0;
        u8 *card_rates;
        int card_rates_size;
-       u16 tmpcap;
        int i;
 
        lbs_deb_enter(LBS_DEB_JOIN);
 
        cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join);
 
-       padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
-
-       padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
-
-       memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
-       memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len);
+       join_cmd->bss.type = cmd_bss_type_ibss;
+       join_cmd->bss.beaconperiod = cpu_to_le16(bss->beaconperiod);
 
-       memcpy(&padhocjoin->bssdescriptor.phyparamset,
-              &bss->phyparamset, sizeof(union ieeetypes_phyparamset));
+       memcpy(&join_cmd->bss.bssid, &bss->bssid, ETH_ALEN);
+       memcpy(&join_cmd->bss.ssid, &bss->ssid, bss->ssid_len);
 
-       memcpy(&padhocjoin->bssdescriptor.ssparamset,
-              &bss->ssparamset, sizeof(union IEEEtypes_ssparamset));
+       memcpy(&join_cmd->bss.phyparamset, &bss->phyparamset,
+              sizeof(union ieeetypes_phyparamset));
 
-       memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo));
-       tmpcap &= CAPINFO_MASK;
+       memcpy(&join_cmd->bss.ssparamset, &bss->ssparamset,
+              sizeof(union IEEEtypes_ssparamset));
 
+       join_cmd->bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK);
        lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
-              tmpcap, CAPINFO_MASK);
-       memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
-              sizeof(struct ieeetypes_capinfo));
+              bss->capability, CAPINFO_MASK);
 
        /* information on BSSID descriptor passed to FW */
        lbs_deb_join(
               "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n",
-              MAC_ARG(padhocjoin->bssdescriptor.BSSID),
-              padhocjoin->bssdescriptor.SSID);
+              MAC_ARG(join_cmd->bss.bssid), join_cmd->bss.ssid);
 
        /* failtimeout */
-       padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
+       join_cmd->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
 
        /* probedelay */
-       padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
+       join_cmd->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
 
        /* Copy Data rates from the rates recorded in scan response */
-       memset(padhocjoin->bssdescriptor.datarates, 0,
-              sizeof(padhocjoin->bssdescriptor.datarates));
-       memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates,
-              min(sizeof(padhocjoin->bssdescriptor.datarates),
-                  sizeof(bss->datarates)));
+       memset(join_cmd->bss.datarates, 0, sizeof(join_cmd->bss.datarates));
+       memcpy(join_cmd->bss.datarates, bss->datarates,
+              min(sizeof(join_cmd->bss.datarates), sizeof(bss->datarates)));
 
        card_rates = libertas_supported_rates;
        card_rates_size = sizeof(libertas_supported_rates);
 
        adapter->curbssparams.channel = bss->channel;
 
-       if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
-                            sizeof(padhocjoin->bssdescriptor.datarates),
+       if (get_common_rates(adapter, join_cmd->bss.datarates,
+                            sizeof(join_cmd->bss.datarates),
                             card_rates, card_rates_size)) {
                lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
                ret = -1;
@@ -653,8 +638,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
        }
 
        /* Find the last non zero */
-       for (i = 0; i < sizeof(padhocjoin->bssdescriptor.datarates)
-            && padhocjoin->bssdescriptor.datarates[i]; i++) ;
+       for (i = 0; i < sizeof(join_cmd->bss.datarates)
+            && join_cmd->bss.datarates[i]; i++) ;
 
        adapter->curbssparams.numofrates = i;
 
@@ -662,14 +647,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
         * Copy the adhoc joining rates to Current BSS State structure
         */
        memcpy(adapter->curbssparams.datarates,
-              padhocjoin->bssdescriptor.datarates,
+              join_cmd->bss.datarates,
               adapter->curbssparams.numofrates);
 
-       padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow =
+       join_cmd->bss.ssparamset.ibssparamset.atimwindow =
            cpu_to_le16(bss->atimwindow);
 
        if (assoc_req->secinfo.wep_enabled) {
-               padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON;
+               u16 tmp = le16_to_cpu(join_cmd->bss.capability);
+               tmp |= WLAN_CAPABILITY_PRIVACY;
+               join_cmd->bss.capability = cpu_to_le16(tmp);
        }
 
        if (adapter->psmode == wlan802_11powermodemax_psp) {
index c3043dc..8753f93 100644 (file)
@@ -76,7 +76,7 @@ static inline int match_bss_no_security(struct wlan_802_11_security * secinfo,
            && !secinfo->WPA2enabled
            && match_bss->wpa_ie[0] != WPA_IE
            && match_bss->rsn_ie[0] != WPA2_IE
-           && !match_bss->privacy) {
+           && !(match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
                return 1;
        }
        return 0;
@@ -88,7 +88,7 @@ static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo,
        if ( secinfo->wep_enabled
           && !secinfo->WPAenabled
           && !secinfo->WPA2enabled
-          && match_bss->privacy) {
+          && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
                return 1;
        }
        return 0;
@@ -101,7 +101,8 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo,
           && secinfo->WPAenabled
           && (match_bss->wpa_ie[0] == WPA_IE)
           /* privacy bit may NOT be set in some APs like LinkSys WRT54G
-             && bss->privacy */
+             && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
+           */
           ) {
                return 1;
        }
@@ -115,7 +116,8 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo,
           && secinfo->WPA2enabled
           && (match_bss->rsn_ie[0] == WPA2_IE)
           /* privacy bit may NOT be set in some APs like LinkSys WRT54G
-             && bss->privacy */
+             && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
+           */
           ) {
                return 1;
        }
@@ -130,7 +132,7 @@ static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo,
           && !secinfo->WPA2enabled
           && (match_bss->wpa_ie[0] != WPA_IE)
           && (match_bss->rsn_ie[0] != WPA2_IE)
-          && match_bss->privacy) {
+          && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
                return 1;
        }
        return 0;
@@ -177,7 +179,7 @@ static int is_network_compatible(wlan_adapter * adapter,
                       adapter->secinfo.wep_enabled ? "e" : "d",
                       adapter->secinfo.WPAenabled ? "e" : "d",
                       adapter->secinfo.WPA2enabled ? "e" : "d",
-                      bss->privacy);
+                      (bss->capability & WLAN_CAPABILITY_PRIVACY));
                goto done;
        } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) {
                lbs_deb_scan(
@@ -187,15 +189,14 @@ static int is_network_compatible(wlan_adapter * adapter,
                       adapter->secinfo.wep_enabled ? "e" : "d",
                       adapter->secinfo.WPAenabled ? "e" : "d",
                       adapter->secinfo.WPA2enabled ? "e" : "d",
-                      bss->privacy);
+                      (bss->capability & WLAN_CAPABILITY_PRIVACY));
                goto done;
        } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) {
                lbs_deb_scan(
                       "is_network_compatible() dynamic WEP: "
                       "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
-                      bss->wpa_ie[0],
-                      bss->rsn_ie[0],
-                      bss->privacy);
+                      bss->wpa_ie[0], bss->rsn_ie[0],
+                      (bss->capability & WLAN_CAPABILITY_PRIVACY));
                goto done;
        }
 
@@ -207,7 +208,7 @@ static int is_network_compatible(wlan_adapter * adapter,
               adapter->secinfo.wep_enabled ? "e" : "d",
               adapter->secinfo.WPAenabled ? "e" : "d",
               adapter->secinfo.WPA2enabled ? "e" : "d",
-              bss->privacy);
+              (bss->capability & WLAN_CAPABILITY_PRIVACY));
 
 done:
        lbs_deb_leave(LBS_DEB_SCAN);
@@ -904,8 +905,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
        struct ieeetypes_dsparamset *pDS;
        struct ieeetypes_cfparamset *pCF;
        struct ieeetypes_ibssparamset *pibss;
-       struct ieeetypes_capinfo *pcap;
-       struct WLAN_802_11_FIXED_IEs fixedie;
        u8 *pcurrentptr;
        u8 *pRate;
        u8 elemlen;
@@ -974,24 +973,28 @@ static int libertas_process_bss(struct bss_descriptor * bss,
        bytesleftforcurrentbeacon -= 1;
 
        /* time stamp is 8 bytes long */
-       fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr);
+       bss->timestamp = le64_to_cpup((void *)pcurrentptr);
        pcurrentptr += 8;
        bytesleftforcurrentbeacon -= 8;
 
        /* beacon interval is 2 bytes long */
-       fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
+       bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
        pcurrentptr += 2;
        bytesleftforcurrentbeacon -= 2;
 
        /* capability information is 2 bytes long */
-        memcpy(&fixedie.capabilities, pcurrentptr, 2);
-       lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n",
-              fixedie.capabilities);
-       pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
-       memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
+       bss->capability = le16_to_cpup((void *)pcurrentptr);
+       lbs_deb_scan("process_bss: capabilities = 0x%4X\n", bss->capability);
        pcurrentptr += 2;
        bytesleftforcurrentbeacon -= 2;
 
+       if (bss->capability & WLAN_CAPABILITY_PRIVACY)
+               lbs_deb_scan("process_bss: AP WEP enabled\n");
+       if (bss->capability & WLAN_CAPABILITY_IBSS)
+               bss->mode = IW_MODE_ADHOC;
+       else
+               bss->mode = IW_MODE_INFRA;
+
        /* rest of the current buffer are IE's */
        lbs_deb_scan("process_bss: IE length for this AP = %d\n",
               bytesleftforcurrentbeacon);
@@ -999,19 +1002,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
        lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr,
                bytesleftforcurrentbeacon);
 
-       if (pcap->privacy) {
-               lbs_deb_scan("process_bss: AP WEP enabled\n");
-               bss->privacy = wlan802_11privfilter8021xWEP;
-       } else {
-               bss->privacy = wlan802_11privfilteracceptall;
-       }
-
-       if (pcap->ibss == 1) {
-               bss->mode = IW_MODE_ADHOC;
-       } else {
-               bss->mode = IW_MODE_INFRA;
-       }
-
        /* process variable IE */
        while (bytesleftforcurrentbeacon >= 2) {
                elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr));
@@ -1550,7 +1540,7 @@ static inline char *libertas_translate_scan(wlan_private *priv,
 
        /* Add encryption capability */
        iwe.cmd = SIOCGIWENCODE;
-       if (bss->privacy) {
+       if (bss->capability & WLAN_CAPABILITY_PRIVACY) {
                iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
        } else {
                iwe.u.data.flags = IW_ENCODE_DISABLED;
index bd019e5..2a09573 100644 (file)
@@ -140,8 +140,7 @@ struct bss_descriptor {
        u8 ssid[IW_ESSID_MAX_SIZE + 1];
        u8 ssid_len;
 
-       /* WEP encryption requirement */
-       u32 privacy;
+       u16 capability;
 
        /* receive signal strength in dBm */
        long rssi;
@@ -160,7 +159,6 @@ struct bss_descriptor {
 
        union ieeetypes_phyparamset phyparamset;
        union IEEEtypes_ssparamset ssparamset;
-       struct ieeetypes_capinfo cap;
        u8 datarates[WLAN_SUPPORTED_RATES];
 
        u64 networktsf;         //!< TSF timestamp from the current firmware TSF
index 028e2f3..f4be129 100644 (file)
@@ -30,47 +30,7 @@ enum ieeetypes_elementid {
        EXTRA_IE = 133,
 } __attribute__ ((packed));
 
-#ifdef __BIG_ENDIAN
-#define CAPINFO_MASK   (~(0xda00))
-#else
 #define CAPINFO_MASK   (~(0x00da))
-#endif
-
-struct ieeetypes_capinfo {
-#ifdef __BIG_ENDIAN_BITFIELD
-       u8 chanagility:1;
-       u8 pbcc:1;
-       u8 shortpreamble:1;
-       u8 privacy:1;
-       u8 cfpollrqst:1;
-       u8 cfpollable:1;
-       u8 ibss:1;
-       u8 ess:1;
-       u8 rsrvd1:2;
-       u8 dsssofdm:1;
-       u8 rsvrd2:1;
-       u8 apsd:1;
-       u8 shortslottime:1;
-       u8 rsrvd3:1;
-       u8 spectrummgmt:1;
-#else
-       u8 ess:1;
-       u8 ibss:1;
-       u8 cfpollable:1;
-       u8 cfpollrqst:1;
-       u8 privacy:1;
-       u8 shortpreamble:1;
-       u8 pbcc:1;
-       u8 chanagility:1;
-       u8 spectrummgmt:1;
-       u8 rsrvd3:1;
-       u8 shortslottime:1;
-       u8 apsd:1;
-       u8 rsvrd2:1;
-       u8 dsssofdm:1;
-       u8 rsrvd1:2;
-#endif
-} __attribute__ ((packed));
 
 struct ieeetypes_cfparamset {
        u8 elementid;
@@ -114,7 +74,7 @@ union ieeetypes_phyparamset {
 } __attribute__ ((packed));
 
 struct ieeetypes_assocrsp {
-       struct ieeetypes_capinfo capability;
+       __le16 capability;
        __le16 statuscode;
        __le16 aid;
        u8 iebuffer[1];