Re: [Bugme-new] [Bug 8808] New: Large file transfer causes kernel panic showing b44_poll

2007-08-01 Thread Gary Zambrano
On Wed, 2007-07-25 at 11:54 -0700, Andrew Morton wrote:
 On Wed, 25 Jul 2007 04:29:33 -0700 (PDT)
 [EMAIL PROTECTED] wrote:
 
  http://bugzilla.kernel.org/show_bug.cgi?id=8808
  
 Summary: Large file transfer causes kernel panic showing b44_poll
 Product: Drivers
 Version: 2.5
   KernelVersion: 2.6.22.1
Platform: All
  OS/Version: Linux
Tree: Mainline
  Status: NEW
Severity: blocking
Priority: P1
   Component: Network
  AssignedTo: [EMAIL PROTECTED]
  ReportedBy: [EMAIL PROTECTED]
  
  
  Most recent kernel where this bug did not occur: /
  Distribution: ttylinux 
  Hardware Environment: Dell Inspiron 1300
  Problem Description: 
  
  A large file transfer (6.5GB) (tried http with wget and plain netcat) 
  causes a
  kernel panic after more than several GB have been transferred. However, 
  kernel
  panic does not occur consistently. That is, it has occurred after 1.2GB, 
  1.8GB,
  2.3GB and even 3.4GB transferred. Transfer never finished though. 
  
I could not repro the problem, but please give this patch a try:

diff -rup a/b44.c b/b44.c
--- a/b44.c 2007-07-31 15:31:08.0 -0700
+++ b/b44.c 2007-08-01 08:03:08.0 -0700
@@ -792,15 +792,15 @@ static int b44_rx(struct b44 *bp, int bu
goto next_pkt;
}
 
-   if (len == 0) {
+   if (len  5) {
int i = 0;
 
do {
udelay(2);
barrier();
len = le16_to_cpu(rh-len);
-   } while (len == 0  i++  5);
-   if (len == 0)
+   } while (len  5  i++  5);
+   if (len  5)
goto drop_it;
}
 



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b44: regression in 2.6.22 (resend)

2007-05-29 Thread Gary Zambrano
On Mon, 2007-05-28 at 13:55 -0700, Maximilian Engelhardt wrote:
 On Monday 28 May 2007, Thomas Gleixner wrote:
  On Mon, 2007-05-28 at 19:44 +0200, Maximilian Engelhardt wrote:
Can you please keep CONFIG_HIGH_RES_TIMERS and CONFIG_NOHZ and try the
following combinations on the kernel command line:
   
1) highres=off nohz=off (should be the same as your working config)
2) highres=off
3) nohz=off
  
   I tested this with my 2.6.22-rc3 kernel, here are the results:
  
   without any special boot parameters: problem does appear
   highres=off nohz=off: problem does not appear
   highres=off: problem does not appear
   nohz=off: problem does appear
 
  Is there any other strange behavior of the high res enabled kernel than
  the b44 problem ?
 
 I didn't notice anything.
 
 
   I additionally built my 2.6.22-rc2-mm1 kernel without High Resolution
   Timer, but the high ping problem is still there.
 
  Hmm, that's mysterious. Wild guess is that highres exposes the hidden
  feature in a different way than rc2-mm1 does.
 
 I think the bug in 2.6.21/22-rc3 is a different one that the one in 
 2.6.22-rc2-mm1, but that's also only a wild guess :)
 
 I'll explain this a bit:
 In 2.6.21/22-rc3 is the same b44 driver that has been in the stock kernels 
 for 
 some time. With this driver and High Resolution Timer turned on I get 
 problems using iperf. The problems are that the systems becomes really slow 
 and unresponsive.  Michael Buesch thought this could be an IRQ storm which 
 sounds logical to me. This bug did never happen to me before I startet the 
 iperf test.


Can you please check to see if you notice anything out of the ordinary
using netperf in place of iperf in your high res timer on/off testbed?

Thanks,
Gary







-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b44: regression in 2.6.22 (resend)

2007-05-29 Thread Gary Zambrano
On Mon, 2007-05-28 at 16:55 +0200, Michael Buesch wrote:
 On Monday 28 May 2007 16:12:12 Maximilian Engelhardt wrote:
  On Monday 28 May 2007, Michael Buesch wrote:
   Can you also test the following patch?
   I think there's a bug in b44 that is doesn't properly discard
   shared IRQs, so it might possibly generate a NAPI storm, dunno.
   Worth a try.
  
   Index: linux-2.6.22-rc3/drivers/net/b44.c
   ===
   --- linux-2.6.22-rc3.orig/drivers/net/b44.c   2007-05-27 
   23:01:44.0
   +0200 +++ linux-2.6.22-rc3/drivers/net/b44.c  2007-05-28 
   12:48:27.0
   +0200 @@ -911,6 +911,8 @@ static irqreturn_t b44_interrupt(int irq
 spin_lock(bp-lock);
  
 istat = br32(bp, B44_ISTAT);
   + if (istat == 0x)
   + goto out; /* Shared IRQ not for us */
 imask = br32(bp, B44_IMASK);
  
 /* The interrupt mask register controls which interrupt bits
   @@ -942,6 +944,7 @@ irq_ack:
 bw32(bp, B44_ISTAT, istat);
 br32(bp, B44_ISTAT);
 }
   +out:
 spin_unlock(bp-lock);
 return IRQ_RETVAL(handled);
}
  
  I did try this patch on a affected kernel, but I didn't notice any big 
  difference. Perhaps the kernel is a bit less slow during the test, but It's 
  hard to tell.
 
 Ok, but anyway. I think this is a bug and needs to be fixed this way. Gary?
 

Thanks Michael.
No, I don't think this is a bug and it does not need to be fixed.
Thanks,
Gary


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b44: regression in 2.6.22 (resend)

2007-05-29 Thread Gary Zambrano
On Tue, 2007-05-29 at 22:45 +0200, Michael Buesch wrote:
 On Tuesday 29 May 2007 16:14:35 Gary Zambrano wrote:
  On Mon, 2007-05-28 at 16:55 +0200, Michael Buesch wrote:
   On Monday 28 May 2007 16:12:12 Maximilian Engelhardt wrote:
On Monday 28 May 2007, Michael Buesch wrote:
 Can you also test the following patch?
 I think there's a bug in b44 that is doesn't properly discard
 shared IRQs, so it might possibly generate a NAPI storm, dunno.
 Worth a try.

 Index: linux-2.6.22-rc3/drivers/net/b44.c
 ===
 --- linux-2.6.22-rc3.orig/drivers/net/b44.c   2007-05-27 
 23:01:44.0
 +0200 +++ linux-2.6.22-rc3/drivers/net/b44.c  2007-05-28 
 12:48:27.0
 +0200 @@ -911,6 +911,8 @@ static irqreturn_t b44_interrupt(int irq
   spin_lock(bp-lock);

   istat = br32(bp, B44_ISTAT);
 + if (istat == 0x)
 + goto out; /* Shared IRQ not for us */
   imask = br32(bp, B44_IMASK);

   /* The interrupt mask register controls which interrupt bits
 @@ -942,6 +944,7 @@ irq_ack:
   bw32(bp, B44_ISTAT, istat);
   br32(bp, B44_ISTAT);
   }
 +out:
   spin_unlock(bp-lock);
   return IRQ_RETVAL(handled);
  }

I did try this patch on a affected kernel, but I didn't notice any big 
difference. Perhaps the kernel is a bit less slow during the test, but 
It's 
hard to tell.
   
   Ok, but anyway. I think this is a bug and needs to be fixed this way. 
   Gary?
   
  
  Thanks Michael.
  No, I don't think this is a bug and it does not need to be fixed.
 
 Are you sure? I'm not so sure, because
 1) On bcm43xx the reverse engineers told us that the card
returns 0x for no-irq-pending. Since b44 and bcm43xx
are very similiar in IRQ and DMA I just thought it would
be the case there, too. Just guessing.
The b44 interrupt status reg returns a value of 0 if no interrupts are
pending. The b44 uses a mask to determine which bits (events) can
generate device interrupts on the system. If the masked interrupt status
register bits are not asserted, then the b44 will return to the system
with handled = 0. 
So, I think the way the b44 interrupt code is written should be ok and
not a bug. 


 2) PCMCIA cards usually return all-ones if you try to read a
register of a card that's been removed. So it's good
practice to check for this and bail out early in the IRQ
path. Do PCMCIA cards (PC-card, not neccessarily a real
16bit PCMCIA card) for b44 exist?

I do not know of any pccard application of the b44. As far as I know
b44s live on motherboards and in the wireless soc.

Thanks,
Gary

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b44: regression in 2.6.22 (resend)

2007-05-29 Thread Gary Zambrano
On Tue, 2007-05-29 at 18:39 -0400, Jeff Garzik wrote:

 We check for 0x because that is often how a fault is indicated, 
 when the memory location is read during or immediately after hotplug (or 
 if the PCI bus is truly faulty).  So for most hardware, you see
 
 tmp = read(irq status)
 if (!tmp)
   return irq-none /* no irq events raised */
 if (tmp == 0x)
   return irq-none /* hot unplug or h/w fault */
 
 and the method that determines no interrupt handling is needed.
 

I guess you are right, but then shouldn't the driver be checking for
faults in other parts of the code too? What if a fault/hotplug occurs
immediately after an interrupt, but before a tx?
Thanks,
Gary

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: b44: regression in 2.6.22

2007-05-25 Thread Gary Zambrano
On Fri, 2007-05-25 at 17:24 -0700, Stephen Hemminger wrote:
 Something is broken with the b44 driver in 2.6.22-rc1 or later. Now bisecting.
 The performance (with iperf) for receiving is normally 94Mbits or more.
 But something happened that dropped performance to less than 1Mbit,
 probably corrupted packets.
 
 There is nothing obvious in the commit log for drivers/net/b44.c, so it
 probably is something more general.

netperf in 2.6.22-rc2 seems ok. I'll give iperf a try to see if I can
repro the problem.

Thanks,
Gary


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Merging SSB upstream

2007-05-07 Thread Gary Zambrano
On Sat, 2007-05-05 at 23:11 -0400, Jeff Garzik wrote:
 Michael Buesch wrote:
  So, now that mac80211 is merged upstream, I think it's
  time to merge SSB and the b44-ssb port upstream.
  Note that bcm43xx-mac80211 is _not_ ready for upstream, yet.
  
  What do you think? I'd like to merge ssb as-is, although
  the embedded-device parts are not quite finished, yet.
  But they don't interfere with the non-embedded parts used
  by b44 and the bcm43xx PCI cards.
  So we _could_ remove the ssb-mips code, but I don't like to
  do that for better maintainability. It doesn't hurt anyone IMO.
 
 What does Ralf (MIPS maintainer) and Gary (Broadcom maintainer) think?
 
 For my part, I'm not going to render even a tentative opinion without a 
 link to actual code.
 
 Last I saw of the code, and descriptions in IRC, it sounded sane.
 
   Jeff
 

I would like to put some test mileage behind the ssb.
We had a hard time testing it a while back, so we will try the latest.
Thanks,
Gary

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.21-rc5] b44: fix IFF_ALLMULTI handling of CAM slots

2007-04-02 Thread Gary Zambrano
On Sun, 2007-04-01 at 10:10 -0700, Bill Helfinstine wrote:
 
 If you set the IFF_ALLMULTI flag on a b44 device, or if you join more
 than
 B44_MCAST_TABLE_SIZE multicast groups, the device will stop receiving
 unicast
 messages.  This is because the __b44_set_mac_addr call sets the zeroth
 CAM
 entry to the MAC address of the device, and then the loop at line 1722
 proceeds to overwrite it unless the value of i is set by the
 __b44_load_mcast
 call.  However, when IFF_ALLMULTI is set, that call is bypassed,
 leaving i set
 to zero. 
 
 Fixed by starting the loop at 1 to make it skip the CAM entry for the
 MAC
 address.
 
 Signed-off-by: Bill Helfinstine [EMAIL PROTECTED]

Thanks.

Acked-by: Gary Zambrano [EMAIL PROTECTED]


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] b44: replace define

2007-02-16 Thread Gary Zambrano
Replaced B44_DMA_MASK with DMA_30BIT_MASK.

Signed-off by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 5ff7882..9332f4c 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -59,7 +59,6 @@
 #define B44_DEF_TX_RING_PENDING(B44_TX_RING_SIZE - 1)
 #define B44_TX_RING_BYTES  (sizeof(struct dma_desc) * \
 B44_TX_RING_SIZE)
-#define B44_DMA_MASK 0x3fff
 
 #define TX_RING_GAP(BP)\
(B44_TX_RING_SIZE - (BP)-tx_pending)
@@ -665,7 +664,7 @@ static int b44_alloc_rx_skb(struct b44 *
/* Hardware bug work-around, the chip is unable to do PCI DMA
   to/from anything above 1GB :-( */
if (dma_mapping_error(mapping) ||
-   mapping + RX_PKT_BUF_SZ  B44_DMA_MASK) {
+   mapping + RX_PKT_BUF_SZ  DMA_30BIT_MASK) {
/* Sigh... */
if (!dma_mapping_error(mapping))
pci_unmap_single(bp-pdev, mapping, 
RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
@@ -677,7 +676,7 @@ static int b44_alloc_rx_skb(struct b44 *
 RX_PKT_BUF_SZ,
 PCI_DMA_FROMDEVICE);
if (dma_mapping_error(mapping) ||
-   mapping + RX_PKT_BUF_SZ  B44_DMA_MASK) {
+   mapping + RX_PKT_BUF_SZ  DMA_30BIT_MASK) {
if (!dma_mapping_error(mapping))
pci_unmap_single(bp-pdev, mapping, 
RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
dev_kfree_skb_any(skb);
@@ -988,7 +987,7 @@ static int b44_start_xmit(struct sk_buff
}
 
mapping = pci_map_single(bp-pdev, skb-data, len, PCI_DMA_TODEVICE);
-   if (dma_mapping_error(mapping) || mapping + len  B44_DMA_MASK) {
+   if (dma_mapping_error(mapping) || mapping + len  DMA_30BIT_MASK) {
/* Chip can't handle DMA to/from 1GB, use bounce buffer */
if (!dma_mapping_error(mapping))
pci_unmap_single(bp-pdev, mapping, len, 
PCI_DMA_TODEVICE);
@@ -1000,7 +999,7 @@ static int b44_start_xmit(struct sk_buff
 
mapping = pci_map_single(bp-pdev, bounce_skb-data,
 len, PCI_DMA_TODEVICE);
-   if (dma_mapping_error(mapping) || mapping + len  B44_DMA_MASK) 
{
+   if (dma_mapping_error(mapping) || mapping + len  
DMA_30BIT_MASK) {
if (!dma_mapping_error(mapping))
pci_unmap_single(bp-pdev, mapping,
 len, PCI_DMA_TODEVICE);
@@ -1227,7 +1226,7 @@ static int b44_alloc_consistent(struct b
 DMA_BIDIRECTIONAL);
 
if (dma_mapping_error(rx_ring_dma) ||
-   rx_ring_dma + size  B44_DMA_MASK) {
+   rx_ring_dma + size  DMA_30BIT_MASK) {
kfree(rx_ring);
goto out_err;
}
@@ -1254,7 +1253,7 @@ static int b44_alloc_consistent(struct b
 DMA_TO_DEVICE);
 
if (dma_mapping_error(tx_ring_dma) ||
-   tx_ring_dma + size  B44_DMA_MASK) {
+   tx_ring_dma + size  DMA_30BIT_MASK) {
kfree(tx_ring);
goto out_err;
}
@@ -2151,13 +2150,13 @@ static int __devinit b44_init_one(struct
 
pci_set_master(pdev);
 
-   err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK);
+   err = pci_set_dma_mask(pdev, (u64) DMA_30BIT_MASK);
if (err) {
dev_err(pdev-dev, No usable DMA configuration, aborting.\n);
goto err_out_free_res;
}
 
-   err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK);
+   err = pci_set_consistent_dma_mask(pdev, (u64) DMA_30BIT_MASK);
if (err) {
dev_err(pdev-dev, No usable DMA configuration, aborting.\n);
goto err_out_free_res;


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] B44: increase wait loop

2007-02-16 Thread Gary Zambrano

The b44 Enet control disable bit may take longer to clear on some
systems, so the loop count is increased with this patch. Functionality
is not compromised, but a debug message can be seen when the bit is not
cleared within the count value.
Thanks to Vasileios Lourdas who reported the problem.

Signed-off by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 9332f4c..aaada57 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1288,7 +1288,7 @@ static void b44_chip_reset(struct b44 *b
if (ssb_is_core_up(bp)) {
bw32(bp, B44_RCV_LAZY, 0);
bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
-   b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1);
+   b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 200, 1);
bw32(bp, B44_DMATX_CTRL, 0);
bp-tx_prod = bp-tx_cons = 0;
if (br32(bp, B44_DMARX_STAT)  DMARX_STAT_EMASK) {


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] dma-mapping.h

2007-02-16 Thread Gary Zambrano
Added dma_sync_single_range_for_cpu/device to dma-mapping.h in asm-arm 
asm-avr32 to call dma_sync_single_for_cpu/device. This patch enables b44
to compile on systems with these cpus.
This patch was created with the assumption that another method of
dma_sync_single_range_for_cpu/device does not exist on these
architectures.


Signed-off by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 9bc46b4..7d01450 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -294,6 +294,24 @@ dma_unmap_sg(struct device *dev, struct 
 extern void dma_unmap_sg(struct device *, struct scatterlist *, int, enum 
dma_data_direction);
 #endif
 
+#ifndef CONFIG_DMABOUNCE
+static inline void
+dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
+ unsigned long offset, size_t size,
+ enum dma_data_direction direction)
+{
+   /* just sync everything, that's all the pci API can do */
+   dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
+}
+
+static inline void
+dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
+unsigned long offset, size_t size,
+enum dma_data_direction direction)
+{
+   /* just sync everything, that's all the pci API can do */
+   dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
+}
 
 /**
  * dma_sync_single_for_cpu
@@ -312,7 +330,6 @@ extern void dma_unmap_sg(struct device *
  * must first the perform a dma_sync_for_device, and then the
  * device again owns the buffer.
  */
-#ifndef CONFIG_DMABOUNCE
 static inline void
 dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size,
enum dma_data_direction dir)
@@ -329,6 +346,8 @@ dma_sync_single_for_device(struct device
consistent_sync((void *)dma_to_virt(dev, handle), size, dir);
 }
 #else
+extern void dma_sync_single_range_for_cpu(struct device*, dma_addr_t, unsigned 
long, size_t, enum dma_data_direction);
+extern void dma_sync_single_range_for_device(struct device*, dma_addr_t, 
unsigned long, size_t, enum dma_data_direction);
 extern void dma_sync_single_for_cpu(struct device*, dma_addr_t, size_t, enum 
dma_data_direction);
 extern void dma_sync_single_for_device(struct device*, dma_addr_t, size_t, 
enum dma_data_direction);
 #endif
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 115813e..dfd1fb3 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -242,6 +242,24 @@ dma_unmap_sg(struct device *dev, struct 
 {
 
 }
+static inline void
+dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
+ unsigned long offset, size_t size,
+ enum dma_data_direction direction)
+{
+   /* just sync everything, that's all the pci API can do */
+   dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
+}
+
+static inline void
+dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
+unsigned long offset, size_t size,
+enum dma_data_direction direction)
+{
+   /* just sync everything, that's all the pci API can do */
+   dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
+}
+
 
 /**
  * dma_sync_single_for_cpu


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH review] b44: Port to ssb subsystem

2007-02-07 Thread Gary Zambrano
On Tue, 2007-01-23 at 17:20 +0100, Michael Buesch wrote:
 This patch ports b44 to the new SSB subsystem and makes
 it possible to turn off PCI related stuff.
 
 This patch is against my tree, where I have implemented the
 ssb subsystem.
 
 If you're all OK with this patch, I'd like apply it to my tree.
 I think that's best. Although it's not wireless-related, it's
 much easier to maintain this way.

  
 +static int b44_ethtool_ioctl (struct net_device *dev, void __user *useraddr)

Michael, Do you really want to create ethtool_ioctl() to do what the
ethtool_ops does?

-Gary


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] b44: fix multicast with 32 groups

2006-10-04 Thread Gary Zambrano
On Fri, 2006-09-29 at 17:53 -0400, Bill Helfinstine wrote:
 The b44 driver has a bug where if there are more than B44_MCAST_TABLE_SIZE 
 groups in the dev-mc_list, it will only listen to the first 
 B44_MCAST_TABLE_SIZE that it sees.
 
 This patch makes the driver go into RXCONFIG_ALLMULTI mode if there are more 
 than B44_MCAST_TABLE_SIZE groups being subscribed to.
 
 This patch is against 2.6.18, b44.c version 1.01.
 
 
 Signed-off-by: Bill Helfinstine [EMAIL PROTECTED]
 
 diff --git a/drivers/net/b44.c b/drivers/net/b44.c
 index e891ea2..dd024e1 100644
 --- a/drivers/net/b44.c
 +++ b/drivers/net/b44.c
 @@ -1706,7 +1706,8 @@ static void __b44_set_rx_mode(struct net
 
  __b44_set_mac_addr(bp);
 
 -   if (dev-flags  IFF_ALLMULTI)
 +   if ((dev-flags  IFF_ALLMULTI) ||
 +   (dev-mc_count  B44_MCAST_TABLE_SIZE))
  val |= RXCONFIG_ALLMULTI;
  else
  i = __b44_load_mcast(bp, dev);
 

It looks good to me, however, I'll have to nack it as this patch has spaces and 
will not apply.
Please convert the spaces to tabs.

Thanks,
Gary

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] bonding: Add 10 Gig support

2006-09-06 Thread Gary Zambrano
On Wed, 2006-09-06 at 12:53 -0400, Jeff Garzik wrote:
 Mitch Williams wrote:
  Add 10 Gig support to bonding.
  
  Resent due to corrupt patch.
 Did you test with git-applymbox first?
 
 It's still corrupt...
 
 
 Applying 'bonding: Add 10 Gig support'
 
 fatal: corrupt patch at line 10
 

I found that if I use git-stripspace on a patch, corruption is reported when 
using git-applymbox.
If git-stripspace is not used on the patch then git-applymbox will apply the 
patch with no errors.





-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] add b44 to maintainers

2006-06-22 Thread Gary Zambrano

Add b44 to the MAINTAINERS file.

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/MAINTAINERS b/MAINTAINERS
index 1421f74..a52e9c0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -568,6 +568,12 @@ L: [EMAIL PROTECTED]
 W: http://www.penguinppc.org/ppc64/
 S: Supported
 
+BROADCOM B44 10/100 ETHERNET DRIVER
+P: Gary Zambrano
+M: [EMAIL PROTECTED]
+L: netdev@vger.kernel.org
+S: Supported
+
 BROADCOM BNX2 GIGABIT ETHERNET DRIVER
 P: Michael Chan
 M: [EMAIL PROTECTED]


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6 resend] b44: update version to 1.01

2006-06-20 Thread Gary Zambrano
Update the driver version to 1.01

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 98c0675..a7e4ba5 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -29,8 +29,8 @@
 
 #define DRV_MODULE_NAMEb44
 #define PFX DRV_MODULE_NAME: 
-#define DRV_MODULE_VERSION 1.00
-#define DRV_MODULE_RELDATE Apr 7, 2006
+#define DRV_MODULE_VERSION 1.01
+#define DRV_MODULE_RELDATE Jun 16, 2006
 
 #define B44_DEF_MSG_ENABLE   \
(NETIF_MSG_DRV  | \


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6 resend] b44: add wol for old nic

2006-06-20 Thread Gary Zambrano
This patch adds wol support for the older 440x nics that use pattern matching.
This patch is a redo thanks to feedback from Michael Chan and Francois Romieu.

Signed-off-by: Gary Zambrano  [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 12fc67a..98c0675 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -75,6 +75,15 @@
 /* minimum number of free TX descriptors required to wake up TX process */
 #define B44_TX_WAKEUP_THRESH   (B44_TX_RING_SIZE / 4)
 
+/* b44 internal pattern match filter info */
+#define B44_PATTERN_BASE   0x400
+#define B44_PATTERN_SIZE   0x80
+#define B44_PMASK_BASE 0x600
+#define B44_PMASK_SIZE 0x10
+#define B44_MAX_PATTERNS   16
+#define B44_ETHIPV6UDP_HLEN62
+#define B44_ETHIPV4UDP_HLEN42
+
 static char version[] __devinitdata =
DRV_MODULE_NAME .c:v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
 
@@ -1457,6 +1466,103 @@ static void b44_poll_controller(struct n
 }
 #endif
 
+static void bwfilter_table(struct b44 *bp, u8 *pp, u32 bytes, u32 table_offset)
+{
+   u32 i;
+   u32 *pattern = (u32 *) pp;
+
+   for (i = 0; i  bytes; i += sizeof(u32)) {
+   bw32(bp, B44_FILT_ADDR, table_offset + i);
+   bw32(bp, B44_FILT_DATA, pattern[i / sizeof(u32)]);
+   }
+}
+
+static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
+{
+   int magicsync = 6;
+   int k, j, len = offset;
+   int ethaddr_bytes = ETH_ALEN;
+
+   memset(ppattern + offset, 0xff, magicsync);
+   for (j = 0; j  magicsync; j++)
+   set_bit(len++, (unsigned long *) pmask);
+
+   for (j = 0; j  B44_MAX_PATTERNS; j++) {
+   if ((B44_PATTERN_SIZE - len) = ETH_ALEN)
+   ethaddr_bytes = ETH_ALEN;
+   else
+   ethaddr_bytes = B44_PATTERN_SIZE - len;
+   if (ethaddr_bytes =0)
+   break;
+   for (k = 0; k ethaddr_bytes; k++) {
+   ppattern[offset + magicsync +
+   (j * ETH_ALEN) + k] = macaddr[k];
+   len++;
+   set_bit(len, (unsigned long *) pmask);
+   }
+   }
+   return len - 1;
+}
+
+/* Setup magic packet patterns in the b44 WOL
+ * pattern matching filter.
+ */
+static void b44_setup_pseudo_magicp(struct b44 *bp)
+{
+
+   u32 val;
+   int plen0, plen1, plen2;
+   u8 *pwol_pattern;
+   u8 pwol_mask[B44_PMASK_SIZE];
+
+   pwol_pattern = kmalloc(B44_PATTERN_SIZE, GFP_KERNEL);
+   if (!pwol_pattern) {
+   printk(KERN_ERR PFX Memory not available for WOL\n);
+   return;
+   }
+
+   /* Ipv4 magic packet pattern - pattern 0.*/
+   memset(pwol_pattern, 0, B44_PATTERN_SIZE);
+   memset(pwol_mask, 0, B44_PMASK_SIZE);
+   plen0 = b44_magic_pattern(bp-dev-dev_addr, pwol_pattern, pwol_mask,
+ B44_ETHIPV4UDP_HLEN);
+
+   bwfilter_table(bp, pwol_pattern, B44_PATTERN_SIZE, B44_PATTERN_BASE);
+   bwfilter_table(bp, pwol_mask, B44_PMASK_SIZE, B44_PMASK_BASE);
+
+   /* Raw ethernet II magic packet pattern - pattern 1 */
+   memset(pwol_pattern, 0, B44_PATTERN_SIZE);
+   memset(pwol_mask, 0, B44_PMASK_SIZE);
+   plen1 = b44_magic_pattern(bp-dev-dev_addr, pwol_pattern, pwol_mask,
+ ETH_HLEN);
+
+   bwfilter_table(bp, pwol_pattern, B44_PATTERN_SIZE,
+  B44_PATTERN_BASE + B44_PATTERN_SIZE);
+   bwfilter_table(bp, pwol_mask, B44_PMASK_SIZE,
+  B44_PMASK_BASE + B44_PMASK_SIZE);
+
+   /* Ipv6 magic packet pattern - pattern 2 */
+   memset(pwol_pattern, 0, B44_PATTERN_SIZE);
+   memset(pwol_mask, 0, B44_PMASK_SIZE);
+   plen2 = b44_magic_pattern(bp-dev-dev_addr, pwol_pattern, pwol_mask,
+ B44_ETHIPV6UDP_HLEN);
+
+   bwfilter_table(bp, pwol_pattern, B44_PATTERN_SIZE,
+  B44_PATTERN_BASE + B44_PATTERN_SIZE + B44_PATTERN_SIZE);
+   bwfilter_table(bp, pwol_mask, B44_PMASK_SIZE,
+  B44_PMASK_BASE + B44_PMASK_SIZE + B44_PMASK_SIZE);
+
+   kfree(pwol_pattern);
+
+   /* set these pattern's lengths: one less than each real length */
+   val = plen0 | (plen1  8) | (plen2  16) | WKUP_LEN_ENABLE_THREE;
+   bw32(bp, B44_WKUP_LEN, val);
+
+   /* enable wakeup pattern matching */
+   val = br32(bp, B44_DEVCTRL);
+   bw32(bp, B44_DEVCTRL, val | DEVCTRL_PFE);
+
+}
 
 static void b44_setup_wol(struct b44 *bp)
 {
@@ -1482,7 +1588,9 @@ static void b44_setup_wol(struct b44 *bp
val = br32(bp, B44_DEVCTRL);
bw32(bp, B44_DEVCTRL, val | DEVCTRL_MPM | DEVCTRL_PFE);
 
-   }
+   } else {
+   b44_setup_pseudo_magicp(bp);
+   }
 
val = br32(bp, B44_SBTMSLOW);
bw32(bp, B44_SBTMSLOW, val | SBTMSLOW_PE);
diff

[PATCH 3/6 resend] b44: add parameter

2006-06-20 Thread Gary Zambrano
This patch adds a parameter to init_hw() to not completely initialize
the nic for wol. 

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 73ca729..12fc67a 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -101,7 +101,7 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl);
 
 static void b44_halt(struct b44 *);
 static void b44_init_rings(struct b44 *);
-static void b44_init_hw(struct b44 *);
+static void b44_init_hw(struct b44 *, int);
 
 static int dma_desc_align_mask;
 static int dma_desc_sync_size;
@@ -873,7 +873,7 @@ static int b44_poll(struct net_device *n
spin_lock_irq(bp-lock);
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_wake_queue(bp-dev);
spin_unlock_irq(bp-lock);
done = 1;
@@ -942,7 +942,7 @@ static void b44_tx_timeout(struct net_de
 
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
 
spin_unlock_irq(bp-lock);
 
@@ -1059,7 +1059,7 @@ static int b44_change_mtu(struct net_dev
b44_halt(bp);
dev-mtu = new_mtu;
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
spin_unlock_irq(bp-lock);
 
b44_enable_ints(bp);
@@ -1356,13 +1356,15 @@ static int b44_set_mac_addr(struct net_d
  * packet processing.  Invoked with bp-lock held.
  */
 static void __b44_set_rx_mode(struct net_device *);
-static void b44_init_hw(struct b44 *bp)
+static void b44_init_hw(struct b44 *bp, int full_reset)
 {
u32 val;
 
b44_chip_reset(bp);
-   b44_phy_reset(bp);
-   b44_setup_phy(bp);
+   if (full_reset) {
+   b44_phy_reset(bp);
+   b44_setup_phy(bp);
+   }
 
/* Enable CRC32, set proper LED modes and power on PHY */
bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
@@ -1376,16 +1378,21 @@ static void b44_init_hw(struct b44 *bp)
bw32(bp, B44_TXMAXLEN, bp-dev-mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
 
bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
-   bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
-   bw32(bp, B44_DMATX_ADDR, bp-tx_ring_dma + bp-dma_offset);
-   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
- (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
-   bw32(bp, B44_DMARX_ADDR, bp-rx_ring_dma + bp-dma_offset);
+   if (full_reset) {
+   bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
+   bw32(bp, B44_DMATX_ADDR, bp-tx_ring_dma + bp-dma_offset);
+   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+ (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
+   bw32(bp, B44_DMARX_ADDR, bp-rx_ring_dma + bp-dma_offset);
 
-   bw32(bp, B44_DMARX_PTR, bp-rx_pending);
-   bp-rx_prod = bp-rx_pending;
+   bw32(bp, B44_DMARX_PTR, bp-rx_pending);
+   bp-rx_prod = bp-rx_pending;
 
-   bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+   bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+   } else {
+   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+ (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
+   }
 
val = br32(bp, B44_ENET_CTRL);
bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
@@ -1401,7 +1408,7 @@ static int b44_open(struct net_device *d
goto out;
 
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
 
b44_check_phy(bp);
 
@@ -1511,7 +1518,7 @@ static int b44_close(struct net_device *
netif_poll_enable(dev);
 
if (bp-flags  B44_FLAG_WOL_ENABLE) {
-   b44_init_hw(bp);
+   b44_init_hw(bp, 0);
b44_setup_wol(bp);
}
 
@@ -1786,7 +1793,7 @@ static int b44_set_ringparam(struct net_
 
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_wake_queue(bp-dev);
spin_unlock_irq(bp-lock);
 
@@ -1829,7 +1836,7 @@ static int b44_set_pauseparam(struct net
if (bp-flags  B44_FLAG_PAUSE_AUTO) {
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
} else {
__b44_set_flow_ctrl(bp, bp-flags);
}
@@ -2188,7 +2195,7 @@ static int b44_suspend(struct pci_dev *p
 
free_irq(dev-irq, dev);
if (bp-flags  B44_FLAG_WOL_ENABLE) {
-   b44_init_hw(bp);
+   b44_init_hw(bp, 0);
b44_setup_wol(bp);
}
pci_disable_device(pdev);
@@ -2213,7 +2220,7 @@ static int b44_resume(struct pci_dev *pd
spin_lock_irq(bp-lock);
 
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_device_attach(bp-dev);
spin_unlock_irq(bp-lock

[PATCH 6/6 resend] b44: update b44 Kconfig entry

2006-06-20 Thread Gary Zambrano
Deleted EXPERIMENTAL from b44 entry in Kconfig.

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bdaaad8..4e57785 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1359,8 +1359,8 @@ config APRICOT
  called apricot.
 
 config B44
-   tristate Broadcom 4400 ethernet support (EXPERIMENTAL)
-   depends on NET_PCI  PCI  EXPERIMENTAL
+   tristate Broadcom 4400 ethernet support
+   depends on NET_PCI  PCI
select MII
help
  If you have a network (Ethernet) controller of this type, say Y and



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings

2006-06-20 Thread Gary Zambrano
On Tue, 2006-06-20 at 04:42 -0400, Jeff Garzik wrote:

 ACK patches 1-6, but unfortunately failed to apply against latest 
 linux-2.6.git:
 
  [EMAIL PROTECTED] netdev-2.6]$ git-applymbox /g/tmp/mbox ~/info/signoff.txt
  6 patch(es) to process.
  
  Applying 'b44: fix manual speed/duplex/autoneg settings'
  
  fatal: corrupt patch at line 8

Sorry about that. 
They patch ok when using patch, however, the apply failure appears to be
related to me using git-stripspace on the patches before submitting
them.

I am resending patches that have not been git-stripspaced, so you should
not have the apply problem with the resend patches.

Thanks.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6 resend] b44: add wol

2006-06-20 Thread Gary Zambrano
Adds wol to the driver.
This is a redo of a previous patch thanks to feedback from Francois Romieu.

Signed-off-by Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 41b1618..81f434e 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1450,6 +1450,41 @@ static void b44_poll_controller(struct n
 }
 #endif
 
+
+static void b44_setup_wol(struct b44 *bp)
+{
+   u32 val;
+   u16 pmval;
+
+   bw32(bp, B44_RXCONFIG, RXCONFIG_ALLMULTI);
+
+   if (bp-flags  B44_FLAG_B0_ANDLATER) {
+
+   bw32(bp, B44_WKUP_LEN, WKUP_LEN_DISABLE);
+
+   val = bp-dev-dev_addr[2]  24 |
+   bp-dev-dev_addr[3]  16 |
+   bp-dev-dev_addr[4]  8 |
+   bp-dev-dev_addr[5];
+   bw32(bp, B44_ADDR_LO, val);
+
+   val = bp-dev-dev_addr[0]  8 |
+   bp-dev-dev_addr[1];
+   bw32(bp, B44_ADDR_HI, val);
+
+   val = br32(bp, B44_DEVCTRL);
+   bw32(bp, B44_DEVCTRL, val | DEVCTRL_MPM | DEVCTRL_PFE);
+
+   }
+
+   val = br32(bp, B44_SBTMSLOW);
+   bw32(bp, B44_SBTMSLOW, val | SBTMSLOW_PE);
+
+   pci_read_config_word(bp-pdev, SSB_PMCSR, pmval);
+   pci_write_config_word(bp-pdev, SSB_PMCSR, pmval | SSB_PE);
+
+}
+
 static int b44_close(struct net_device *dev)
 {
struct b44 *bp = netdev_priv(dev);
@@ -1475,6 +1510,11 @@ static int b44_close(struct net_device *
 
netif_poll_enable(dev);
 
+   if (bp-flags  B44_FLAG_WOL_ENABLE) {
+   b44_init_hw(bp);
+   b44_setup_wol(bp);
+   }
+
b44_free_consistent(bp);
 
return 0;
@@ -1831,12 +1871,40 @@ static void b44_get_ethtool_stats(struct
spin_unlock_irq(bp-lock);
 }
 
+static void b44_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   struct b44 *bp = netdev_priv(dev);
+
+   wol-supported = WAKE_MAGIC;
+   if (bp-flags  B44_FLAG_WOL_ENABLE)
+   wol-wolopts = WAKE_MAGIC;
+   else
+   wol-wolopts = 0;
+   memset(wol-sopass, 0, sizeof(wol-sopass));
+}
+
+static int b44_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   struct b44 *bp = netdev_priv(dev);
+
+   spin_lock_irq(bp-lock);
+   if (wol-wolopts  WAKE_MAGIC)
+   bp-flags |= B44_FLAG_WOL_ENABLE;
+   else
+   bp-flags = ~B44_FLAG_WOL_ENABLE;
+   spin_unlock_irq(bp-lock);
+
+   return 0;
+}
+
 static struct ethtool_ops b44_ethtool_ops = {
.get_drvinfo= b44_get_drvinfo,
.get_settings   = b44_get_settings,
.set_settings   = b44_set_settings,
.nway_reset = b44_nway_reset,
.get_link   = ethtool_op_get_link,
+   .get_wol= b44_get_wol,
+   .set_wol= b44_set_wol,
.get_ringparam  = b44_get_ringparam,
.set_ringparam  = b44_set_ringparam,
.get_pauseparam = b44_get_pauseparam,
@@ -1915,6 +1983,10 @@ static int __devinit b44_get_invariants(
/* XXX - really required?
   bp-flags |= B44_FLAG_BUGGY_TXPTR;
  */
+
+   if (ssb_get_core_rev(bp) = 7)
+   bp-flags |= B44_FLAG_B0_ANDLATER;
+
 out:
return err;
 }
@@ -2115,6 +2187,10 @@ static int b44_suspend(struct pci_dev *p
spin_unlock_irq(bp-lock);
 
free_irq(dev-irq, dev);
+   if (bp-flags  B44_FLAG_WOL_ENABLE) {
+   b44_init_hw(bp);
+   b44_setup_wol(bp);
+   }
pci_disable_device(pdev);
return 0;
 }
diff --git a/drivers/net/b44.h b/drivers/net/b44.h
index b178662..1f4 100644
--- a/drivers/net/b44.h
+++ b/drivers/net/b44.h
@@ -264,6 +264,8 @@
 #define  SBIDHIGH_VC_SHIFT 16
 
 /* SSB PCI config space registers.  */
+#define SSB_PMCSR  0x44
+#define  SSB_PE0x100
 #defineSSB_BAR0_WIN0x80
 #defineSSB_BAR1_WIN0x84
 #defineSSB_SPROM_CONTROL   0x88
@@ -420,6 +422,7 @@ struct b44 {
 
u32 dma_offset;
u32 flags;
+#define B44_FLAG_B0_ANDLATER   0x0001
 #define B44_FLAG_BUGGY_TXPTR   0x0002
 #define B44_FLAG_REORDER_BUG   0x0004
 #define B44_FLAG_PAUSE_AUTO0x8000
@@ -435,6 +438,7 @@ struct b44 {
 #define B44_FLAG_INTERNAL_PHY  0x1000
 #define B44_FLAG_RX_RING_HACK  0x2000
 #define B44_FLAG_TX_RING_HACK  0x4000
+#define B44_FLAG_WOL_ENABLE0x8000
 
u32 rx_offset;
 


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] b44: add wol

2006-06-16 Thread Gary Zambrano
Adds wol to the driver.
This is a redo of a previous patch thanks to feedback from Francois Romieu.

Signed-off-by Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 41b1618..81f434e 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1450,6 +1450,41 @@ static void b44_poll_controller(struct n
 }
 #endif

+
+static void b44_setup_wol(struct b44 *bp)
+{
+   u32 val;
+   u16 pmval;
+
+   bw32(bp, B44_RXCONFIG, RXCONFIG_ALLMULTI);
+
+   if (bp-flags  B44_FLAG_B0_ANDLATER) {
+
+   bw32(bp, B44_WKUP_LEN, WKUP_LEN_DISABLE);
+
+   val = bp-dev-dev_addr[2]  24 |
+   bp-dev-dev_addr[3]  16 |
+   bp-dev-dev_addr[4]  8 |
+   bp-dev-dev_addr[5];
+   bw32(bp, B44_ADDR_LO, val);
+
+   val = bp-dev-dev_addr[0]  8 |
+   bp-dev-dev_addr[1];
+   bw32(bp, B44_ADDR_HI, val);
+
+   val = br32(bp, B44_DEVCTRL);
+   bw32(bp, B44_DEVCTRL, val | DEVCTRL_MPM | DEVCTRL_PFE);
+
+   }
+
+   val = br32(bp, B44_SBTMSLOW);
+   bw32(bp, B44_SBTMSLOW, val | SBTMSLOW_PE);
+
+   pci_read_config_word(bp-pdev, SSB_PMCSR, pmval);
+   pci_write_config_word(bp-pdev, SSB_PMCSR, pmval | SSB_PE);
+
+}
+
 static int b44_close(struct net_device *dev)
 {
struct b44 *bp = netdev_priv(dev);
@@ -1475,6 +1510,11 @@ static int b44_close(struct net_device *

netif_poll_enable(dev);

+   if (bp-flags  B44_FLAG_WOL_ENABLE) {
+   b44_init_hw(bp);
+   b44_setup_wol(bp);
+   }
+
b44_free_consistent(bp);

return 0;
@@ -1831,12 +1871,40 @@ static void b44_get_ethtool_stats(struct
spin_unlock_irq(bp-lock);
 }

+static void b44_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   struct b44 *bp = netdev_priv(dev);
+
+   wol-supported = WAKE_MAGIC;
+   if (bp-flags  B44_FLAG_WOL_ENABLE)
+   wol-wolopts = WAKE_MAGIC;
+   else
+   wol-wolopts = 0;
+   memset(wol-sopass, 0, sizeof(wol-sopass));
+}
+
+static int b44_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   struct b44 *bp = netdev_priv(dev);
+
+   spin_lock_irq(bp-lock);
+   if (wol-wolopts  WAKE_MAGIC)
+   bp-flags |= B44_FLAG_WOL_ENABLE;
+   else
+   bp-flags = ~B44_FLAG_WOL_ENABLE;
+   spin_unlock_irq(bp-lock);
+
+   return 0;
+}
+
 static struct ethtool_ops b44_ethtool_ops = {
.get_drvinfo= b44_get_drvinfo,
.get_settings   = b44_get_settings,
.set_settings   = b44_set_settings,
.nway_reset = b44_nway_reset,
.get_link   = ethtool_op_get_link,
+   .get_wol= b44_get_wol,
+   .set_wol= b44_set_wol,
.get_ringparam  = b44_get_ringparam,
.set_ringparam  = b44_set_ringparam,
.get_pauseparam = b44_get_pauseparam,
@@ -1915,6 +1983,10 @@ static int __devinit b44_get_invariants(
/* XXX - really required?
   bp-flags |= B44_FLAG_BUGGY_TXPTR;
  */
+
+   if (ssb_get_core_rev(bp) = 7)
+   bp-flags |= B44_FLAG_B0_ANDLATER;
+
 out:
return err;
 }
@@ -2115,6 +2187,10 @@ static int b44_suspend(struct pci_dev *p
spin_unlock_irq(bp-lock);

free_irq(dev-irq, dev);
+   if (bp-flags  B44_FLAG_WOL_ENABLE) {
+   b44_init_hw(bp);
+   b44_setup_wol(bp);
+   }
pci_disable_device(pdev);
return 0;
 }
diff --git a/drivers/net/b44.h b/drivers/net/b44.h
index b178662..1f4 100644
--- a/drivers/net/b44.h
+++ b/drivers/net/b44.h
@@ -264,6 +264,8 @@
 #define  SBIDHIGH_VC_SHIFT 16

 /* SSB PCI config space registers.  */
+#define SSB_PMCSR  0x44
+#define  SSB_PE0x100
 #defineSSB_BAR0_WIN0x80
 #defineSSB_BAR1_WIN0x84
 #defineSSB_SPROM_CONTROL   0x88
@@ -420,6 +422,7 @@ struct b44 {

u32 dma_offset;
u32 flags;
+#define B44_FLAG_B0_ANDLATER   0x0001
 #define B44_FLAG_BUGGY_TXPTR   0x0002
 #define B44_FLAG_REORDER_BUG   0x0004
 #define B44_FLAG_PAUSE_AUTO0x8000
@@ -435,6 +438,7 @@ struct b44 {
 #define B44_FLAG_INTERNAL_PHY  0x1000
 #define B44_FLAG_RX_RING_HACK  0x2000
 #define B44_FLAG_TX_RING_HACK  0x4000
+#define B44_FLAG_WOL_ENABLE0x8000

u32 rx_offset;


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] b44: add parameter

2006-06-16 Thread Gary Zambrano
This patch adds a parameter to init_hw() to not completely initialize
the nic for wol. 

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 73ca729..12fc67a 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -101,7 +101,7 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl);

 static void b44_halt(struct b44 *);
 static void b44_init_rings(struct b44 *);
-static void b44_init_hw(struct b44 *);
+static void b44_init_hw(struct b44 *, int);

 static int dma_desc_align_mask;
 static int dma_desc_sync_size;
@@ -873,7 +873,7 @@ static int b44_poll(struct net_device *n
spin_lock_irq(bp-lock);
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_wake_queue(bp-dev);
spin_unlock_irq(bp-lock);
done = 1;
@@ -942,7 +942,7 @@ static void b44_tx_timeout(struct net_de

b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);

spin_unlock_irq(bp-lock);

@@ -1059,7 +1059,7 @@ static int b44_change_mtu(struct net_dev
b44_halt(bp);
dev-mtu = new_mtu;
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
spin_unlock_irq(bp-lock);

b44_enable_ints(bp);
@@ -1356,13 +1356,15 @@ static int b44_set_mac_addr(struct net_d
  * packet processing.  Invoked with bp-lock held.
  */
 static void __b44_set_rx_mode(struct net_device *);
-static void b44_init_hw(struct b44 *bp)
+static void b44_init_hw(struct b44 *bp, int full_reset)
 {
u32 val;

b44_chip_reset(bp);
-   b44_phy_reset(bp);
-   b44_setup_phy(bp);
+   if (full_reset) {
+   b44_phy_reset(bp);
+   b44_setup_phy(bp);
+   }

/* Enable CRC32, set proper LED modes and power on PHY */
bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
@@ -1376,16 +1378,21 @@ static void b44_init_hw(struct b44 *bp)
bw32(bp, B44_TXMAXLEN, bp-dev-mtu + ETH_HLEN + 8 + RX_HEADER_LEN);

bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
-   bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
-   bw32(bp, B44_DMATX_ADDR, bp-tx_ring_dma + bp-dma_offset);
-   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
- (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
-   bw32(bp, B44_DMARX_ADDR, bp-rx_ring_dma + bp-dma_offset);
+   if (full_reset) {
+   bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
+   bw32(bp, B44_DMATX_ADDR, bp-tx_ring_dma + bp-dma_offset);
+   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+ (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
+   bw32(bp, B44_DMARX_ADDR, bp-rx_ring_dma + bp-dma_offset);

-   bw32(bp, B44_DMARX_PTR, bp-rx_pending);
-   bp-rx_prod = bp-rx_pending;
+   bw32(bp, B44_DMARX_PTR, bp-rx_pending);
+   bp-rx_prod = bp-rx_pending;

-   bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+   bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+   } else {
+   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+ (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
+   }

val = br32(bp, B44_ENET_CTRL);
bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
@@ -1401,7 +1408,7 @@ static int b44_open(struct net_device *d
goto out;

b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);

b44_check_phy(bp);

@@ -1511,7 +1518,7 @@ static int b44_close(struct net_device *
netif_poll_enable(dev);

if (bp-flags  B44_FLAG_WOL_ENABLE) {
-   b44_init_hw(bp);
+   b44_init_hw(bp, 0);
b44_setup_wol(bp);
}

@@ -1786,7 +1793,7 @@ static int b44_set_ringparam(struct net_

b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_wake_queue(bp-dev);
spin_unlock_irq(bp-lock);

@@ -1829,7 +1836,7 @@ static int b44_set_pauseparam(struct net
if (bp-flags  B44_FLAG_PAUSE_AUTO) {
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
} else {
__b44_set_flow_ctrl(bp, bp-flags);
}
@@ -2188,7 +2195,7 @@ static int b44_suspend(struct pci_dev *p

free_irq(dev-irq, dev);
if (bp-flags  B44_FLAG_WOL_ENABLE) {
-   b44_init_hw(bp);
+   b44_init_hw(bp, 0);
b44_setup_wol(bp);
}
pci_disable_device(pdev);
@@ -2213,7 +2220,7 @@ static int b44_resume(struct pci_dev *pd
spin_lock_irq(bp-lock);

b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_device_attach(bp-dev);
spin_unlock_irq(bp-lock);


-
To unsubscribe from

[PATCH 4/6] b44: add wol for old nic

2006-06-16 Thread Gary Zambrano
This patch adds wol support for the older 440x nics that use pattern matching.
This patch is a redo thanks to feedback from Michael Chan and Francois Romieu.

Signed-off-by: Gary Zambrano  [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 12fc67a..98c0675 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -75,6 +75,15 @@
 /* minimum number of free TX descriptors required to wake up TX process */
 #define B44_TX_WAKEUP_THRESH   (B44_TX_RING_SIZE / 4)

+/* b44 internal pattern match filter info */
+#define B44_PATTERN_BASE   0x400
+#define B44_PATTERN_SIZE   0x80
+#define B44_PMASK_BASE 0x600
+#define B44_PMASK_SIZE 0x10
+#define B44_MAX_PATTERNS   16
+#define B44_ETHIPV6UDP_HLEN62
+#define B44_ETHIPV4UDP_HLEN42
+
 static char version[] __devinitdata =
DRV_MODULE_NAME .c:v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;

@@ -1457,6 +1466,103 @@ static void b44_poll_controller(struct n
 }
 #endif

+static void bwfilter_table(struct b44 *bp, u8 *pp, u32 bytes, u32 table_offset)
+{
+   u32 i;
+   u32 *pattern = (u32 *) pp;
+
+   for (i = 0; i  bytes; i += sizeof(u32)) {
+   bw32(bp, B44_FILT_ADDR, table_offset + i);
+   bw32(bp, B44_FILT_DATA, pattern[i / sizeof(u32)]);
+   }
+}
+
+static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
+{
+   int magicsync = 6;
+   int k, j, len = offset;
+   int ethaddr_bytes = ETH_ALEN;
+
+   memset(ppattern + offset, 0xff, magicsync);
+   for (j = 0; j  magicsync; j++)
+   set_bit(len++, (unsigned long *) pmask);
+
+   for (j = 0; j  B44_MAX_PATTERNS; j++) {
+   if ((B44_PATTERN_SIZE - len) = ETH_ALEN)
+   ethaddr_bytes = ETH_ALEN;
+   else
+   ethaddr_bytes = B44_PATTERN_SIZE - len;
+   if (ethaddr_bytes =0)
+   break;
+   for (k = 0; k ethaddr_bytes; k++) {
+   ppattern[offset + magicsync +
+   (j * ETH_ALEN) + k] = macaddr[k];
+   len++;
+   set_bit(len, (unsigned long *) pmask);
+   }
+   }
+   return len - 1;
+}
+
+/* Setup magic packet patterns in the b44 WOL
+ * pattern matching filter.
+ */
+static void b44_setup_pseudo_magicp(struct b44 *bp)
+{
+
+   u32 val;
+   int plen0, plen1, plen2;
+   u8 *pwol_pattern;
+   u8 pwol_mask[B44_PMASK_SIZE];
+
+   pwol_pattern = kmalloc(B44_PATTERN_SIZE, GFP_KERNEL);
+   if (!pwol_pattern) {
+   printk(KERN_ERR PFX Memory not available for WOL\n);
+   return;
+   }
+
+   /* Ipv4 magic packet pattern - pattern 0.*/
+   memset(pwol_pattern, 0, B44_PATTERN_SIZE);
+   memset(pwol_mask, 0, B44_PMASK_SIZE);
+   plen0 = b44_magic_pattern(bp-dev-dev_addr, pwol_pattern, pwol_mask,
+ B44_ETHIPV4UDP_HLEN);
+
+   bwfilter_table(bp, pwol_pattern, B44_PATTERN_SIZE, B44_PATTERN_BASE);
+   bwfilter_table(bp, pwol_mask, B44_PMASK_SIZE, B44_PMASK_BASE);
+
+   /* Raw ethernet II magic packet pattern - pattern 1 */
+   memset(pwol_pattern, 0, B44_PATTERN_SIZE);
+   memset(pwol_mask, 0, B44_PMASK_SIZE);
+   plen1 = b44_magic_pattern(bp-dev-dev_addr, pwol_pattern, pwol_mask,
+ ETH_HLEN);
+
+   bwfilter_table(bp, pwol_pattern, B44_PATTERN_SIZE,
+  B44_PATTERN_BASE + B44_PATTERN_SIZE);
+   bwfilter_table(bp, pwol_mask, B44_PMASK_SIZE,
+  B44_PMASK_BASE + B44_PMASK_SIZE);
+
+   /* Ipv6 magic packet pattern - pattern 2 */
+   memset(pwol_pattern, 0, B44_PATTERN_SIZE);
+   memset(pwol_mask, 0, B44_PMASK_SIZE);
+   plen2 = b44_magic_pattern(bp-dev-dev_addr, pwol_pattern, pwol_mask,
+ B44_ETHIPV6UDP_HLEN);
+
+   bwfilter_table(bp, pwol_pattern, B44_PATTERN_SIZE,
+  B44_PATTERN_BASE + B44_PATTERN_SIZE + B44_PATTERN_SIZE);
+   bwfilter_table(bp, pwol_mask, B44_PMASK_SIZE,
+  B44_PMASK_BASE + B44_PMASK_SIZE + B44_PMASK_SIZE);
+
+   kfree(pwol_pattern);
+
+   /* set these pattern's lengths: one less than each real length */
+   val = plen0 | (plen1  8) | (plen2  16) | WKUP_LEN_ENABLE_THREE;
+   bw32(bp, B44_WKUP_LEN, val);
+
+   /* enable wakeup pattern matching */
+   val = br32(bp, B44_DEVCTRL);
+   bw32(bp, B44_DEVCTRL, val | DEVCTRL_PFE);
+
+}

 static void b44_setup_wol(struct b44 *bp)
 {
@@ -1482,7 +1588,9 @@ static void b44_setup_wol(struct b44 *bp
val = br32(bp, B44_DEVCTRL);
bw32(bp, B44_DEVCTRL, val | DEVCTRL_MPM | DEVCTRL_PFE);

-   }
+   } else {
+   b44_setup_pseudo_magicp(bp);
+   }

val = br32(bp, B44_SBTMSLOW);
bw32(bp, B44_SBTMSLOW, val | SBTMSLOW_PE);
diff --git

[PATCH 2/4] b44: wol setup for older 4401

2006-05-24 Thread Gary Zambrano

This patch adds wol support for the older 4401 revs.

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index b9e2462..6f4d1d4 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1448,6 +1448,93 @@ static void b44_poll_controller(struct n
 }
 #endif

+static inline void bwfilter_table(struct b44 *bp,
+   u32 *pattern,
+   u32 bytes,
+   u32 table_offset)
+{
+   u32 i;
+
+   for (i = 0; i  bytes; i += sizeof(u32)) {
+   bw32(bp, B44_FILT_ADDR, table_offset + i);
+   bw32(bp, B44_FILT_DATA, pattern[i / sizeof(u32)]);
+   }
+}
+
+/* Setup two common magic packet patterns in the b44 WOL
+ * pattern matching filter.
+ */
+static void b44_setup_pseudo_magicp(struct b44 *bp)
+{
+
+   u32 val;
+   int plen0, plen1, max, i, j;
+   u8 *pwol_pattern;
+   u8 *pwol_mask;
+
+   pwol_pattern = kmalloc(B44_WOL_PATTERN_SIZE, GFP_KERNEL);
+   pwol_mask = kmalloc(B44_WOL_MASK_SIZE, GFP_KERNEL);
+
+   /* UDP magic packet pattern */
+   memset(pwol_pattern, 0, B44_WOL_PATTERN_SIZE);
+   memset(pwol_pattern + 42, 0xff, 6); /* sync pattern */
+   max = ETH_ALEN;
+   for (i = 0; i  14; ++i) {
+   if (i == 13)
+   max = 2;
+   for (j = 0; j  max; ++j) {
+   pwol_pattern[42 + 6 +
+   (i * ETH_ALEN) + j] =
+   bp-dev-dev_addr[j];
+   }
+   }
+
+   memset(pwol_mask, 0, B44_WOL_MASK_SIZE);
+   pwol_mask[5] = 0xfc;
+   memset(pwol_mask + 6, 0xff, 10);
+   plen0 = B44_WOL_PATTERN_SIZE - 1;
+
+   bwfilter_table(bp, (u32 *)pwol_pattern,
+   B44_WOL_PATTERN_SIZE, B44_WOL_PATTERN_BASE);
+
+   bwfilter_table(bp, (u32 *)pwol_mask,
+   B44_WOL_MASK_SIZE, B44_WOL_MASK_BASE);
+
+   /* raw ethernet II magic packet pattern */
+   memset(pwol_pattern, 0, B44_WOL_PATTERN_SIZE);
+   memset(pwol_pattern + 14, 0xff, 6); /* sync pattern */
+   max = ETH_ALEN;
+   for (i = 0; i  16; ++i) {
+   for (j = 0; j  max; ++j) {
+   pwol_pattern[14 + 6 +
+   (i * ETH_ALEN) + j] =
+   bp-dev-dev_addr[j];
+   }
+   }
+
+   memset(pwol_mask, 0, B44_WOL_MASK_SIZE);
+   pwol_mask[2] = 0xf0;
+   memset(pwol_mask + 3, 0xff, 11);
+   pwol_mask[14] = 0xf;
+   plen1 = 14 + 6 + 96 - 1;
+
+   bwfilter_table(bp, (u32 *)pwol_pattern, B44_WOL_PATTERN_SIZE,
+   B44_WOL_PATTERN_BASE + B44_WOL_PATTERN_SIZE);
+   bwfilter_table(bp, (u32 *)pwol_mask, B44_WOL_MASK_SIZE,
+   B44_WOL_MASK_BASE + B44_WOL_MASK_SIZE);
+
+   /* set this pattern's length: one less than the real length */
+   val = plen0 | (plen1  8) | WKUP_LEN_ENABLE_TWO;
+   bw32(bp, B44_WKUP_LEN, val);
+
+   /* enable chip wakeup pattern matching */
+   val = br32(bp, B44_DEVCTRL);
+   bw32(bp, B44_DEVCTRL, val | DEVCTRL_PFE);
+
+   kfree(pwol_mask);
+   kfree(pwol_pattern);
+
+}

 static void b44_setup_wol(struct b44 *bp)
 {


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] b44: add parameter to init_hw for wol

2006-05-24 Thread Gary Zambrano

This patch adds a parameter to init_hw() for wol.

Signed-off-by: Gary Zambrano [EMAIL PROTECTED]

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 81d1f36..6eea1fc 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -107,7 +107,7 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl);

 static void b44_halt(struct b44 *);
 static void b44_init_rings(struct b44 *);
-static void b44_init_hw(struct b44 *);
+static void b44_init_hw(struct b44 *, int);

 static int dma_desc_align_mask;
 static int dma_desc_sync_size;
@@ -875,7 +875,7 @@ static int b44_poll(struct net_device *n
spin_lock_irq(bp-lock);
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_wake_queue(bp-dev);
spin_unlock_irq(bp-lock);
done = 1;
@@ -944,7 +944,7 @@ static void b44_tx_timeout(struct net_de

b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);

spin_unlock_irq(bp-lock);

@@ -1059,7 +1059,7 @@ static int b44_change_mtu(struct net_dev
b44_halt(bp);
dev-mtu = new_mtu;
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
spin_unlock_irq(bp-lock);

b44_enable_ints(bp);
@@ -1354,14 +1354,15 @@ static int b44_set_mac_addr(struct net_d
  * packet processing.  Invoked with bp-lock held.
  */
 static void __b44_set_rx_mode(struct net_device *);
-static void b44_init_hw(struct b44 *bp)
+static void b44_init_hw(struct b44 *bp, int full)
 {
u32 val;

b44_chip_reset(bp);
-   b44_phy_reset(bp);
-   b44_setup_phy(bp);
-
+   if (full) {
+   b44_phy_reset(bp);
+   b44_setup_phy(bp);
+   }
/* Enable CRC32, set proper LED modes and power on PHY */
bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
bw32(bp, B44_RCV_LAZY, (1  RCV_LAZY_FC_SHIFT));
@@ -1374,16 +1375,21 @@ static void b44_init_hw(struct b44 *bp)
bw32(bp, B44_TXMAXLEN, bp-dev-mtu + ETH_HLEN + 8 + RX_HEADER_LEN);

bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
-   bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
-   bw32(bp, B44_DMATX_ADDR, bp-tx_ring_dma + bp-dma_offset);
-   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+   if (full){
+   bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
+   bw32(bp, B44_DMATX_ADDR, bp-tx_ring_dma + bp-dma_offset);
+   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
  (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
-   bw32(bp, B44_DMARX_ADDR, bp-rx_ring_dma + bp-dma_offset);
+   bw32(bp, B44_DMARX_ADDR, bp-rx_ring_dma + bp-dma_offset);

-   bw32(bp, B44_DMARX_PTR, bp-rx_pending);
-   bp-rx_prod = bp-rx_pending;
+   bw32(bp, B44_DMARX_PTR, bp-rx_pending);
+   bp-rx_prod = bp-rx_pending;

-   bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+   bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
+   }else{
+   bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
+ (bp-rx_offset  DMARX_CTRL_ROSHIFT)));
+   }

val = br32(bp, B44_ENET_CTRL);
bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
@@ -1399,7 +1405,7 @@ static int b44_open(struct net_device *d
goto out;

b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);

b44_check_phy(bp);

@@ -1598,7 +1604,7 @@ static int b44_close(struct net_device *
netif_poll_enable(dev);

if (bp-flags  B44_FLAG_WOL_ENABLE){
-   b44_init_hw(bp);
+   b44_init_hw(bp, 0);
b44_setup_wol(bp);
}

@@ -1860,7 +1866,7 @@ static int b44_set_ringparam(struct net_

b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_wake_queue(bp-dev);
spin_unlock_irq(bp-lock);

@@ -1903,7 +1909,7 @@ static int b44_set_pauseparam(struct net
if (bp-flags  B44_FLAG_PAUSE_AUTO) {
b44_halt(bp);
b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
} else {
__b44_set_flow_ctrl(bp, bp-flags);
}
@@ -2281,7 +2287,7 @@ static int b44_resume(struct pci_dev *pd
spin_lock_irq(bp-lock);

b44_init_rings(bp);
-   b44_init_hw(bp);
+   b44_init_hw(bp, 1);
netif_device_attach(bp-dev);
spin_unlock_irq(bp-lock);


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] b44: wol setup for older 4401

2006-05-24 Thread Gary Zambrano
On Thu, 2006-05-25 at 00:13 +0200, Francois Romieu wrote:

  +   pwol_pattern = kmalloc(B44_WOL_PATTERN_SIZE, GFP_KERNEL);
  +   pwol_mask = kmalloc(B44_WOL_MASK_SIZE, GFP_KERNEL);
  +
 kmalloc can fail. It should be checked.
Yep. Thanks.

  +   max = ETH_ALEN;
  +   for (i = 0; i  14; ++i) {
  +   if (i == 13)
  +   max = 2;
  +   for (j = 0; j  max; ++j) {
  +   pwol_pattern[42 + 6 +
  +   (i * ETH_ALEN) + j] =
  +   bp-dev-dev_addr[j];
 
 Indentation went strange here.
 
Will adjust.
Thanks.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html