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 1/4] iwlwifi: Endianity fix for iwl4965_handle_data_packet function
Date: Thu,  2 Aug 2007 10:16:02 +0800	[thread overview]
Message-ID: <11860209683483-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <1186020965807-git-send-email-yi.zhu@intel.com>

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

This patch fixes endianity issue in iwl4965_handle_data_packet
function.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-4965.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index 1b90838..f501f82 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -3588,10 +3588,10 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
 	struct iwl4965_rx_phy_res *rx_start = (include_phy) ?
 	    (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL;
 	struct ieee80211_hdr *hdr;
-	unsigned int len;
-	u32 *rx_end;
+	u16 len;
+	__le32 *rx_end;
 	unsigned int skblen;
-	u32 ampd_status;
+	u32 ampdu_status;
 
 	if (!include_phy && priv->last_phy_res[0])
 		rx_start = (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1];
@@ -3604,9 +3604,9 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
 		hdr = (struct ieee80211_hdr *)((u8 *) & rx_start[1] +
 					       rx_start->cfg_phy_cnt);
 
-		len = rx_start->byte_count;
+		len = le16_to_cpu(rx_start->byte_count);
 
-		rx_end = (u32 *) ((u8 *) & pkt->u.raw[0] +
+		rx_end = (__le32 *) ((u8 *) & pkt->u.raw[0] +
 				  sizeof(struct iwl4965_rx_phy_res) +
 				  rx_start->cfg_phy_cnt + len);
 
@@ -3614,20 +3614,19 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
 		struct iwl4965_rx_mpdu_res_start *amsdu =
 		    (struct iwl4965_rx_mpdu_res_start *)pkt->u.raw;
 
-		hdr = (void *)(pkt->u.raw +
+		hdr = (struct ieee80211_hdr *)(pkt->u.raw +
 			       sizeof(struct iwl4965_rx_mpdu_res_start));
-		len = amsdu->byte_count;
-		rx_end = (u32 *) (((u8 *) hdr) + len);
-		rx_start->byte_count = len;
+		len =  le16_to_cpu(amsdu->byte_count);
+		rx_start->byte_count = amsdu->byte_count;
+		rx_end = (__le32 *) (((u8 *) hdr) + len);
 	}
 	if (len > 2342 || len < 16) {
 		IWL_DEBUG_DROP("byte count out of range [16,2342]"
 			       " : %d\n", len);
 		return;
-
 	}
 
-	ampd_status = *rx_end;
+	ampdu_status = le32_to_cpu(*rx_end);
 	skblen = ((u8 *) rx_end - (u8 *) & pkt->u.raw[0]) + sizeof(u32);
 
 	/* start from MAC */
@@ -3644,7 +3643,7 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
 	if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
 		if (iwl_param_hwcrypto)
 			iwl_set_decrypted_flag(priv, rxb->skb,
-					       ampd_status, stats);
+					       ampdu_status, stats);
 		iwl_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0);
 		return;
 	}
@@ -3653,7 +3652,7 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
 	hdr = (struct ieee80211_hdr *)rxb->skb->data;
 
 	if (iwl_param_hwcrypto)
-		iwl_set_decrypted_flag(priv, rxb->skb, ampd_status, stats);
+		iwl_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats);
 
 	ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats);
 	priv->alloc_rxb_skb--;
-- 
1.5.2

       reply	other threads:[~2007-08-02  2:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1186020965807-git-send-email-yi.zhu@intel.com>
2007-08-02  2:16 ` Zhu Yi [this message]
2007-08-02  2:16   ` [PATCH 2/4] iwlwifi: Endianity fix in iwl4965_calc_rssi function Zhu Yi
2007-08-02  2:16     ` [PATCH 3/4] iwlwifi: TX aggregation fix Zhu Yi
2007-08-02  2:16       ` [PATCH 4/4] iwlwifi: Update version iwl-base.c stamp to 0.1.8 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=11860209683483-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.