linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Winkler <tomas.winkler@intel.com>
To: linville@tuxdriver.com, yi.zhu@intel.com, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Ben Cahill <ben.m.cahill@intel.com>
Subject: [PATCH 27/34] iwlwifi: add comments to RXON command and txpower formats
Date: Mon,  3 Dec 2007 13:43:39 +0200	[thread overview]
Message-ID: <11966822321616-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <11966822324036-git-send-email-tomas.winkler@intel.com>

From: Ben Cahill <ben.m.cahill@intel.com>

Add comments to RXON command and txpower formats

Signed-off-by: Ben Cahill <ben.m.cahill@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945-commands.h |   62 ++++++++++---
 drivers/net/wireless/iwlwifi/iwl-4965-commands.h |  104 ++++++++++++++++------
 2 files changed, 124 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
index 3d3c7e3..4a8fc68 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
@@ -124,7 +124,7 @@ enum {
 	/* Bluetooth device coexistance config command */
 	REPLY_BT_CONFIG = 0x9b,
 
-	/* 4965 Statistics */
+	/* Statistics */
 	REPLY_STATISTICS_CMD = 0x9c,
 	STATISTICS_NOTIFICATION = 0x9d,
 
@@ -140,7 +140,8 @@ enum {
 
 /******************************************************************************
  * (0)
- * Header
+ * Commonly used structures and definitions:
+ * Command header, txpower
  *
  *****************************************************************************/
 
@@ -183,6 +184,36 @@ struct iwl3945_cmd_header {
 	u8 data[0];
 } __attribute__ ((packed));
 
+/**
+ * struct iwl3945_tx_power
+ *
+ * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
+ *
+ * Each entry contains two values:
+ * 1)  DSP gain (or sometimes called DSP attenuation).  This is a fine-grained
+ *     linear value that multiplies the output of the digital signal processor,
+ *     before being sent to the analog radio.
+ * 2)  Radio gain.  This sets the analog gain of the radio Tx path.
+ *     It is a coarser setting, and behaves in a logarithmic (dB) fashion.
+ *
+ * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
+ */
+struct iwl3945_tx_power {
+	u8 tx_gain;		/* gain for analog radio */
+	u8 dsp_atten;		/* gain for DSP */
+} __attribute__ ((packed));
+
+/**
+ * struct iwl3945_power_per_rate
+ *
+ * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ */
+struct iwl3945_power_per_rate {
+	u8 rate;		/* plcp */
+	struct iwl3945_tx_power tpc;
+	u8 reserved;
+} __attribute__ ((packed));
+
 /******************************************************************************
  * (0a)
  * Alive and Error Commands & Responses:
@@ -328,8 +359,22 @@ enum {
 /* transfer to host non bssid beacons in associated state */
 #define RXON_FILTER_BCON_AWARE_MSK      __constant_cpu_to_le32(1 << 6)
 
-/*
+/**
  * REPLY_RXON = 0x10 (command, has simple generic response)
+ *
+ * RXON tunes the radio tuner to a service channel, and sets up a number
+ * of parameters that are used primarily for Rx, but also for Tx operations.
+ *
+ * NOTE:  When tuning to a new channel, driver must set the
+ *        RXON_FILTER_ASSOC_MSK to 0.  This will clear station-dependent
+ *        info within the device, including the station tables, tx retry
+ *        rate tables, and txpower tables.  Driver must build a new station
+ *        table and txpower table before transmitting anything on the RXON
+ *        channel.
+ *
+ * NOTE:  All RXONs wipe clean the internal txpower table.  Driver must
+ *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
+ *        regardless of whether RXON_FILTER_ASSOC_MSK is set.
  */
 struct iwl3945_rxon_cmd {
 	u8 node_addr[6];
@@ -373,17 +418,6 @@ struct iwl3945_rxon_time_cmd {
 	__le16 reserved;
 } __attribute__ ((packed));
 
-struct iwl3945_tx_power {
-	u8 tx_gain;		/* gain for analog radio */
-	u8 dsp_atten;		/* gain for DSP */
-} __attribute__ ((packed));
-
-struct iwl3945_power_per_rate {
-	u8 rate;		/* plcp */
-	struct iwl3945_tx_power tpc;
-	u8 reserved;
-} __attribute__ ((packed));
-
 /*
  * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index bde3aa0..0813e3e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -123,7 +123,7 @@ enum {
 	/* Bluetooth device coexistance config command */
 	REPLY_BT_CONFIG = 0x9b,
 
-	/* 4965 Statistics */
+	/* Statistics */
 	REPLY_STATISTICS_CMD = 0x9c,
 	STATISTICS_NOTIFICATION = 0x9d,
 
@@ -147,7 +147,7 @@ enum {
 /******************************************************************************
  * (0)
  * Commonly used structures and definitions:
- * Command header, rate_n_flags
+ * Command header, rate_n_flags, txpower
  *
  *****************************************************************************/
 
@@ -273,6 +273,65 @@ struct iwl4965_cmd_header {
 #define RATE_MCS_ANT_AB_MSK	0xc000
 
 
+/**
+ * struct iwl4965_tx_power - txpower format used in REPLY_SCAN_CMD
+ *
+ * Scan uses only one transmitter, so only one analog/dsp gain pair is needed.
+ */
+struct iwl4965_tx_power {
+	u8 tx_gain;		/* gain for analog radio */
+	u8 dsp_atten;		/* gain for DSP */
+} __attribute__ ((packed));
+
+#define POWER_TABLE_NUM_ENTRIES			33
+#define POWER_TABLE_NUM_HT_OFDM_ENTRIES		32
+#define POWER_TABLE_CCK_ENTRY			32
+
+/**
+ * union iwl4965_tx_power_dual_stream
+ *
+ * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ * Use __le32 version (struct tx_power_dual_stream) when building command.
+ *
+ * Driver provides radio gain and DSP attenuation settings to device in pairs,
+ * one value for each transmitter chain.  The first value is for transmitter A,
+ * second for transmitter B.
+ *
+ * For SISO bit rates, both values in a pair should be identical.
+ * For MIMO rates, one value may be different from the other,
+ * in order to balance the Tx output between the two transmitters.
+ *
+ * See more details in doc for TXPOWER in iwl-4965-hw.h.
+ */
+union iwl4965_tx_power_dual_stream {
+	struct {
+		u8 radio_tx_gain[2];
+		u8 dsp_predis_atten[2];
+	} s;
+	u32 dw;
+};
+
+/**
+ * struct tx_power_dual_stream
+ *
+ * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ *
+ * Same format as iwl_tx_power_dual_stream, but __le32
+ */
+struct tx_power_dual_stream {
+	__le32 dw;
+} __attribute__ ((packed));
+
+/**
+ * struct iwl4965_tx_power_db
+ *
+ * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ */
+struct iwl4965_tx_power_db {
+	struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
+} __attribute__ ((packed));
+
+
 /******************************************************************************
  * (0a)
  * Alive and Error Commands & Responses:
@@ -501,8 +560,22 @@ enum {
 /* transfer to host non bssid beacons in associated state */
 #define RXON_FILTER_BCON_AWARE_MSK      __constant_cpu_to_le32(1 << 6)
 
-/*
+/**
  * REPLY_RXON = 0x10 (command, has simple generic response)
+ *
+ * RXON tunes the radio tuner to a service channel, and sets up a number
+ * of parameters that are used primarily for Rx, but also for Tx operations.
+ *
+ * NOTE:  When tuning to a new channel, driver must set the
+ *        RXON_FILTER_ASSOC_MSK to 0.  This will clear station-dependent
+ *        info within the device, including the station tables, tx retry
+ *        rate tables, and txpower tables.  Driver must build a new station
+ *        table and txpower table before transmitting anything on the RXON
+ *        channel.
+ *
+ * NOTE:  All RXONs wipe clean the internal txpower table.  Driver must
+ *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
+ *        regardless of whether RXON_FILTER_ASSOC_MSK is set.
  */
 struct iwl4965_rxon_cmd {
 	u8 node_addr[6];
@@ -550,31 +623,6 @@ struct iwl4965_rxon_time_cmd {
 	__le16 reserved;
 } __attribute__ ((packed));
 
-struct iwl4965_tx_power {
-	u8 tx_gain;		/* gain for analog radio */
-	u8 dsp_atten;		/* gain for DSP */
-} __attribute__ ((packed));
-
-#define POWER_TABLE_NUM_ENTRIES			33
-#define POWER_TABLE_NUM_HT_OFDM_ENTRIES		32
-#define POWER_TABLE_CCK_ENTRY			32
-
-union iwl4965_tx_power_dual_stream {
-	struct {
-		u8 radio_tx_gain[2];
-		u8 dsp_predis_atten[2];
-	} s;
-	u32 dw;
-};
-
-struct tx_power_dual_stream {
-	__le32 dw;
-} __attribute__ ((packed));
-
-struct iwl4965_tx_power_db {
-	struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
-} __attribute__ ((packed));
-
 /*
  * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  */
-- 
1.5.2.2
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

  reply	other threads:[~2007-12-03 11:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 11:43 [PATCH 0/34 V2] iwlwifi (version 1.1.22) Tomas Winkler
2007-12-03 11:43 ` [PATCH 01/34] iwlwifi: Support for uCode without init and bsm section Tomas Winkler
2007-12-03 11:43   ` [PATCH 02/34] iwlwifi: continue namespace changes - fix CONFIG variables Tomas Winkler
2007-12-03 11:43     ` [PATCH 03/34] iwl3945: re-align 3945 event log data Tomas Winkler
2007-12-03 11:43       ` [PATCH 04/34] iwl4965: add comments to rate scaling code Tomas Winkler
2007-12-03 11:43         ` [PATCH 05/34] iwlwifi: add comments to EEPROM stuff Tomas Winkler
2007-12-03 11:43           ` [PATCH 06/34] iwl-4965-hw.h: clean up unused eeprom structures and definitions Tomas Winkler
2007-12-03 11:43             ` [PATCH 07/34] iwlwifi: clean up and clarify some comments after 3945/4965 split Tomas Winkler
2007-12-03 11:43               ` [PATCH 08/34] iwlwifi: Move is_legacy() macro family from iwl-4965-hw.h to iwl-4965-rs.h Tomas Winkler
2007-12-03 11:43                 ` [PATCH 09/34] iwlwifi: Add comments to some driver data structures Tomas Winkler
2007-12-03 11:43                   ` [PATCH 10/34] iwlwifi: Document 4965 rate_n_flags bits Tomas Winkler
2007-12-03 11:43                     ` [PATCH 11/34] iwlwifi: Document Rx calibration Tomas Winkler
2007-12-03 11:43                       ` [PATCH 12/34] iwlwifi: Partially clean-up, add comments to iwl-*-hw.h Tomas Winkler
2007-12-03 11:43                         ` [PATCH 13/34] iwlwifi: clean up some unused definitions in iwl-4965.h and iwl-3945.h Tomas Winkler
2007-12-03 11:43                           ` [PATCH 14/34] iwlwifi: add comments, mostly on Tx queues Tomas Winkler
2007-12-03 11:43                             ` [PATCH 15/34] iwlwifi: add comments to iwl*-base.c Tomas Winkler
2007-12-03 11:43                               ` [PATCH 16/34] iwlwifi: Clean up unused definitions in iwl-3945-hw.h Tomas Winkler
2007-12-03 11:43                                 ` [PATCH 17/34] iwlwifi: clean up unused definitions in iwl-4965-hw.h Tomas Winkler
2007-12-03 11:43                                   ` [PATCH 18/34] iwlwifi: move uCode API definitions to iwl-4965-commands.h Tomas Winkler
2007-12-03 11:43                                     ` [PATCH 19/34] iwlwifi: move HT_IE_EXT_CHANNEL_* driver definitions to iwl-4965.h Tomas Winkler
2007-12-03 11:43                                       ` [PATCH 20/34] iwlwifi: document temperature calculation Tomas Winkler
2007-12-03 11:43                                         ` [PATCH 21/34] iwlwifi: document txpower calculations Tomas Winkler
2007-12-03 11:43                                           ` [PATCH 22/34] iwlwifi: document keep-warm buffer Tomas Winkler
2007-12-03 11:43                                             ` [PATCH 23/34] iwlwifi: document Rx registers Tomas Winkler
2007-12-03 11:43                                               ` [PATCH 24/34] iwlwifi: document shared Tx structures Tomas Winkler
2007-12-03 11:43                                                 ` [PATCH 25/34] iwlwifi: document 4965 Tx scheduler Tomas Winkler
2007-12-03 11:43                                                   ` [PATCH 26/34] iwlwifi: document command header and "alive" responses Tomas Winkler
2007-12-03 11:43                                                     ` Tomas Winkler [this message]
2007-12-03 11:43                                                       ` [PATCH 28/34] iwlwifi: add comments to QOS and ADD_STA commands Tomas Winkler
2007-12-03 11:43                                                         ` [PATCH 29/34] iwlwifi: add comments to Tx commands Tomas Winkler
2007-12-03 11:43                                                           ` [PATCH 30/34] iwlwifi: document 4965 rate scaling Tomas Winkler
2007-12-03 11:43                                                             ` [PATCH 31/34] iwlwifi: enhance WPA authenication stability Tomas Winkler
2007-12-03 11:43                                                               ` [PATCH 32/34] iwlwifi: fix ucode assertion for RX queue overrun Tomas Winkler
2007-12-03 11:43                                                                 ` [PATCH 33/34] iwlwifi: avoid firmware command sending if rfkill is enabled Tomas Winkler
2007-12-03 11:43                                                                   ` [PATCH 34/34] iwlwifi: update version number to 1.2.22 Tomas Winkler

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=11966822321616-git-send-email-tomas.winkler@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=ben.m.cahill@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=yi.zhu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).