linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chr <chunkeey@web.de>
To: Michael Wu <flamingice@sourmilk.net>
Cc: Hans de Goede <j.w.r.degoede@hhs.nl>,
	linux-wireless@vger.kernel.org,
	John Linville <linville@tuxdriver.com>
Subject: [PATCH 2/2] p54: disable QoS on older firmwares
Date: Fri, 31 Aug 2007 23:27:28 +0200	[thread overview]
Message-ID: <200708312327.28981.chunkeey@web.de> (raw)
In-Reply-To: <200708300152.27736.flamingice@sourmilk.net>

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

From: Christian Lamparter <chunkeey@web.de>

This patch fixes a regression with older (pre 2.5.2.0) firmwares, that don't
support the QoS queues yet...

Thanks to Hans de Goede <j.w.r.degoede@hhs.nl> for reporting and debugging it.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
---

[-- Attachment #2: p54-support-older-firmwares3.diff --]
[-- Type: text/x-diff, Size: 3427 bytes --]

diff -Nurp a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c
--- a/drivers/net/wireless/p54common.c	2007-08-31 21:57:29.000000000 +0200
+++ b/drivers/net/wireless/p54common.c	2007-08-31 21:57:56.000000000 +0200
@@ -30,9 +30,13 @@ MODULE_ALIAS("prism54common");
 void p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
 {
 	struct p54_common *priv = dev->priv;
+	struct bootrec_exp_if *exp_if;
 	struct bootrec *bootrec;
 	u32 *data = (u32 *)fw->data;
 	u32 *end_data = (u32 *)fw->data + (fw->size >> 2);
+	u8 *fw_version = NULL;
+	size_t len;
+	int i;
 
 	if (priv->rx_start)
 		return;
@@ -46,7 +50,7 @@ void p54_parse_firmware(struct ieee80211
 	bootrec = (struct bootrec *) data;
 
 	while (bootrec->data <= end_data &&
-	       (bootrec->data + le32_to_cpu(bootrec->len)) <= end_data) {
+	       (bootrec->data + (len = le32_to_cpu(bootrec->len))) <= end_data) {
 		u32 code = le32_to_cpu(bootrec->code);
 		switch (code) {
 		case BR_CODE_COMPONENT_ID:
@@ -69,6 +73,11 @@ void p54_parse_firmware(struct ieee80211
 			}
 			break;
 		case BR_CODE_COMPONENT_VERSION:
+			fw_version = kmalloc(len * 4, GFP_KERNEL);
+			if (!fw_version)
+				return ;
+			snprintf(fw_version, len * 4, "%s",
+				(unsigned char*)bootrec->data);
 			break;
 		case BR_CODE_DESCR:
 			priv->rx_start = le32_to_cpu(bootrec->data[1]);
@@ -76,6 +85,10 @@ void p54_parse_firmware(struct ieee80211
 			priv->rx_end = le32_to_cpu(bootrec->data[2]) - 0x3500;
 			break;
 		case BR_CODE_EXPOSED_IF:
+			exp_if = (struct bootrec_exp_if *) bootrec->data;
+			for (i = 0; i < (len * sizeof(*exp_if) / 4); i++)
+				if (exp_if[i].if_id == 0x1a)
+					priv->fw_var = le16_to_cpu(exp_if[i].variant);
 			break;
 		case BR_CODE_DEPENDENT_IF:
 			break;
@@ -86,8 +99,26 @@ void p54_parse_firmware(struct ieee80211
 		default:
 			break;
 		}
-		bootrec = (struct bootrec *)&bootrec->data[le32_to_cpu(bootrec->len)];
+		bootrec = (struct bootrec *)&bootrec->data[len];
+	}
+
+	if (fw_version)
+		printk(KERN_INFO "p54: FW Rev %s - Softmac protocol %x.%x\n",
+			fw_version, priv->fw_var >> 8, priv->fw_var & 0xff);
+	kfree(fw_version);
+
+	/* Firmware supports QoS, use it! */
+	if (priv->fw_var >= 0x300) {
+		/* queue limits */
+		priv->tx_stats.data[0].limit = 3;
+		priv->tx_stats.data[1].limit = 4;
+		priv->tx_stats.data[2].limit = 3;
+		priv->tx_stats.data[3].limit = 1;
+		
+		dev->queues = 4;
 	}
+
+
 }
 EXPORT_SYMBOL_GPL(p54_parse_firmware);
 
@@ -909,13 +940,9 @@ struct ieee80211_hw *p54_init_common(siz
 	dev->channel_change_time = 1000;	/* TODO: find actual value */
 	dev->max_rssi = 127;
 
-	/* (hard) queue limits */
-	priv->tx_stats.data[0].limit = 3;
-	priv->tx_stats.data[1].limit = 4;
-	priv->tx_stats.data[2].limit = 3;
-	priv->tx_stats.data[3].limit = 1;
+	priv->tx_stats.data[0].limit = 5;
+	dev->queues = 1;
 
-	dev->queues = 4;
 	dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 +
 				 sizeof(struct p54_tx_control_allocdata);
 
diff -Nurp a/drivers/net/wireless/p54.h b/drivers/net/wireless/p54.h
--- a/drivers/net/wireless/p54.h	2007-08-28 12:00:54.000000000 +0200
+++ b/drivers/net/wireless/p54.h	2007-08-31 21:28:37.000000000 +0200
@@ -62,6 +62,7 @@ struct p54_common {
 	u8 version;
 	unsigned int tx_hdr_len;
 	void *cached_vdcf;
+	__le16 fw_var;
 	/* FIXME: this channels/modes/rates stuff sucks */
 	struct ieee80211_channel channels[14];
 	struct ieee80211_rate rates[12];

  parent reply	other threads:[~2007-08-31 21:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-13  5:50 Recent linux-wireless git changes have broken my prism54pci card Hans de Goede
2007-08-13  6:18 ` Michael Wu
2007-08-13  6:33   ` Hans de Goede
2007-08-13  6:46     ` Andy Green
2007-08-13  7:49       ` Hans de Goede
2007-08-13  7:58         ` Michael Wu
2007-08-13  8:05           ` Andy Green
2007-08-13 11:58           ` Hans de Goede
2007-08-13 20:14             ` Michael Wu
2007-08-13 22:25               ` Chr
2007-08-14  8:10                 ` Hans de Goede
2007-08-14 18:29                   ` Chr
2007-08-20  0:44                   ` Chr
2007-08-20  2:32                     ` Larry Finger
2007-08-20  7:52                     ` Hans de Goede
2007-08-20 11:51                       ` Chr
2007-08-20 12:17                         ` Johannes Berg
2007-08-20 22:14                           ` Chr
2007-08-23 11:24                         ` Hans de Goede
2007-08-23 14:43                           ` Chr
2007-08-23 14:36                             ` Hans de Goede
2007-08-23 21:52                             ` Hans de Goede
2007-08-23 23:00                               ` Chr
2007-08-24  9:45                                 ` Hans de Goede
2007-08-28 19:32                                   ` Chr
2007-08-30  5:52                                     ` Michael Wu
2007-08-30 11:16                                       ` Chr
2007-08-31 21:27                                       ` [PATCH 1/2] p54: various fixes Chr
2007-08-31 21:27                                       ` Chr [this message]
2007-09-01  4:58                                         ` [PATCH 2/2] p54: disable QoS on older firmwares Michael Wu
2007-09-01 16:54                                           ` [PATCH 2/2 v2] " Chr
2007-08-13 13:14       ` Recent linux-wireless git changes have broken my prism54pci card Johannes Berg

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=200708312327.28981.chunkeey@web.de \
    --to=chunkeey@web.de \
    --cc=flamingice@sourmilk.net \
    --cc=j.w.r.degoede@hhs.nl \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).