Re: [PATCH RFT] b43: Add support for new firmware

2008-01-11 Thread Larry Finger
Michael Buesch wrote:
 This patch adds support for new firmware.
 Please test this on old and new firmware.

I have tested this patch with old firmware. It seems to work; however my 
testing is not complete as
my computer has started hanging with the Caps Lock light flashing. The crash 
is not caused by this
patch as it happened with 2.6.24-rc5, which has run for many days. I do have a 
suggestion for
changing the patch (see below).

 +static inline
 +size_t b43_txhdr_size(struct b43_wldev *dev)
 +{
 + if (b43_is_old_txhdr_format(dev))
 + return 100 + sizeof(struct b43_plcp_hdr6);
 + return 104 + sizeof(struct b43_plcp_hdr6);
 +}

Why not eliminate most of the magic numbers in this part with

size_t b43_txhdr_size(struct b43_wldev *dev)
{
if (b43_is_old_txhdr_format(dev))
return sizeof(struct b43_txhdr) - 4;
return sizeof(struct b43_txhdr);
}

Larry
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH RFT] b43: Add support for new firmware

2008-01-11 Thread Larry Finger
Martin Marques wrote:
 
 Sorry if it's a change of subject, but what does the flashing caps hang
 mean? It has happend to me a lot when trying to run 3D apps.

AFAIK, it indicates an error so severe that the kernel has no chance to 
recover. Examples might be
stack underflow or a page fault while accessing the stack.

Your crashes when running 3D apps is likely a bug in the driver for your 
graphics adapter. Are you
using a binary-only driver? If so, complain to the manufacturer. If it is an 
open-source driver,
then a note to the Linux Kernel Mailing List would be appropriate. You should 
describe your kernel,
configuration, etc. and list the 3D app that causes the problem.

Larry
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH RFT] b43: Add support for new firmware

2008-01-11 Thread Michael Buesch
On Friday 11 January 2008 17:40:04 Larry Finger wrote:
 Michael Buesch wrote:
  This patch adds support for new firmware.
  Please test this on old and new firmware.
 
 I have tested this patch with old firmware. It seems to work; however my 
 testing is not complete as
 my computer has started hanging with the Caps Lock light flashing. The 
 crash is not caused by this
 patch as it happened with 2.6.24-rc5, which has run for many days. I do have 
 a suggestion for
 changing the patch (see below).
 
  +static inline
  +size_t b43_txhdr_size(struct b43_wldev *dev)
  +{
  +   if (b43_is_old_txhdr_format(dev))
  +   return 100 + sizeof(struct b43_plcp_hdr6);
  +   return 104 + sizeof(struct b43_plcp_hdr6);
  +}
 
 Why not eliminate most of the magic numbers in this part with
 
 size_t b43_txhdr_size(struct b43_wldev *dev)
 {
   if (b43_is_old_txhdr_format(dev))
   return sizeof(struct b43_txhdr) - 4;
   return sizeof(struct b43_txhdr);
 }

Because this is IMO as magic as the above.
The struct b43_txhdr is _not_ meant to be used as an object anymore,
as it now contains this union magic stuff. So we must only use it
as a pointer type. The sizeof, however, uses it as an object.
I'm perfectly fine with the hardcoded constants. And they really
are constants, as they are defined by the hard(firm)ware.
I think this all leads to the same issue as Should we use
#defines for the PCI IDs in PCI ID tables?.
However, this code will go away in summer anyway. So it doesn't
really matter. It really is just a hack.

-- 
Greetings Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH RFT] b43: Add support for new firmware

2008-01-11 Thread Martin Marques
Larry Finger escribió:
 Michael Buesch wrote:
 This patch adds support for new firmware.
 Please test this on old and new firmware.
 
 I have tested this patch with old firmware. It seems to work; however my 
 testing is not complete as
 my computer has started hanging with the Caps Lock light flashing. The 
 crash is not caused by this
 patch as it happened with 2.6.24-rc5, which has run for many days. I do have 
 a suggestion for
 changing the patch (see below).

Sorry if it's a change of subject, but what does the flashing caps hang 
mean? It has happend to me a lot when trying to run 3D apps.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH RFT] b43: Add support for new firmware

2008-01-10 Thread Michael Buesch
This patch adds support for new firmware.
Please test this on old and new firmware.

To get new firmware, go to
ftp://ftp.linksys.com/opensourcecode/wrt150nv11/1.51.3/
and download the tarball. We don't have a smaller tarball, yet.
That will be fixed later.
You can extract firmware out of the wl_ap.o file contained
in this tarball using latest fwcutter. You must pass the option
--unsupported to fwcutter.


Index: wireless-2.6/drivers/net/wireless/b43/dma.c
===
--- wireless-2.6.orig/drivers/net/wireless/b43/dma.c2008-01-09 
16:59:33.0 +0100
+++ wireless-2.6/drivers/net/wireless/b43/dma.c 2008-01-10 18:00:18.0 
+0100
@@ -804,44 +804,43 @@ struct b43_dmaring *b43_setup_dmaring(st
ring-meta = kcalloc(nr_slots, sizeof(struct b43_dmadesc_meta),
 GFP_KERNEL);
if (!ring-meta)
goto err_kfree_ring;
if (for_tx) {
ring-txhdr_cache = kcalloc(nr_slots,
-   sizeof(struct b43_txhdr_fw4),
+   b43_txhdr_size(dev),
GFP_KERNEL);
if (!ring-txhdr_cache)
goto err_kfree_meta;
 
/* test for ability to dma to txhdr_cache */
dma_test = dma_map_single(dev-dev-dev,
  ring-txhdr_cache,
- sizeof(struct b43_txhdr_fw4),
+ b43_txhdr_size(dev),
  DMA_TO_DEVICE);
 
if (dma_mapping_error(dma_test)) {
/* ugh realloc */
kfree(ring-txhdr_cache);
ring-txhdr_cache = kcalloc(nr_slots,
-   sizeof(struct
-  b43_txhdr_fw4),
+   b43_txhdr_size(dev),
GFP_KERNEL | GFP_DMA);
if (!ring-txhdr_cache)
goto err_kfree_meta;
 
dma_test = dma_map_single(dev-dev-dev,
  ring-txhdr_cache,
- sizeof(struct b43_txhdr_fw4),
+ b43_txhdr_size(dev),
  DMA_TO_DEVICE);
 
if (dma_mapping_error(dma_test))
goto err_kfree_txhdr_cache;
}
 
dma_unmap_single(dev-dev-dev,
-dma_test, sizeof(struct b43_txhdr_fw4),
+dma_test, b43_txhdr_size(dev),
 DMA_TO_DEVICE);
}
 
ring-dev = dev;
ring-nr_slots = nr_slots;
ring-mmio_base = b43_dmacontroller_base(dma64, controller_index);
@@ -1119,32 +1118,33 @@ static int dma_tx_fragment(struct b43_dm
int err;
struct b43_dmadesc_generic *desc;
struct b43_dmadesc_meta *meta;
struct b43_dmadesc_meta *meta_hdr;
struct sk_buff *bounce_skb;
u16 cookie;
+   size_t hdrsize = b43_txhdr_size(ring-dev);
 
 #define SLOTS_PER_PACKET  2
B43_WARN_ON(skb_shinfo(skb)-nr_frags);
 
/* Get a slot for the header. */
slot = request_slot(ring);
desc = ops-idx2desc(ring, slot, meta_hdr);
memset(meta_hdr, 0, sizeof(*meta_hdr));
 
-   header = (ring-txhdr_cache[slot * sizeof(struct b43_txhdr_fw4)]);
+   header = (ring-txhdr_cache[slot * hdrsize]);
cookie = generate_cookie(ring, slot);
b43_generate_txhdr(ring-dev, header,
   skb-data, skb-len, ctl, cookie);
 
meta_hdr-dmaaddr = map_descbuffer(ring, (unsigned char *)header,
-  sizeof(struct b43_txhdr_fw4), 1);
+  hdrsize, 1);
if (dma_mapping_error(meta_hdr-dmaaddr))
return -EIO;
ops-fill_descriptor(ring, desc, meta_hdr-dmaaddr,
-sizeof(struct b43_txhdr_fw4), 1, 0, 0);
+hdrsize, 1, 0, 0);
 
/* Get a slot for the payload. */
slot = request_slot(ring);
desc = ops-idx2desc(ring, slot, meta);
memset(meta, 0, sizeof(*meta));
 
@@ -1186,13 +1186,13 @@ static int dma_tx_fragment(struct b43_dm
return 0;
 
 out_free_bounce:
dev_kfree_skb_any(skb);
 out_unmap_hdr:
unmap_descbuffer(ring, meta_hdr-dmaaddr,
-sizeof(struct b43_txhdr_fw4), 1);
+hdrsize, 1);
return err;
 }
 
 static inline int should_inject_overflow(struct b43_dmaring *ring)
 {