diff options
author | Zhu Yi <yi.zhu@intel.com> | 2006-01-24 03:37:28 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-01-30 20:35:34 -0500 |
commit | 0a7bcf261ea584c87a9cee4523023fa74168de4a (patch) | |
tree | f5ccb4cf6b3e376bbb16a1a0cb12b700b58ba928 /drivers/net/wireless/ipw2200.c | |
parent | 397ae121ee0116d3b4125d621f0ef528d1d52580 (diff) |
[PATCH] ipw2200: stack reduction
Checking the stack usage of my kernel, showed that ipw2200 had a few bad
offenders. This is on i386 32-bit:
0x00002876 ipw_send_associate: 544
0x000028ee ipw_send_associate: 544
0x000027dc ipw_send_scan_request_ext: 520
0x00002864 ipw_set_sensitivity: 520
0x00005eac ipw_set_rsn_capa: 520
The reason is the host_cmd structure is large (500 bytes). All other
functions currently using ipw_send_cmd() suffer from the same problem.
This patch introduces ipw_send_cmd_simple() for commands with no data
transfer, and ipw_send_cmd_pdu() for commands with a data payload and
makes the payload a pointer to the buffer passed in from the caller.
As an added bonus, the diffstat looks like this:
ipw2200.c | 260 +++++++++++++++++++++-----------------------------------------
ipw2200.h | 2
2 files changed, 92 insertions(+), 170 deletions(-)
and it shrinks the module a lot as well:
Before:
text data bss dec hex filename
75177 2472 44 77693 12f7d drivers/net/wireless/ipw2200.ko
After:
text data bss dec hex filename
61363 2488 44 63895 f997 drivers/net/wireless/ipw2200.ko
So about a ~18% reduction in module size.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2200.c')
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 253 |
1 files changed, 90 insertions, 163 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index c42eb54f379a..2fe1e048328e 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1928,7 +1928,8 @@ static char *get_cmd_string(u8 cmd) | |||
1928 | } | 1928 | } |
1929 | 1929 | ||
1930 | #define HOST_COMPLETE_TIMEOUT HZ | 1930 | #define HOST_COMPLETE_TIMEOUT HZ |
1931 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | 1931 | |
1932 | static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | ||
1932 | { | 1933 | { |
1933 | int rc = 0; | 1934 | int rc = 0; |
1934 | unsigned long flags; | 1935 | unsigned long flags; |
@@ -1964,7 +1965,7 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
1964 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | 1965 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); |
1965 | 1966 | ||
1966 | 1967 | ||
1967 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); | 1968 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, cmd->param, cmd->len, 0); |
1968 | if (rc) { | 1969 | if (rc) { |
1969 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1970 | priv->status &= ~STATUS_HCMD_ACTIVE; |
1970 | IPW_ERROR("Failed to send %s: Reason %d\n", | 1971 | IPW_ERROR("Failed to send %s: Reason %d\n", |
@@ -1999,7 +2000,7 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
1999 | goto exit; | 2000 | goto exit; |
2000 | } | 2001 | } |
2001 | 2002 | ||
2002 | exit: | 2003 | exit: |
2003 | if (priv->cmdlog) { | 2004 | if (priv->cmdlog) { |
2004 | priv->cmdlog[priv->cmdlog_pos++].retcode = rc; | 2005 | priv->cmdlog[priv->cmdlog_pos++].retcode = rc; |
2005 | priv->cmdlog_pos %= priv->cmdlog_len; | 2006 | priv->cmdlog_pos %= priv->cmdlog_len; |
@@ -2007,61 +2008,62 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2007 | return rc; | 2008 | return rc; |
2008 | } | 2009 | } |
2009 | 2010 | ||
2010 | static int ipw_send_host_complete(struct ipw_priv *priv) | 2011 | static int ipw_send_cmd_simple(struct ipw_priv *priv, u8 command) |
2012 | { | ||
2013 | struct host_cmd cmd = { | ||
2014 | .cmd = command, | ||
2015 | }; | ||
2016 | |||
2017 | return __ipw_send_cmd(priv, &cmd); | ||
2018 | } | ||
2019 | |||
2020 | static int ipw_send_cmd_pdu(struct ipw_priv *priv, u8 command, u8 len, | ||
2021 | void *data) | ||
2011 | { | 2022 | { |
2012 | struct host_cmd cmd = { | 2023 | struct host_cmd cmd = { |
2013 | .cmd = IPW_CMD_HOST_COMPLETE, | 2024 | .cmd = command, |
2014 | .len = 0 | 2025 | .len = len, |
2026 | .param = data, | ||
2015 | }; | 2027 | }; |
2016 | 2028 | ||
2029 | return __ipw_send_cmd(priv, &cmd); | ||
2030 | } | ||
2031 | |||
2032 | static int ipw_send_host_complete(struct ipw_priv *priv) | ||
2033 | { | ||
2017 | if (!priv) { | 2034 | if (!priv) { |
2018 | IPW_ERROR("Invalid args\n"); | 2035 | IPW_ERROR("Invalid args\n"); |
2019 | return -1; | 2036 | return -1; |
2020 | } | 2037 | } |
2021 | 2038 | ||
2022 | return ipw_send_cmd(priv, &cmd); | 2039 | return ipw_send_cmd_simple(priv, IPW_CMD_HOST_COMPLETE); |
2023 | } | 2040 | } |
2024 | 2041 | ||
2025 | static int ipw_send_system_config(struct ipw_priv *priv, | 2042 | static int ipw_send_system_config(struct ipw_priv *priv, |
2026 | struct ipw_sys_config *config) | 2043 | struct ipw_sys_config *config) |
2027 | { | 2044 | { |
2028 | struct host_cmd cmd = { | ||
2029 | .cmd = IPW_CMD_SYSTEM_CONFIG, | ||
2030 | .len = sizeof(*config) | ||
2031 | }; | ||
2032 | |||
2033 | if (!priv || !config) { | 2045 | if (!priv || !config) { |
2034 | IPW_ERROR("Invalid args\n"); | 2046 | IPW_ERROR("Invalid args\n"); |
2035 | return -1; | 2047 | return -1; |
2036 | } | 2048 | } |
2037 | 2049 | ||
2038 | memcpy(cmd.param, config, sizeof(*config)); | 2050 | return ipw_send_cmd_pdu(priv, IPW_CMD_SYSTEM_CONFIG, sizeof(*config), |
2039 | return ipw_send_cmd(priv, &cmd); | 2051 | config); |
2040 | } | 2052 | } |
2041 | 2053 | ||
2042 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | 2054 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) |
2043 | { | 2055 | { |
2044 | struct host_cmd cmd = { | ||
2045 | .cmd = IPW_CMD_SSID, | ||
2046 | .len = min(len, IW_ESSID_MAX_SIZE) | ||
2047 | }; | ||
2048 | |||
2049 | if (!priv || !ssid) { | 2056 | if (!priv || !ssid) { |
2050 | IPW_ERROR("Invalid args\n"); | 2057 | IPW_ERROR("Invalid args\n"); |
2051 | return -1; | 2058 | return -1; |
2052 | } | 2059 | } |
2053 | 2060 | ||
2054 | memcpy(cmd.param, ssid, cmd.len); | 2061 | return ipw_send_cmd_pdu(priv, IPW_CMD_SSID, min(len, IW_ESSID_MAX_SIZE), |
2055 | return ipw_send_cmd(priv, &cmd); | 2062 | ssid); |
2056 | } | 2063 | } |
2057 | 2064 | ||
2058 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | 2065 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) |
2059 | { | 2066 | { |
2060 | struct host_cmd cmd = { | ||
2061 | .cmd = IPW_CMD_ADAPTER_ADDRESS, | ||
2062 | .len = ETH_ALEN | ||
2063 | }; | ||
2064 | |||
2065 | if (!priv || !mac) { | 2067 | if (!priv || !mac) { |
2066 | IPW_ERROR("Invalid args\n"); | 2068 | IPW_ERROR("Invalid args\n"); |
2067 | return -1; | 2069 | return -1; |
@@ -2070,8 +2072,8 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | |||
2070 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", | 2072 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", |
2071 | priv->net_dev->name, MAC_ARG(mac)); | 2073 | priv->net_dev->name, MAC_ARG(mac)); |
2072 | 2074 | ||
2073 | memcpy(cmd.param, mac, ETH_ALEN); | 2075 | return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, |
2074 | return ipw_send_cmd(priv, &cmd); | 2076 | mac); |
2075 | } | 2077 | } |
2076 | 2078 | ||
2077 | /* | 2079 | /* |
@@ -2130,51 +2132,40 @@ static void ipw_bg_scan_check(void *data) | |||
2130 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, | 2132 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, |
2131 | struct ipw_scan_request_ext *request) | 2133 | struct ipw_scan_request_ext *request) |
2132 | { | 2134 | { |
2133 | struct host_cmd cmd = { | 2135 | return ipw_send_cmd_pdu(priv, IPW_CMD_SCAN_REQUEST_EXT, |
2134 | .cmd = IPW_CMD_SCAN_REQUEST_EXT, | 2136 | sizeof(*request), request); |
2135 | .len = sizeof(*request) | ||
2136 | }; | ||
2137 | |||
2138 | memcpy(cmd.param, request, sizeof(*request)); | ||
2139 | return ipw_send_cmd(priv, &cmd); | ||
2140 | } | 2137 | } |
2141 | 2138 | ||
2142 | static int ipw_send_scan_abort(struct ipw_priv *priv) | 2139 | static int ipw_send_scan_abort(struct ipw_priv *priv) |
2143 | { | 2140 | { |
2144 | struct host_cmd cmd = { | ||
2145 | .cmd = IPW_CMD_SCAN_ABORT, | ||
2146 | .len = 0 | ||
2147 | }; | ||
2148 | |||
2149 | if (!priv) { | 2141 | if (!priv) { |
2150 | IPW_ERROR("Invalid args\n"); | 2142 | IPW_ERROR("Invalid args\n"); |
2151 | return -1; | 2143 | return -1; |
2152 | } | 2144 | } |
2153 | 2145 | ||
2154 | return ipw_send_cmd(priv, &cmd); | 2146 | return ipw_send_cmd_simple(priv, IPW_CMD_SCAN_ABORT); |
2155 | } | 2147 | } |
2156 | 2148 | ||
2157 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | 2149 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) |
2158 | { | 2150 | { |
2159 | struct host_cmd cmd = { | 2151 | struct ipw_sensitivity_calib calib = { |
2160 | .cmd = IPW_CMD_SENSITIVITY_CALIB, | 2152 | .beacon_rssi_raw = sens, |
2161 | .len = sizeof(struct ipw_sensitivity_calib) | ||
2162 | }; | 2153 | }; |
2163 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) | 2154 | |
2164 | &cmd.param; | 2155 | return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib), |
2165 | calib->beacon_rssi_raw = sens; | 2156 | &calib); |
2166 | return ipw_send_cmd(priv, &cmd); | ||
2167 | } | 2157 | } |
2168 | 2158 | ||
2169 | static int ipw_send_associate(struct ipw_priv *priv, | 2159 | static int ipw_send_associate(struct ipw_priv *priv, |
2170 | struct ipw_associate *associate) | 2160 | struct ipw_associate *associate) |
2171 | { | 2161 | { |
2172 | struct host_cmd cmd = { | ||
2173 | .cmd = IPW_CMD_ASSOCIATE, | ||
2174 | .len = sizeof(*associate) | ||
2175 | }; | ||
2176 | |||
2177 | struct ipw_associate tmp_associate; | 2162 | struct ipw_associate tmp_associate; |
2163 | |||
2164 | if (!priv || !associate) { | ||
2165 | IPW_ERROR("Invalid args\n"); | ||
2166 | return -1; | ||
2167 | } | ||
2168 | |||
2178 | memcpy(&tmp_associate, associate, sizeof(*associate)); | 2169 | memcpy(&tmp_associate, associate, sizeof(*associate)); |
2179 | tmp_associate.policy_support = | 2170 | tmp_associate.policy_support = |
2180 | cpu_to_le16(tmp_associate.policy_support); | 2171 | cpu_to_le16(tmp_associate.policy_support); |
@@ -2187,80 +2178,56 @@ static int ipw_send_associate(struct ipw_priv *priv, | |||
2187 | cpu_to_le16(tmp_associate.beacon_interval); | 2178 | cpu_to_le16(tmp_associate.beacon_interval); |
2188 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); | 2179 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); |
2189 | 2180 | ||
2190 | if (!priv || !associate) { | 2181 | return ipw_send_cmd_pdu(priv, IPW_CMD_ASSOCIATE, sizeof(tmp_associate), |
2191 | IPW_ERROR("Invalid args\n"); | 2182 | &tmp_associate); |
2192 | return -1; | ||
2193 | } | ||
2194 | |||
2195 | memcpy(cmd.param, &tmp_associate, sizeof(*associate)); | ||
2196 | return ipw_send_cmd(priv, &cmd); | ||
2197 | } | 2183 | } |
2198 | 2184 | ||
2199 | static int ipw_send_supported_rates(struct ipw_priv *priv, | 2185 | static int ipw_send_supported_rates(struct ipw_priv *priv, |
2200 | struct ipw_supported_rates *rates) | 2186 | struct ipw_supported_rates *rates) |
2201 | { | 2187 | { |
2202 | struct host_cmd cmd = { | ||
2203 | .cmd = IPW_CMD_SUPPORTED_RATES, | ||
2204 | .len = sizeof(*rates) | ||
2205 | }; | ||
2206 | |||
2207 | if (!priv || !rates) { | 2188 | if (!priv || !rates) { |
2208 | IPW_ERROR("Invalid args\n"); | 2189 | IPW_ERROR("Invalid args\n"); |
2209 | return -1; | 2190 | return -1; |
2210 | } | 2191 | } |
2211 | 2192 | ||
2212 | memcpy(cmd.param, rates, sizeof(*rates)); | 2193 | return ipw_send_cmd_pdu(priv, IPW_CMD_SUPPORTED_RATES, sizeof(*rates), |
2213 | return ipw_send_cmd(priv, &cmd); | 2194 | rates); |
2214 | } | 2195 | } |
2215 | 2196 | ||
2216 | static int ipw_set_random_seed(struct ipw_priv *priv) | 2197 | static int ipw_set_random_seed(struct ipw_priv *priv) |
2217 | { | 2198 | { |
2218 | struct host_cmd cmd = { | 2199 | u32 val; |
2219 | .cmd = IPW_CMD_SEED_NUMBER, | ||
2220 | .len = sizeof(u32) | ||
2221 | }; | ||
2222 | 2200 | ||
2223 | if (!priv) { | 2201 | if (!priv) { |
2224 | IPW_ERROR("Invalid args\n"); | 2202 | IPW_ERROR("Invalid args\n"); |
2225 | return -1; | 2203 | return -1; |
2226 | } | 2204 | } |
2227 | 2205 | ||
2228 | get_random_bytes(&cmd.param, sizeof(u32)); | 2206 | get_random_bytes(&val, sizeof(val)); |
2229 | 2207 | ||
2230 | return ipw_send_cmd(priv, &cmd); | 2208 | return ipw_send_cmd_pdu(priv, IPW_CMD_SEED_NUMBER, sizeof(val), &val); |
2231 | } | 2209 | } |
2232 | 2210 | ||
2233 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | 2211 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) |
2234 | { | 2212 | { |
2235 | struct host_cmd cmd = { | ||
2236 | .cmd = IPW_CMD_CARD_DISABLE, | ||
2237 | .len = sizeof(u32) | ||
2238 | }; | ||
2239 | |||
2240 | if (!priv) { | 2213 | if (!priv) { |
2241 | IPW_ERROR("Invalid args\n"); | 2214 | IPW_ERROR("Invalid args\n"); |
2242 | return -1; | 2215 | return -1; |
2243 | } | 2216 | } |
2244 | 2217 | ||
2245 | *((u32 *) & cmd.param) = phy_off; | 2218 | return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off), |
2246 | 2219 | &phy_off); | |
2247 | return ipw_send_cmd(priv, &cmd); | ||
2248 | } | 2220 | } |
2249 | 2221 | ||
2250 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | 2222 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) |
2251 | { | 2223 | { |
2252 | struct host_cmd cmd = { | ||
2253 | .cmd = IPW_CMD_TX_POWER, | ||
2254 | .len = sizeof(*power) | ||
2255 | }; | ||
2256 | |||
2257 | if (!priv || !power) { | 2224 | if (!priv || !power) { |
2258 | IPW_ERROR("Invalid args\n"); | 2225 | IPW_ERROR("Invalid args\n"); |
2259 | return -1; | 2226 | return -1; |
2260 | } | 2227 | } |
2261 | 2228 | ||
2262 | memcpy(cmd.param, power, sizeof(*power)); | 2229 | return ipw_send_cmd_pdu(priv, IPW_CMD_TX_POWER, sizeof(*power), |
2263 | return ipw_send_cmd(priv, &cmd); | 2230 | power); |
2264 | } | 2231 | } |
2265 | 2232 | ||
2266 | static int ipw_set_tx_power(struct ipw_priv *priv) | 2233 | static int ipw_set_tx_power(struct ipw_priv *priv) |
@@ -2312,18 +2279,14 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) | |||
2312 | struct ipw_rts_threshold rts_threshold = { | 2279 | struct ipw_rts_threshold rts_threshold = { |
2313 | .rts_threshold = rts, | 2280 | .rts_threshold = rts, |
2314 | }; | 2281 | }; |
2315 | struct host_cmd cmd = { | ||
2316 | .cmd = IPW_CMD_RTS_THRESHOLD, | ||
2317 | .len = sizeof(rts_threshold) | ||
2318 | }; | ||
2319 | 2282 | ||
2320 | if (!priv) { | 2283 | if (!priv) { |
2321 | IPW_ERROR("Invalid args\n"); | 2284 | IPW_ERROR("Invalid args\n"); |
2322 | return -1; | 2285 | return -1; |
2323 | } | 2286 | } |
2324 | 2287 | ||
2325 | memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); | 2288 | return ipw_send_cmd_pdu(priv, IPW_CMD_RTS_THRESHOLD, |
2326 | return ipw_send_cmd(priv, &cmd); | 2289 | sizeof(rts_threshold), &rts_threshold); |
2327 | } | 2290 | } |
2328 | 2291 | ||
2329 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | 2292 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) |
@@ -2331,27 +2294,19 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | |||
2331 | struct ipw_frag_threshold frag_threshold = { | 2294 | struct ipw_frag_threshold frag_threshold = { |
2332 | .frag_threshold = frag, | 2295 | .frag_threshold = frag, |
2333 | }; | 2296 | }; |
2334 | struct host_cmd cmd = { | ||
2335 | .cmd = IPW_CMD_FRAG_THRESHOLD, | ||
2336 | .len = sizeof(frag_threshold) | ||
2337 | }; | ||
2338 | 2297 | ||
2339 | if (!priv) { | 2298 | if (!priv) { |
2340 | IPW_ERROR("Invalid args\n"); | 2299 | IPW_ERROR("Invalid args\n"); |
2341 | return -1; | 2300 | return -1; |
2342 | } | 2301 | } |
2343 | 2302 | ||
2344 | memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); | 2303 | return ipw_send_cmd_pdu(priv, IPW_CMD_FRAG_THRESHOLD, |
2345 | return ipw_send_cmd(priv, &cmd); | 2304 | sizeof(frag_threshold), &frag_threshold); |
2346 | } | 2305 | } |
2347 | 2306 | ||
2348 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | 2307 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) |
2349 | { | 2308 | { |
2350 | struct host_cmd cmd = { | 2309 | u32 param; |
2351 | .cmd = IPW_CMD_POWER_MODE, | ||
2352 | .len = sizeof(u32) | ||
2353 | }; | ||
2354 | u32 *param = (u32 *) (&cmd.param); | ||
2355 | 2310 | ||
2356 | if (!priv) { | 2311 | if (!priv) { |
2357 | IPW_ERROR("Invalid args\n"); | 2312 | IPW_ERROR("Invalid args\n"); |
@@ -2362,17 +2317,18 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
2362 | * level */ | 2317 | * level */ |
2363 | switch (mode) { | 2318 | switch (mode) { |
2364 | case IPW_POWER_BATTERY: | 2319 | case IPW_POWER_BATTERY: |
2365 | *param = IPW_POWER_INDEX_3; | 2320 | param = IPW_POWER_INDEX_3; |
2366 | break; | 2321 | break; |
2367 | case IPW_POWER_AC: | 2322 | case IPW_POWER_AC: |
2368 | *param = IPW_POWER_MODE_CAM; | 2323 | param = IPW_POWER_MODE_CAM; |
2369 | break; | 2324 | break; |
2370 | default: | 2325 | default: |
2371 | *param = mode; | 2326 | param = mode; |
2372 | break; | 2327 | break; |
2373 | } | 2328 | } |
2374 | 2329 | ||
2375 | return ipw_send_cmd(priv, &cmd); | 2330 | return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), |
2331 | ¶m); | ||
2376 | } | 2332 | } |
2377 | 2333 | ||
2378 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | 2334 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) |
@@ -2381,18 +2337,14 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | |||
2381 | .short_retry_limit = slimit, | 2337 | .short_retry_limit = slimit, |
2382 | .long_retry_limit = llimit | 2338 | .long_retry_limit = llimit |
2383 | }; | 2339 | }; |
2384 | struct host_cmd cmd = { | ||
2385 | .cmd = IPW_CMD_RETRY_LIMIT, | ||
2386 | .len = sizeof(retry_limit) | ||
2387 | }; | ||
2388 | 2340 | ||
2389 | if (!priv) { | 2341 | if (!priv) { |
2390 | IPW_ERROR("Invalid args\n"); | 2342 | IPW_ERROR("Invalid args\n"); |
2391 | return -1; | 2343 | return -1; |
2392 | } | 2344 | } |
2393 | 2345 | ||
2394 | memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); | 2346 | return ipw_send_cmd_pdu(priv, IPW_CMD_RETRY_LIMIT, sizeof(retry_limit), |
2395 | return ipw_send_cmd(priv, &cmd); | 2347 | &retry_limit); |
2396 | } | 2348 | } |
2397 | 2349 | ||
2398 | /* | 2350 | /* |
@@ -5750,54 +5702,44 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
5750 | 5702 | ||
5751 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) | 5703 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) |
5752 | { | 5704 | { |
5753 | struct ipw_tgi_tx_key *key; | 5705 | struct ipw_tgi_tx_key key; |
5754 | struct host_cmd cmd = { | ||
5755 | .cmd = IPW_CMD_TGI_TX_KEY, | ||
5756 | .len = sizeof(*key) | ||
5757 | }; | ||
5758 | 5706 | ||
5759 | if (!(priv->ieee->sec.flags & (1 << index))) | 5707 | if (!(priv->ieee->sec.flags & (1 << index))) |
5760 | return; | 5708 | return; |
5761 | 5709 | ||
5762 | key = (struct ipw_tgi_tx_key *)&cmd.param; | 5710 | key.key_id = index; |
5763 | key->key_id = index; | 5711 | memcpy(key.key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); |
5764 | memcpy(key->key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); | 5712 | key.security_type = type; |
5765 | key->security_type = type; | 5713 | key.station_index = 0; /* always 0 for BSS */ |
5766 | key->station_index = 0; /* always 0 for BSS */ | 5714 | key.flags = 0; |
5767 | key->flags = 0; | ||
5768 | /* 0 for new key; previous value of counter (after fatal error) */ | 5715 | /* 0 for new key; previous value of counter (after fatal error) */ |
5769 | key->tx_counter[0] = 0; | 5716 | key.tx_counter[0] = 0; |
5770 | key->tx_counter[1] = 0; | 5717 | key.tx_counter[1] = 0; |
5771 | 5718 | ||
5772 | ipw_send_cmd(priv, &cmd); | 5719 | ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key); |
5773 | } | 5720 | } |
5774 | 5721 | ||
5775 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) | 5722 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) |
5776 | { | 5723 | { |
5777 | struct ipw_wep_key *key; | 5724 | struct ipw_wep_key key; |
5778 | int i; | 5725 | int i; |
5779 | struct host_cmd cmd = { | ||
5780 | .cmd = IPW_CMD_WEP_KEY, | ||
5781 | .len = sizeof(*key) | ||
5782 | }; | ||
5783 | 5726 | ||
5784 | key = (struct ipw_wep_key *)&cmd.param; | 5727 | key.cmd_id = DINO_CMD_WEP_KEY; |
5785 | key->cmd_id = DINO_CMD_WEP_KEY; | 5728 | key.seq_num = 0; |
5786 | key->seq_num = 0; | ||
5787 | 5729 | ||
5788 | /* Note: AES keys cannot be set for multiple times. | 5730 | /* Note: AES keys cannot be set for multiple times. |
5789 | * Only set it at the first time. */ | 5731 | * Only set it at the first time. */ |
5790 | for (i = 0; i < 4; i++) { | 5732 | for (i = 0; i < 4; i++) { |
5791 | key->key_index = i | type; | 5733 | key.key_index = i | type; |
5792 | if (!(priv->ieee->sec.flags & (1 << i))) { | 5734 | if (!(priv->ieee->sec.flags & (1 << i))) { |
5793 | key->key_size = 0; | 5735 | key.key_size = 0; |
5794 | continue; | 5736 | continue; |
5795 | } | 5737 | } |
5796 | 5738 | ||
5797 | key->key_size = priv->ieee->sec.key_sizes[i]; | 5739 | key.key_size = priv->ieee->sec.key_sizes[i]; |
5798 | memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); | 5740 | memcpy(key.key, priv->ieee->sec.keys[i], key.key_size); |
5799 | 5741 | ||
5800 | ipw_send_cmd(priv, &cmd); | 5742 | ipw_send_cmd_pdu(priv, IPW_CMD_WEP_KEY, sizeof(key), &key); |
5801 | } | 5743 | } |
5802 | } | 5744 | } |
5803 | 5745 | ||
@@ -6298,15 +6240,10 @@ static void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, | |||
6298 | static int ipw_set_rsn_capa(struct ipw_priv *priv, | 6240 | static int ipw_set_rsn_capa(struct ipw_priv *priv, |
6299 | char *capabilities, int length) | 6241 | char *capabilities, int length) |
6300 | { | 6242 | { |
6301 | struct host_cmd cmd = { | ||
6302 | .cmd = IPW_CMD_RSN_CAPABILITIES, | ||
6303 | .len = length, | ||
6304 | }; | ||
6305 | |||
6306 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); | 6243 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); |
6307 | 6244 | ||
6308 | memcpy(cmd.param, capabilities, length); | 6245 | return ipw_send_cmd_pdu(priv, IPW_CMD_RSN_CAPABILITIES, length, |
6309 | return ipw_send_cmd(priv, &cmd); | 6246 | capabilities); |
6310 | } | 6247 | } |
6311 | 6248 | ||
6312 | /* | 6249 | /* |
@@ -7093,25 +7030,15 @@ static int ipw_handle_assoc_response(struct net_device *dev, | |||
7093 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | 7030 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters |
7094 | *qos_param) | 7031 | *qos_param) |
7095 | { | 7032 | { |
7096 | struct host_cmd cmd = { | 7033 | return ipw_send_cmd_pdu(priv, IPW_CMD_QOS_PARAMETERS, qos_param, |
7097 | .cmd = IPW_CMD_QOS_PARAMETERS, | 7034 | sizeof(*qos_param) * 3); |
7098 | .len = (sizeof(struct ieee80211_qos_parameters) * 3) | ||
7099 | }; | ||
7100 | |||
7101 | memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); | ||
7102 | return ipw_send_cmd(priv, &cmd); | ||
7103 | } | 7035 | } |
7104 | 7036 | ||
7105 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | 7037 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element |
7106 | *qos_param) | 7038 | *qos_param) |
7107 | { | 7039 | { |
7108 | struct host_cmd cmd = { | 7040 | return ipw_send_cmd_pdu(priv, IPW_CMD_WME_INFO, qos_param, |
7109 | .cmd = IPW_CMD_WME_INFO, | 7041 | sizeof(*qos_param)); |
7110 | .len = sizeof(*qos_param) | ||
7111 | }; | ||
7112 | |||
7113 | memcpy(cmd.param, qos_param, sizeof(*qos_param)); | ||
7114 | return ipw_send_cmd(priv, &cmd); | ||
7115 | } | 7042 | } |
7116 | 7043 | ||
7117 | #endif /* CONFIG_IPW_QOS */ | 7044 | #endif /* CONFIG_IPW_QOS */ |