aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorMarc Yang <yangyang@marvell.com>2011-03-30 21:12:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-04 16:20:05 -0400
commit2b06bdbe073f8dff93eb476f07352df43dcdba44 (patch)
treef3aad8c0cc48faa49874028ea60ab0cefe9d7736 /drivers/net/wireless/mwifiex
parent4dd365fd55991b4e54a1d1c255081e6370b9da29 (diff)
mwifiex: cleanup power save related struct and macros
remove redundant structures and unused macros Signed-off-by: Marc Yang <yangyang@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c37
-rw-r--r--drivers/net/wireless/mwifiex/fw.h41
-rw-r--r--drivers/net/wireless/mwifiex/init.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c23
4 files changed, 37 insertions, 66 deletions
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 3865dd19e4f8..a9aeb31af455 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -275,14 +275,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
275 } 275 }
276 if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY)) 276 if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY))
277 == MWIFIEX_BSS_ROLE_STA) { 277 == MWIFIEX_BSS_ROLE_STA) {
278 if (!sleep_cfm_buf->ps_cfm_sleep.sleep_cfm.resp_ctrl) 278 if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl)
279 /* Response is not needed for sleep 279 /* Response is not needed for sleep
280 confirm command */ 280 confirm command */
281 adapter->ps_state = PS_STATE_SLEEP; 281 adapter->ps_state = PS_STATE_SLEEP;
282 else 282 else
283 adapter->ps_state = PS_STATE_SLEEP_CFM; 283 adapter->ps_state = PS_STATE_SLEEP_CFM;
284 284
285 if (!sleep_cfm_buf->ps_cfm_sleep.sleep_cfm.resp_ctrl 285 if (!sleep_cfm_buf->ps_cfm_sleep.resp_ctrl
286 && (adapter->is_hs_configured 286 && (adapter->is_hs_configured
287 && !adapter->sleep_period.period)) { 287 && !adapter->sleep_period.period)) {
288 adapter->pm_wakeup_card_req = true; 288 adapter->pm_wakeup_card_req = true;
@@ -1211,15 +1211,18 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1211 if (cmd_action == DIS_AUTO_PS) { 1211 if (cmd_action == DIS_AUTO_PS) {
1212 psmode_enh->action = cpu_to_le16(DIS_AUTO_PS); 1212 psmode_enh->action = cpu_to_le16(DIS_AUTO_PS);
1213 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); 1213 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap);
1214 cmd->size = cpu_to_le16(S_DS_GEN + AUTO_PS_FIX_SIZE); 1214 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) +
1215 sizeof(psmode_enh->params.ps_bitmap));
1215 } else if (cmd_action == GET_PS) { 1216 } else if (cmd_action == GET_PS) {
1216 psmode_enh->action = cpu_to_le16(GET_PS); 1217 psmode_enh->action = cpu_to_le16(GET_PS);
1217 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); 1218 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap);
1218 cmd->size = cpu_to_le16(S_DS_GEN + AUTO_PS_FIX_SIZE); 1219 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) +
1220 sizeof(psmode_enh->params.ps_bitmap));
1219 } else if (cmd_action == EN_AUTO_PS) { 1221 } else if (cmd_action == EN_AUTO_PS) {
1220 psmode_enh->action = cpu_to_le16(EN_AUTO_PS); 1222 psmode_enh->action = cpu_to_le16(EN_AUTO_PS);
1221 psmode_enh->params.auto_ps.ps_bitmap = cpu_to_le16(ps_bitmap); 1223 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap);
1222 cmd_size = S_DS_GEN + AUTO_PS_FIX_SIZE; 1224 cmd_size = S_DS_GEN + sizeof(psmode_enh->action) +
1225 sizeof(psmode_enh->params.ps_bitmap);
1223 tlv = (u8 *) cmd + cmd_size; 1226 tlv = (u8 *) cmd + cmd_size;
1224 if (ps_bitmap & BITMAP_STA_PS) { 1227 if (ps_bitmap & BITMAP_STA_PS) {
1225 struct mwifiex_adapter *adapter = priv->adapter; 1228 struct mwifiex_adapter *adapter = priv->adapter;
@@ -1249,24 +1252,23 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1249 1252
1250 } 1253 }
1251 if (ps_bitmap & BITMAP_AUTO_DS) { 1254 if (ps_bitmap & BITMAP_AUTO_DS) {
1252 struct mwifiex_ie_types_auto_ds_param *auto_ps_tlv = 1255 struct mwifiex_ie_types_auto_ds_param *auto_ds_tlv =
1253 (struct mwifiex_ie_types_auto_ds_param *) tlv; 1256 (struct mwifiex_ie_types_auto_ds_param *) tlv;
1254 struct mwifiex_auto_ds_param *auto_ds =
1255 &auto_ps_tlv->param;
1256 u16 idletime = 0; 1257 u16 idletime = 0;
1257 auto_ps_tlv->header.type = 1258
1259 auto_ds_tlv->header.type =
1258 cpu_to_le16(TLV_TYPE_AUTO_DS_PARAM); 1260 cpu_to_le16(TLV_TYPE_AUTO_DS_PARAM);
1259 auto_ps_tlv->header.len = 1261 auto_ds_tlv->header.len =
1260 cpu_to_le16(sizeof(*auto_ps_tlv) - 1262 cpu_to_le16(sizeof(*auto_ds_tlv) -
1261 sizeof(struct mwifiex_ie_types_header)); 1263 sizeof(struct mwifiex_ie_types_header));
1262 cmd_size += sizeof(*auto_ps_tlv); 1264 cmd_size += sizeof(*auto_ds_tlv);
1263 tlv += sizeof(*auto_ps_tlv); 1265 tlv += sizeof(*auto_ds_tlv);
1264 if (data_buf) 1266 if (data_buf)
1265 idletime = ((struct mwifiex_ds_auto_ds *) 1267 idletime = ((struct mwifiex_ds_auto_ds *)
1266 data_buf)->idle_time; 1268 data_buf)->idle_time;
1267 dev_dbg(priv->adapter->dev, 1269 dev_dbg(priv->adapter->dev,
1268 "cmd: PS Command: Enter Auto Deep Sleep\n"); 1270 "cmd: PS Command: Enter Auto Deep Sleep\n");
1269 auto_ds->deep_sleep_timeout = cpu_to_le16(idletime); 1271 auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime);
1270 } 1272 }
1271 cmd->size = cpu_to_le16(cmd_size); 1273 cmd->size = cpu_to_le16(cmd_size);
1272 } 1274 }
@@ -1290,7 +1292,7 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1290 uint16_t action = le16_to_cpu(ps_mode->action); 1292 uint16_t action = le16_to_cpu(ps_mode->action);
1291 uint16_t ps_bitmap = le16_to_cpu(ps_mode->params.ps_bitmap); 1293 uint16_t ps_bitmap = le16_to_cpu(ps_mode->params.ps_bitmap);
1292 uint16_t auto_ps_bitmap = 1294 uint16_t auto_ps_bitmap =
1293 le16_to_cpu(ps_mode->params.auto_ps.ps_bitmap); 1295 le16_to_cpu(ps_mode->params.ps_bitmap);
1294 1296
1295 dev_dbg(adapter->dev, "info: %s: PS_MODE cmd reply result=%#x action=%#X\n", 1297 dev_dbg(adapter->dev, "info: %s: PS_MODE cmd reply result=%#x action=%#X\n",
1296 __func__, resp->result, action); 1298 __func__, resp->result, action);
@@ -1318,8 +1320,7 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1318 } 1320 }
1319 } 1321 }
1320 } else if (action == GET_PS) { 1322 } else if (action == GET_PS) {
1321 if (ps_bitmap & (BITMAP_STA_PS | BITMAP_UAP_INACT_PS 1323 if (ps_bitmap & BITMAP_STA_PS)
1322 | BITMAP_UAP_DTIM_PS))
1323 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; 1324 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
1324 else 1325 else
1325 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; 1326 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index b4e4991e58e8..d981265eb943 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -127,11 +127,14 @@ enum MWIFIEX_802_11_WEP_STATUS {
127#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 16) 127#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 16)
128#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 18) 128#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 18)
129#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19) 129#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19)
130
131#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31) 130#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31)
132
133#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) 131#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42)
132#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82)
133#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83)
134#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84)
134#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94) 135#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94)
136#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113)
137#define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114)
135 138
136#define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 139#define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048
137 140
@@ -184,11 +187,6 @@ enum MWIFIEX_802_11_WEP_STATUS {
184 187
185#define LLC_SNAP_LEN 8 188#define LLC_SNAP_LEN 8
186 189
187#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82)
188#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83)
189
190#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84)
191
192#define MOD_CLASS_HR_DSSS 0x03 190#define MOD_CLASS_HR_DSSS 0x03
193#define MOD_CLASS_OFDM 0x07 191#define MOD_CLASS_OFDM 0x07
194#define MOD_CLASS_HT 0x08 192#define MOD_CLASS_HT 0x08
@@ -553,34 +551,12 @@ struct mwifiex_ps_param {
553 __le16 delay_to_ps; 551 __le16 delay_to_ps;
554}; 552};
555 553
556struct mwifiex_auto_ds_param {
557 __le16 deep_sleep_timeout;
558};
559
560struct sleep_confirm_param {
561 __le16 resp_ctrl;
562};
563
564#define BITMAP_AUTO_DS 0x01 554#define BITMAP_AUTO_DS 0x01
565#define BITMAP_STA_PS 0x10 555#define BITMAP_STA_PS 0x10
566#define BITMAP_UAP_INACT_PS 0x100
567#define BITMAP_UAP_DTIM_PS 0x200
568struct auto_ps_param {
569 __le16 ps_bitmap;
570 /* auto deep sleep parameter,
571 * sta power save parameter
572 * uap inactivity parameter
573 * uap DTIM parameter */
574};
575
576#define AUTO_PS_FIX_SIZE 4
577
578#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113)
579#define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114)
580 556
581struct mwifiex_ie_types_auto_ds_param { 557struct mwifiex_ie_types_auto_ds_param {
582 struct mwifiex_ie_types_header header; 558 struct mwifiex_ie_types_header header;
583 struct mwifiex_auto_ds_param param; 559 __le16 deep_sleep_timeout;
584} __packed; 560} __packed;
585 561
586struct mwifiex_ie_types_ps_param { 562struct mwifiex_ie_types_ps_param {
@@ -593,10 +569,7 @@ struct host_cmd_ds_802_11_ps_mode_enh {
593 569
594 union { 570 union {
595 struct mwifiex_ps_param opt_ps; 571 struct mwifiex_ps_param opt_ps;
596 struct mwifiex_auto_ds_param auto_ds;
597 struct sleep_confirm_param sleep_cfm;
598 __le16 ps_bitmap; 572 __le16 ps_bitmap;
599 struct auto_ps_param auto_ps;
600 } params; 573 } params;
601} __packed; 574} __packed;
602 575
@@ -1260,7 +1233,7 @@ struct mwifiex_opt_sleep_confirm {
1260 __le16 seq_num; 1233 __le16 seq_num;
1261 __le16 result; 1234 __le16 result;
1262 __le16 action; 1235 __le16 action;
1263 struct sleep_confirm_param sleep_cfm; 1236 __le16 resp_ctrl;
1264} __packed; 1237} __packed;
1265 1238
1266struct mwifiex_opt_sleep_confirm_buffer { 1239struct mwifiex_opt_sleep_confirm_buffer {
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index 6fcdaa9b4294..43ea87d0f348 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -280,7 +280,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
280 cpu_to_le16(adapter->sleep_cfm->len); 280 cpu_to_le16(adapter->sleep_cfm->len);
281 sleep_cfm_buf->ps_cfm_sleep.result = 0; 281 sleep_cfm_buf->ps_cfm_sleep.result = 0;
282 sleep_cfm_buf->ps_cfm_sleep.action = cpu_to_le16(SLEEP_CONFIRM); 282 sleep_cfm_buf->ps_cfm_sleep.action = cpu_to_le16(SLEEP_CONFIRM);
283 sleep_cfm_buf->ps_cfm_sleep.sleep_cfm.resp_ctrl = 283 sleep_cfm_buf->ps_cfm_sleep.resp_ctrl =
284 cpu_to_le16(RESP_NEEDED); 284 cpu_to_le16(RESP_NEEDED);
285 } 285 }
286 memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params)); 286 memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params));
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index b220b8b62cfa..74add45b99b6 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -46,6 +46,7 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
46{ 46{
47 struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; 47 struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
48 struct mwifiex_adapter *adapter = priv->adapter; 48 struct mwifiex_adapter *adapter = priv->adapter;
49 struct host_cmd_ds_802_11_ps_mode_enh *pm;
49 unsigned long flags; 50 unsigned long flags;
50 51
51 dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n", 52 dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n",
@@ -55,20 +56,16 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
55 56
56 switch (le16_to_cpu(resp->command)) { 57 switch (le16_to_cpu(resp->command)) {
57 case HostCmd_CMD_802_11_PS_MODE_ENH: 58 case HostCmd_CMD_802_11_PS_MODE_ENH:
58 { 59 pm = &resp->params.psmode_enh;
59 struct host_cmd_ds_802_11_ps_mode_enh *pm = 60 dev_err(adapter->dev, "PS_MODE_ENH cmd failed: "
60 &resp->params.psmode_enh; 61 "result=0x%x action=0x%X\n",
61 dev_err(adapter->dev, "PS_MODE_ENH cmd failed: "
62 "result=0x%x action=0x%X\n",
63 resp->result, le16_to_cpu(pm->action)); 62 resp->result, le16_to_cpu(pm->action));
64 /* We do not re-try enter-ps command in ad-hoc mode. */ 63 /* We do not re-try enter-ps command in ad-hoc mode. */
65 if (le16_to_cpu(pm->action) == EN_AUTO_PS && 64 if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
66 (le16_to_cpu(pm->params.auto_ps.ps_bitmap) & 65 (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) &&
67 BITMAP_STA_PS) 66 priv->bss_mode == NL80211_IFTYPE_ADHOC)
68 && priv->bss_mode == NL80211_IFTYPE_ADHOC) 67 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
69 adapter->ps_mode = 68
70 MWIFIEX_802_11_POWER_MODE_CAM;
71 }
72 break; 69 break;
73 case HostCmd_CMD_802_11_SCAN: 70 case HostCmd_CMD_802_11_SCAN:
74 /* Cancel all pending scan command */ 71 /* Cancel all pending scan command */