Recent linux-wireless git changes have broken my prism54pci card
Hi All,
I first reported this in Fedora bugzilla, as I'm using Fedora with a Fedora kernel (which includes recent linux-wireless git snapshots), see here for the Fedora bugreport:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=249823
Updating from the Fedora 7 test kernel to the final results in very poor performance, and going to even newer versions of the Fedora kernel totally breaks connectivity. Linville thought it would be best to further discuss this here, so here I am.
I've looked at recent git commits to the prism54 / p54pci driver and have been trying it revision by revision, eventually I've managed to pin the cause down to 2 patches, below is a verbatim cut and paste from the bugzilla entry, containing my analysis:
---
I've been busy researching this and I have come to the following conclusions.
1) with the 2.6.20-2something F7-test kernel everything works fine build date 3 march, I can give you the exact revision if you want.
2) with the fc release kerkel (3194) things work, but the connection is often lost.
3) with the 2.6.23-0.49.rc1.git3.fc8, the card asociates and thats it.
Using wireless git and out of tree driver building I've found that the following 2 patches are the culprits:
Patch causing loose off connection within seconds when fully loading the link with a local file transfer:
http://bu3sch.de/gitweb?p=wireless-dev.git;a=commitdiff;h=62ee473d67b7ae353d210b186abaadc37a642237
Only associating and nothing else:
http://bu3sch.de/gitweb?p=wireless-dev.git;a=commitdiff;h=7d59453a9dbe50dc9bab846c410e39f8d5b10c83
And then specifically the changes to prism54common.c
This is with an isl3886 cardbus card, using the p54pci driver.
----
I would be more then happy to test any changes.
Thanks & Regards,
Hans
p.s.
Please keep my CC-ed I'm not on the list.
Quoted 9 lines · Hans de Goede
Patch causing loose off connection within seconds when fully loading the link with a local file transfer:
http://bu3sch.de/gitweb?p=wireless-dev.git;a=commitdiff;h=62ee473d67b7ae353d210b186abaadc37a642237Only associating and nothing else:
http://bu3sch.de/gitweb?p=wireless-dev.git;a=commitdiff;h=7d59453a9dbe50dc9bab846c410e39f8d5b10c83And then specifically the changes toprism54common.c
Links not working.
-Michael Wu
Quoted 6 lines · Michael Wu
Quoted 5 lines · Hans de Goede
Patch causing loose off connection within seconds when fully loading the link with a local file transfer:
http://bu3sch.de/gitweb?p=wireless-dev.git;a=commitdiff;h=62ee473d67b7ae353d210b186abaadc37a642237
Quoted 6 lines
Quoted 4 lines
Only associating and nothing else:
http://bu3sch.de/gitweb?p=wireless-dev.git;a=commitdiff;h=7d59453a9dbe50dc9bab846c410e39f8d5b10c83And then specifically the changes toprism54common.cLinks not working.
Darn, is there a gitweb of the wireless-dev git anywhere else, I'm pretty sure I can find those patches pretty quick again.
Regards,
Hans
Quoted 2 lines · Somebody in the thread at some point
Darn, is there a gitweb of the wireless-dev git anywhere else, I'm pretty sure I can find those patches pretty quick again.
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=summary
-Andy
Quoted 7 lines · Andy Green
Quoted 2 lines · Somebody in the thread at some point
Darn, is there a gitweb of the wireless-dev git anywhere else, I'm pretty sure I can find those patches pretty quick again.
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=summary
Erm,
I already found that one, but there is no drivers/net/wireless/mac80211 dir there. What am I missing?
Regards,
Hans
Quoted 3 lines · Hans de Goede
I already found that one, but there is no
drivers/net/wireless/mac80211dir there. What am I missing?
John Linville recently collapsed that directory into driver/net/wireless.
If you can just find the title of the patches/commits or describe them, that's probably enough for me to find them.
-Michael Wu
Quoted 5 lines · Somebody in the thread at some point
Quoted 3 lines · Hans de Goede
I already found that one, but there is no
drivers/net/wireless/mac80211dir there. What am I missing?John Linville recently collapsed that directory into driver/net/wireless.
Looking through that gitweb HEAD, the mac80211 stuff appears to be just plain absent at the moment as Hans says:
-Andy
Quoted 8 lines · Michael Wu
Quoted 3 lines · Hans de Goede
I already found that one, but there is no
drivers/net/wireless/mac80211dir there. What am I missing?John Linville recently collapsed that directory into driver/net/wireless.
If you can just find the title of the patches/commits or describe them, that's probably enough for me to find them.
Okay, I still had copies of various git revisions of prism54common.c and .h (aka the culprits) on my laptop. I've run some tests again to make sure I had the right revisions in mind for the breakage (which I had). I've attached 2 patches:
diff: with this reversed my speed increases 10x and more importantly when fully
loading the link (using scp from a local non wireless ethernet machine) it no
longer looses the connection in a couple of seconds
diff2, when I do not reverse this one, it still associates, but it no longer
receives / or transmits packages. (no dhcp, no ping when manually assigning IP's, etc).
Regards,
Hans
prism54common.h renamed from prism54common.h.orig +20 -16
@@ -232,40 +232,44 @@static const struct ieee80211_rate p54_rates[] = { { .rate =10 , - .val =1 , - .flags =IEEE80211_RATE_CCK }, + .val =0 , + .val2 =0x10 , + .flags =IEEE80211_RATE_CCK_2 }, { .rate =20 , - .val =2 , - .flags =IEEE80211_RATE_CCK }, + .val =1 , + .val2 =0x11 , + .flags =IEEE80211_RATE_CCK_2 }, { .rate =55 , - .val =3 , - .flags =IEEE80211_RATE_CCK }, + .val =2 , + .val2 =0x12 , + .flags =IEEE80211_RATE_CCK_2 }, { .rate =110 , - .val =4 , - .flags =IEEE80211_RATE_CCK }, + .val =3 , + .val2 =0x13 , + .flags =IEEE80211_RATE_CCK_2 }, { .rate =60 , - .val =5 , + .val =4 , .flags =IEEE80211_RATE_OFDM }, { .rate =90 , - .val =6 , + .val =5 , .flags =IEEE80211_RATE_OFDM }, { .rate =120 , - .val =7 , + .val =6 , .flags =IEEE80211_RATE_OFDM }, { .rate =180 , - .val =8 , + .val =7 , .flags =IEEE80211_RATE_OFDM }, { .rate =240 , - .val =9 , + .val =8 , .flags =IEEE80211_RATE_OFDM }, { .rate =360 , - .val =10 , + .val =9 , .flags =IEEE80211_RATE_OFDM }, { .rate =480 , - .val =11 , + .val =10 , .flags =IEEE80211_RATE_OFDM }, { .rate =540 , - .val =12 , + .val =11 , .flags =IEEE80211_RATE_OFDM }, };
prism54common-13-6.c renamed from prism54common-11-4.c +143 -10
266 lines not on this page · raw message
Quoted 8 lines · Hans de Goede
Okay, I still had copies of various git revisions of
prism54common.cand .h (aka the culprits) on my laptop. I've run some tests again to make sure I had the right revisions in mind for the breakage (which I had). I've attached 2 patches:
diff: with this reversed my speed increases 10x and more importantly when fully loading the link (using scp from a local non wireless ethernet machine) it no longer looses the connection in a couple of seconds
Hm, I guess either these changes were wrong or exposed some bugs. Can you check what sort of tx rates are being reported in iwconfig before and after that change?
Quoted 4 lines
diff2, when I do not reverse this one, it still associates, but it no longer receives / or transmits packages. (no dhcp, no ping when manually assigning IP's, etc).
Not sure.. this patch generally helped things on my hardware. Christian Lamparter might have an idea.
Thanks,
-Michael Wu
Quoted 13 lines · Michael Wu
Quoted 8 lines · Hans de Goede
Okay, I still had copies of various git revisions of
prism54common.cand .h (aka the culprits) on my laptop. I've run some tests again to make sure I had the right revisions in mind for the breakage (which I had). I've attached 2 patches:
diff: with this reversed my speed increases 10x and more importantly when fully loading the link (using scp from a local non wireless ethernet machine) it no longer looses the connection in a couple of secondsHm, I guess either these changes were wrong or exposed some bugs. Can you check what sort of tx rates are being reported in iwconfig before and after that change?
Quoted 7 lines
Quoted 4 lines
diff2, when I do not reverse this one, it still associates, but it no longer receives / or transmits packages. (no dhcp, no ping when manually assigning IP's, etc).
Not sure.. this patch generally helped things on my hardware. Christian Lamparter might have an idea.
Well not really, It is "fast" as usual here:
scp user@p54pci-pc:/usr/src/dummyzero ./
dummyzero 100% 236MB 1.8MB/s 02:09
iperf:
[ 5] local 192.168.1.247 port 5001 connected with 192.168.1.1 port 56253
[ 5] 0.0-240.7 sec 597 MBytes 20.8 Mbits/sec
=> need more data...
1. Which p54 firmware do you use? (It "must" be 2.7.0.0 for pci/cardbus)
2. What's your "average" txrate and Link Signal Level / Link Quality with and without the patches. (see iwconfig)
3. what brand/type of AP do you have?
-> what does the beacon frame look like? (or: if you don't have a
wlan sniffer / monitor, just run: iwlist wlanX scan )
4. Can you recompile the mac80211 layer with debug options and look for
something like ethX: STA XX:YY:ZZ:AA:BB:CC Average rate: VVV ... in your syslogs?
5. are they any suspicious dmesg outputs when the "network" stops/dies?
Thanks,
Chr.
Quoted 24 lines · Chr
Quoted 9 lines · Michael Wu
Quoted 8 lines · Hans de Goede
Okay, I still had copies of various git revisions of
prism54common.cand .h (aka the culprits) on my laptop. I've run some tests again to make sure I had the right revisions in mind for the breakage (which I had). I've attached 2 patches:
diff: with this reversed my speed increases 10x and more importantly when fully loading the link (using scp from a local non wireless ethernet machine) it no longer looses the connection in a couple of secondsQuoted 8 lines
Hm, I guess either these changes were wrong or exposed some bugs. Can you check what sort of tx rates are being reported in iwconfig before and after that change?
Quoted 4 lines
diff2, when I do not reverse this one, it still associates, but it no longer receives / or transmits packages. (no dhcp, no ping when manually assigning IP's, etc).
Not sure.. this patch generally helped things on my hardware. Christian Lamparter might have an idea.
Well not really, It is "fast" as usual here:
scp user@p54pci-pc:/usr/src/dummyzero ./
dummyzero 100% 236MB 1.8MB/s 02:09
Quoted 8 lines
iperf:
[ 5] local 192.168.1.247 port 5001 connected with 192.168.1.1 port 56253
[ 5] 0.0-240.7 sec 597 MBytes 20.8 Mbits/sec=> need more data...
1. Which p54 firmware do you use? (It "must" be 2.7.0.0 for pci/cardbus)
2.4.12.0, extracted from the window driver for my card, any later version will cause the driver to fail to load with: "Error cannot read eeprom!"
Quoted 2 lines
2. What's your "average" txrate and Link Signal Level / Link Quality with and without the patches. (see iwconfig)
See attached logs
Quoted 1 line
3. what brand/type of AP do you have?
A davolink DV-201AMR its an embedded Linux device using the BCM6348 chipset,
Quoted 2 lines
-> what does the beacon frame look like? (or: if you don't have a wlan sniffer / monitor, just run: iwlist wlanX scan )
See logs
Quoted 2 lines
4. Can you recompile the mac80211 layer with debug options and look for something like ethX: STA XX:YY:ZZ:AA:BB:CC Average rate: VVV ... in your syslogs?
See logs
Quoted 2 lines
5. are they any suspicious dmesg outputs when the "network" stops/dies?
Nope.
I've attached a tarbal with logs the FC7test logs are the logs from the Fedora 7 test kernel which I normally use, as that works well.
The rest is based on a F-8 test kernel which contains a wireless-dev snapshot from 26 jul 2007. The dates are dates of git checkouts from prism54common.{c,h} the -common one has the speed changes to prism54common.h reversed, because otherwise connectivity is lost as explained.
I hope this helps.
Regards,
Hans
Quoted 4 lines · Hans de Goede
Quoted 2 lines
1. Which p54 firmware do you use? (It "must" be 2.7.0.0 for pci/cardbus)
2.4.12.0, extracted from the window driver for my card, any later version will cause the driver to fail to load with: "Error cannot read eeprom!"
uhh, that's a pity... Well, I'm thinking about to get the FW then. The problem is that I don't have the necessary equipment "here" for debugging (I am abroad with my old laptop and a minipci prism54 card...)
Anyway, could you please verify that the firmware at
http://daemonizer.de/prism54/prism54-fw/fw-softmac/2.4.12.0.arm is the same one you have? Or does it "differ"?
Quoted 5 lines
Quoted 3 lines
2. What's your "average" txrate and Link Signal Level / Link Quality with and without the patches. (see iwconfig)
See attached logs
Your average speed is in the very low MBit/s and your normal Link Signal Level is only about 40/100 (~ -80 dbm! ) ?! (The equation is roughly (rssi / 2) - 100 = dbm)
Something is fishy: take a look at the "not working" scan-13-6. Signal level is about 62/100 (~ -69 dbm! => much better! Did you move the laptop, or is this high value really reproducible?)
Quoted 2 lines
Quoted 1 line
3. what brand/type of AP do you have?
A davolink DV-201AMR its an embedded Linux device using the BCM6348 chipset,
hmm, a embedded linux? do you have a ssh/telnet access to the router? Maybe the syslogs / dmesg gives us a "hint" why it won't connect.
(BTW: does your router really only support the weak WEP encryptions?)
Quoted 9 lines
Quoted 3 lines
-> what does the beacon frame look like? (or: if you don't have a wlan sniffer / monitor, just run: iwlist wlanX scan )
See logs
Quoted 2 lines
4. Can you recompile the mac80211 layer with debug options and look for something like ethX: STA XX:YY:ZZ:AA:BB:CC Average rate: VVV ... in your syslogs?
See logs
phy4: not handling 0x02 type control frame.
=> It's a bit strange that you got one, it's probably because of the 2.4.12.0 Firmware.
wlan0: switched to short barker preamble.
Well, that's probably the reason why your connection always "dropped". could you please replace all "IEEE80211_RATE_CCK_2" in p54common.h with "IEEE80211_RATE_CCK" and report back?
Quoted 5 lines
Quoted 3 lines
5. are they any suspicious dmesg outputs when the "network" stops/dies?
Nope.
Yep, none!
I'll see if I can post you a "debug" driver, when I'm back at home. I'm afraid it's not possible right now...
Quoted 9 lines
I've attached a tarbal with logs the FC7test logs are the logs from the Fedora 7 test kernel which I normally use, as that works well.
The rest is based on a F-8 test kernel which contains a wireless-dev snapshot from 26 jul 2007. The dates are dates of git checkouts from prism54common.{c,h} the -common one has the speed changes to
prism54common.hreversed, because otherwise connectivity is lost as explained.
k. Do you have another wifi card that can perform wifi sniffs? (just as an option)
Quoted 6 lines
I hope this helps.
Regards,
Hans
Thanks,
Chr
On Tuesday, 14. August 2007, Hans de Goede wrote:
Hans,
Any updates? Or are you on holiday?
I've prepared a patch, which should theoretically lower the excessive retry count.
however I don't think it will magically solve anything...
OT: Michael/anyone else:
1. Do you know why the rate algorithm (rc80211_simple) starts with the lowest speed? or is this really only a p54 bug?
2. Is there any way to get a station aid (in ap mode) and dtim period without lots of castings or "new variables" in struct ieee80211_tx_control? I really need them for AP mode (yes, I have a "proof of concept" for it, the hardest thing was to compile hostapd ;-) ).
Thanks,
Chr.
drivers/net/wireless/p54common.c +23 -9
@@ -315,9 +315,11 @@ static void p54_rx_frame_sent(struct ieestruct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data;struct p54_frame_sent_hdr *payload = (struct p54_frame_sent_hdr *) hdr->data;struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; +struct p54_control_hdr *entry_hdr; +struct p54_tx_control_allocdata *entry_data;u32 addr =le32_to_cpu (hdr->req_id) -0x70 ;struct memrecord *range =NULL ; -u32 freed =0 ; +u32 freed =0 , pad =0 ;u32 last_addr = priv->rx_start;while (entry != (struct sk_buff *)&priv->tx_queue) {
@@ -339,15 +341,27 @@ static void p54_rx_frame_sent(struct ieememcpy (&status.control, range->control,sizeof (status.control));kfree (range->control); -if (!payload->status) - status.flags |=IEEE80211_TX_STATUS_ACK ; -else - status.excessive_retries =1 ; - status.retry_count = payload->retries -1 ; - status.ack_signal =le16_to_cpu (payload->ack_rssi); -skb_pull (entry,sizeof (*hdr) +sizeof (struct p54_tx_control_allocdata )); priv->tx_stats.data[status.control.queue].len--; -ieee80211_tx_status_irqsafe (dev, entry, &status); + +if (status.control.flags &IEEE80211_TXCTL_REQ_TX_STATUS ) { + entry_hdr = (struct p54_control_hdr *) entry->data; + entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; +if (entry_hdr->magic1 ==cpu_to_le16 (0x4010 )) + pad = entry_data->align[0 ]; +else + pad =0 ; + +if (!payload->status) + status.flags |=IEEE80211_TX_STATUS_ACK ; +else + status.excessive_retries =1 ; + status.retry_count = payload->retries -1 ; + status.ack_signal =le16_to_cpu (payload->ack_rssi); +skb_pull (entry,sizeof (*hdr) + pad +sizeof (*entry_data)); +ieee80211_tx_status_irqsafe (dev, entry, &status); + }else +dev_kfree_skb_irq (entry); +break ; }else last_addr = range->end_addr;
Quoted 8 lines · Chr
On Tuesday, 14. August 2007, Hans de Goede wrote:
Hans,
Any updates? Or are you on holiday?
I've prepared a patch, which should theoretically lower the excessive retry count.
Quoted 7 lines
however I don't think it will magically solve anything...
OT: Michael/anyone else:
1. Do you know why the rate algorithm (
rc80211_simple) starts with the lowest speed? or is this really only a p54 bug?
I cannot answer any other of your questions, but rc80211_simple starting at 1 Mbs is not a bug, it is a feature. The reason is that particular speed offers the greatest chance of authenticating and associating. It used to start at the highest rate and many systems would give up trying to connect before the rate was dropped to a point at which they could communicate. If the connection is really capable of higher speeds, it gets there very quickly.
Larry
Quoted 5 lines · Chr
On Tuesday, 14. August 2007, Hans de Goede wrote:
Hans,
Any updates?
Erm, did you not receive my long mail with all kinda logs attached in logs.tar.gz?
Quoted 1 line
Or are you on holiday?
Nope
Quoted 5 lines
I've prepared a patch, which should theoretically lower the excessive retry count.
however I don't think it will magically solve anything...
Erm, I'm awfully busy, still I want to get this resolved! So I'll make time to test things as necessary, but could you first look at the logs I send and then confirm (or deny) that this pathc might help.
Regards,
Hans
Quoted 9 lines · Hans de Goede
Quoted 5 lines · Chr
On Tuesday, 14. August 2007, Hans de Goede wrote:
Hans,
Any updates?
Erm, did you not receive my long mail with all kinda logs attached in logs.tar.gz?
yes I got the logs... but maybe you haven't seen my reply:
http://www.spinics.net/lists/linux-wireless/msg04658.html
Quoted 5 lines
Quoted 1 line
Or are you on holiday?
Nope
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
I've prepared a patch, which should theoretically lower the excessive retry count.
however I don't think it will magically solve anything...
Erm, I'm awfully busy, still I want to get this resolved! So I'll make time to test things as necessary, but could you first look at the logs I send and then confirm (or deny) that this pathc might help.
me too... but the logs don't carry much useful information inside:
"pyh2: not handling 0x02 type control frame" (could be the FW) "wlan0: duplicate address detected!" (never seen this before... IPv6?) "wlan0: switched to short barker preamble" (nothing to be scared.)
and of course: the low signal with any driver, except 13-6...
Thanks,
Chr.
Johannes Berg
maintainerQuoted 1 line · Chr
"pyh2: not handling
0x02type control frame" (could be the FW)
The driver, I assume.
Quoted 1 line
"wlan0: duplicate address detected!" (never seen this before... IPv6?)
Yes, IPv6, caused by the multicast bug.
Quoted 1 line
"wlan0: switched to short barker preamble" (nothing to be scared.)
Fairly new, but yeah, nothing to worry.
johannes
Quoted 5 lines · Johannes Berg
Quoted 1 line · Chr
"pyh2: not handling
0x02type control frame" (could be the FW)The driver, I assume.
No, it's really the firmware. I've "finally" tried the 2.4.12.0 and got the same messages... But, I didn't get them with 2.7.0.0 or 2.5.2.0.
Moreover, because of some "unknown reason" 2.4.12.0 does not work very well with my isl3880 chip, I cannot tx/rx any QoS data frame... And probably, it's because the feature is not supported by the firmware...
I made two patches:
the p54-pull-padding.diff should finally fix the rate algorithm for "everyone" and as a bonus for developers: it adds a printk for the firmware revision p54 is using. (If noone complains within a week, I'll write a official patch post for it...)
p54-remove-qos.diff (must be applied on top of p54-pull-padding.diff) is _only_ for Hans... It removes/reverts QoS/WME/WMM/IEEE802.11e features.
Thanks,
Chr
drivers/net/wireless/p54common.c +36 -15
@@ -48,6 +48,7 @@ void p54_parse_firmware(struct ieee80211while (bootrec->data <= end_data && (bootrec->data +le32_to_cpu (bootrec->len)) <= end_data) {u32 code =le32_to_cpu (bootrec->code); +size_t len =le32_to_cpu (bootrec->len);switch (code) {case BR_CODE_COMPONENT_ID :switch (be32_to_cpu (*bootrec->data)) {
@@ -69,6 +70,9 @@ void p54_parse_firmware(struct ieee80211 }break ;case BR_CODE_COMPONENT_VERSION : + priv->fw_version =kmalloc (len *4 ,GFP_KERNEL ); +snprintf (priv->fw_version, len *4 ,"%s" , (char *)bootrec->data); +printk (KERN_INFO "p54: firmware version %s\n" , priv->fw_version);break ;case BR_CODE_DESCR : priv->rx_start =le32_to_cpu (bootrec->data[1 ]);
@@ -86,7 +90,7 @@ void p54_parse_firmware(struct ieee80211default :break ; } - bootrec = (struct bootrec *)&bootrec->data[le32_to_cpu (bootrec->len)]; + bootrec = (struct bootrec *)&bootrec->data[len]; } }EXPORT_SYMBOL_GPL (p54_parse_firmware);
@@ -315,9 +319,11 @@ static void p54_rx_frame_sent(struct ieestruct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data;struct p54_frame_sent_hdr *payload = (struct p54_frame_sent_hdr *) hdr->data;struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; +struct p54_control_hdr *entry_hdr; +struct p54_tx_control_allocdata *entry_data;u32 addr =le32_to_cpu (hdr->req_id) -0x70 ;struct memrecord *range =NULL ; -u32 freed =0 ; +u32 freed =0 , pad =0 ;u32 last_addr = priv->rx_start;while (entry != (struct sk_buff *)&priv->tx_queue) {
@@ -339,15 +345,25 @@ static void p54_rx_frame_sent(struct ieememcpy (&status.control, range->control,sizeof (status.control));kfree (range->control); -if (!payload->status) - status.flags |=IEEE80211_TX_STATUS_ACK ; -else - status.excessive_retries =1 ; - status.retry_count = payload->retries -1 ; - status.ack_signal =le16_to_cpu (payload->ack_rssi); -skb_pull (entry,sizeof (*hdr) +sizeof (struct p54_tx_control_allocdata )); priv->tx_stats.data[status.control.queue].len--; + + entry_hdr = (struct p54_control_hdr *) entry->data; + entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; +if (entry_hdr->magic1 &cpu_to_le16 (0x4000 )) + pad = entry_data->align[0 ]; +else + pad =0 ; +if (status.control.flags &IEEE80211_TXCTL_NO_ACK ) { +if (!(payload->status &0x01 )) + status.flags |=IEEE80211_TX_STATUS_ACK ; +else + status.excessive_retries =1 ; + status.retry_count = payload->retries -1 ; + status.ack_signal =le16_to_cpu (payload->ack_rssi); + } +skb_pull (entry,sizeof (*hdr) + pad +sizeof (*entry_data));ieee80211_tx_status_irqsafe (dev, entry, &status); +break ; }else last_addr = range->end_addr;
@@ -486,6 +502,7 @@ static int p54_tx(struct ieee80211_hw *dieee80211_stop_queue (dev, control->queue); padding = (unsigned long )(skb->data - (sizeof (*hdr) +sizeof (*txhdr))) &3 ; + len = skb->len; control_copy =kmalloc (sizeof (*control),GFP_ATOMIC );
@@ -496,10 +513,12 @@ static int p54_tx(struct ieee80211_hw *dskb_push (skb,sizeof (*txhdr) + padding); hdr = (struct p54_control_hdr *)skb_push (skb,sizeof (*hdr)); -if (padding) - hdr->magic1 =cpu_to_le16 (0x4010 ); -else - hdr->magic1 =cpu_to_le16 (0x0010 ); +if (padding) { + hdr->magic1 =cpu_to_le16 (0x4000 ); + txhdr->align[0 ] = padding; + }else + hdr->magic1 =cpu_to_le16 (0x0000 ); + hdr->len =cpu_to_le16 (len); hdr->type = (control->flags &IEEE80211_TXCTL_NO_ACK ) ?0 :cpu_to_le16 (1 ); hdr->retry1 = hdr->retry2 = control->retry_limit;
@@ -515,6 +534,9 @@ static int p54_tx(struct ieee80211_hw *d rate |=0x40 ; else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) rate |= 0x20; + else + hdr->magic1 |= cpu_to_le16(0x0010); +memset (txhdr->rateset, rate,8 ); txhdr->wep_key_present =0 ; txhdr->wep_key_len =0 ;
@@ -525,8 +547,6 @@ static int p54_tx(struct ieee80211_hw *d txhdr->output_power =0x7f ;// HW Maximum txhdr->magic5 = (control->flags &IEEE80211_TXCTL_NO_ACK ) ?0 : ((rate >0x3 ) ?cpu_to_le32 (0x33 ) :cpu_to_le32 (0x23 )); -if (padding) - txhdr->align[0 ] = padding; priv->tx (dev, hdr, skb->len,0 );return 0 ;
@@ -938,6 +958,7 @@ void p54_free_common(struct ieee80211_hwkfree (priv->output_limit);kfree (priv->curve_data);kfree (priv->cached_vdcf); +kfree (priv->fw_version); }EXPORT_SYMBOL_GPL (p54_free_common);
drivers/net/wireless/p54.h +1 -0
@@ -60,6 +60,7 @@ struct p54_common {struct pda_pa_curve_data *curve_data;__le16 rxhw;u8 version; +char *fw_version;unsigned int tx_hdr_len;void *cached_vdcf;/* FIXME: this channels/modes/rates stuff sucks */
drivers/net/wireless/p54common.c +6 -9
@@ -345,7 +345,7 @@ static void p54_rx_frame_sent(struct ieememcpy (&status.control, range->control,sizeof (status.control));kfree (range->control); - priv->tx_stats.data[status.control.queue].len--; + priv->tx_stats.data[0 ].len--; entry_hdr = (struct p54_control_hdr *) entry->data; entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
@@ -493,13 +493,13 @@ static int p54_tx(struct ieee80211_hw *dsize_t padding, len;u8 rate; - current_queue = &priv->tx_stats.data[control->queue]; + current_queue = &priv->tx_stats.data[0 ];if (unlikely (current_queue->len > current_queue->limit))return NETDEV_TX_BUSY ; current_queue->len++; current_queue->count++;if (current_queue->len == current_queue->limit) -ieee80211_stop_queue (dev, control->queue); +ieee80211_stop_queue (dev,0 ); padding = (unsigned long )(skb->data - (sizeof (*hdr) +sizeof (*txhdr))) &3 ;
@@ -540,7 +540,7 @@ static int p54_tx(struct ieee80211_hw *dmemset (txhdr->rateset, rate,8 ); txhdr->wep_key_present =0 ; txhdr->wep_key_len =0 ; - txhdr->frame_type =cpu_to_le32 (control->queue +4 ); + txhdr->frame_type =4 ; txhdr->magic4 =0 ; txhdr->antenna = (control->antenna_sel_tx ==0 ) ?2 : control->antenna_sel_tx -1 ;
@@ -920,12 +920,9 @@ struct ieee80211_hw *p54_init_common(siz dev->max_rssi =100 ;/* (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 =4 ; - dev->queues =4 ; + dev->queues =1 ; dev->extra_tx_headroom =sizeof (struct p54_control_hdr ) +4 +sizeof (struct p54_tx_control_allocdata );
Quoted 4 lines · Chr
Quoted 3 lines · Hans de Goede
Quoted 2 lines · Chr
On Tuesday, 14. August 2007, Hans de Goede wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Hans,
Any updates?
Erm, did you not receive my long mail with all kinda logs attached in logs.tar.gz?
yes I got the logs... but maybe you haven't seen my reply:
http://www.spinics.net/lists/linux-wireless/msg04658.html
I indeed didn't see that, probably because I'm not on the list. Here are some answers to your questions:
Quoted 11 lines
Quoted 3 lines
Quoted 1 line
1. Which p54 firmware do you use? (It "must" be 2.7.0.0 for pci/cardbus)
2.4.12.0, extracted from the window driver for my card, any later version will cause the driver to fail to load with: "Error cannot read eeprom!"
uhh, that's a pity... Well, I'm thinking about to get the FW then. The problem is that I don't have the necessary equipment "here" for debugging (I am abroad with my old laptop and a minipci prism54 card...)
Anyway, could you please verify that the firmware at
http://daemonizer.de/prism54/prism54-fw/fw-softmac/2.4.12.0.arm is the same one you have? Or does it "differ"?
I'm at work atm, but I did verify that my 2.4.12.0 matched 2.4.12.0 available from the firmware site linked to from the prism54 wiki.
I can verify that your link matches too if you want, but it porbably will.
Quoted 5 lines
Quoted 3 lines
2. What's your "average" txrate and Link Signal Level / Link Quality with and without the patches. (see iwconfig)
See attached logs
Your average speed is in the very low MBit/s and your normal Link Signal Level is only about 40/100 (~ -80 dbm! ) ?! (The equation is roughly (rssi / 2) - 100 = dbm)
Something is fishy: take a look at the "not working" scan-13-6. Signal level is about 62/100 (~ -69 dbm! => much better! Did you move the laptop, or is this high value really reproducible?)
I'm afraid that my reception quality varies wildly. I don't know why, I'll try to configure a different channel on the AP the next time I do some testing.
Quoted 2 lines
Quoted 1 line
3. what brand/type of AP do you have?
A davolink DV-201AMR its an embedded Linux device using the BCM6348 chipset,
hmm, a embedded linux? do you have a ssh/telnet access to the router? Maybe the syslogs / dmesg gives us a "hint" why it won't connect.
I'm afraid its provisioned by my ISP , and I only have access to some crippled web interface, I really need to kick the ISP and ask them to give me the source and stuff, as they are oblidged under the GPL.
(BTW: does your router really only support the weak WEP encryptions?)
No it also supports 128 bit, but when first settings things up I had trouble getting that working. This has been working reasonably for me, so I didn't change it. The firmware can also do wpa, but the webinterface I'm stuck behind doesn't allow this (GRRRR).
Quoted 2 lines
k. Do you have another wifi card that can perform wifi sniffs? (just as an option)
I can get my hands on a full mac prism pci card, but I'll first try your patches.
----
Replying to other mail in one go:
Quoted 5 lines · Chr
I made two patches:
the p54-pull-padding.diff should finally fix the rate algorithm for "everyone" and as a bonus for developers: it adds a printk for the firmware revision p54 is using.
Cool I'll give this a try tonight, I really wanted to try it sooner, but ...
Quoted 3 lines
p54-remove-qos.diff (must be applied on top of p54-pull-padding.diff) is _only_ for Hans... It removes/reverts QoS/WME/WMM/IEEE802.11e features.
Hmm, could this be made conditionally on the firmware revision perhaps? I don't like having to patch my kernel every update, and more importantly, my card is a pretty popular el cheapo sitecom, which are stacked by the dozen by every computershop in town, so it would be nice if this worked out of the box.
I'll try to see if 2.5.2.0 will work with my card, I think I've tried before but you never know, will 2.5.2.0 be good enough for the QoS/WME/WMM/IEEE802.11e features?
Maybe it would be an idea to dump the eeprom from the driver with the 2.4.12.0 firmware, and then fake the eeprom in the driver using newer firmware to see if the eeprom reading is the only problem with newer firmware and my card ?
Thanks & Regards,
Hans
Quoted 4 lines · Hans de Goede
I'm afraid that my reception quality varies wildly. I don't know why, I'll try to configure a different channel on the AP the next time I do some testing.
Ok, maybe someone has cooked a meal in a microwave oven, or something like that...
Quoted 4 lines
Replying to other mail in one go:
Chr wrote:
Quoted 9 lines
Quoted 3 lines
I made two patches:
the p54-pull-padding.diff should finally fix the rate algorithm for
"everyone" and as
Quoted 2 lines
a bonus for developers: it adds a printk for the firmware revision p54 is using.
Cool I'll give this a try tonight, I really wanted to try it sooner, but ...
k, I'll wait ;-)
BTW: There's already a newer version of it... see attachment.
Quoted 6 lines
Hmm, could this be made conditionally on the firmware revision perhaps? I don't like having to patch my kernel every update, and more importantly, my card is a pretty popular el cheapo sitecom, which are stacked by the dozen by every computershop in town, so it would be nice if this worked out of the box.
Of course! This patch is just a "test" patch, because you never know if it's "this" or "that"... Probably, it's only necessary to hardcode "txhdr->frame_type = 4;" in p54_tx again.
Quoted 3 lines
I'll try to see if 2.5.2.0 will work with my card, I think I've tried before but you never know, will 2.5.2.0 be good enough for the QoS/WME/WMM/IEEE802.11e features?
AFAIK Michael uses this revision too and he would not have merged the QoS patch, if it was completly unusable or faulty... So I think 2.5.2 will be fine, if it works with your card. (However, 2.7.0.0 is recommend, because it's one of the few FWs for which we have additional debugging and testing facilities...)
Quoted 3 lines
Maybe it would be an idea to dump the eeprom from the driver with the 2.4.12.0 firmware, and then fake the eeprom in the driver using newer firmware to see if the eeprom reading is the only problem with newer firmware and my card ?
Hmm, I don't think that the firmware somehow changes the eeprom.
Thanks,
Chr.
drivers/net/wireless/p54common.c +36 -14
@@ -48,6 +48,7 @@ void p54_parse_firmware(struct ieee80211while (bootrec->data <= end_data && (bootrec->data +le32_to_cpu (bootrec->len)) <= end_data) {u32 code =le32_to_cpu (bootrec->code); +size_t len =le32_to_cpu (bootrec->len);switch (code) {case BR_CODE_COMPONENT_ID :switch (be32_to_cpu (*bootrec->data)) {
@@ -69,6 +70,9 @@ void p54_parse_firmware(struct ieee80211 }break ;case BR_CODE_COMPONENT_VERSION : + priv->fw_version =kmalloc (len *4 ,GFP_KERNEL ); +snprintf (priv->fw_version, len *4 ,"%s" , (char *)bootrec->data); +printk (KERN_INFO "p54: firmware version %s\n" , priv->fw_version);break ;case BR_CODE_DESCR : priv->rx_start =le32_to_cpu (bootrec->data[1 ]);
@@ -86,7 +90,7 @@ void p54_parse_firmware(struct ieee80211default :break ; } - bootrec = (struct bootrec *)&bootrec->data[le32_to_cpu (bootrec->len)]; + bootrec = (struct bootrec *)&bootrec->data[len]; } }EXPORT_SYMBOL_GPL (p54_parse_firmware);
@@ -315,9 +319,11 @@ static void p54_rx_frame_sent(struct ieestruct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data;struct p54_frame_sent_hdr *payload = (struct p54_frame_sent_hdr *) hdr->data;struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; +struct p54_control_hdr *entry_hdr; +struct p54_tx_control_allocdata *entry_data;u32 addr =le32_to_cpu (hdr->req_id) -0x70 ;struct memrecord *range =NULL ; -u32 freed =0 ; +u32 freed =0 , pad =0 ;u32 last_addr = priv->rx_start;while (entry != (struct sk_buff *)&priv->tx_queue) {
@@ -339,15 +345,26 @@ static void p54_rx_frame_sent(struct ieememcpy (&status.control, range->control,sizeof (status.control));kfree (range->control); -if (!payload->status) - status.flags |=IEEE80211_TX_STATUS_ACK ; -else - status.excessive_retries =1 ; + priv->tx_stats.data[status.control.queue].len--; + + entry_hdr = (struct p54_control_hdr *) entry->data; + entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; +if (entry_hdr->magic1 &cpu_to_le16 (0x4000 )) + pad = entry_data->align[0 ]; +else + pad =0 ; + +if (!status.control.flags &IEEE80211_TXCTL_NO_ACK ) { +if (!(payload->status &0x01 )) + status.flags |=IEEE80211_TX_STATUS_ACK ; +else + status.excessive_retries =1 ; + } status.retry_count = payload->retries -1 ; status.ack_signal =le16_to_cpu (payload->ack_rssi); -skb_pull (entry,sizeof (*hdr) +sizeof (struct p54_tx_control_allocdata )); - priv->tx_stats.data[status.control.queue].len--; +skb_pull (entry,sizeof (*hdr) + pad +sizeof (*entry_data));ieee80211_tx_status_irqsafe (dev, entry, &status); +break ; }else last_addr = range->end_addr;
@@ -486,6 +503,7 @@ static int p54_tx(struct ieee80211_hw *dieee80211_stop_queue (dev, control->queue); padding = (unsigned long )(skb->data - (sizeof (*hdr) +sizeof (*txhdr))) &3 ; + len = skb->len; control_copy =kmalloc (sizeof (*control),GFP_ATOMIC );
@@ -496,10 +514,12 @@ static int p54_tx(struct ieee80211_hw *dskb_push (skb,sizeof (*txhdr) + padding); hdr = (struct p54_control_hdr *)skb_push (skb,sizeof (*hdr)); -if (padding) - hdr->magic1 =cpu_to_le16 (0x4010 ); -else - hdr->magic1 =cpu_to_le16 (0x0010 ); +if (padding) { + hdr->magic1 =cpu_to_le16 (0x4000 ); + txhdr->align[0 ] = padding; + }else + hdr->magic1 =cpu_to_le16 (0x0000 ); + hdr->len =cpu_to_le16 (len); hdr->type = (control->flags &IEEE80211_TXCTL_NO_ACK ) ?0 :cpu_to_le16 (1 ); hdr->retry1 = hdr->retry2 = control->retry_limit;
@@ -515,6 +535,9 @@ static int p54_tx(struct ieee80211_hw *d rate |=0x40 ; else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) rate |= 0x20; + else + hdr->magic1 |= cpu_to_le16(0x0010); +memset (txhdr->rateset, rate,8 ); txhdr->wep_key_present =0 ; txhdr->wep_key_len =0 ;
@@ -525,8 +548,6 @@ static int p54_tx(struct ieee80211_hw *d txhdr->output_power =0x7f ;// HW Maximum txhdr->magic5 = (control->flags &IEEE80211_TXCTL_NO_ACK ) ?0 : ((rate >0x3 ) ?cpu_to_le32 (0x33 ) :cpu_to_le32 (0x23 )); -if (padding) - txhdr->align[0 ] = padding; priv->tx (dev, hdr, skb->len,0 );return 0 ;
@@ -938,6 +959,7 @@ void p54_free_common(struct ieee80211_hwkfree (priv->output_limit);kfree (priv->curve_data);kfree (priv->cached_vdcf); +kfree (priv->fw_version); }EXPORT_SYMBOL_GPL (p54_free_common);
drivers/net/wireless/p54.h +1 -0
@@ -60,6 +60,7 @@ struct p54_common {struct pda_pa_curve_data *curve_data;__le16 rxhw;u8 version; +char *fw_version;unsigned int tx_hdr_len;void *cached_vdcf;/* FIXME: this channels/modes/rates stuff sucks */
Quoted 5 lines · Chr
Quoted 1 line · Hans de Goede
Maybe it would be an idea to dump the eeprom from the driver with the 2.4.12.0 firmware, and then fake the eeprom in the driver using newer firmware to see if the eeprom reading is the only problem with newer firmware and my card ?
Hmm, I don't think that the firmware somehow changes the eeprom.
I think you misunderstood me. The driver fails to load when using newer firmware with a "can not read eeprom" error. So I have the idea to add a couple of printk's printing all the important bits from the eeprom using the 2.4.12.0 firmware, then modify the driver to hardcode these bits from the eeprom in to the driver and then try newer firmware with the driver with the hardcoded bits in. This way I want to see if the reading of the eeprom is the only problem, or if there are other problems too when using newer firmware. Does this sound like a plan or is it a waste of time?
Regards,
Hans
Quoted 16 lines · Chr
Quoted 2 lines · Hans de Goede
I'm afraid that my reception quality varies wildly. I don't know why, I'll try to configure a different channel on the AP the next time I do some testing.
Ok, maybe someone has cooked a meal in a microwave oven, or something like that...
Quoted 10 lines
Replying to other mail in one go:
Quoted 3 lines · Chr
I made two patches:
the p54-pull-padding.diff should finally fix the rate algorithm for
"everyone" and as
Quoted 2 lines
a bonus for developers: it adds a printk for the firmware revision p54 is using.
Quoted 6 lines
Quoted 2 lines
Cool I'll give this a try tonight, I really wanted to try it sooner, but ...
k, I'll wait ;-)
BTW: There's already a newer version of it... see attachment.
Okay, I've given this a test together with your remvoe QOS and other advanced features patch and it seems to work well (as good as the versiono of the driver I'm currently using).
I've tried using all other firmwares from here:
http://jbnote.free.fr/prism54usb/data/firmwares/
But none of them work, except for the (identical) 2.4.12.0 one. the others either don't boot or can't read the eeprom.
Regards,
Hans
Quoted 11 lines · Hans de Goede
Okay, I've given this a test together with your remvoe QOS and other advanced features patch and it seems to work well (as good as the versiono of the driver I'm currently using).
I've tried using all other firmwares from here:
http://jbnote.free.fr/prism54usb/data/firmwares/But none of them work, except for the (identical) 2.4.12.0 one. the others either don't boot or can't read the eeprom.
Thanks for testing! Let's see if I can write something over the weekend. Since you have said in your previous post that your Sitecom adapter is cheap and common ... can you please tell me which one is it?
Regards,
Chr.
Quoted 6 lines · Chr
Quoted 5 lines · Hans de Goede
Okay, I've given this a test together with your remvoe QOS and other advanced features patch and it seems to work well (as good as the versiono of the driver I'm currently using).
I've tried using all other firmwares from here:
http://jbnote.free.fr/prism54usb/data/firmwares/
Quoted 7 lines
Quoted 2 lines
But none of them work, except for the (identical) 2.4.12.0 one. the others either don't boot or can't read the eeprom.
Thanks for testing! Let's see if I can write something over the weekend. Since you have said in your previous post that your Sitecom adapter is cheap and common ... can you please tell me which one is it?
Its a Sitecom WL-140 V2 (small letters at the bottom right of the front of the box) aka the Sitecom Nitro XM 140G+
Note I think that the V2 is important to get the same one as mine, otherwise you probably get an older fullmac version (if they still sell that anyware).
Regards,
Hans
Quoted 8 lines · Hans de Goede
Chr wrote:
Its a Sitecom WL-140 V2 (small letters at the bottom right of the front of the box) aka the Sitecom Nitro XM 140G+
Note I think that the V2 is important to get the same one as mine, otherwise you probably get an older fullmac version (if they still sell that anyware).
Here we are:
series:
p54-pull-padding2.diff
p54-support-older-firmwares.diff
Signed-off will follow on friday/saturday... Michael, any complains?
Regards,
Chr.
drivers/net/wireless/p54common.c +20 -8
@@ -283,12 +283,13 @@ static void p54_rx_data(struct ieee80211struct ieee80211_rx_status rx_status = {0 };u16 freq =le16_to_cpu (hdr->freq); - rx_status.ssi = hdr->rssi;/* TODO: check this */ + rx_status.ssi = hdr->rssi; rx_status.rate = hdr->rate &0x1f ;/* report short preambles & CCK too */ rx_status.channel = freq ==2484 ?14 : (freq -2407 )/5 ; rx_status.freq = freq; rx_status.phymode =MODE_IEEE80211G ; rx_status.antenna = hdr->antenna; + rx_status.mactime =le64_to_cpu (hdr->timestamp);skb_pull (skb,sizeof (*hdr));skb_trim (skb,le16_to_cpu (hdr->len));
@@ -324,6 +325,9 @@ static void p54_rx_frame_sent(struct iee range = (struct memrecord *)&entry->cb;if (range->start_addr == addr) {struct ieee80211_tx_status status = {{0 }}; +struct p54_control_hdr *entry_hdr; +struct p54_tx_control_allocdata *entry_data; +int pad =0 ;if (entry->next != (struct sk_buff *)&priv->tx_queue) freed = ((struct memrecord *)&entry->next->cb)->start_addr - last_addr;
@@ -339,14 +343,22 @@ static void p54_rx_frame_sent(struct ieememcpy (&status.control, range->control,sizeof (status.control));kfree (range->control); -if (!payload->status) - status.flags |=IEEE80211_TX_STATUS_ACK ; -else - status.excessive_retries =1 ; + priv->tx_stats.data[status.control.queue].len--; + + entry_hdr = (struct p54_control_hdr *) entry->data; + entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; +if ((entry_hdr->magic1 &cpu_to_le16 (0x4000 )) !=0 ) + pad = entry_data->align[0 ]; + +if (!status.control.flags &IEEE80211_TXCTL_NO_ACK ) { +if (!(payload->status &0x01 )) + status.flags |=IEEE80211_TX_STATUS_ACK ; +else + status.excessive_retries =1 ; + } status.retry_count = payload->retries -1 ; status.ack_signal =le16_to_cpu (payload->ack_rssi); -skb_pull (entry,sizeof (*hdr) +sizeof (struct p54_tx_control_allocdata )); - priv->tx_stats.data[status.control.queue].len--; +skb_pull (entry,sizeof (*hdr) + pad +sizeof (*entry_data));ieee80211_tx_status_irqsafe (dev, entry, &status);break ; }else
@@ -897,7 +909,7 @@ struct ieee80211_hw *p54_init_common(sizIEEE80211_HW_DATA_NULLFUNC_ACK ;/* TODO: check */ /* IEEE80211_HW_MONITOR_DURING_OPER FIXME: check */ dev->channel_change_time =1000 ;/* TODO: find actual value */ - dev->max_rssi =100 ; + dev->max_rssi =127 ;/* (hard) queue limits */ priv->tx_stats.data[0 ].limit =3 ;
drivers/net/wireless/p54common.h +1 -1
@@ -168,7 +168,7 @@ struct p54_rx_hdr {u8 antenna;u8 rate;u8 rssi; -u8 padding; +u8 quality;u16 unknown2;__le64 timestamp;u8 data[0 ];
drivers/net/wireless/p54common.c +34 -8
89 lines not on this page · raw message
drivers/net/wireless/p54.h +2 -0
@@ -62,6 +62,8 @@ struct p54_common {u8 version;unsigned int tx_hdr_len;void *cached_vdcf; +u8 *fw_version; +__le16 fw_variant;/* FIXME: this channels/modes/rates stuff sucks */ struct ieee80211_channel channels[14 ];struct ieee80211_rate rates[12 ];
Quoted 4 lines · Chr
Here we are:
series:
p54-pull-padding2.diff
Looks okay, but it seems to do more than just account for padding. I'm okay with those changes too.
Quoted 1 line
p54-support-older-firmwares.diff
The new information pulled from parsing the firmware isn't used anywhere but in this function.. no need to keep that information in the private structure.
Thanks,
-Michael Wu
Quoted 8 lines · Michael Wu
Quoted 4 lines · Chr
Here we are:
series:
p54-pull-padding2.diffLooks okay, but it seems to do more than just account for padding. I'm okay with those changes too.
Ok!
Quoted 4 lines
Quoted 1 line
p54-support-older-firmwares.diff
The new information pulled from parsing the firmware isn't used anywhere but in this function.. no need to keep that information in the private structure.
Yes, the firmware version string could be freed right after the printk... but I would like to keep the fw_variant for "further" patches, since the softmac protocol has changed a bit throughout 2.4 - 2.13.1 firmwares.
Quoted 2 lines
Thanks,
-Michael Wu
Thanks,
Chr.
PATCH 1/2 p54: various fixes
In reply to Michael WuFrom: Christian Lamparter <[email protected]>
This patch should finally fix the mysterious "stuck at 1 mbps" and numerous of "lost" ACKs (very important for the not yet released p54 AP addon).
The patch also includes a bunch of useful one liners that did not make it in the tree yet.
---
drivers/net/wireless/p54common.c +20 -8
@@ -283,12 +283,13 @@ static void p54_rx_data(struct ieee80211struct ieee80211_rx_status rx_status = {0 };u16 freq =le16_to_cpu (hdr->freq); - rx_status.ssi = hdr->rssi;/* TODO: check this */ + rx_status.ssi = hdr->rssi; rx_status.rate = hdr->rate &0x1f ;/* report short preambles & CCK too */ rx_status.channel = freq ==2484 ?14 : (freq -2407 )/5 ; rx_status.freq = freq; rx_status.phymode =MODE_IEEE80211G ; rx_status.antenna = hdr->antenna; + rx_status.mactime =le64_to_cpu (hdr->timestamp);skb_pull (skb,sizeof (*hdr));skb_trim (skb,le16_to_cpu (hdr->len));
@@ -324,6 +325,9 @@ static void p54_rx_frame_sent(struct iee range = (struct memrecord *)&entry->cb;if (range->start_addr == addr) {struct ieee80211_tx_status status = {{0 }}; +struct p54_control_hdr *entry_hdr; +struct p54_tx_control_allocdata *entry_data; +int pad =0 ;if (entry->next != (struct sk_buff *)&priv->tx_queue) freed = ((struct memrecord *)&entry->next->cb)->start_addr - last_addr;
@@ -339,14 +343,22 @@ static void p54_rx_frame_sent(struct ieememcpy (&status.control, range->control,sizeof (status.control));kfree (range->control); -if (!payload->status) - status.flags |=IEEE80211_TX_STATUS_ACK ; -else - status.excessive_retries =1 ; + priv->tx_stats.data[status.control.queue].len--; + + entry_hdr = (struct p54_control_hdr *) entry->data; + entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; +if ((entry_hdr->magic1 &cpu_to_le16 (0x4000 )) !=0 ) + pad = entry_data->align[0 ]; + +if (!status.control.flags &IEEE80211_TXCTL_NO_ACK ) { +if (!(payload->status &0x01 )) + status.flags |=IEEE80211_TX_STATUS_ACK ; +else + status.excessive_retries =1 ; + } status.retry_count = payload->retries -1 ; status.ack_signal =le16_to_cpu (payload->ack_rssi); -skb_pull (entry,sizeof (*hdr) +sizeof (struct p54_tx_control_allocdata )); - priv->tx_stats.data[status.control.queue].len--; +skb_pull (entry,sizeof (*hdr) + pad +sizeof (*entry_data));ieee80211_tx_status_irqsafe (dev, entry, &status);break ; }else
@@ -895,7 +907,7 @@ struct ieee80211_hw *p54_init_common(sizIEEE80211_HW_RX_INCLUDES_FCS |IEEE80211_HW_WEP_INCLUDE_IV ; dev->channel_change_time =1000 ;/* TODO: find actual value */ - dev->max_rssi =100 ; + dev->max_rssi =127 ;/* (hard) queue limits */ priv->tx_stats.data[0 ].limit =3 ;
drivers/net/wireless/p54common.h +1 -1
@@ -168,7 +168,7 @@ struct p54_rx_hdr {u8 antenna;u8 rate;u8 rssi; -u8 padding; +u8 quality;u16 unknown2;__le64 timestamp;u8 data[0 ];
PATCH 2/2 p54: disable QoS on older firmwares
In reply to Michael WuFrom: Christian Lamparter <[email protected]>
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 <[email protected]> for reporting and debugging it.
---
drivers/net/wireless/p54common.c +35 -8
@@ -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 ieee80211default :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 );
drivers/net/wireless/p54.h +1 -0
@@ -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 ];
Re: [PATCH 2/2] p54: disable QoS on older firmwares
Quoted 3 lines · Chr
This patch fixes a regression with older (pre 2.5.2.0) firmwares, that don't support the QoS queues yet...
Why bother allocating a temporary buffer for firmware version string? Just keep a pointer to where it's located. (unless it's not null terminated..)
There's two extra unnecessary lines added to the end of p54_parse_firmware.
Thanks,
-Michael Wu
Re: [PATCH 2/2 v2] p54: disable QoS on older firmwares
From: Christian Lamparter <[email protected]>
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 <[email protected]> for reporting and debugging it.
---
Quoted 2 lines
Why bother allocating a temporary buffer for firmware version string? Just keep a pointer to where it's located. (unless it's not null terminated..)
Ok
drivers/net/wireless/p54common.c +28 -8
@@ -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,9 @@ void p54_parse_firmware(struct ieee80211 }break ;case BR_CODE_COMPONENT_VERSION : +/* 24 bytes should be enough for all firmwares */ +if (strnlen ((unsigned char *)bootrec->data,24 ) <24 ) + fw_version = (unsigned char *)bootrec->data;break ;case BR_CODE_DESCR : priv->rx_start =le32_to_cpu (bootrec->data[1 ]);
@@ -76,6 +83,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,7 +97,20 @@ void p54_parse_firmware(struct ieee80211default :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 ); + +if (priv->fw_var >=0x300 ) { +/* Firmware supports QoS, use it! */ + 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 +933,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 );
drivers/net/wireless/p54.h +1 -0
@@ -62,6 +62,7 @@ struct p54_common {u8 version;unsigned int tx_hdr_len;void *cached_vdcf; +unsigned int fw_var;/* FIXME: this channels/modes/rates stuff sucks */ struct ieee80211_channel channels[14 ];struct ieee80211_rate rates[12 ];
Johannes Berg
maintainerQuoted 6 lines · Andy Green
Quoted 2 lines · Somebody in the thread at some point
Darn, is there a gitweb of the wireless-dev git anywhere else, I'm pretty sure I can find those patches pretty quick again.
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=summary
Actually, you want to look at
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=shortlog;h=everything or one of the other branches.
johannes