spin_lock_irqsave(&priv->lock, flags);
if (priv->status & STATUS_HCMD_ACTIVE) {
- IPW_ERROR("Already sending a command\n");
+ IPW_ERROR("Failed to send %s: Already sending a command.\n",
+ get_cmd_string(cmd->cmd));
spin_unlock_irqrestore(&priv->lock, flags);
- return -1;
+ return -EAGAIN;
}
priv->status |= STATUS_HCMD_ACTIVE;
rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0);
if (rc) {
priv->status &= ~STATUS_HCMD_ACTIVE;
+ IPW_ERROR("Failed to send %s: Reason %d\n",
+ get_cmd_string(cmd->cmd), rc);
spin_unlock_irqrestore(&priv->lock, flags);
return rc;
}
if (rc == 0) {
spin_lock_irqsave(&priv->lock, flags);
if (priv->status & STATUS_HCMD_ACTIVE) {
- IPW_DEBUG_INFO("Command completion failed out after "
- "%dms.\n",
- 1000 * (HOST_COMPLETE_TIMEOUT / HZ));
+ IPW_ERROR("Failed to send %s: Command timed out.\n",
+ get_cmd_string(cmd->cmd));
priv->status &= ~STATUS_HCMD_ACTIVE;
spin_unlock_irqrestore(&priv->lock, flags);
return -EIO;
}
if (priv->status & STATUS_RF_KILL_HW) {
- IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n");
+ IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n",
+ get_cmd_string(cmd->cmd));
return -EIO;
}
return -1;
}
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send HOST_COMPLETE command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_system_config(struct ipw_priv *priv,
}
memcpy(cmd.param, config, sizeof(*config));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SYSTEM_CONFIG command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len)
}
memcpy(cmd.param, ssid, cmd.len);
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SSID command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
priv->net_dev->name, MAC_ARG(mac));
memcpy(cmd.param, mac, ETH_ALEN);
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send ADAPTER_ADDRESS command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
/*
};
memcpy(cmd.param, request, sizeof(*request));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_scan_abort(struct ipw_priv *priv)
return -1;
}
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SCAN_ABORT command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens)
struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *)
&cmd.param;
calib->beacon_rssi_raw = sens;
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SENSITIVITY CALIB command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_associate(struct ipw_priv *priv,
}
memcpy(cmd.param, &tmp_associate, sizeof(*associate));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send ASSOCIATE command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_supported_rates(struct ipw_priv *priv,
}
memcpy(cmd.param, rates, sizeof(*rates));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SUPPORTED_RATES command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_set_random_seed(struct ipw_priv *priv)
get_random_bytes(&cmd.param, sizeof(u32));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send SEED_NUMBER command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
*((u32 *) & cmd.param) = phy_off;
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send CARD_DISABLE command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power)
}
memcpy(cmd.param, power, sizeof(*power));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send TX_POWER command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_set_tx_power(struct ipw_priv *priv)
}
memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send RTS_THRESHOLD command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
}
memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send FRAG_THRESHOLD command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
break;
}
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send POWER_MODE command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit)
}
memcpy(cmd.param, &retry_limit, sizeof(retry_limit));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send RETRY_LIMIT command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
/*
ipw_queue_tx_free(priv, &priv->txq[3]);
}
-static void inline __maybe_wake_tx(struct ipw_priv *priv)
-{
- if (netif_running(priv->net_dev)) {
- switch (priv->port_type) {
- case DCR_TYPE_MU_BSS:
- case DCR_TYPE_MU_IBSS:
- if (!(priv->status & STATUS_ASSOCIATED))
- return;
- }
- netif_wake_queue(priv->net_dev);
- }
-
-}
-
static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid)
{
/* First 3 bytes are manufacturer */
priv->tx_packets++;
}
done:
- if (ipw_queue_space(q) > q->low_mark && qindex >= 0)
- __maybe_wake_tx(priv);
+ if ((ipw_queue_space(q) > q->low_mark) &&
+ (qindex >= 0) &&
+ (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev))
+ netif_wake_queue(priv->net_dev);
used = q->first_empty - q->last_used;
if (used < 0)
used += q->n_bd;
key->tx_counter[0] = 0;
key->tx_counter[1] = 0;
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send TGI_TX_KEY command\n");
- return;
- }
+ ipw_send_cmd(priv, &cmd);
}
static void ipw_send_wep_keys(struct ipw_priv *priv, int type)
key->key_size = priv->ieee->sec.key_sizes[i];
memcpy(key->key, priv->ieee->sec.keys[i], key->key_size);
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send WEP_KEY command\n");
- return;
- }
+ ipw_send_cmd(priv, &cmd);
}
}
IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n");
memcpy(cmd.param, capabilities, length);
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n");
- return -1;
- }
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
#if WIRELESS_EXT < 18
.len = (sizeof(struct ieee80211_qos_parameters) * 3)
};
- if (!priv || !qos_param) {
- IPW_ERROR("Invalid args\n");
- return -1;
- }
-
memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3);
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send IPW_CMD_QOS_PARAMETERS command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element
.len = sizeof(*qos_param)
};
- if (!priv || !qos_param) {
- IPW_ERROR("Invalid args\n");
- return -1;
- }
-
memcpy(cmd.param, qos_param, sizeof(*qos_param));
- if (ipw_send_cmd(priv, &cmd)) {
- IPW_ERROR("failed to send CMD_QOS_INFO command\n");
- return -1;
- }
-
- return 0;
+ return ipw_send_cmd(priv, &cmd);
}
#endif /* CONFIG_IPW_QOS */