From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
To: ipwpatch@vger.kernel.org
Cc: linux-wireless@vger.kernel.org, Zhu Yi <yi.zhu@intel.com>,
Tomas Winkler <tomas.winkler@intel.com>
Subject: [PATCH 12/17] iwlwifi: endianity cleanup for power table host command
Date: Fri, 27 Jul 2007 17:26:36 +0800 [thread overview]
Message-ID: <1185528423816-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <11855284212390-git-send-email-yi.zhu@intel.com>
This patch cleans up endianity issues in power table host command.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
drivers/net/wireless/iwl-base.c | 58 ++++++++++++++++++++---------------
drivers/net/wireless/iwl-commands.h | 23 +++++++------
2 files changed, 45 insertions(+), 36 deletions(-)
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index d56360c..111e51b 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -2029,26 +2029,33 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
#define NOSLP 0, 0, 0
#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0
#endif
+#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC)
+#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
+ __constant_cpu_to_le32(X1), \
+ __constant_cpu_to_le32(X2), \
+ __constant_cpu_to_le32(X3), \
+ __constant_cpu_to_le32(X4)}
+
/* default power management (not Tx power) table values */
/* for tim 0-10 */
static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
- {{NOSLP, 0 * MSEC_TO_USEC, 0 * MSEC_TO_USEC, {0, 0, 0, 0, 0}}, 0},
- {{SLP, 200 * MSEC_TO_USEC, 500 * MSEC_TO_USEC, {1, 2, 3, 4, 4}}, 0},
- {{SLP, 200 * MSEC_TO_USEC, 300 * MSEC_TO_USEC, {2, 4, 6, 7, 7}}, 0},
- {{SLP, 50 * MSEC_TO_USEC, 100 * MSEC_TO_USEC, {2, 6, 9, 9, 10}}, 0},
- {{SLP, 50 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {2, 7, 9, 9, 10}}, 1},
- {{SLP, 25 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {4, 7, 10, 10, 10}}, 1}
+ {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
+ {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
+ {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
+ {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), SLP_VEC(2, 6, 9, 9, 10)}, 0},
+ {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 10)}, 1},
+ {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 10)}, 1}
};
/* for tim > 10 */
static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
- {{NOSLP, 0 * MSEC_TO_USEC, 0 * MSEC_TO_USEC, {0, 0, 0, 0, 0}}, 0},
- {{SLP, 200 * MSEC_TO_USEC, 500 * MSEC_TO_USEC, {1, 2, 3, 4, 0xFF}}, 0},
- {{SLP, 200 * MSEC_TO_USEC, 300 * MSEC_TO_USEC, {2, 4, 6, 7, 0xFF}}, 0},
- {{SLP, 50 * MSEC_TO_USEC, 100 * MSEC_TO_USEC, {2, 6, 9, 9, 0xFF}}, 0},
- {{SLP, 50 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {2, 7, 9, 9, 0xFF}}, 0},
- {{SLP, 25 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {4, 7, 10, 10, 0xFF}}, 0}
+ {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
+ {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
+ {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0},
+ {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), SLP_VEC(2, 6, 9, 9, 0xFF)}, 0},
+ {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 0xFF)}, 0},
+ {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
};
int iwl_power_init_handle(struct iwl_priv *priv)
@@ -2119,7 +2126,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
period = priv->assoc_network->tim.tim_period;
}
-#endif /*IWL_MAC80211_DISABLE */
+#endif /*IWL_MAC80211_DISABLE */
skip = range[mode].no_dtim;
if (period == 0) {
@@ -2131,24 +2138,25 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
max_sleep = period;
cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
} else {
- max_sleep = (cmd->sleep_interval[IWL_POWER_TABLE_SIZE - 1] /
- period) * period;
+ __le32 slp_itrvl = cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1];
+ max_sleep = (le32_to_cpu(slp_itrvl) / period) * period;
cmd->flags |= IWL_POWER_SLEEP_OVER_DTIM_MSK;
}
- for (i = 0; i < IWL_POWER_TABLE_SIZE; i++) {
- if (cmd->sleep_interval[i] > max_sleep)
- cmd->sleep_interval[i] = max_sleep;
+ for (i = 0; i < IWL_POWER_VEC_SIZE; i++) {
+ if (le32_to_cpu(cmd->sleep_interval[i]) > max_sleep)
+ cmd->sleep_interval[i] = cpu_to_le32(max_sleep);
}
IWL_DEBUG_POWER("Flags value = 0x%08X\n", cmd->flags);
- IWL_DEBUG_POWER("Tx timeout = %u\n", cmd->tx_data_timeout);
- IWL_DEBUG_POWER("Rx timeout = %u\n", cmd->rx_data_timeout);
- IWL_DEBUG_POWER
- ("Sleep interval vector = { %d , %d , %d , %d , %d }\n",
- cmd->sleep_interval[0], cmd->sleep_interval[1],
- cmd->sleep_interval[2], cmd->sleep_interval[3],
- cmd->sleep_interval[4]);
+ IWL_DEBUG_POWER("Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout));
+ IWL_DEBUG_POWER("Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout));
+ IWL_DEBUG_POWER("Sleep interval vector = { %d , %d , %d , %d , %d }\n",
+ le32_to_cpu(cmd->sleep_interval[0]),
+ le32_to_cpu(cmd->sleep_interval[1]),
+ le32_to_cpu(cmd->sleep_interval[2]),
+ le32_to_cpu(cmd->sleep_interval[3]),
+ le32_to_cpu(cmd->sleep_interval[4]));
return rc;
}
diff --git a/drivers/net/wireless/iwl-commands.h b/drivers/net/wireless/iwl-commands.h
index bd4011d..297d24a 100644
--- a/drivers/net/wireless/iwl-commands.h
+++ b/drivers/net/wireless/iwl-commands.h
@@ -648,29 +648,30 @@ struct iwl_add_sta_resp {
* ucode assume sleep over DTIM is allowed and we don't need to wakeup
* for every DTIM.
*/
-#define IWL_POWER_TABLE_SIZE 5
+#define IWL_POWER_VEC_SIZE 5
-enum {
- IWL_POWER_DRIVER_ALLOW_SLEEP_MSK = (1<<0),
- IWL_POWER_SLEEP_OVER_DTIM_MSK = (1<<2),
- IWL_POWER_PCI_PM_MSK = (1<<3),
-};
+#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0)
+#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2)
+#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3)
-struct iwl_powertable_cmd {
#if IWL == 3945
+struct iwl_powertable_cmd {
__le32 flags;
+ __le32 rx_data_timeout;
+ __le32 tx_data_timeout;
+ __le32 sleep_interval[IWL_POWER_VEC_SIZE];
+} __attribute__((packed));
#elif IWL == 4965
+struct iwl_powertable_cmd {
__le16 flags;
u8 keep_alive_seconds;
u8 debug_flags;
-#endif
__le32 rx_data_timeout;
__le32 tx_data_timeout;
- __le32 sleep_interval[IWL_POWER_TABLE_SIZE];
-#if IWL == 4965
+ __le32 sleep_interval[IWL_POWER_VEC_SIZE];
__le32 keep_alive_beacons;
-#endif
} __attribute__ ((packed));
+#endif
struct iwl_rate_scaling_info {
--
1.5.2
next prev parent reply other threads:[~2007-07-27 9:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11855284012123-git-send-email-yi.zhu@intel.com>
2007-07-27 9:26 ` [PATCH 01/17] iwlwifi: provide frequency to radiotap monitor not channel index Zhu Yi
2007-07-27 9:26 ` [PATCH 02/17] iwlwifi: Calculate and report noise level while associated Zhu Yi
2007-07-27 9:26 ` [PATCH 03/17] iwlwifi: modify station fix Zhu Yi
2007-07-27 9:26 ` [PATCH 04/17] iwlwifi: cleanup tx queue allocation Zhu Yi
2007-07-27 9:26 ` [PATCH 05/17] iwlwifi: rxon filter_flags endianity fix Zhu Yi
2007-07-27 9:26 ` [PATCH 06/17] iwlwifi: rename base.c to iwl-base.c Zhu Yi
2007-07-27 9:26 ` [PATCH 07/17] iwilwifi: removed unused constant Zhu Yi
2007-07-27 9:26 ` [PATCH 08/17] iwlwifi: QoS control endianity fixes Zhu Yi
2007-07-27 9:26 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Zhu Yi
2007-07-27 9:26 ` [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd Zhu Yi
2007-07-27 9:26 ` [PATCH 11/17] iwlwifi: endianity cleanup for QoS host command Zhu Yi
2007-07-27 9:26 ` Zhu Yi [this message]
2007-07-27 9:26 ` [PATCH 13/17] iwlwifi: fix 11n on 2.4 channel Zhu Yi
2007-07-27 9:26 ` [PATCH 14/17] iwlwifi: fix channel switch assert Zhu Yi
2007-07-27 9:26 ` [PATCH 15/17] iwlwifi: fix scaing watchdog time out Zhu Yi
2007-07-27 9:26 ` [PATCH 16/17] iwlwifi: Add uCode/driver compatibility version number Zhu Yi
2007-07-27 9:26 ` [PATCH 17/17] iwlwifi: update version stamp to 0.1.5 Zhu Yi
2007-07-27 11:22 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Michael Buesch
2007-07-27 22:24 ` Tomas Winkler
2007-07-27 22:32 ` Michael Buesch
2007-07-27 9:30 ` [PATCH 00/17] iwlwifi driver updated to version 0.1.5 Zhu Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1185528423816-git-send-email-yi.zhu@intel.com \
--to=yi.zhu@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.