All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	Tomas Winkler <tomas.winkler@intel.com>,
	Zhu Yi <yi.zhu@intel.com>
Subject: [PATCH 2/7] iwlwifi: fix rate setting in beacon command
Date: Tue, 31 Jul 2007 10:56:31 +0800	[thread overview]
Message-ID: <11858505994113-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <118585059814-git-send-email-yi.zhu@intel.com>

From: Tomas Winkler <tomas.winkler@intel.com>

This patch fixed rate setting in beacon command. It removes
invalid <= comparsion on unsinged values.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-3945.c |    2 +-
 drivers/net/wireless/iwl-4965.c |   11 ++++++-----
 drivers/net/wireless/iwl-base.c |    6 +++---
 drivers/net/wireless/iwlwifi.h  |    2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c
index 8a534e1..b71e987 100644
--- a/drivers/net/wireless/iwl-3945.c
+++ b/drivers/net/wireless/iwl-3945.c
@@ -2231,7 +2231,7 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)
 }
 
 int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
-			  struct iwl_frame *frame, u16 rate)
+			  struct iwl_frame *frame, u8 rate)
 {
 	struct iwl_tx_beacon_cmd *tx_beacon_cmd;
 	int frame_size;
diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index cc2dd49..9f4d83a 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -2718,14 +2718,11 @@ int iwl_hw_get_temperature(struct iwl_priv *priv)
 }
 
 int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
-			  struct iwl_frame *frame, u16 rate)
+			  struct iwl_frame *frame, u8 rate)
 {
 	struct iwl_tx_beacon_cmd *tx_beacon_cmd;
 	int frame_size;
 
-	if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
-		rate |= RATE_MCS_CCK_MSK;
-
 	tx_beacon_cmd = &frame->u.beacon;
 	memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
 
@@ -2739,7 +2736,11 @@ int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
 
 	tx_beacon_cmd->tx.len = frame_size;
 
-	tx_beacon_cmd->tx.rate.rate_n_flags = rate;
+	if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
+		tx_beacon_cmd->tx.rate.rate_n_flags = rate|RATE_MCS_CCK_MSK;
+	else
+		tx_beacon_cmd->tx.rate.rate_n_flags = rate;
+
 	tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
 				TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK);
 	return (sizeof(*tx_beacon_cmd) + frame_size);
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 6e77a51..574d01c 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -1487,7 +1487,7 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
 {
 	struct iwl_frame *frame;
 	int frame_size, rc;
-	u16 rate;
+	u8 rate;
 
 	frame = iwl_get_free_frame(priv);
 
@@ -1500,11 +1500,11 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
 	if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) {
 		rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic &
 						0xFF0);
-		if (rate <= 0)
+		if (rate == IWL_INVALID_RATE)
 			rate = IWL_RATE_6M_PLCP;
 	} else {
 		rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 0xF);
-		if (rate <= 0)
+		if (rate == IWL_INVALID_RATE)
 			rate = IWL_RATE_1M_PLCP;
 	}
 
diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h
index 6941031..dff6f6f 100644
--- a/drivers/net/wireless/iwlwifi.h
+++ b/drivers/net/wireless/iwlwifi.h
@@ -692,7 +692,7 @@ extern int iwl_tx_queue_free_tfd(struct iwl_priv *priv,
 extern int iwl_hw_tx_queue_init(struct iwl_priv *priv,
 				struct iwl_tx_queue *txq);
 extern int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
-				 struct iwl_frame *frame, u16 rate);
+				 struct iwl_frame *frame, u8 rate);
 extern int iwl_hw_get_rx_read(struct iwl_priv *priv);
 extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
 				     struct iwl_cmd *cmd,
-- 
1.5.2

  reply	other threads:[~2007-07-31  2:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11858505963374-git-send-email-yi.zhu@intel.com>
2007-07-31  2:56 ` [PATCH 1/7] iwlwifi: add IWLWIFI_HT Kconfig option Zhu Yi
2007-07-31  2:56   ` Zhu Yi [this message]
2007-07-31  2:56     ` [PATCH 3/7] iwlwifi: Endianity fix for TX host command Zhu Yi
2007-07-31  2:56       ` [PATCH 4/7] iwlwifi: Endainity fix for rx configuration Zhu Yi
2007-07-31  2:56         ` [PATCH 5/7] iwlwifi: Endianity fixes for 3945 Zhu Yi
2007-07-31  2:56           ` [PATCH 6/7] iwlwifi: Endianity fix for tx configuration Zhu Yi
2007-07-31  2:56             ` [PATCH 7/7] iwlwifi: Endian fix for rate setting in 3945 Zhu Yi
2007-07-31  9:48         ` [PATCH 4/7] iwlwifi: Endainity fix for rx configuration Michael Buesch
2007-07-31 10:11           ` 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=11858505994113-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.