Commit 9ddf84f6 authored by James Ketrenos's avatar James Ketrenos

Changed all of the ipw_send_cmd() calls to return any ipw_send_cmd error

codes to the caller and changed ipw_send_cmd itself to print the error
message to the syslog indicating which command failed to be sent.
Signed-off-by: default avatarJames Ketrenos <jketreno@linux.intel.com>
parent b39860c6
...@@ -1817,9 +1817,10 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) ...@@ -1817,9 +1817,10 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
if (priv->status & STATUS_HCMD_ACTIVE) { 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); spin_unlock_irqrestore(&priv->lock, flags);
return -1; return -EAGAIN;
} }
priv->status |= STATUS_HCMD_ACTIVE; priv->status |= STATUS_HCMD_ACTIVE;
...@@ -1832,6 +1833,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) ...@@ -1832,6 +1833,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0);
if (rc) { if (rc) {
priv->status &= ~STATUS_HCMD_ACTIVE; 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); spin_unlock_irqrestore(&priv->lock, flags);
return rc; return rc;
} }
...@@ -1844,9 +1847,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) ...@@ -1844,9 +1847,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
if (rc == 0) { if (rc == 0) {
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
if (priv->status & STATUS_HCMD_ACTIVE) { if (priv->status & STATUS_HCMD_ACTIVE) {
IPW_DEBUG_INFO("Command completion failed out after " IPW_ERROR("Failed to send %s: Command timed out.\n",
"%dms.\n", get_cmd_string(cmd->cmd));
1000 * (HOST_COMPLETE_TIMEOUT / HZ));
priv->status &= ~STATUS_HCMD_ACTIVE; priv->status &= ~STATUS_HCMD_ACTIVE;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
return -EIO; return -EIO;
...@@ -1855,7 +1857,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) ...@@ -1855,7 +1857,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
} }
if (priv->status & STATUS_RF_KILL_HW) { 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 -EIO;
} }
...@@ -1874,12 +1877,7 @@ static int ipw_send_host_complete(struct ipw_priv *priv) ...@@ -1874,12 +1877,7 @@ static int ipw_send_host_complete(struct ipw_priv *priv)
return -1; return -1;
} }
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send HOST_COMPLETE command\n");
return -1;
}
return 0;
} }
static int ipw_send_system_config(struct ipw_priv *priv, static int ipw_send_system_config(struct ipw_priv *priv,
...@@ -1896,12 +1894,7 @@ static int ipw_send_system_config(struct ipw_priv *priv, ...@@ -1896,12 +1894,7 @@ static int ipw_send_system_config(struct ipw_priv *priv,
} }
memcpy(cmd.param, config, sizeof(*config)); memcpy(cmd.param, config, sizeof(*config));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SYSTEM_CONFIG command\n");
return -1;
}
return 0;
} }
static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len)
...@@ -1917,12 +1910,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) ...@@ -1917,12 +1910,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len)
} }
memcpy(cmd.param, ssid, cmd.len); memcpy(cmd.param, ssid, cmd.len);
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SSID command\n");
return -1;
}
return 0;
} }
static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
...@@ -1941,12 +1929,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) ...@@ -1941,12 +1929,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
priv->net_dev->name, MAC_ARG(mac)); priv->net_dev->name, MAC_ARG(mac));
memcpy(cmd.param, mac, ETH_ALEN); memcpy(cmd.param, mac, ETH_ALEN);
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send ADAPTER_ADDRESS command\n");
return -1;
}
return 0;
} }
/* /*
...@@ -2011,12 +1994,7 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, ...@@ -2011,12 +1994,7 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv,
}; };
memcpy(cmd.param, request, sizeof(*request)); memcpy(cmd.param, request, sizeof(*request));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n");
return -1;
}
return 0;
} }
static int ipw_send_scan_abort(struct ipw_priv *priv) static int ipw_send_scan_abort(struct ipw_priv *priv)
...@@ -2031,12 +2009,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv) ...@@ -2031,12 +2009,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv)
return -1; return -1;
} }
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SCAN_ABORT command\n");
return -1;
}
return 0;
} }
static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens)
...@@ -2048,12 +2021,7 @@ static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) ...@@ -2048,12 +2021,7 @@ static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens)
struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *)
&cmd.param; &cmd.param;
calib->beacon_rssi_raw = sens; calib->beacon_rssi_raw = sens;
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SENSITIVITY CALIB command\n");
return -1;
}
return 0;
} }
static int ipw_send_associate(struct ipw_priv *priv, static int ipw_send_associate(struct ipw_priv *priv,
...@@ -2083,12 +2051,7 @@ static int ipw_send_associate(struct ipw_priv *priv, ...@@ -2083,12 +2051,7 @@ static int ipw_send_associate(struct ipw_priv *priv,
} }
memcpy(cmd.param, &tmp_associate, sizeof(*associate)); memcpy(cmd.param, &tmp_associate, sizeof(*associate));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send ASSOCIATE command\n");
return -1;
}
return 0;
} }
static int ipw_send_supported_rates(struct ipw_priv *priv, static int ipw_send_supported_rates(struct ipw_priv *priv,
...@@ -2105,12 +2068,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv, ...@@ -2105,12 +2068,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv,
} }
memcpy(cmd.param, rates, sizeof(*rates)); memcpy(cmd.param, rates, sizeof(*rates));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SUPPORTED_RATES command\n");
return -1;
}
return 0;
} }
static int ipw_set_random_seed(struct ipw_priv *priv) static int ipw_set_random_seed(struct ipw_priv *priv)
...@@ -2127,12 +2085,7 @@ static int ipw_set_random_seed(struct ipw_priv *priv) ...@@ -2127,12 +2085,7 @@ static int ipw_set_random_seed(struct ipw_priv *priv)
get_random_bytes(&cmd.param, sizeof(u32)); get_random_bytes(&cmd.param, sizeof(u32));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send SEED_NUMBER command\n");
return -1;
}
return 0;
} }
static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
...@@ -2149,12 +2102,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) ...@@ -2149,12 +2102,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
*((u32 *) & cmd.param) = phy_off; *((u32 *) & cmd.param) = phy_off;
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send CARD_DISABLE command\n");
return -1;
}
return 0;
} }
static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power)
...@@ -2170,12 +2118,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) ...@@ -2170,12 +2118,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power)
} }
memcpy(cmd.param, power, sizeof(*power)); memcpy(cmd.param, power, sizeof(*power));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send TX_POWER command\n");
return -1;
}
return 0;
} }
static int ipw_set_tx_power(struct ipw_priv *priv) static int ipw_set_tx_power(struct ipw_priv *priv)
...@@ -2238,12 +2181,7 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) ...@@ -2238,12 +2181,7 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts)
} }
memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send RTS_THRESHOLD command\n");
return -1;
}
return 0;
} }
static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
...@@ -2262,12 +2200,7 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) ...@@ -2262,12 +2200,7 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
} }
memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send FRAG_THRESHOLD command\n");
return -1;
}
return 0;
} }
static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
...@@ -2297,12 +2230,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) ...@@ -2297,12 +2230,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
break; break;
} }
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send POWER_MODE command\n");
return -1;
}
return 0;
} }
static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit)
...@@ -2322,12 +2250,7 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) ...@@ -2322,12 +2250,7 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit)
} }
memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); memcpy(cmd.param, &retry_limit, sizeof(retry_limit));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send RETRY_LIMIT command\n");
return -1;
}
return 0;
} }
/* /*
...@@ -3608,20 +3531,6 @@ static void ipw_tx_queue_free(struct ipw_priv *priv) ...@@ -3608,20 +3531,6 @@ static void ipw_tx_queue_free(struct ipw_priv *priv)
ipw_queue_tx_free(priv, &priv->txq[3]); 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) static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid)
{ {
/* First 3 bytes are manufacturer */ /* First 3 bytes are manufacturer */
...@@ -4713,8 +4622,10 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, ...@@ -4713,8 +4622,10 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
priv->tx_packets++; priv->tx_packets++;
} }
done: done:
if (ipw_queue_space(q) > q->low_mark && qindex >= 0) if ((ipw_queue_space(q) > q->low_mark) &&
__maybe_wake_tx(priv); (qindex >= 0) &&
(priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev))
netif_wake_queue(priv->net_dev);
used = q->first_empty - q->last_used; used = q->first_empty - q->last_used;
if (used < 0) if (used < 0)
used += q->n_bd; used += q->n_bd;
...@@ -5657,10 +5568,7 @@ static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) ...@@ -5657,10 +5568,7 @@ static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index)
key->tx_counter[0] = 0; key->tx_counter[0] = 0;
key->tx_counter[1] = 0; key->tx_counter[1] = 0;
if (ipw_send_cmd(priv, &cmd)) { ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send TGI_TX_KEY command\n");
return;
}
} }
static void ipw_send_wep_keys(struct ipw_priv *priv, int type) static void ipw_send_wep_keys(struct ipw_priv *priv, int type)
...@@ -5688,10 +5596,7 @@ static void ipw_send_wep_keys(struct ipw_priv *priv, int type) ...@@ -5688,10 +5596,7 @@ static void ipw_send_wep_keys(struct ipw_priv *priv, int type)
key->key_size = priv->ieee->sec.key_sizes[i]; key->key_size = priv->ieee->sec.key_sizes[i];
memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); memcpy(key->key, priv->ieee->sec.keys[i], key->key_size);
if (ipw_send_cmd(priv, &cmd)) { ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send WEP_KEY command\n");
return;
}
} }
} }
...@@ -6249,11 +6154,7 @@ static int ipw_set_rsn_capa(struct ipw_priv *priv, ...@@ -6249,11 +6154,7 @@ static int ipw_set_rsn_capa(struct ipw_priv *priv,
IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n");
memcpy(cmd.param, capabilities, length); memcpy(cmd.param, capabilities, length);
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n");
return -1;
}
return 0;
} }
#if WIRELESS_EXT < 18 #if WIRELESS_EXT < 18
...@@ -7435,18 +7336,8 @@ static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_q ...@@ -7435,18 +7336,8 @@ static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_q
.len = (sizeof(struct ieee80211_qos_parameters) * 3) .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); memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3);
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send IPW_CMD_QOS_PARAMETERS command\n");
return -1;
}
return 0;
} }
static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element
...@@ -7457,18 +7348,8 @@ static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos ...@@ -7457,18 +7348,8 @@ static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos
.len = sizeof(*qos_param) .len = sizeof(*qos_param)
}; };
if (!priv || !qos_param) {
IPW_ERROR("Invalid args\n");
return -1;
}
memcpy(cmd.param, qos_param, sizeof(*qos_param)); memcpy(cmd.param, qos_param, sizeof(*qos_param));
if (ipw_send_cmd(priv, &cmd)) { return ipw_send_cmd(priv, &cmd);
IPW_ERROR("failed to send CMD_QOS_INFO command\n");
return -1;
}
return 0;
} }
#endif /* CONFIG_IPW_QOS */ #endif /* CONFIG_IPW_QOS */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment