lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19699.40557.302196.832862@gargle.gargle.HOWL>
Date:	Mon, 29 Nov 2010 18:07:01 +0530
From:	Sujith <m.sujith@...il.com>
To:	Pavel Machek <pma@...go.com>
Cc:	Larry Finger <Larry.Finger@...inger.net>,
	"ath9k-devel@...ema.h4ckr.net" <ath9k-devel@...ema.h4ckr.net>,
	kernel list <linux-kernel@...r.kernel.org>,
	"chunkeey@...glemail.com" <chunkeey@...glemail.com>,
	"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
	"rudolf.marek@...go.com" <rudolf.marek@...go.com>,
	"cko@...go.com" <cko@...go.com>, "mfa@...go.com" <mfa@...go.com>,
	"anl@...go.com" <anl@...go.com>
Subject: Re: ath9k_htc vs. powerpc (was Re: working usb wifi card, that is still possible to buy)

Pavel Machek wrote:
> ...so I indentified two endianness problems in eeprom, but even with
> both fixed, it still will not associate. Is there some way to dump USB
> packets, then compare them between PC and PowerPC versions? Should I
> expect them to match?

Does this patch help ?

diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index afe39a9..b04a25a 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -78,7 +78,7 @@ struct tx_frame_hdr {
 	u8 node_idx;
 	u8 vif_idx;
 	u8 tidno;
-	u32 flags; /* ATH9K_HTC_TX_* */
+	__be32 flags; /* ATH9K_HTC_TX_* */
 	u8 key_type;
 	u8 keyix;
 	u8 reserved[26];
@@ -91,30 +91,19 @@ struct tx_mgmt_hdr {
 	u8 flags;
 	u8 key_type;
 	u8 keyix;
-	u16 reserved;
+	__be16 reserved;
 } __packed;
 
 struct tx_beacon_header {
 	u8 len_changed;
 	u8 vif_index;
-	u16 rev;
-} __packed;
-
-struct ath9k_htc_target_hw {
-	u32 flags;
-	u32 flags_ext;
-	u32 ampdu_limit;
-	u8 ampdu_subframes;
-	u8 tx_chainmask;
-	u8 tx_chainmask_legacy;
-	u8 rtscts_ratecode;
-	u8 protmode;
+	__be16 rev;
 } __packed;
 
 struct ath9k_htc_cap_target {
-	u32 flags;
-	u32 flags_ext;
-	u32 ampdu_limit;
+	__be32 flags;
+	__be32 flags_ext;
+	__be32 ampdu_limit;
 	u8 ampdu_subframes;
 	u8 tx_chainmask;
 	u8 tx_chainmask_legacy;
@@ -128,9 +117,9 @@ struct ath9k_htc_target_vif {
 	__be32 opmode;
 	u8 myaddr[ETH_ALEN];
 	u8 bssid[ETH_ALEN];
-	u32 flags;
-	u32 flags_ext;
-	u16 ps_sta;
+	__be32 flags;
+	__be32 flags_ext;
+	__be16 ps_sta;
 	__be16 rtsthreshold;
 	u8 ath_cap;
 	u8 node;
@@ -144,25 +133,25 @@ struct ath9k_htc_target_vif {
 
 /* FIXME: UAPSD variables */
 struct ath9k_htc_target_sta {
-	u16 associd;
-	u16 txpower;
-	u32 ucastkey;
+	__be16 associd;
+	__be16 txpower;
+	__be32 ucastkey;
 	u8 macaddr[ETH_ALEN];
 	u8 bssid[ETH_ALEN];
 	u8 sta_index;
 	u8 vif_index;
 	u8 vif_sta;
 	__be16 flags; /* ATH_HTC_STA_* */
-	u16 htcap;
+	__be16 htcap;
 	u8 valid;
-	u16 capinfo;
-	struct ath9k_htc_target_hw *hw;
+	__be16 capinfo;
+	struct ath9k_htc_cap_target *hw;
 	struct ath9k_htc_target_vif *vif;
-	u16 txseqmgmt;
+	__be16 txseqmgmt;
 	u8 is_vif_sta;
-	u16 maxampdu;
-	u16 iv16;
-	u32 iv32;
+	__be16 maxampdu;
+	__be16 iv16;
+	__be32 iv32;
 } __packed;
 
 struct ath9k_htc_target_aggr {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index e9761c2..1b435d4 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -204,7 +204,7 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
 		ista = (struct ath9k_htc_sta *) sta->drv_priv;
 		memcpy(&tsta.macaddr, sta->addr, ETH_ALEN);
 		memcpy(&tsta.bssid, common->curbssid, ETH_ALEN);
-		tsta.associd = common->curaid;
+		tsta.associd = cpu_to_be16(common->curaid);
 		tsta.is_vif_sta = 0;
 		tsta.valid = true;
 		ista->index = priv->nstations;
@@ -215,7 +215,7 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
 
 	tsta.sta_index = priv->nstations;
 	tsta.vif_index = avp->index;
-	tsta.maxampdu = 0xffff;
+	tsta.maxampdu = cpu_to_be16(0xffff);
 	if (sta && sta->ht_cap.ht_supported)
 		tsta.flags = cpu_to_be16(ATH_HTC_STA_HT);
 
@@ -279,9 +279,9 @@ static int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv)
 	memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target));
 
 	/* FIXME: Values are hardcoded */
-	tcap.flags = 0x240c40;
-	tcap.flags_ext = 0x80601000;
-	tcap.ampdu_limit = 0xffff0000;
+	tcap.flags = cpu_to_be32(0x240c40);
+	tcap.flags_ext = cpu_to_be32(0x80601000);
+	tcap.ampdu_limit = cpu_to_be32(0xffff0000);
 	tcap.ampdu_subframes = 20;
 	tcap.tx_chainmask_legacy = priv->ah->caps.tx_chainmask;
 	tcap.protmode = 1;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 7795867..9902ec7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -136,12 +136,12 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb)
 		/* Check for RTS protection */
 		if (priv->hw->wiphy->rts_threshold != (u32) -1)
 			if (skb->len > priv->hw->wiphy->rts_threshold)
-				tx_hdr.flags |= ATH9K_HTC_TX_RTSCTS;
+				tx_hdr.flags |= cpu_to_be32(ATH9K_HTC_TX_RTSCTS);
 
 		/* CTS-to-self */
-		if (!(tx_hdr.flags & ATH9K_HTC_TX_RTSCTS) &&
+		if (!(tx_hdr.flags & cpu_to_be32(ATH9K_HTC_TX_RTSCTS)) &&
 		    (priv->op_flags & OP_PROTECT_ENABLE))
-			tx_hdr.flags |= ATH9K_HTC_TX_CTSONLY;
+			tx_hdr.flags |= cpu_to_be32(ATH9K_HTC_TX_CTSONLY);
 
 		tx_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb);
 		if (tx_hdr.key_type == ATH9K_KEY_TYPE_CLEAR)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ