aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2200.c
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-08-16 18:07:11 -0400
committerJames Ketrenos <jketreno@linux.intel.com>2005-11-07 18:50:58 -0500
commit9ddf84f6f20335ce896feb459b19c3258bbf2e96 (patch)
tree48e2e961031aa7bb7fe7fef401ba132b1e53bf39 /drivers/net/wireless/ipw2200.c
parentb39860c60b135ef16c1c16a3e2a757ff8070c5ad (diff)
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: James Ketrenos <jketreno@linux.intel.com>
Diffstat (limited to 'drivers/net/wireless/ipw2200.c')
-rw-r--r--drivers/net/wireless/ipw2200.c187
1 files changed, 34 insertions, 153 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index a3283caaa872..ef1007785030 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1817,9 +1817,10 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1817 1817
1818 spin_lock_irqsave(&priv->lock, flags); 1818 spin_lock_irqsave(&priv->lock, flags);
1819 if (priv->status & STATUS_HCMD_ACTIVE) { 1819 if (priv->status & STATUS_HCMD_ACTIVE) {
1820 IPW_ERROR("Already sending a command\n"); 1820 IPW_ERROR("Failed to send %s: Already sending a command.\n",
1821 get_cmd_string(cmd->cmd));
1821 spin_unlock_irqrestore(&priv->lock, flags); 1822 spin_unlock_irqrestore(&priv->lock, flags);
1822 return -1; 1823 return -EAGAIN;
1823 } 1824 }
1824 1825
1825 priv->status |= STATUS_HCMD_ACTIVE; 1826 priv->status |= STATUS_HCMD_ACTIVE;
@@ -1832,6 +1833,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1832 rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); 1833 rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0);
1833 if (rc) { 1834 if (rc) {
1834 priv->status &= ~STATUS_HCMD_ACTIVE; 1835 priv->status &= ~STATUS_HCMD_ACTIVE;
1836 IPW_ERROR("Failed to send %s: Reason %d\n",
1837 get_cmd_string(cmd->cmd), rc);
1835 spin_unlock_irqrestore(&priv->lock, flags); 1838 spin_unlock_irqrestore(&priv->lock, flags);
1836 return rc; 1839 return rc;
1837 } 1840 }
@@ -1844,9 +1847,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1844 if (rc == 0) { 1847 if (rc == 0) {
1845 spin_lock_irqsave(&priv->lock, flags); 1848 spin_lock_irqsave(&priv->lock, flags);
1846 if (priv->status & STATUS_HCMD_ACTIVE) { 1849 if (priv->status & STATUS_HCMD_ACTIVE) {
1847 IPW_DEBUG_INFO("Command completion failed out after " 1850 IPW_ERROR("Failed to send %s: Command timed out.\n",
1848 "%dms.\n", 1851 get_cmd_string(cmd->cmd));
1849 1000 * (HOST_COMPLETE_TIMEOUT / HZ));
1850 priv->status &= ~STATUS_HCMD_ACTIVE; 1852 priv->status &= ~STATUS_HCMD_ACTIVE;
1851 spin_unlock_irqrestore(&priv->lock, flags); 1853 spin_unlock_irqrestore(&priv->lock, flags);
1852 return -EIO; 1854 return -EIO;
@@ -1855,7 +1857,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1855 } 1857 }
1856 1858
1857 if (priv->status & STATUS_RF_KILL_HW) { 1859 if (priv->status & STATUS_RF_KILL_HW) {
1858 IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n"); 1860 IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n",
1861 get_cmd_string(cmd->cmd));
1859 return -EIO; 1862 return -EIO;
1860 } 1863 }
1861 1864
@@ -1874,12 +1877,7 @@ static int ipw_send_host_complete(struct ipw_priv *priv)
1874 return -1; 1877 return -1;
1875 } 1878 }
1876 1879
1877 if (ipw_send_cmd(priv, &cmd)) { 1880 return ipw_send_cmd(priv, &cmd);
1878 IPW_ERROR("failed to send HOST_COMPLETE command\n");
1879 return -1;
1880 }
1881
1882 return 0;
1883} 1881}
1884 1882
1885static int ipw_send_system_config(struct ipw_priv *priv, 1883static int ipw_send_system_config(struct ipw_priv *priv,
@@ -1896,12 +1894,7 @@ static int ipw_send_system_config(struct ipw_priv *priv,
1896 } 1894 }
1897 1895
1898 memcpy(cmd.param, config, sizeof(*config)); 1896 memcpy(cmd.param, config, sizeof(*config));
1899 if (ipw_send_cmd(priv, &cmd)) { 1897 return ipw_send_cmd(priv, &cmd);
1900 IPW_ERROR("failed to send SYSTEM_CONFIG command\n");
1901 return -1;
1902 }
1903
1904 return 0;
1905} 1898}
1906 1899
1907static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) 1900static 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 } 1910 }
1918 1911
1919 memcpy(cmd.param, ssid, cmd.len); 1912 memcpy(cmd.param, ssid, cmd.len);
1920 if (ipw_send_cmd(priv, &cmd)) { 1913 return ipw_send_cmd(priv, &cmd);
1921 IPW_ERROR("failed to send SSID command\n");
1922 return -1;
1923 }
1924
1925 return 0;
1926} 1914}
1927 1915
1928static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) 1916static 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 priv->net_dev->name, MAC_ARG(mac)); 1929 priv->net_dev->name, MAC_ARG(mac));
1942 1930
1943 memcpy(cmd.param, mac, ETH_ALEN); 1931 memcpy(cmd.param, mac, ETH_ALEN);
1944 if (ipw_send_cmd(priv, &cmd)) { 1932 return ipw_send_cmd(priv, &cmd);
1945 IPW_ERROR("failed to send ADAPTER_ADDRESS command\n");
1946 return -1;
1947 }
1948
1949 return 0;
1950} 1933}
1951 1934
1952/* 1935/*
@@ -2011,12 +1994,7 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv,
2011 }; 1994 };
2012 1995
2013 memcpy(cmd.param, request, sizeof(*request)); 1996 memcpy(cmd.param, request, sizeof(*request));
2014 if (ipw_send_cmd(priv, &cmd)) { 1997 return ipw_send_cmd(priv, &cmd);
2015 IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n");
2016 return -1;
2017 }
2018
2019 return 0;
2020} 1998}
2021 1999
2022static int ipw_send_scan_abort(struct ipw_priv *priv) 2000static int ipw_send_scan_abort(struct ipw_priv *priv)
@@ -2031,12 +2009,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv)
2031 return -1; 2009 return -1;
2032 } 2010 }
2033 2011
2034 if (ipw_send_cmd(priv, &cmd)) { 2012 return ipw_send_cmd(priv, &cmd);
2035 IPW_ERROR("failed to send SCAN_ABORT command\n");
2036 return -1;
2037 }
2038
2039 return 0;
2040} 2013}
2041 2014
2042static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) 2015static 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 struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) 2021 struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *)
2049 &cmd.param; 2022 &cmd.param;
2050 calib->beacon_rssi_raw = sens; 2023 calib->beacon_rssi_raw = sens;
2051 if (ipw_send_cmd(priv, &cmd)) { 2024 return ipw_send_cmd(priv, &cmd);
2052 IPW_ERROR("failed to send SENSITIVITY CALIB command\n");
2053 return -1;
2054 }
2055
2056 return 0;
2057} 2025}
2058 2026
2059static int ipw_send_associate(struct ipw_priv *priv, 2027static int ipw_send_associate(struct ipw_priv *priv,
@@ -2083,12 +2051,7 @@ static int ipw_send_associate(struct ipw_priv *priv,
2083 } 2051 }
2084 2052
2085 memcpy(cmd.param, &tmp_associate, sizeof(*associate)); 2053 memcpy(cmd.param, &tmp_associate, sizeof(*associate));
2086 if (ipw_send_cmd(priv, &cmd)) { 2054 return ipw_send_cmd(priv, &cmd);
2087 IPW_ERROR("failed to send ASSOCIATE command\n");
2088 return -1;
2089 }
2090
2091 return 0;
2092} 2055}
2093 2056
2094static int ipw_send_supported_rates(struct ipw_priv *priv, 2057static int ipw_send_supported_rates(struct ipw_priv *priv,
@@ -2105,12 +2068,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv,
2105 } 2068 }
2106 2069
2107 memcpy(cmd.param, rates, sizeof(*rates)); 2070 memcpy(cmd.param, rates, sizeof(*rates));
2108 if (ipw_send_cmd(priv, &cmd)) { 2071 return ipw_send_cmd(priv, &cmd);
2109 IPW_ERROR("failed to send SUPPORTED_RATES command\n");
2110 return -1;
2111 }
2112
2113 return 0;
2114} 2072}
2115 2073
2116static int ipw_set_random_seed(struct ipw_priv *priv) 2074static int ipw_set_random_seed(struct ipw_priv *priv)
@@ -2127,12 +2085,7 @@ static int ipw_set_random_seed(struct ipw_priv *priv)
2127 2085
2128 get_random_bytes(&cmd.param, sizeof(u32)); 2086 get_random_bytes(&cmd.param, sizeof(u32));
2129 2087
2130 if (ipw_send_cmd(priv, &cmd)) { 2088 return ipw_send_cmd(priv, &cmd);
2131 IPW_ERROR("failed to send SEED_NUMBER command\n");
2132 return -1;
2133 }
2134
2135 return 0;
2136} 2089}
2137 2090
2138static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) 2091static 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 2102
2150 *((u32 *) & cmd.param) = phy_off; 2103 *((u32 *) & cmd.param) = phy_off;
2151 2104
2152 if (ipw_send_cmd(priv, &cmd)) { 2105 return ipw_send_cmd(priv, &cmd);
2153 IPW_ERROR("failed to send CARD_DISABLE command\n");
2154 return -1;
2155 }
2156
2157 return 0;
2158} 2106}
2159 2107
2160static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) 2108static 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 } 2118 }
2171 2119
2172 memcpy(cmd.param, power, sizeof(*power)); 2120 memcpy(cmd.param, power, sizeof(*power));
2173 if (ipw_send_cmd(priv, &cmd)) { 2121 return ipw_send_cmd(priv, &cmd);
2174 IPW_ERROR("failed to send TX_POWER command\n");
2175 return -1;
2176 }
2177
2178 return 0;
2179} 2122}
2180 2123
2181static int ipw_set_tx_power(struct ipw_priv *priv) 2124static 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 } 2181 }
2239 2182
2240 memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); 2183 memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold));
2241 if (ipw_send_cmd(priv, &cmd)) { 2184 return ipw_send_cmd(priv, &cmd);
2242 IPW_ERROR("failed to send RTS_THRESHOLD command\n");
2243 return -1;
2244 }
2245
2246 return 0;
2247} 2185}
2248 2186
2249static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) 2187static 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 } 2200 }
2263 2201
2264 memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); 2202 memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold));
2265 if (ipw_send_cmd(priv, &cmd)) { 2203 return ipw_send_cmd(priv, &cmd);
2266 IPW_ERROR("failed to send FRAG_THRESHOLD command\n");
2267 return -1;
2268 }
2269
2270 return 0;
2271} 2204}
2272 2205
2273static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) 2206static 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 break; 2230 break;
2298 } 2231 }
2299 2232
2300 if (ipw_send_cmd(priv, &cmd)) { 2233 return ipw_send_cmd(priv, &cmd);
2301 IPW_ERROR("failed to send POWER_MODE command\n");
2302 return -1;
2303 }
2304
2305 return 0;
2306} 2234}
2307 2235
2308static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) 2236static 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 } 2250 }
2323 2251
2324 memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); 2252 memcpy(cmd.param, &retry_limit, sizeof(retry_limit));
2325 if (ipw_send_cmd(priv, &cmd)) { 2253 return ipw_send_cmd(priv, &cmd);
2326 IPW_ERROR("failed to send RETRY_LIMIT command\n");
2327 return -1;
2328 }
2329
2330 return 0;
2331} 2254}
2332 2255
2333/* 2256/*
@@ -3608,20 +3531,6 @@ static void ipw_tx_queue_free(struct ipw_priv *priv)
3608 ipw_queue_tx_free(priv, &priv->txq[3]); 3531 ipw_queue_tx_free(priv, &priv->txq[3]);
3609} 3532}
3610 3533
3611static void inline __maybe_wake_tx(struct ipw_priv *priv)
3612{
3613 if (netif_running(priv->net_dev)) {
3614 switch (priv->port_type) {
3615 case DCR_TYPE_MU_BSS:
3616 case DCR_TYPE_MU_IBSS:
3617 if (!(priv->status & STATUS_ASSOCIATED))
3618 return;
3619 }
3620 netif_wake_queue(priv->net_dev);
3621 }
3622
3623}
3624
3625static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) 3534static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid)
3626{ 3535{
3627 /* First 3 bytes are manufacturer */ 3536 /* First 3 bytes are manufacturer */
@@ -4713,8 +4622,10 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
4713 priv->tx_packets++; 4622 priv->tx_packets++;
4714 } 4623 }
4715 done: 4624 done:
4716 if (ipw_queue_space(q) > q->low_mark && qindex >= 0) 4625 if ((ipw_queue_space(q) > q->low_mark) &&
4717 __maybe_wake_tx(priv); 4626 (qindex >= 0) &&
4627 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev))
4628 netif_wake_queue(priv->net_dev);
4718 used = q->first_empty - q->last_used; 4629 used = q->first_empty - q->last_used;
4719 if (used < 0) 4630 if (used < 0)
4720 used += q->n_bd; 4631 used += q->n_bd;
@@ -5657,10 +5568,7 @@ static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index)
5657 key->tx_counter[0] = 0; 5568 key->tx_counter[0] = 0;
5658 key->tx_counter[1] = 0; 5569 key->tx_counter[1] = 0;
5659 5570
5660 if (ipw_send_cmd(priv, &cmd)) { 5571 ipw_send_cmd(priv, &cmd);
5661 IPW_ERROR("failed to send TGI_TX_KEY command\n");
5662 return;
5663 }
5664} 5572}
5665 5573
5666static void ipw_send_wep_keys(struct ipw_priv *priv, int type) 5574static 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 key->key_size = priv->ieee->sec.key_sizes[i]; 5596 key->key_size = priv->ieee->sec.key_sizes[i];
5689 memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); 5597 memcpy(key->key, priv->ieee->sec.keys[i], key->key_size);
5690 5598
5691 if (ipw_send_cmd(priv, &cmd)) { 5599 ipw_send_cmd(priv, &cmd);
5692 IPW_ERROR("failed to send WEP_KEY command\n");
5693 return;
5694 }
5695 } 5600 }
5696} 5601}
5697 5602
@@ -6249,11 +6154,7 @@ static int ipw_set_rsn_capa(struct ipw_priv *priv,
6249 IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); 6154 IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n");
6250 6155
6251 memcpy(cmd.param, capabilities, length); 6156 memcpy(cmd.param, capabilities, length);
6252 if (ipw_send_cmd(priv, &cmd)) { 6157 return ipw_send_cmd(priv, &cmd);
6253 IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n");
6254 return -1;
6255 }
6256 return 0;
6257} 6158}
6258 6159
6259#if WIRELESS_EXT < 18 6160#if WIRELESS_EXT < 18
@@ -7435,18 +7336,8 @@ static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_q
7435 .len = (sizeof(struct ieee80211_qos_parameters) * 3) 7336 .len = (sizeof(struct ieee80211_qos_parameters) * 3)
7436 }; 7337 };
7437 7338
7438 if (!priv || !qos_param) {
7439 IPW_ERROR("Invalid args\n");
7440 return -1;
7441 }
7442
7443 memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); 7339 memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3);
7444 if (ipw_send_cmd(priv, &cmd)) { 7340 return ipw_send_cmd(priv, &cmd);
7445 IPW_ERROR("failed to send IPW_CMD_QOS_PARAMETERS command\n");
7446 return -1;
7447 }
7448
7449 return 0;
7450} 7341}
7451 7342
7452static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element 7343static 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 .len = sizeof(*qos_param) 7348 .len = sizeof(*qos_param)
7458 }; 7349 };
7459 7350
7460 if (!priv || !qos_param) {
7461 IPW_ERROR("Invalid args\n");
7462 return -1;
7463 }
7464
7465 memcpy(cmd.param, qos_param, sizeof(*qos_param)); 7351 memcpy(cmd.param, qos_param, sizeof(*qos_param));
7466 if (ipw_send_cmd(priv, &cmd)) { 7352 return ipw_send_cmd(priv, &cmd);
7467 IPW_ERROR("failed to send CMD_QOS_INFO command\n");
7468 return -1;
7469 }
7470
7471 return 0;
7472} 7353}
7473 7354
7474#endif /* CONFIG_IPW_QOS */ 7355#endif /* CONFIG_IPW_QOS */