diff options
Diffstat (limited to 'drivers/net/wireless/libertas/join.c')
-rw-r--r-- | drivers/net/wireless/libertas/join.c | 313 |
1 files changed, 146 insertions, 167 deletions
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index dc24a05..2d45080 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -30,16 +30,18 @@ * NOTE: Setting the MSB of the basic rates need to be taken * care, either before or after calling this function * - * @param adapter A pointer to wlan_adapter structure + * @param priv A pointer to struct lbs_private structure * @param rate1 the buffer which keeps input and output * @param rate1_size the size of rate1 buffer; new size of buffer on return * * @return 0 or -1 */ -static int get_common_rates(wlan_adapter * adapter, u8 * rates, u16 *rates_size) +static int get_common_rates(struct lbs_private *priv, + u8 *rates, + u16 *rates_size) { - u8 *card_rates = libertas_bg_rates; - size_t num_card_rates = sizeof(libertas_bg_rates); + u8 *card_rates = lbs_bg_rates; + size_t num_card_rates = sizeof(lbs_bg_rates); int ret = 0, i, j; u8 tmp[30]; size_t tmp_size = 0; @@ -55,15 +57,15 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rates, u16 *rates_size) lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); - lbs_deb_join("Tx datarate is currently 0x%X\n", adapter->cur_rate); + lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); - if (!adapter->auto_rate) { + if (!priv->auto_rate) { for (i = 0; i < tmp_size; i++) { - if (tmp[i] == adapter->cur_rate) + if (tmp[i] == priv->cur_rate) goto done; } lbs_pr_alert("Previously set fixed data rate %#x isn't " - "compatible with the network.\n", adapter->cur_rate); + "compatible with the network.\n", priv->cur_rate); ret = -1; goto done; } @@ -85,7 +87,7 @@ done: * @param rates buffer of data rates * @param len size of buffer */ -static void libertas_set_basic_rate_flags(u8 * rates, size_t len) +static void lbs_set_basic_rate_flags(u8 *rates, size_t len) { int i; @@ -104,7 +106,7 @@ static void libertas_set_basic_rate_flags(u8 * rates, size_t len) * @param rates buffer of data rates * @param len size of buffer */ -void libertas_unset_basic_rate_flags(u8 * rates, size_t len) +void lbs_unset_basic_rate_flags(u8 *rates, size_t len) { int i; @@ -116,19 +118,18 @@ void libertas_unset_basic_rate_flags(u8 * rates, size_t len) /** * @brief Associate to a specific BSS discovered in a scan * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to struct lbs_private structure * @param pbssdesc Pointer to the BSS descriptor to associate with. * * @return 0-success, otherwise fail */ -int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) +int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) { - wlan_adapter *adapter = priv->adapter; int ret; - lbs_deb_enter(LBS_DEB_JOIN); + lbs_deb_enter(LBS_DEB_ASSOC); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, 0, CMD_OPTION_WAITFORRSP, 0, assoc_req->bss.bssid); @@ -136,50 +137,50 @@ int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) goto done; /* set preamble to firmware */ - if ( (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) + if ( (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) - adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; + priv->preamble = CMD_TYPE_SHORT_PREAMBLE; else - adapter->preamble = CMD_TYPE_LONG_PREAMBLE; + priv->preamble = CMD_TYPE_LONG_PREAMBLE; - libertas_set_radio_control(priv); + lbs_set_radio_control(priv); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_ASSOCIATE, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_ASSOCIATE, 0, CMD_OPTION_WAITFORRSP, 0, assoc_req); done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } /** * @brief Start an Adhoc Network * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to struct lbs_private structure * @param adhocssid The ssid of the Adhoc Network * @return 0--success, -1--fail */ -int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) +int lbs_start_adhoc_network(struct lbs_private *priv, + struct assoc_request *assoc_req) { - wlan_adapter *adapter = priv->adapter; int ret = 0; - adapter->adhoccreate = 1; + priv->adhoccreate = 1; - if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { + if (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { lbs_deb_join("AdhocStart: Short preamble\n"); - adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; + priv->preamble = CMD_TYPE_SHORT_PREAMBLE; } else { lbs_deb_join("AdhocStart: Long preamble\n"); - adapter->preamble = CMD_TYPE_LONG_PREAMBLE; + priv->preamble = CMD_TYPE_LONG_PREAMBLE; } - libertas_set_radio_control(priv); + lbs_set_radio_control(priv); lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel); lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band); - ret = libertas_prepare_and_send_command(priv, CMD_802_11_AD_HOC_START, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_START, 0, CMD_OPTION_WAITFORRSP, 0, assoc_req); return ret; @@ -188,34 +189,34 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass /** * @brief Join an adhoc network found in a previous scan * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to struct lbs_private structure * @param pbssdesc Pointer to a BSS descriptor found in a previous scan * to attempt to join * * @return 0--success, -1--fail */ -int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) +int lbs_join_adhoc_network(struct lbs_private *priv, + struct assoc_request *assoc_req) { - wlan_adapter *adapter = priv->adapter; struct bss_descriptor * bss = &assoc_req->bss; int ret = 0; lbs_deb_join("%s: Current SSID '%s', ssid length %u\n", __func__, - escape_essid(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len), - adapter->curbssparams.ssid_len); + escape_essid(priv->curbssparams.ssid, + priv->curbssparams.ssid_len), + priv->curbssparams.ssid_len); lbs_deb_join("%s: requested ssid '%s', ssid length %u\n", __func__, escape_essid(bss->ssid, bss->ssid_len), bss->ssid_len); /* check if the requested SSID is already joined */ - if ( adapter->curbssparams.ssid_len - && !libertas_ssid_cmp(adapter->curbssparams.ssid, - adapter->curbssparams.ssid_len, + if ( priv->curbssparams.ssid_len + && !lbs_ssid_cmp(priv->curbssparams.ssid, + priv->curbssparams.ssid_len, bss->ssid, bss->ssid_len) - && (adapter->mode == IW_MODE_ADHOC) - && (adapter->connect_status == LIBERTAS_CONNECTED)) { + && (priv->mode == IW_MODE_ADHOC) + && (priv->connect_status == LBS_CONNECTED)) { union iwreq_data wrqu; lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as " @@ -225,7 +226,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso * request really was successful, even if just a null-op. */ memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, + memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); @@ -235,22 +236,22 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso /* Use shortpreamble only when both creator and card supports short preamble */ if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) - || !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { + || !(priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { lbs_deb_join("AdhocJoin: Long preamble\n"); - adapter->preamble = CMD_TYPE_LONG_PREAMBLE; + priv->preamble = CMD_TYPE_LONG_PREAMBLE; } else { lbs_deb_join("AdhocJoin: Short preamble\n"); - adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; + priv->preamble = CMD_TYPE_SHORT_PREAMBLE; } - libertas_set_radio_control(priv); + lbs_set_radio_control(priv); lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); - adapter->adhoccreate = 0; + priv->adhoccreate = 0; - ret = libertas_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN, + ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN, 0, CMD_OPTION_WAITFORRSP, OID_802_11_SSID, assoc_req); @@ -258,38 +259,37 @@ out: return ret; } -int libertas_stop_adhoc_network(wlan_private * priv) +int lbs_stop_adhoc_network(struct lbs_private *priv) { - return libertas_prepare_and_send_command(priv, CMD_802_11_AD_HOC_STOP, + return lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_STOP, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } /** * @brief Send Deauthentication Request * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to struct lbs_private structure * @return 0--success, -1--fail */ -int libertas_send_deauthentication(wlan_private * priv) +int lbs_send_deauthentication(struct lbs_private *priv) { - return libertas_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE, + return lbs_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE, 0, CMD_OPTION_WAITFORRSP, 0, NULL); } /** * @brief This function prepares command of authenticate. * - * @param priv A pointer to wlan_private structure + * @param priv A pointer to struct lbs_private structure * @param cmd A pointer to cmd_ds_command structure * @param pdata_buf Void cast of pointer to a BSSID to authenticate with * * @return 0 or -1 */ -int libertas_cmd_80211_authenticate(wlan_private * priv, +int lbs_cmd_80211_authenticate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; int ret = -1; u8 *bssid = pdata_buf; @@ -302,7 +302,7 @@ int libertas_cmd_80211_authenticate(wlan_private * priv, + S_DS_GEN); /* translate auth mode to 802.11 defined wire value */ - switch (adapter->secinfo.auth_mode) { + switch (priv->secinfo.auth_mode) { case IW_AUTH_ALG_OPEN_SYSTEM: pauthenticate->authtype = 0x00; break; @@ -314,13 +314,13 @@ int libertas_cmd_80211_authenticate(wlan_private * priv, break; default: lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n", - adapter->secinfo.auth_mode); + priv->secinfo.auth_mode); goto out; } memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); - lbs_deb_join("AUTH_CMD: BSSID is : %s auth=0x%X\n", + lbs_deb_join("AUTH_CMD: BSSID %s, auth 0x%x\n", print_mac(mac, bssid), pauthenticate->authtype); ret = 0; @@ -329,10 +329,9 @@ out: return ret; } -int libertas_cmd_80211_deauthenticate(wlan_private * priv, +int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, struct cmd_ds_command *cmd) { - wlan_adapter *adapter = priv->adapter; struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; lbs_deb_enter(LBS_DEB_JOIN); @@ -342,7 +341,7 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, S_DS_GEN); /* set AP MAC address */ - memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN); + memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN); /* Reason code 3 = Station is leaving */ #define REASON_CODE_STA_LEAVING 3 @@ -352,10 +351,9 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, return 0; } -int libertas_cmd_80211_associate(wlan_private * priv, +int lbs_cmd_80211_associate(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; struct cmd_ds_802_11_associate *passo = &cmd->params.associate; int ret = 0; struct assoc_request * assoc_req = pdata_buf; @@ -368,11 +366,11 @@ int libertas_cmd_80211_associate(wlan_private * priv, struct mrvlietypes_ratesparamset *rates; struct mrvlietypes_rsnparamset *rsn; - lbs_deb_enter(LBS_DEB_JOIN); + lbs_deb_enter(LBS_DEB_ASSOC); pos = (u8 *) passo; - if (!adapter) { + if (!priv) { ret = -1; goto done; } @@ -416,22 +414,22 @@ int libertas_cmd_80211_associate(wlan_private * priv, rates->header.type = cpu_to_le16(TLV_TYPE_RATES); memcpy(&rates->rates, &bss->rates, MAX_RATES); tmplen = MAX_RATES; - if (get_common_rates(adapter, rates->rates, &tmplen)) { + if (get_common_rates(priv, rates->rates, &tmplen)) { ret = -1; goto done; } pos += sizeof(rates->header) + tmplen; rates->header.len = cpu_to_le16(tmplen); - lbs_deb_join("ASSOC_CMD: num rates = %u\n", tmplen); + lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen); /* Copy the infra. association rates into Current BSS state structure */ - memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); - memcpy(&adapter->curbssparams.rates, &rates->rates, tmplen); + memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); + memcpy(&priv->curbssparams.rates, &rates->rates, tmplen); /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. */ - libertas_set_basic_rate_flags(rates->rates, tmplen); + lbs_set_basic_rate_flags(rates->rates, tmplen); if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { rsn = (struct mrvlietypes_rsnparamset *) pos; @@ -446,9 +444,9 @@ int libertas_cmd_80211_associate(wlan_private * priv, } /* update curbssparams */ - adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; + priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; - if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { + if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { ret = -1; goto done; } @@ -460,18 +458,16 @@ int libertas_cmd_80211_associate(wlan_private * priv, 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); + lbs_deb_assoc("ASSOC_CMD: capability 0x%04x\n", tmpcap); done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } -int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; int ret = 0; int cmdappendsize = 0; @@ -481,7 +477,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, lbs_deb_enter(LBS_DEB_JOIN); - if (!adapter) { + if (!priv) { ret = -1; goto done; } @@ -491,7 +487,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, /* * Fill in the parameters for 2 data structures: * 1. cmd_ds_802_11_ad_hoc_start command - * 2. adapter->scantable[i] + * 2. priv->scantable[i] * * Driver will fill up SSID, bsstype,IBSS param, Physical Param, * probe delay, and cap info. @@ -509,8 +505,10 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, /* set the BSS type */ adhs->bsstype = CMD_BSS_TYPE_IBSS; - adapter->mode = IW_MODE_ADHOC; - adhs->beaconperiod = cpu_to_le16(MRVDRV_BEACON_INTERVAL); + priv->mode = IW_MODE_ADHOC; + if (priv->beacon_period == 0) + priv->beacon_period = MRVDRV_BEACON_INTERVAL; + adhs->beaconperiod = cpu_to_le16(priv->beacon_period); /* set Physical param set */ #define DS_PARA_IE_ID 3 @@ -548,24 +546,24 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, adhs->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); memset(adhs->rates, 0, sizeof(adhs->rates)); - ratesize = min(sizeof(adhs->rates), sizeof(libertas_bg_rates)); - memcpy(adhs->rates, libertas_bg_rates, ratesize); + ratesize = min(sizeof(adhs->rates), sizeof(lbs_bg_rates)); + memcpy(adhs->rates, lbs_bg_rates, ratesize); /* Copy the ad-hoc creating rates into Current BSS state structure */ - memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); - memcpy(&adapter->curbssparams.rates, &adhs->rates, ratesize); + memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); + memcpy(&priv->curbssparams.rates, &adhs->rates, ratesize); /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. */ - libertas_set_basic_rate_flags(adhs->rates, ratesize); + lbs_set_basic_rate_flags(adhs->rates, ratesize); lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n", adhs->rates[0], adhs->rates[1], adhs->rates[2], adhs->rates[3]); lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n"); - if (libertas_create_dnld_countryinfo_11d(priv)) { + if (lbs_create_dnld_countryinfo_11d(priv)) { lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); ret = -1; goto done; @@ -580,7 +578,7 @@ done: return ret; } -int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv, struct cmd_ds_command *cmd) { cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP); @@ -589,10 +587,9 @@ int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv, return 0; } -int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, +int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, struct cmd_ds_command *cmd, void *pdata_buf) { - wlan_adapter *adapter = priv->adapter; 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; @@ -633,26 +630,26 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, /* probedelay */ join_cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); - adapter->curbssparams.channel = bss->channel; + priv->curbssparams.channel = bss->channel; /* Copy Data rates from the rates recorded in scan response */ memset(join_cmd->bss.rates, 0, sizeof(join_cmd->bss.rates)); ratesize = min_t(u16, sizeof(join_cmd->bss.rates), MAX_RATES); memcpy(join_cmd->bss.rates, bss->rates, ratesize); - if (get_common_rates(adapter, join_cmd->bss.rates, &ratesize)) { + if (get_common_rates(priv, join_cmd->bss.rates, &ratesize)) { lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); ret = -1; goto done; } /* Copy the ad-hoc creating rates into Current BSS state structure */ - memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); - memcpy(&adapter->curbssparams.rates, join_cmd->bss.rates, ratesize); + memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); + memcpy(&priv->curbssparams.rates, join_cmd->bss.rates, ratesize); /* Set MSB on basic rates as the firmware requires, but _after_ * copying to current bss rates. */ - libertas_set_basic_rate_flags(join_cmd->bss.rates, ratesize); + lbs_set_basic_rate_flags(join_cmd->bss.rates, ratesize); join_cmd->bss.ssparamset.ibssparamset.atimwindow = cpu_to_le16(bss->atimwindow); @@ -663,12 +660,12 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, join_cmd->bss.capability = cpu_to_le16(tmp); } - if (adapter->psmode == WLAN802_11POWERMODEMAX_PSP) { + if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { /* wake up first */ __le32 Localpsmode; - Localpsmode = cpu_to_le32(WLAN802_11POWERMODECAM); - ret = libertas_prepare_and_send_command(priv, + Localpsmode = cpu_to_le32(LBS802_11POWERMODECAM); + ret = lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, CMD_ACT_SET, 0, 0, &Localpsmode); @@ -679,7 +676,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, } } - if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { + if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { ret = -1; goto done; } @@ -692,24 +689,23 @@ done: return ret; } -int libertas_ret_80211_associate(wlan_private * priv, +int lbs_ret_80211_associate(struct lbs_private *priv, struct cmd_ds_command *resp) { - wlan_adapter *adapter = priv->adapter; int ret = 0; union iwreq_data wrqu; struct ieeetypes_assocrsp *passocrsp; struct bss_descriptor * bss; u16 status_code; - lbs_deb_enter(LBS_DEB_JOIN); + lbs_deb_enter(LBS_DEB_ASSOC); - if (!adapter->in_progress_assoc_req) { - lbs_deb_join("ASSOC_RESP: no in-progress association request\n"); + if (!priv->in_progress_assoc_req) { + lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n"); ret = -1; goto done; } - bss = &adapter->in_progress_assoc_req->bss; + bss = &priv->in_progress_assoc_req->bss; passocrsp = (struct ieeetypes_assocrsp *) & resp->params; @@ -734,96 +730,83 @@ int libertas_ret_80211_associate(wlan_private * priv, status_code = le16_to_cpu(passocrsp->statuscode); switch (status_code) { case 0x00: - lbs_deb_join("ASSOC_RESP: Association succeeded\n"); break; case 0x01: - lbs_deb_join("ASSOC_RESP: Association failed; invalid " - "parameters (status code %d)\n", status_code); + lbs_deb_assoc("ASSOC_RESP: invalid parameters\n"); break; case 0x02: - lbs_deb_join("ASSOC_RESP: Association failed; internal timer " - "expired while waiting for the AP (status code %d)" - "\n", status_code); + lbs_deb_assoc("ASSOC_RESP: internal timer " + "expired while waiting for the AP\n"); break; case 0x03: - lbs_deb_join("ASSOC_RESP: Association failed; association " - "was refused by the AP (status code %d)\n", - status_code); + lbs_deb_assoc("ASSOC_RESP: association " + "refused by AP\n"); break; case 0x04: - lbs_deb_join("ASSOC_RESP: Association failed; authentication " - "was refused by the AP (status code %d)\n", - status_code); + lbs_deb_assoc("ASSOC_RESP: authentication " + "refused by AP\n"); break; default: - lbs_deb_join("ASSOC_RESP: Association failed; reason unknown " - "(status code %d)\n", status_code); + lbs_deb_assoc("ASSOC_RESP: failure reason 0x%02x " + " unknown\n", status_code); break; } if (status_code) { - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); ret = -1; goto done; } - lbs_deb_hex(LBS_DEB_JOIN, "ASSOC_RESP", (void *)&resp->params, + lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_RESP", (void *)&resp->params, le16_to_cpu(resp->size) - S_DS_GEN); /* Send a Media Connected event, according to the Spec */ - adapter->connect_status = LIBERTAS_CONNECTED; - - lbs_deb_join("ASSOC_RESP: assocated to '%s'\n", - escape_essid(bss->ssid, bss->ssid_len)); + priv->connect_status = LBS_CONNECTED; /* Update current SSID and BSSID */ - memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); - adapter->curbssparams.ssid_len = bss->ssid_len; - memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); + memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); + priv->curbssparams.ssid_len = bss->ssid_len; + memcpy(priv->curbssparams.bssid, bss->bssid, ETH_ALEN); - lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n", - adapter->currentpacketfilter); + lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n", + priv->currentpacketfilter); - adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; - adapter->NF[TYPE_RXPD][TYPE_AVG] = 0; + priv->SNR[TYPE_RXPD][TYPE_AVG] = 0; + priv->NF[TYPE_RXPD][TYPE_AVG] = 0; - memset(adapter->rawSNR, 0x00, sizeof(adapter->rawSNR)); - memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF)); - adapter->nextSNRNF = 0; - adapter->numSNRNF = 0; + memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR)); + memset(priv->rawNF, 0x00, sizeof(priv->rawNF)); + priv->nextSNRNF = 0; + priv->numSNRNF = 0; netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - - if (priv->mesh_dev) { - netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); - } + if (!priv->tx_pending_len) + netif_wake_queue(priv->dev); - memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); + memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); + lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); return ret; } -int libertas_ret_80211_disassociate(wlan_private * priv, +int lbs_ret_80211_disassociate(struct lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_JOIN); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); lbs_deb_leave(LBS_DEB_JOIN); return 0; } -int libertas_ret_80211_ad_hoc_start(wlan_private * priv, +int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, struct cmd_ds_command *resp) { - wlan_adapter *adapter = priv->adapter; int ret = 0; u16 command = le16_to_cpu(resp->command); u16 result = le16_to_cpu(resp->result); @@ -840,20 +823,20 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, lbs_deb_join("ADHOC_RESP: command = %x\n", command); lbs_deb_join("ADHOC_RESP: result = %x\n", result); - if (!adapter->in_progress_assoc_req) { + if (!priv->in_progress_assoc_req) { lbs_deb_join("ADHOC_RESP: no in-progress association request\n"); ret = -1; goto done; } - bss = &adapter->in_progress_assoc_req->bss; + bss = &priv->in_progress_assoc_req->bss; /* * Join result code 0 --> SUCCESS */ if (result) { lbs_deb_join("ADHOC_RESP: failed\n"); - if (adapter->connect_status == LIBERTAS_CONNECTED) { - libertas_mac_event_disconnected(priv); + if (priv->connect_status == LBS_CONNECTED) { + lbs_mac_event_disconnected(priv); } ret = -1; goto done; @@ -867,7 +850,7 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, escape_essid(bss->ssid, bss->ssid_len)); /* Send a Media Connected event, according to the Spec */ - adapter->connect_status = LIBERTAS_CONNECTED; + priv->connect_status = LBS_CONNECTED; if (command == CMD_RET(CMD_802_11_AD_HOC_START)) { /* Update the created network descriptor with the new BSSID */ @@ -875,27 +858,23 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, } /* Set the BSSID from the joined/started descriptor */ - memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); + memcpy(&priv->curbssparams.bssid, bss->bssid, ETH_ALEN); /* Set the new SSID to current SSID */ - memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); - adapter->curbssparams.ssid_len = bss->ssid_len; + memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); + priv->curbssparams.ssid_len = bss->ssid_len; netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - - if (priv->mesh_dev) { - netif_carrier_on(priv->mesh_dev); - netif_wake_queue(priv->mesh_dev); - } + if (!priv->tx_pending_len) + netif_wake_queue(priv->dev); memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); + memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n"); - lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel); + lbs_deb_join("ADHOC_RESP: channel = %d\n", priv->curbssparams.channel); lbs_deb_join("ADHOC_RESP: BSSID = %s\n", print_mac(mac, padhocresult->bssid)); @@ -904,12 +883,12 @@ done: return ret; } -int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, +int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv, struct cmd_ds_command *resp) { lbs_deb_enter(LBS_DEB_JOIN); - libertas_mac_event_disconnected(priv); + lbs_mac_event_disconnected(priv); lbs_deb_leave(LBS_DEB_JOIN); return 0; |