mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sujith <m.sujith@gmail.com>
To: Pavel Machek <pma@sysgo.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	"ath9k-devel@venema.h4ckr.net" <ath9k-devel@venema.h4ckr.net>,
	kernel list <linux-kernel@vger.kernel.org>,
	"chunkeey@googlemail.com" <chunkeey@googlemail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"rudolf.marek@sysgo.com" <rudolf.marek@sysgo.com>,
	"cko@sysgo.com" <cko@sysgo.com>, "mfa@sysgo.com" <mfa@sysgo.com>,
	"anl@sysgo.com" <anl@sysgo.com>
Subject: Re: ath9k_htc vs. powerpc (was Re: working usb wifi card, that is still possible to buy)
Date: Mon, 29 Nov 2010 18:07:01 +0530	[thread overview]
Message-ID: <19699.40557.302196.832862@gargle.gargle.HOWL> (raw)
In-Reply-To: <20101129100159.GC28833@pma.sysgo.com>

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)

  reply	other threads:[~2010-11-29 12:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03  9:24 working usb wifi card, that is still possible to buy Pavel Machek
2010-11-24  8:16 ` Pavel Machek
2010-11-24  8:42   ` Johannes Berg
2010-11-24  9:57     ` Pavel Machek
2010-11-24 13:13   ` Pavel Machek
2010-11-24 15:48     ` Larry Finger
2010-11-26  8:31       ` ath9k_htc vs. powerpc (was Re: working usb wifi card, that is still possible to buy) Pavel Machek
2010-11-26 10:20         ` Pavel Machek
2010-11-26 11:27           ` Pavel Machek
2010-11-26 11:35             ` [PATCH] ath9k_htc: cleanup eeprom endiannes handling Pavel Machek
2010-11-26 11:37             ` [PATCH?] do structures need to be packed? [was Re: ath9k_htc vs. powerpc (was Re: working usb wifi card, that is still possible to buy)] Pavel Machek
2010-11-26 11:47             ` ath9k_htc vs. powerpc (was Re: working usb wifi card, that is still possible to buy) Sujith
2010-11-26 12:37               ` Pavel Machek
2010-11-29  9:58                 ` [PATCH] fix endianity on ath9k_htc Pavel Machek
2010-11-29 11:46                   ` [ath9k-devel] " Felix Fietkau
2010-11-29 12:07                     ` Pavel Machek
2010-11-29 12:11                       ` [patch] remove unneeded prototype " Pavel Machek
2010-11-29  9:59                 ` [PATCH] ath9k_htc cleanups Pavel Machek
2010-11-29 11:34                   ` [PATCH] ath9k_htc more cleanups Pavel Machek
2010-11-29 10:01                 ` ath9k_htc vs. powerpc (was Re: working usb wifi card, that is still possible to buy) Pavel Machek
2010-11-29 12:37                   ` Sujith [this message]
2010-11-29 12:48                     ` Pavel Machek
2010-11-29 12:57                     ` Pavel Machek
2010-11-29 13:28                       ` Sujith
2010-11-29 12:16                 ` Sujith
2010-12-06  8:37     ` working usb wifi card, that is still possible to buy Pavel Machek
2010-12-06 15:30       ` Larry Finger

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=19699.40557.302196.832862@gargle.gargle.HOWL \
    --to=m.sujith@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=anl@sysgo.com \
    --cc=ath9k-devel@venema.h4ckr.net \
    --cc=chunkeey@googlemail.com \
    --cc=cko@sysgo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mfa@sysgo.com \
    --cc=pma@sysgo.com \
    --cc=rudolf.marek@sysgo.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

all inboxes | Powered by JetHome®