* 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 lbs_adapter structure
+ * @param adapter A pointer to struct lbs_adapter 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(lbs_adapter *adapter, u8 *rates, u16 *rates_size)
+static int get_common_rates(struct lbs_adapter *adapter,
+ u8 *rates,
+ u16 *rates_size)
{
u8 *card_rates = lbs_bg_rates;
size_t num_card_rates = sizeof(lbs_bg_rates);
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", adapter->cur_rate);
if (!adapter->auto_rate) {
for (i = 0; i < tmp_size; i++) {
/**
* @brief Associate to a specific BSS discovered in a scan
*
- * @param priv A pointer to lbs_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 lbs_associate(lbs_private *priv, struct assoc_request *assoc_req)
+int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
int ret;
- lbs_deb_enter(LBS_DEB_JOIN);
+ lbs_deb_enter(LBS_DEB_ASSOC);
ret = lbs_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE,
0, CMD_OPTION_WAITFORRSP,
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 lbs_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 lbs_start_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req)
+int lbs_start_adhoc_network(struct lbs_private *priv,
+ struct assoc_request *assoc_req)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
adapter->adhoccreate = 1;
/**
* @brief Join an adhoc network found in a previous scan
*
- * @param priv A pointer to lbs_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 lbs_join_adhoc_network(lbs_private *priv, struct assoc_request *assoc_req)
+int lbs_join_adhoc_network(struct lbs_private *priv,
+ struct assoc_request *assoc_req)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
struct bss_descriptor * bss = &assoc_req->bss;
int ret = 0;
return ret;
}
-int lbs_stop_adhoc_network(lbs_private * priv)
+int lbs_stop_adhoc_network(struct lbs_private *priv)
{
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 lbs_private structure
+ * @param priv A pointer to struct lbs_private structure
* @return 0--success, -1--fail
*/
-int lbs_send_deauthentication(lbs_private *priv)
+int lbs_send_deauthentication(struct lbs_private *priv)
{
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 lbs_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 lbs_cmd_80211_authenticate(lbs_private *priv,
+int lbs_cmd_80211_authenticate(struct lbs_private *priv,
struct cmd_ds_command *cmd,
void *pdata_buf)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth;
int ret = -1;
u8 *bssid = pdata_buf;
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;
return ret;
}
-int lbs_cmd_80211_deauthenticate(lbs_private *priv,
+int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
struct cmd_ds_command *cmd)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
lbs_deb_enter(LBS_DEB_JOIN);
return 0;
}
-int lbs_cmd_80211_associate(lbs_private *priv,
+int lbs_cmd_80211_associate(struct lbs_private *priv,
struct cmd_ds_command *cmd, void *pdata_buf)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
int ret = 0;
struct assoc_request * assoc_req = pdata_buf;
struct mrvlietypes_ratesparamset *rates;
struct mrvlietypes_rsnparamset *rsn;
- lbs_deb_enter(LBS_DEB_JOIN);
+ lbs_deb_enter(LBS_DEB_ASSOC);
pos = (u8 *) passo;
}
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));
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 lbs_cmd_80211_ad_hoc_start(lbs_private *priv,
+int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
struct cmd_ds_command *cmd, void *pdata_buf)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
int ret = 0;
int cmdappendsize = 0;
/* set the BSS type */
adhs->bsstype = CMD_BSS_TYPE_IBSS;
adapter->mode = IW_MODE_ADHOC;
- adhs->beaconperiod = cpu_to_le16(MRVDRV_BEACON_INTERVAL);
+ if (adapter->beacon_period == 0)
+ adapter->beacon_period = MRVDRV_BEACON_INTERVAL;
+ adhs->beaconperiod = cpu_to_le16(adapter->beacon_period);
/* set Physical param set */
#define DS_PARA_IE_ID 3
return ret;
}
-int lbs_cmd_80211_ad_hoc_stop(lbs_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);
return 0;
}
-int lbs_cmd_80211_ad_hoc_join(lbs_private *priv,
+int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
struct cmd_ds_command *cmd, void *pdata_buf)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_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;
return ret;
}
-int lbs_ret_80211_associate(lbs_private *priv,
+int lbs_ret_80211_associate(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_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");
+ lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n");
ret = -1;
goto done;
}
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;
}
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 = LBS_CONNECTED;
- lbs_deb_join("ASSOC_RESP: assocated to '%s'\n",
- escape_essid(bss->ssid, bss->ssid_len));
-
/* 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);
- lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
- adapter->currentpacketfilter);
+ lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n",
+ adapter->currentpacketfilter);
adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
adapter->NF[TYPE_RXPD][TYPE_AVG] = 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);
- }
memcpy(wrqu.ap_addr.sa_data, adapter->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 lbs_ret_80211_disassociate(lbs_private *priv,
+int lbs_ret_80211_disassociate(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
lbs_deb_enter(LBS_DEB_JOIN);
return 0;
}
-int lbs_ret_80211_ad_hoc_start(lbs_private *priv,
+int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
- lbs_adapter *adapter = priv->adapter;
+ struct lbs_adapter *adapter = priv->adapter;
int ret = 0;
u16 command = le16_to_cpu(resp->command);
u16 result = le16_to_cpu(resp->result);
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);
- }
-
memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
return ret;
}
-int lbs_ret_80211_ad_hoc_stop(lbs_private *priv,
+int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
lbs_deb_enter(LBS_DEB_JOIN);