Re: RESEND [PATCH 2/3] NetXen: Support per PCI-function interrupt mask registers

2007-07-01 Thread Michael Buesch
On Sunday 01 July 2007 04:43:27 [EMAIL PROTECTED] wrote:
 This patch updates the various access routines to access different
 control and status settings present in different register locations.
 This will fix problems related to working of different ports in
 multi Port card.
 
 Signed-off by: Dhananjay Phadke [EMAIL PROTECTED]
 Signed-off by: Milan Bag [EMAIL PROTECTED]
 
 Index: netdev-2.6/drivers/net/netxen/netxen_nic.h
 ===
 --- netdev-2.6.orig/drivers/net/netxen/netxen_nic.h
 +++ netdev-2.6/drivers/net/netxen/netxen_nic.h
 @@ -937,6 +937,7 @@ struct netxen_adapter {
   struct netxen_ring_ctx *ctx_desc;
   struct pci_dev *ctx_desc_pdev;
   dma_addr_t ctx_desc_phys_addr;
 + int intr_scheme;
   int (*enable_phy_interrupts) (struct netxen_adapter *);
   int (*disable_phy_interrupts) (struct netxen_adapter *);
   void (*handle_phy_intr) (struct netxen_adapter *);
 @@ -1080,37 +1081,103 @@ struct net_device_stats *netxen_nic_get_
  
  static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
  {
 - /*
 -  * ISR_INT_MASK: Can be read from window 0 or 1.
 -  */
 - writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
 + uint32_tmask = 0x7ff;
 + int count = 0;
  
 + DPRINTK(1, INFO, Entered ISR Disable \n);
 +
 + switch (adapter-portnum) {
 + case 0:
 + writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
 + break;
 + case 1:
 + writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
 + break;
 + case 2:
 + writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
 + break;
 + case 3:
 + writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
 + break;
 + }
 +
 + if (adapter-intr_scheme != -1 
 + adapter-intr_scheme != INTR_SCHEME_PERPORT) {
 + writel(mask,
 + (void *)(PCI_OFFSET_SECOND_RANGE(adapter, 
 ISR_INT_MASK)));
 + }
 +
 + /* Window = 0 or 1 */
 + if (!(adapter-flags  NETXEN_NIC_MSI_ENABLED)) {
 + do {
 + writel(0x, (void *)
 + (PCI_OFFSET_SECOND_RANGE(adapter, 
 ISR_INT_TARGET_STATUS)));
 + mask = readl((void *)
 + (pci_base_offset(adapter, 
 ISR_INT_VECTOR)));
 + udelay(10);

This needlessly always delays at least 10 uS, even if it succeed on the
first attempt.
Better do it like I suggested to avoid that.

-- 
Greetings Michael.
-
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: power down PHY when interface down

2007-07-01 Thread Michael Buesch
On Sunday 01 July 2007 01:17:34 Lennert Buytenhek wrote:
 More or less.  You can't add the resistances like that, since the
 bus isolation chip buffers the IDSEL signal, but it is correct that
 if the host's IDSEL resistor is larger than a certain value, the
 combination of the resistive coupling of IDSEL plus the extra buffer
 in the isolator might be causing the IDSEL input on the 'guest' PCI
 board to assert too late (or not assert at all), causing config
 accesses to fail.
 
 (This also depends on the specific 'guest' PCI board used, as you
 noted, due to differing IDSEL trace lengths/capacitances and input
 pin capacitances on different PCI boards.  Also, it might work at
 33 MHz but not work at 66 MHz, etc.)

It doesn't work on any of my boards :(

 If you feel adventurous, you could try to hack around this by
 figuring out which AD[31:16] line this PCI slot's IDSEL line is
 resistively coupled to (depends on the slot), and then adding
 another parallel resistor on the board itself to make the bus
 isolator's input buffer charge faster.  Note that this does
 increase the load on that specific AD[] line, which might cause
 other funny effects.

Well, but how to find out to which address line it's connected to?
Pretty hard to follow the PCB traces, especially since it's
multilayered.

-- 
Greetings Michael.
-
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: e1000: backport ich9 support from 7.5.5 ?

2007-07-01 Thread James Chapman

Kok, Auke wrote:

James Chapman wrote:
I briefly looked over your new driver. I think it might benefit by 
moving common parts into one or more libraries (or modules) and have 
separate chip-specific drivers for 82540, 82541, 82542, 82543, 82571 
etc. Put all the chip-specific bits in a chip-specific driver and have 
each driver call into the common (shared) code. The device 
probe/init/remove would be done by the chip-specific code, not the 
common code like it is now. When built as a module, the chip-specific 
parts and the common parts could be built as separate modules; 
modprobe would load the common parts automatically. Most of the code 
would be in the common part since these chips are very similar.


splitting beyond the obvious does not make any sense and will just add 
confusion.


Users wouldn't need to know which driver to load - the right driver 
would be loaded automatically. Distros would ship all of them (and the 
common bits). The few users who know which device(s) they have could 
build only the required drivers if they wanted to do so.


I'm not against a pcie/pre-pcie split or even going a step 
further and looking into using PHYlib as you suggest below, but we 
should really avoid trying to create an unmaintainable mess where we 
have to patch 7 drivers for each generic issue we find.


The generic issues would be in the common part so would be patched once.

Looking at your new driver code, there are separate source files for the 
5 chips I mention, hence my leaning towards a driver per device. I 
counted 24 funcptrs that are set up in order for the common code to call 
out to driver-private chip specific functions. Wouldn't most of these go 
away if the chip-specific code called common code, not the other way round?


Let me use an example to illustrate what I mean. e1000_setup_link() is 
common code. It simply calls a function pointed to by func.setup_link, 
which was initialized to a chip-specific function, e.g. 
e1000_setup_link_82543() in e1000_init_mac_params_82543(). It turns out 
that e1000_setup_link() is called by chip-specific code from 
e1000_init_hw_82543() so the abstraction through e1000_setup_link() 
wouldn't be needed for init. However, e1000_setup_link() is also called 
from the common driver/ethtool entry points e1000_open() and 
e1000_set_pause_params(). These entry points could be moved in to the 
chip specific code, calling out to common code when necessary: the 
funcptrs/abstractions wouldn't then be needed. This would obviously lead 
to some common boilerplate code in each chip specific driver for the 
driver entry points open/close etc and occasionally some common changes 
might be needed in that code. However, I'm sure most bugs will be in the 
guts of the driver, not the boilerplate code so the duplication of the 
driver boilerplate code wouldn't matter so much. I think maintenance 
effort would actually reduce with this kind of structure.


I don't want to sound negative though; it's great that you and Intel are 
putting a lot of work into this driver. You know much more about the 
actual chip feature differences/workarounds than I do so if you don't 
think the approach I suggest will work, I'm happy to just drop this thread.


--
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development


-
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: power down PHY when interface down

2007-07-01 Thread Török Edvin

On 6/30/07, Stephen Hemminger [EMAIL PROTECTED] wrote:


This is a non-standard formatting for comments, please follow
Coding style:


Thanks, I have updated the patch.

When the interface is down (or driver removed), the BroadCom 44xx card
remains powered on,
and both its MAC and PHY is using up power.
This patch makes the driver issue a MAC_CTRL_PHY_PDOWN when the
interface is halted.
Also doing a partial chip reset turns off the activity LEDs too.

Signed-off-by: Torok Edwin [EMAIL PROTECTED]
---
b44.c |   28 +++-
 1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 879a2ff..43926fd 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -113,6 +113,8 @@ static void b44_init_rings(struct b44 *);
#define B44_FULL_RESET  1
#define B44_FULL_RESET_SKIP_PHY 2
#define B44_PARTIAL_RESET   3
+#define B44_CHIP_RESET_FULL 4
+#define B44_CHIP_RESET_PARTIAL  5

static void b44_init_hw(struct b44 *, int);

@@ -1283,7 +1285,7 @@ static void b44_clear_stats(struct b44 *bp)
}

/* bp-lock is held. */
-static void b44_chip_reset(struct b44 *bp)
+static void b44_chip_reset(struct b44 *bp, int reset_kind)
{
if (ssb_is_core_up(bp)) {
bw32(bp, B44_RCV_LAZY, 0);
@@ -1307,6 +1309,13 @@ static void b44_chip_reset(struct b44 *bp)

b44_clear_stats(bp);

+   /*
+* Don't enable PHY if we are doing a partial reset
+* we are probably going to power down
+*/
+   if (reset_kind == B44_CHIP_RESET_PARTIAL)
+   return;
+
/* Make PHY accessible. */
bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
 (0x0d  MDIO_CTRL_MAXF_MASK)));
@@ -1332,7 +1341,14 @@ static void b44_chip_reset(struct b44 *bp)
static void b44_halt(struct b44 *bp)
{
b44_disable_ints(bp);
-   b44_chip_reset(bp);
+   /* reset PHY */
+   b44_phy_reset(bp);
+   /* power down PHY */
+   printk(KERN_INFO PFX %s: powering down PHY\n, bp-dev-name);
+   bw32(bp, B44_MAC_CTRL, MAC_CTRL_PHY_PDOWN);
+   /* now reset the chip, but without enabling the MACPHY
+* part of it. This has to be done _after_ we shut down the PHY */
+   b44_chip_reset(bp, B44_CHIP_RESET_PARTIAL);
}

/* bp-lock is held. */
@@ -1376,7 +1392,7 @@ static void b44_init_hw(struct b44 *bp, int reset_kind)
{
u32 val;

-   b44_chip_reset(bp);
+   b44_chip_reset(bp, B44_CHIP_RESET_FULL);
if (reset_kind == B44_FULL_RESET) {
b44_phy_reset(bp);
b44_setup_phy(bp);
@@ -1430,7 +1446,7 @@ static int b44_open(struct net_device *dev)

err = request_irq(dev-irq, b44_interrupt, IRQF_SHARED, dev-name, dev);
if (unlikely(err  0)) {
-   b44_chip_reset(bp);
+   b44_chip_reset(bp, B44_CHIP_RESET_PARTIAL);
b44_free_rings(bp);
b44_free_consistent(bp);
goto out;
@@ -2250,7 +2266,7 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
/* Chip reset provides power to the b44 MAC  PCI cores, which
 * is necessary for MAC register access.
 */
-   b44_chip_reset(bp);
+   b44_chip_reset(bp, B44_CHIP_RESET_FULL);

printk(KERN_INFO %s: Broadcom 4400 10/100BaseT Ethernet , dev-name);
for (i = 0; i  6; i++)
@@ -2284,6 +2300,7 @@ static void __devexit b44_remove_one(struct pci_dev *pdev)
free_netdev(dev);
pci_release_regions(pdev);
pci_disable_device(pdev);
+   pci_set_power_state(pdev, PCI_D3hot);
pci_set_drvdata(pdev, NULL);
}

@@ -2312,6 +2329,7 @@ static int b44_suspend(struct pci_dev *pdev,
pm_message_t state)
b44_setup_wol(bp);
}
pci_disable_device(pdev);
+   pci_set_power_state(pdev, PCI_D3hot);
return 0;
}
-
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: power down PHY when interface down

2007-07-01 Thread Michael Buesch
On Sunday 01 July 2007 14:49:23 Török Edvin wrote:
 On 6/30/07, Stephen Hemminger [EMAIL PROTECTED] wrote:
 
  This is a non-standard formatting for comments, please follow
  Coding style:
 
 Thanks, I have updated the patch.
 
 When the interface is down (or driver removed), the BroadCom 44xx card
 remains powered on,
 and both its MAC and PHY is using up power.
 This patch makes the driver issue a MAC_CTRL_PHY_PDOWN when the
 interface is halted.
 Also doing a partial chip reset turns off the activity LEDs too.
 
 Signed-off-by: Torok Edwin [EMAIL PROTECTED]
 ---
  b44.c |   28 +++-
   1 file changed, 23 insertions(+), 5 deletions(-)
 diff --git a/drivers/net/b44.c b/drivers/net/b44.c
 index 879a2ff..43926fd 100644
 --- a/drivers/net/b44.c
 +++ b/drivers/net/b44.c
 @@ -113,6 +113,8 @@ static void b44_init_rings(struct b44 *);
  #define B44_FULL_RESET   1
  #define B44_FULL_RESET_SKIP_PHY  2
  #define B44_PARTIAL_RESET3
 +#define B44_CHIP_RESET_FULL 4
 +#define B44_CHIP_RESET_PARTIAL  5
 
  static void b44_init_hw(struct b44 *, int);
 
 @@ -1283,7 +1285,7 @@ static void b44_clear_stats(struct b44 *bp)
  }
 
  /* bp-lock is held. */
 -static void b44_chip_reset(struct b44 *bp)
 +static void b44_chip_reset(struct b44 *bp, int reset_kind)
  {
   if (ssb_is_core_up(bp)) {
   bw32(bp, B44_RCV_LAZY, 0);
 @@ -1307,6 +1309,13 @@ static void b44_chip_reset(struct b44 *bp)
 
   b44_clear_stats(bp);
 
 + /*
 +  * Don't enable PHY if we are doing a partial reset
 +  * we are probably going to power down
 +  */
 + if (reset_kind == B44_CHIP_RESET_PARTIAL)
 + return;
 +
   /* Make PHY accessible. */
   bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
(0x0d  MDIO_CTRL_MAXF_MASK)));
 @@ -1332,7 +1341,14 @@ static void b44_chip_reset(struct b44 *bp)
  static void b44_halt(struct b44 *bp)
  {
   b44_disable_ints(bp);
 - b44_chip_reset(bp);
 + /* reset PHY */
 + b44_phy_reset(bp);
 + /* power down PHY */
 + printk(KERN_INFO PFX %s: powering down PHY\n, bp-dev-name);
 + bw32(bp, B44_MAC_CTRL, MAC_CTRL_PHY_PDOWN);
 + /* now reset the chip, but without enabling the MACPHY
 +  * part of it. This has to be done _after_ we shut down the PHY */
 + b44_chip_reset(bp, B44_CHIP_RESET_PARTIAL);
  }
 
  /* bp-lock is held. */
 @@ -1376,7 +1392,7 @@ static void b44_init_hw(struct b44 *bp, int reset_kind)
  {
   u32 val;
 
 - b44_chip_reset(bp);
 + b44_chip_reset(bp, B44_CHIP_RESET_FULL);
   if (reset_kind == B44_FULL_RESET) {
   b44_phy_reset(bp);
   b44_setup_phy(bp);
 @@ -1430,7 +1446,7 @@ static int b44_open(struct net_device *dev)
 
   err = request_irq(dev-irq, b44_interrupt, IRQF_SHARED, dev-name, dev);
   if (unlikely(err  0)) {
 - b44_chip_reset(bp);
 + b44_chip_reset(bp, B44_CHIP_RESET_PARTIAL);
   b44_free_rings(bp);
   b44_free_consistent(bp);
   goto out;
 @@ -2250,7 +2266,7 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
   /* Chip reset provides power to the b44 MAC  PCI cores, which
* is necessary for MAC register access.
*/
 - b44_chip_reset(bp);
 + b44_chip_reset(bp, B44_CHIP_RESET_FULL);
 
   printk(KERN_INFO %s: Broadcom 4400 10/100BaseT Ethernet , dev-name);
   for (i = 0; i  6; i++)
 @@ -2284,6 +2300,7 @@ static void __devexit b44_remove_one(struct pci_dev 
 *pdev)
   free_netdev(dev);
   pci_release_regions(pdev);
   pci_disable_device(pdev);
 + pci_set_power_state(pdev, PCI_D3hot);
   pci_set_drvdata(pdev, NULL);
  }
 
 @@ -2312,6 +2329,7 @@ static int b44_suspend(struct pci_dev *pdev,
 pm_message_t state)

You patch is also damaged here.
Check your MUA settings.

-- 
Greetings Michael.
-
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: power down PHY when interface down

2007-07-01 Thread Török Edvin

On 6/30/07, Matthew Garrett [EMAIL PROTECTED] wrote:

On Sat, Jun 30, 2007 at 07:44:59AM -0700, Arjan van de Ven wrote:
 Matthew Garrett wrote:
 Do you still get link beat detection when the phy is powered down?


No.
As for link detection on the switch connected to this card:
If I have WoL turned off, then I don't get link beat detection.
If I have WoL turned on, then PHY won't be powered down, and I get
link detection on the switch.


 
 does that matter?
 If the interface is down, nic drivers aren't expected to detect
 link... if userspace wants to find link status it should have the
 interface up.


I don't get link beat detection with the original driver either, when
interface is down
(unless I pass it -a, but then it will bring the interface up).


--Edwin
-
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: r8169 2.2LK: Low link speed after suspend

2007-07-01 Thread Peter Missel
Bonjour Francois!

 If you feel adventurous, you will find a compile-tested-only patchkit for
 2.6.21.5 here:
 http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.21.5
 or:
 http://www.fr.zoreil.com/people/francois/misc/20060630-2.6.21.5-r8169-test.
patch

 The content should be almost the same as the 2.6.22-rc6 patchkit dated
 from 2007/06/28 (i.e. pending 2.6.23 merge).


Many thanks!

The patch applies without failure; I'm getting a warning during build,

  CC [M]  drivers/net/r8169.o
drivers/net/r8169.c: In function ‘rtl8169_start_xmit’:
drivers/net/r8169.c:2341: warning: ‘txd’ may be used uninitialized in this 
function

After installing and loading the new driver, I still do have a gigabit 
connection, which is good. I'll be reporting about the suspend/resume 
behaviour next.

regards,
Peter
-
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: power down PHY when interface down

2007-07-01 Thread Lennert Buytenhek
On Sun, Jul 01, 2007 at 12:23:16PM +0200, Michael Buesch wrote:

  More or less.  You can't add the resistances like that, since the
  bus isolation chip buffers the IDSEL signal, but it is correct that
  if the host's IDSEL resistor is larger than a certain value, the
  combination of the resistive coupling of IDSEL plus the extra buffer
  in the isolator might be causing the IDSEL input on the 'guest' PCI
  board to assert too late (or not assert at all), causing config
  accesses to fail.
  
  (This also depends on the specific 'guest' PCI board used, as you
  noted, due to differing IDSEL trace lengths/capacitances and input
  pin capacitances on different PCI boards.  Also, it might work at
  33 MHz but not work at 66 MHz, etc.)
 
 It doesn't work on any of my boards :(

What extender board is this?  Do you have docs/schematics?
And what motherboard brand/type?


  If you feel adventurous, you could try to hack around this by
  figuring out which AD[31:16] line this PCI slot's IDSEL line is
  resistively coupled to (depends on the slot), and then adding
  another parallel resistor on the board itself to make the bus
  isolator's input buffer charge faster.  Note that this does
  increase the load on that specific AD[] line, which might cause
  other funny effects.
 
 Well, but how to find out to which address line it's connected to?
 Pretty hard to follow the PCB traces, especially since it's
 multilayered.

Actually, the IDSEL resistor would be on the computer's
motherboard, not on the PCI board.  And to which address line
the IDSEL line is connected depends on which PCI slot on the
motherboard you're looking at.

A multimeter should do the trick, but I would advise against this
if you're not totally comfortable with hacking hardware.
-
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: power down PHY when interface down

2007-07-01 Thread Michael Buesch
On Sunday 01 July 2007 17:00:06 Lennert Buytenhek wrote:
 On Sun, Jul 01, 2007 at 12:23:16PM +0200, Michael Buesch wrote:
 
   More or less.  You can't add the resistances like that, since the
   bus isolation chip buffers the IDSEL signal, but it is correct that
   if the host's IDSEL resistor is larger than a certain value, the
   combination of the resistive coupling of IDSEL plus the extra buffer
   in the isolator might be causing the IDSEL input on the 'guest' PCI
   board to assert too late (or not assert at all), causing config
   accesses to fail.
   
   (This also depends on the specific 'guest' PCI board used, as you
   noted, due to differing IDSEL trace lengths/capacitances and input
   pin capacitances on different PCI boards.  Also, it might work at
   33 MHz but not work at 66 MHz, etc.)
  
  It doesn't work on any of my boards :(
 
 What extender board is this?  Do you have docs/schematics?

catalyst pcibx32
http://bu3sch.de/pcibx.php
Docs yes, schematics no.

 And what motherboard brand/type?

ABit AI7
The other was some MSI and some very old random board. dunno.
It works perfectly fine with other cards, like a linksys
wlan card with a broadcom 4318 chip. It's just the b44
that doesn't work in the extender.

 Actually, the IDSEL resistor would be on the computer's
 motherboard, not on the PCI board.  And to which address line

Yeah, I know.

 the IDSEL line is connected depends on which PCI slot on the
 motherboard you're looking at.

Sure.

 A multimeter should do the trick, but I would advise against this
 if you're not totally comfortable with hacking hardware.

Well, you mean to measure the idsel against each possible AD line?
It's difficult, because the motherboard is inside of a standard
computer case and a watercooling system is mounted. So I would
have to disassemble all that stuff. :/
Probably I can measure it with very thin probes on the slots
without unmounting the board, hm...

-- 
Greetings Michael.
-
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] zd1211rw-mac80211: Detect more AL2230S radios

2007-07-01 Thread Daniel Drake
Zen Kato has a device which reports the 0xa RF type. The vendor driver
treats this as AL2230S, the same as devices with the AL2230S bit in the POD.

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
Signed-off-by: Ulrich Kunitz [EMAIL PROTECTED]
---
 drivers/net/wireless/mac80211/zd1211rw/zd_rf.c |3 ++-
 drivers/net/wireless/mac80211/zd1211rw/zd_rf.h |2 +-
 .../net/wireless/mac80211/zd1211rw/zd_rf_al2230.c  |   10 ++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_rf.c 
b/drivers/net/wireless/mac80211/zd1211rw/zd_rf.c
index 7407409..abe5d38 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_rf.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_rf.c
@@ -34,7 +34,7 @@ static const char * const rfs[] = {
[AL2210_RF] = AL2210_RF,
[MAXIM_NEW_RF]  = MAXIM_NEW_RF,
[UW2453_RF] = UW2453_RF,
-   [UNKNOWN_A_RF]  = UNKNOWN_A_RF,
+   [AL2230S_RF]= AL2230S_RF,
[RALINK_RF] = RALINK_RF,
[INTERSIL_RF]   = INTERSIL_RF,
[RF2959_RF] = RF2959_RF,
@@ -77,6 +77,7 @@ int zd_rf_init_hw(struct zd_rf *rf, u8 type)
r = zd_rf_init_rf2959(rf);
break;
case AL2230_RF:
+   case AL2230S_RF:
r = zd_rf_init_al2230(rf);
break;
case AL7230B_RF:
diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_rf.h 
b/drivers/net/wireless/mac80211/zd1211rw/zd_rf.h
index c6dfd82..30502f2 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_rf.h
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_rf.h
@@ -26,7 +26,7 @@
 #define AL2210_RF  0x7
 #define MAXIM_NEW_RF   0x8
 #define UW2453_RF  0x9
-#define UNKNOWN_A_RF   0xa
+#define AL2230S_RF 0xa
 #define RALINK_RF  0xb
 #define INTERSIL_RF0xc
 #define RF2959_RF  0xd
diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_rf_al2230.c 
b/drivers/net/wireless/mac80211/zd1211rw/zd_rf_al2230.c
index 1640bcc..006774d 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_rf_al2230.c
@@ -21,6 +21,8 @@
 #include zd_usb.h
 #include zd_chip.h
 
+#define IS_AL2230S(chip) ((chip)-al2230s_bit || (chip)-rf.type == AL2230S_RF)
+
 static const u32 zd1211_al2230_table[][3] = {
RF_CHANNEL( 1) = { 0x03f790, 0x01, 0x0d, },
RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x0d, },
@@ -176,7 +178,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
if (r)
return r;
 
-   if (chip-al2230s_bit) {
+   if (IS_AL2230S(chip)) {
r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
ARRAY_SIZE(ioreqs_init_al2230s));
if (r)
@@ -188,7 +190,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
return r;
 
/* improve band edge for AL2230S */
-   if (chip-al2230s_bit)
+   if (IS_AL2230S(chip))
r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
else
r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
@@ -314,7 +316,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
if (r)
return r;
 
-   if (chip-al2230s_bit) {
+   if (IS_AL2230S(chip)) {
r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
ARRAY_SIZE(ioreqs_init_al2230s));
if (r)
@@ -328,7 +330,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
if (r)
return r;
 
-   if (chip-al2230s_bit)
+   if (IS_AL2230S(chip))
r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS);
else
r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS);
-- 
1.5.2.2

-
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] zd1211rw-mac80211: Defer firmware load until first ifup

2007-07-01 Thread Daniel Drake
While playing with the firmware a while back, I discovered a way to
access the device's entire address space before the firmware has been
loaded.

Previously we were loading the firmware early on (during probe) so that
we could read the MAC address from the EEPROM and register a netdevice.
Now that we can read the EEPROM without having firmware, we can defer
firmware loading until later while still reading the MAC address early
on.

This has the advantage that zd1211rw can now be built into the kernel --
previously if this was the case, zd1211rw would be loaded before the
filesystem is available and firmware loading would fail.

Firmware load and other device initialization operations now happen the
first time the interface is brought up.

Some architectural changes were needed: handling of the is_zd1211b flag
was moved into the zd_usb structure, MAC address handling was obviously
changed, and a preinit_hw stage was added (the order is now: init,
preinit_hw, init_hw).

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
Signed-off-by: Ulrich Kunitz [EMAIL PROTECTED]
---
 drivers/net/wireless/mac80211/zd1211rw/zd_chip.c   |   88 +++---
 drivers/net/wireless/mac80211/zd1211rw/zd_chip.h   |   13 ++-
 drivers/net/wireless/mac80211/zd1211rw/zd_mac.c|   45 ++---
 drivers/net/wireless/mac80211/zd1211rw/zd_mac.h|3 +-
 .../net/wireless/mac80211/zd1211rw/zd_rf_al2230.c  |2 +-
 .../net/wireless/mac80211/zd1211rw/zd_rf_al7230b.c |2 +-
 .../net/wireless/mac80211/zd1211rw/zd_rf_rf2959.c  |2 +-
 .../net/wireless/mac80211/zd1211rw/zd_rf_uw2453.c  |2 +-
 drivers/net/wireless/mac80211/zd1211rw/zd_usb.c|   97 ++--
 drivers/net/wireless/mac80211/zd1211rw/zd_usb.h|3 +
 10 files changed, 133 insertions(+), 124 deletions(-)

diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c 
b/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
index fcf78ab..75728bb 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_chip.c
@@ -49,8 +49,9 @@ void zd_chip_clear(struct zd_chip *chip)
ZD_MEMCLEAR(chip, sizeof(*chip));
 }
 
-static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size)
+static int scnprint_mac_oui(struct zd_chip *chip, char *buffer, size_t size)
 {
+   u8 *addr = zd_chip_to_mac(chip)-hwaddr;
return scnprintf(buffer, size, %02x-%02x-%02x,
 addr[0], addr[1], addr[2]);
 }
@@ -61,10 +62,10 @@ static int scnprint_id(struct zd_chip *chip, char *buffer, 
size_t size)
int i = 0;
 
i = scnprintf(buffer, size, zd1211%s chip ,
- chip-is_zd1211b ? b : );
+ zd_chip_is_zd1211b(chip) ? b : );
i += zd_usb_scnprint_id(chip-usb, buffer+i, size-i);
i += scnprintf(buffer+i, size-i,  );
-   i += scnprint_mac_oui(chip-e2p_mac, buffer+i, size-i);
+   i += scnprint_mac_oui(chip, buffer+i, size-i);
i += scnprintf(buffer+i, size-i,  );
i += zd_rf_scnprint_id(chip-rf, buffer+i, size-i);
i += scnprintf(buffer+i, size-i,  pa%1x %c%c%c%c%c, chip-pa_type,
@@ -366,64 +367,9 @@ error:
return r;
 }
 
-static int _read_mac_addr(struct zd_chip *chip, u8 *mac_addr,
- const zd_addr_t *addr)
-{
-   int r;
-   u32 parts[2];
-
-   r = zd_ioread32v_locked(chip, parts, (const zd_addr_t *)addr, 2);
-   if (r) {
-   dev_dbg_f(zd_chip_dev(chip),
-   error: couldn't read e2p macs. Error number %d\n, r);
-   return r;
-   }
-
-   mac_addr[0] = parts[0];
-   mac_addr[1] = parts[0]   8;
-   mac_addr[2] = parts[0]  16;
-   mac_addr[3] = parts[0]  24;
-   mac_addr[4] = parts[1];
-   mac_addr[5] = parts[1]   8;
-
-   return 0;
-}
-
-static int read_e2p_mac_addr(struct zd_chip *chip)
-{
-   static const zd_addr_t addr[2] = { E2P_MAC_ADDR_P1, E2P_MAC_ADDR_P2 };
-
-   ZD_ASSERT(mutex_is_locked(chip-mutex));
-   return _read_mac_addr(chip, chip-e2p_mac, (const zd_addr_t *)addr);
-}
-
 /* MAC address: if custom mac addresses are to to be used CR_MAC_ADDR_P1 and
  *  CR_MAC_ADDR_P2 must be overwritten
  */
-void zd_get_e2p_mac_addr(struct zd_chip *chip, u8 *mac_addr)
-{
-   mutex_lock(chip-mutex);
-   memcpy(mac_addr, chip-e2p_mac, ETH_ALEN);
-   mutex_unlock(chip-mutex);
-}
-
-static int read_mac_addr(struct zd_chip *chip, u8 *mac_addr)
-{
-   static const zd_addr_t addr[2] = { CR_MAC_ADDR_P1, CR_MAC_ADDR_P2 };
-   return _read_mac_addr(chip, mac_addr, (const zd_addr_t *)addr);
-}
-
-int zd_read_mac_addr(struct zd_chip *chip, u8 *mac_addr)
-{
-   int r;
-
-   dev_dbg_f(zd_chip_dev(chip), \n);
-   mutex_lock(chip-mutex);
-   r = read_mac_addr(chip, mac_addr);
-   mutex_unlock(chip-mutex);
-   return r;
-}
-
 int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr)
 {
int r;
@@ -444,12 +390,6 @@ int 

[PATCH] zd1211rw-mac80211: Add ID for Buffalo WLI-U2-KG54L

2007-07-01 Thread Daniel Drake
Tested by Zen Kato
zd1211b chip 0411:00da v4810 high 00-16-01 AL2230S_RF pa0 g--N-

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
Signed-off-by: Ulrich Kunitz [EMAIL PROTECTED]
---
 drivers/net/wireless/mac80211/zd1211rw/zd_usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c 
b/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c
index fbb3ed0..30ae209 100644
--- a/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/mac80211/zd1211rw/zd_usb.c
@@ -69,6 +69,7 @@ static struct usb_device_id usb_ids[] = {
{ USB_DEVICE(0x0586, 0x3412), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B },
+   { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B },
/* Driverless devices that need ejecting */
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
{ USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
-- 
1.5.2.2

-
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] zd1211rw: Allow channels 1-11 for unrecognised regulatory domains

2007-07-01 Thread Daniel Drake
Zen Kato's device has a regulatory domain value of 0x49, which is not an
IEEE 802.11 code and is not even identified in the vendor driver.

Recent versions of the vendor driver don't even look at the regdomain
value any more, and just allow channels 1-11 everywhere. This patch
brings us more in line with that behaviour, by allowing channels 1-11
for regdomains which we don't know about.

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
---
 zd_mac.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_mac.c
===
--- linux-2.6.orig/drivers/net/wireless/zd1211rw/zd_mac.c
+++ linux-2.6/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -113,11 +113,14 @@ int zd_mac_init_hw(struct zd_mac *mac, u
if (r)
goto disable_int;
if (!zd_regdomain_supported(default_regdomain)) {
-   dev_dbg_f(zd_mac_dev(mac),
- Regulatory Domain %#04x is not supported.\n,
- default_regdomain);
-   r = -EINVAL;
-   goto disable_int;
+   /* The vendor driver overrides the regulatory domain and
+* allowed channel registers and unconditionally restricts
+* available channels to 1-11 everywhere. Match their
+* questionable behaviour only for regdomains which we don't
+* recognise. */
+   dev_warn(zd_mac_dev(mac),  Unrecognised regulatory domain: 
+   %#04x. Defaulting to FCC.\n, default_regdomain);
+   default_regdomain = ZD_REGDOMAIN_FCC;
}
spin_lock_irq(mac-lock);
mac-regdomain = mac-default_regdomain = default_regdomain;
-
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] zd1211rw: Detect more AL2230S radios

2007-07-01 Thread Daniel Drake
Zen Kato has a device which reports the 0xa RF type. The vendor driver
treats this as AL2230S, the same as devices with the AL2230S bit in the POD.

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
---
 zd_rf.c|3 ++-
 zd_rf.h|2 +-
 zd_rf_al2230.c |   10 ++
 3 files changed, 9 insertions(+), 6 deletions(-)

Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_rf.c
===
--- linux-2.6.orig/drivers/net/wireless/zd1211rw/zd_rf.c
+++ linux-2.6/drivers/net/wireless/zd1211rw/zd_rf.c
@@ -34,7 +34,7 @@ static const char * const rfs[] = {
[AL2210_RF] = AL2210_RF,
[MAXIM_NEW_RF]  = MAXIM_NEW_RF,
[UW2453_RF] = UW2453_RF,
-   [UNKNOWN_A_RF]  = UNKNOWN_A_RF,
+   [AL2230S_RF]= AL2230S_RF,
[RALINK_RF] = RALINK_RF,
[INTERSIL_RF]   = INTERSIL_RF,
[RF2959_RF] = RF2959_RF,
@@ -77,6 +77,7 @@ int zd_rf_init_hw(struct zd_rf *rf, u8 t
r = zd_rf_init_rf2959(rf);
break;
case AL2230_RF:
+   case AL2230S_RF:
r = zd_rf_init_al2230(rf);
break;
case AL7230B_RF:
Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_rf.h
===
--- linux-2.6.orig/drivers/net/wireless/zd1211rw/zd_rf.h
+++ linux-2.6/drivers/net/wireless/zd1211rw/zd_rf.h
@@ -26,7 +26,7 @@
 #define AL2210_RF  0x7
 #define MAXIM_NEW_RF   0x8
 #define UW2453_RF  0x9
-#define UNKNOWN_A_RF   0xa
+#define AL2230S_RF 0xa
 #define RALINK_RF  0xb
 #define INTERSIL_RF0xc
 #define RF2959_RF  0xd
Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
===
--- linux-2.6.orig/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ linux-2.6/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -21,6 +21,8 @@
 #include zd_usb.h
 #include zd_chip.h
 
+#define IS_AL2230S(chip) ((chip)-al2230s_bit || (chip)-rf.type == AL2230S_RF)
+
 static const u32 zd1211_al2230_table[][3] = {
RF_CHANNEL( 1) = { 0x03f790, 0x01, 0x0d, },
RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x0d, },
@@ -176,7 +178,7 @@ static int zd1211_al2230_init_hw(struct 
if (r)
return r;
 
-   if (chip-al2230s_bit) {
+   if (IS_AL2230S(chip)) {
r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
ARRAY_SIZE(ioreqs_init_al2230s));
if (r)
@@ -188,7 +190,7 @@ static int zd1211_al2230_init_hw(struct 
return r;
 
/* improve band edge for AL2230S */
-   if (chip-al2230s_bit)
+   if (IS_AL2230S(chip))
r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
else
r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
@@ -314,7 +316,7 @@ static int zd1211b_al2230_init_hw(struct
if (r)
return r;
 
-   if (chip-al2230s_bit) {
+   if (IS_AL2230S(chip)) {
r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
ARRAY_SIZE(ioreqs_init_al2230s));
if (r)
@@ -328,7 +330,7 @@ static int zd1211b_al2230_init_hw(struct
if (r)
return r;
 
-   if (chip-al2230s_bit)
+   if (IS_AL2230S(chip))
r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS);
else
r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS);
-
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] zd1211rw: Add ID for Buffalo WLI-U2-KG54L

2007-07-01 Thread Daniel Drake
Tested by Zen Kato
zd1211b chip 0411:00da v4810 high 00-16-01 AL2230S_RF pa0 g--N-

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
---
 zd_usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_usb.c
===
--- linux-2.6.orig/drivers/net/wireless/zd1211rw/zd_usb.c
+++ linux-2.6/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -71,6 +71,7 @@ static struct usb_device_id usb_ids[] = 
{ USB_DEVICE(0x0586, 0x3412), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B },
+   { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B },
/* Driverless devices that need ejecting */
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
{ USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
-
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] zd1211rw: Defer firmware load until first ifup

2007-07-01 Thread Daniel Drake
While playing with the firmware a while back, I discovered a way to
access the device's entire address space before the firmware has been
loaded.

Previously we were loading the firmware early on (during probe) so that
we could read the MAC address from the EEPROM and register a netdevice.
Now that we can read the EEPROM without having firmware, we can defer
firmware loading until later while still reading the MAC address early
on.

This has the advantage that zd1211rw can now be built into the kernel --
previously if this was the case, zd1211rw would be loaded before the
filesystem is available and firmware loading would fail.

Firmware load and other device initialization operations now happen the
first time the interface is brought up.

Some architectural changes were needed: handling of the is_zd1211b flag
was moved into the zd_usb structure, MAC address handling was obviously
changed, and a preinit_hw stage was added (the order is now: init,
preinit_hw, init_hw).

Signed-off-by: Daniel Drake [EMAIL PROTECTED]
---
 zd_chip.c   |   88 -
 zd_chip.h   |   13 ---
 zd_mac.c|   46 ++
 zd_mac.h|3 +-
 zd_rf_al2230.c  |2 +-
 zd_rf_al7230b.c |2 +-
 zd_rf_rf2959.c  |2 +-
 zd_rf_uw2453.c  |2 +-
 zd_usb.c|   97 +++---
 zd_usb.h|3 ++
 10 files changed, 134 insertions(+), 124 deletions(-)

Index: linux-2.6/drivers/net/wireless/zd1211rw/zd_chip.c
===
--- linux-2.6.orig/drivers/net/wireless/zd1211rw/zd_chip.c
+++ linux-2.6/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -49,8 +49,9 @@ void zd_chip_clear(struct zd_chip *chip)
ZD_MEMCLEAR(chip, sizeof(*chip));
 }
 
-static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size)
+static int scnprint_mac_oui(struct zd_chip *chip, char *buffer, size_t size)
 {
+   u8 *addr = zd_usb_to_netdev(chip-usb)-dev_addr;
return scnprintf(buffer, size, %02x-%02x-%02x,
 addr[0], addr[1], addr[2]);
 }
@@ -61,10 +62,10 @@ static int scnprint_id(struct zd_chip *c
int i = 0;
 
i = scnprintf(buffer, size, zd1211%s chip ,
- chip-is_zd1211b ? b : );
+ zd_chip_is_zd1211b(chip) ? b : );
i += zd_usb_scnprint_id(chip-usb, buffer+i, size-i);
i += scnprintf(buffer+i, size-i,  );
-   i += scnprint_mac_oui(chip-e2p_mac, buffer+i, size-i);
+   i += scnprint_mac_oui(chip, buffer+i, size-i);
i += scnprintf(buffer+i, size-i,  );
i += zd_rf_scnprint_id(chip-rf, buffer+i, size-i);
i += scnprintf(buffer+i, size-i,  pa%1x %c%c%c%c%c, chip-pa_type,
@@ -366,64 +367,9 @@ error:
return r;
 }
 
-static int _read_mac_addr(struct zd_chip *chip, u8 *mac_addr,
- const zd_addr_t *addr)
-{
-   int r;
-   u32 parts[2];
-
-   r = zd_ioread32v_locked(chip, parts, (const zd_addr_t *)addr, 2);
-   if (r) {
-   dev_dbg_f(zd_chip_dev(chip),
-   error: couldn't read e2p macs. Error number %d\n, r);
-   return r;
-   }
-
-   mac_addr[0] = parts[0];
-   mac_addr[1] = parts[0]   8;
-   mac_addr[2] = parts[0]  16;
-   mac_addr[3] = parts[0]  24;
-   mac_addr[4] = parts[1];
-   mac_addr[5] = parts[1]   8;
-
-   return 0;
-}
-
-static int read_e2p_mac_addr(struct zd_chip *chip)
-{
-   static const zd_addr_t addr[2] = { E2P_MAC_ADDR_P1, E2P_MAC_ADDR_P2 };
-
-   ZD_ASSERT(mutex_is_locked(chip-mutex));
-   return _read_mac_addr(chip, chip-e2p_mac, (const zd_addr_t *)addr);
-}
-
 /* MAC address: if custom mac addresses are to to be used CR_MAC_ADDR_P1 and
  *  CR_MAC_ADDR_P2 must be overwritten
  */
-void zd_get_e2p_mac_addr(struct zd_chip *chip, u8 *mac_addr)
-{
-   mutex_lock(chip-mutex);
-   memcpy(mac_addr, chip-e2p_mac, ETH_ALEN);
-   mutex_unlock(chip-mutex);
-}
-
-static int read_mac_addr(struct zd_chip *chip, u8 *mac_addr)
-{
-   static const zd_addr_t addr[2] = { CR_MAC_ADDR_P1, CR_MAC_ADDR_P2 };
-   return _read_mac_addr(chip, mac_addr, (const zd_addr_t *)addr);
-}
-
-int zd_read_mac_addr(struct zd_chip *chip, u8 *mac_addr)
-{
-   int r;
-
-   dev_dbg_f(zd_chip_dev(chip), \n);
-   mutex_lock(chip-mutex);
-   r = read_mac_addr(chip, mac_addr);
-   mutex_unlock(chip-mutex);
-   return r;
-}
-
 int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr)
 {
int r;
@@ -444,12 +390,6 @@ int zd_write_mac_addr(struct zd_chip *ch
 
mutex_lock(chip-mutex);
r = zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs));
-#ifdef DEBUG
-   {
-   u8 tmp[ETH_ALEN];
-   read_mac_addr(chip, tmp);
-   }
-#endif /* DEBUG */
mutex_unlock(chip-mutex);
return r;
 }
@@ -809,7 +749,7 @@ out:
 
 

Re: [Bugme-new] [Bug 8697] New: nfs-root doesn't work with jumbo frames

2007-07-01 Thread Andrew Morton
please submit the patch via email as per
http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
to
Andrew Morton [EMAIL PROTECTED]
netdev@vger.kernel.org
[EMAIL PROTECTED]

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.22-rc6] net/usb/cdc_ether minor sparse cleanup

2007-07-01 Thread David Brownell
Remove an sparse warning about a shadowed variable name.

Signed-off-by: David Brownell [EMAIL PROTECTED]
---
 drivers/net/usb/cdc_ether.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

--- g26.orig/drivers/net/usb/cdc_ether.c2007-07-01 11:40:37.0 
-0700
+++ g26/drivers/net/usb/cdc_ether.c 2007-07-01 11:40:48.0 -0700
@@ -144,14 +144,14 @@ int usbnet_generic_cdc_bind(struct usbne
 * modem interface from an RNDIS non-modem.
 */
if (rndis) {
-   struct usb_cdc_acm_descriptor *d;
+   struct usb_cdc_acm_descriptor *acm;
 
-   d = (void *) buf;
-   if (d-bmCapabilities) {
+   acm = (void *) buf;
+   if (acm-bmCapabilities) {
dev_dbg(intf-dev,
ACM capabilities %02x, 
not really RNDIS?\n,
-   d-bmCapabilities);
+   acm-bmCapabilities);
goto bad_desc;
}
}
-
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


RESEND [PATCH 0/3] NetXen: Bug fixes for multiport and blade adapters

2007-07-01 Thread dhananjay . phadke
Removed signal_pending checks during init, per Jeff's suggestion.


 drivers/net/netxen/netxen_nic.h  |  180 +++---
 drivers/net/netxen/netxen_nic_hdr.h  |2 +
 drivers/net/netxen/netxen_nic_hw.c   |   33 --
 drivers/net/netxen/netxen_nic_init.c |   51 +
 drivers/net/netxen/netxen_nic_main.c |  177 ++---
 drivers/net/netxen/netxen_nic_phan_reg.h |   14 +++
 6 files changed, 341 insertions(+), 116 deletions(-)
-
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


RESEND [PATCH 2/3] NetXen: Support per PCI-function interrupt mask registers

2007-07-01 Thread dhananjay . phadke
This patch updates the various access routines to access different
control and status settings present in different register locations.
This will fix problems related to working of different ports in
multi Port card.

Signed-off by: Dhananjay Phadke [EMAIL PROTECTED]
Signed-off by: Milan Bag [EMAIL PROTECTED]

Index: netdev-2.6/drivers/net/netxen/netxen_nic.h
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic.h
+++ netdev-2.6/drivers/net/netxen/netxen_nic.h
@@ -937,6 +937,7 @@ struct netxen_adapter {
struct netxen_ring_ctx *ctx_desc;
struct pci_dev *ctx_desc_pdev;
dma_addr_t ctx_desc_phys_addr;
+   int intr_scheme;
int (*enable_phy_interrupts) (struct netxen_adapter *);
int (*disable_phy_interrupts) (struct netxen_adapter *);
void (*handle_phy_intr) (struct netxen_adapter *);
@@ -1080,37 +1081,106 @@ struct net_device_stats *netxen_nic_get_
 
 static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
 {
-   /*
-* ISR_INT_MASK: Can be read from window 0 or 1.
-*/
-   writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
+   uint32_tmask = 0x7ff;
+   int retries = 32;
 
+   DPRINTK(1, INFO, Entered ISR Disable \n);
+
+   switch (adapter-portnum) {
+   case 0:
+   writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
+   break;
+   case 1:
+   writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
+   break;
+   case 2:
+   writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
+   break;
+   case 3:
+   writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
+   break;
+   }
+
+   if (adapter-intr_scheme != -1 
+   adapter-intr_scheme != INTR_SCHEME_PERPORT) {
+   writel(mask,
+   (void *)(PCI_OFFSET_SECOND_RANGE(adapter, 
ISR_INT_MASK)));
+   }
+
+   /* Window = 0 or 1 */
+   if (!(adapter-flags  NETXEN_NIC_MSI_ENABLED)) {
+   do {
+   writel(0x, (void *)
+   (PCI_OFFSET_SECOND_RANGE(adapter, 
ISR_INT_TARGET_STATUS)));
+   mask = readl((void *)
+   (pci_base_offset(adapter, 
ISR_INT_VECTOR)));
+   if (!(mask  0x80))
+   break;
+   udelay(10);
+   } while (--retries);
+
+   if (!retries) {
+   printk(KERN_NOTICE %s: Failed to disable interrupt 
completely\n,
+   netxen_nic_driver_name);
+   }
+   }
+
+   DPRINTK(1, INFO, Done with Disable Int\n);
+
+   return;
 }
 
 static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
 {
u32 mask;
 
-   switch (adapter-ahw.board_type) {
-   case NETXEN_NIC_GBE:
-   mask = 0x77b;
+   DPRINTK(1, INFO, Entered ISR Enable \n);
+
+   if (adapter-intr_scheme != -1 
+   adapter-intr_scheme != INTR_SCHEME_PERPORT) {
+   switch (adapter-ahw.board_type) {
+   case NETXEN_NIC_GBE:
+   mask  =  0x77b;
+   break;
+   case NETXEN_NIC_XGBE:
+   mask  =  0x77f;
+   break;
+   default:
+   mask  =  0x7ff;
+   break;
+   }
+
+   writel(mask,
+   (void *)(PCI_OFFSET_SECOND_RANGE(adapter, 
ISR_INT_MASK)));
+   }
+   switch (adapter-portnum) {
+   case 0:
+   writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
+   break;
+   case 1:
+   writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
break;
-   case NETXEN_NIC_XGBE:
-   mask = 0x77f;
+   case 2:
+   writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
break;
-   default:
-   mask = 0x7ff;
+   case 3:
+   writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
break;
}
 
-   writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
-
if (!(adapter-flags  NETXEN_NIC_MSI_ENABLED)) {
mask = 0xbff;
-   writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
-   writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
-ISR_INT_TARGET_MASK));
+   if (adapter-intr_scheme != -1 
+   adapter-intr_scheme != INTR_SCHEME_PERPORT) {
+   writel(0X0, NETXEN_CRB_NORMALIZE(adapter, 
CRB_INT_VECTOR));
+   }
+   

RESEND [PATCH 1/3] NetXen: Fix issue of MSI not working correctly

2007-07-01 Thread dhananjay . phadke
NetXen driver uses PCI function 0 to provide the functionality of MSI.
The patch makes driver check the bus master bit for function 0 and
enable it after the card initialization.

Signed-off-by: Dhananjay Phadke[EMAIL PROTECTED]
Signed-off-by: Milan Bag [EMAIL PROTECTED]
Signed-off-by: Wen Xiong [EMAIL PROTECTED]

Index: netdev-2.6/drivers/net/netxen/netxen_nic_main.c
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic_main.c
+++ netdev-2.6/drivers/net/netxen/netxen_nic_main.c
@@ -336,11 +336,9 @@ netxen_nic_probe(struct pci_dev *pdev, c
if (pci_using_dac)
netdev-features |= NETIF_F_HIGHDMA;
 
-   if (pci_enable_msi(pdev)) {
+   if (pci_enable_msi(pdev))
adapter-flags = ~NETXEN_NIC_MSI_ENABLED;
-   printk(KERN_WARNING %s: unable to allocate MSI interrupt
-   error\n, netxen_nic_driver_name);
-   } else
+   else
adapter-flags |= NETXEN_NIC_MSI_ENABLED;
 
netdev-irq = pdev-irq;
@@ -355,13 +353,6 @@ netxen_nic_probe(struct pci_dev *pdev, c
/* initialize the adapter */
netxen_initialize_adapter_hw(adapter);
 
-#ifdef CONFIG_PPC
-   if ((adapter-ahw.boardcfg.board_type ==
-   NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) 
-   (pci_func_id == 2))
-   goto err_out_free_adapter;
-#endif /* CONFIG_PPC */
-
/*
 *  Adapter in our case is quad port so initialize it before
 *  initializing the ports
@@ -509,16 +500,22 @@ netxen_nic_probe(struct pci_dev *pdev, c
NETXEN_CAM_RAM(0x1fc)));
if (val == 0x) {
/* This is the first boot after power up */
+   netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(0x4), val);
+   if (!(val  0x4)) {
+   val |= 0x4;
+   netxen_nic_write_w0(adapter, NETXEN_PCIE_REG(0x4), val);
+   netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(0x4), val);
+   }
val = readl(NETXEN_CRB_NORMALIZE(adapter,
NETXEN_ROMUSB_GLB_SW_RESET));
printk(KERN_INFONetXen: read 0x%08x for reset reg.\n,val);
if (val != 0x8f) {
/* clear the register for future unloads/loads */
-   writel(0, NETXEN_CRB_NORMALIZE(adapter,
-   NETXEN_CAM_RAM(0x1fc)));
-   printk(KERN_ERR ERROR in NetXen HW init sequence.\n);
-   err = -ENODEV;
-   goto err_out_free_dev;
+   writel(0, NETXEN_CRB_NORMALIZE(adapter,
+   NETXEN_CAM_RAM(0x1fc)));
+   printk(KERN_ERR ERROR in NetXen HW init 
sequence.\n);
+   err = -ENODEV;
+   goto err_out_free_dev;
}
 
/* clear the register for future unloads/loads */

-- 
-
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


RESEND [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload

2007-07-01 Thread dhananjay . phadke
These changes allow driver close routine to be called during module unload,
to clean-up buffers and other software resources, flush queues etc. Also,
hardware is reset to pristine state. 

Signed-off-by: Dhananjay Phadke [EMAIL PROTECTED]
Signed-off-by: Milan Bag [EMAIL PROTECTED]
Signed-off-by: Wen Xiong [EMAIL PROTECTED]

Index: netdev-2.6/drivers/net/netxen/netxen_nic.h
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic.h
+++ netdev-2.6/drivers/net/netxen/netxen_nic.h
@@ -952,6 +952,24 @@ struct netxen_adapter {
int (*stop_port) (struct netxen_adapter *);
 }; /* netxen_adapter structure */
 
+/*
+ * NetXen dma watchdog control structure
+ *
+ * Bit 0   : enabled = R/O: 1 watchdog active, 0 inactive
+ * Bit 1   : disable_request = 1 req disable dma watchdog
+ * Bit 2   : enable_request =  1 req enable dma watchdog
+ * Bit 3-31: unused
+ */
+
+#define netxen_set_dma_watchdog_disable_req(config_word) \
+   _netxen_set_bits(config_word, 1, 1, 1)
+#define netxen_set_dma_watchdog_enable_req(config_word) \
+   _netxen_set_bits(config_word, 2, 1, 1)
+#define netxen_get_dma_watchdog_enabled(config_word) \
+   ((config_word)  0x1)
+#define netxen_get_dma_watchdog_disabled(config_word) \
+   (((config_word)  1)  0x1)
+
 /* Max number of xmit producer threads that can run simultaneously */
 #defineMAX_XMIT_PRODUCERS  16
 
@@ -1031,8 +1049,8 @@ int netxen_nic_erase_pxe(struct netxen_a
 /* Functions from netxen_nic_init.c */
 void netxen_free_adapter_offload(struct netxen_adapter *adapter);
 int netxen_initialize_adapter_offload(struct netxen_adapter *adapter);
-void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
-void netxen_load_firmware(struct netxen_adapter *adapter);
+int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
+int netxen_load_firmware(struct netxen_adapter *adapter);
 int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose);
 int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp);
 int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr, 
@@ -1234,6 +1252,62 @@ static inline void get_brd_name_by_type(
name = Unknown;
 }
 
+static inline int
+dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
+{
+   u32 ctrl;
+
+   /* check if already inactive */
+   if (netxen_nic_hw_read_wx(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl, 4))
+   printk(KERN_ERR failed to read dma watchdog status\n);
+
+   if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
+   return 1;
+
+   /* Send the disable request */
+   netxen_set_dma_watchdog_disable_req(ctrl);
+   netxen_crb_writelit_adapter(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
+
+   return 0;
+}
+
+static inline int
+dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
+{
+   u32 ctrl;
+
+   if (netxen_nic_hw_read_wx(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl, 4))
+   printk(KERN_ERR failed to read dma watchdog status\n);
+
+   return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) 
+   (netxen_get_dma_watchdog_disabled(ctrl) == 0));
+}
+
+static inline int
+dma_watchdog_wakeup(struct netxen_adapter *adapter)
+{
+   u32 ctrl;
+
+   if (netxen_nic_hw_read_wx(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl, 4))
+   printk(KERN_ERR failed to read dma watchdog status\n);
+
+   if (netxen_get_dma_watchdog_enabled(ctrl))
+   return 1;
+
+   /* send the wakeup request */
+   netxen_set_dma_watchdog_enable_req(ctrl);
+
+   netxen_crb_writelit_adapter(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
+
+   return 0;
+}
+
+
 int netxen_is_flash_supported(struct netxen_adapter *adapter);
 int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]);
 extern void netxen_change_ringparam(struct netxen_adapter *adapter);
Index: netdev-2.6/drivers/net/netxen/netxen_nic_hdr.h
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic_hdr.h
+++ netdev-2.6/drivers/net/netxen/netxen_nic_hdr.h
@@ -687,4 +687,6 @@ enum {
 
 #define PCIE_MAX_MASTER_SPLIT  (0x14048)
 
+#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL   (0x14)
+
 #endif /* __NETXEN_NIC_HDR_H_ */
Index: netdev-2.6/drivers/net/netxen/netxen_nic_hw.c
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic_hw.c
+++ netdev-2.6/drivers/net/netxen/netxen_nic_hw.c
@@ -377,7 +377,7 @@ int netxen_nic_hw_resources(struct netxe

[-mm patch] e1000: #if 0 two functions

2007-07-01 Thread Adrian Bunk
e1000_{read,write}_pci_cfg() are no longer used.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

This patch has been sent on:
- 5 Jun 2007

 drivers/net/e1000/e1000_hw.h   |2 --
 drivers/net/e1000/e1000_main.c |4 
 2 files changed, 4 insertions(+), 2 deletions(-)

--- linux-2.6.22-rc3-mm1/drivers/net/e1000/e1000_hw.h.old   2007-06-04 
22:03:05.0 +0200
+++ linux-2.6.22-rc3-mm1/drivers/net/e1000/e1000_hw.h   2007-06-04 
22:03:14.0 +0200
@@ -421,8 +421,6 @@ void e1000_tbi_adjust_stats(struct e1000
 void e1000_get_bus_info(struct e1000_hw *hw);
 void e1000_pci_set_mwi(struct e1000_hw *hw);
 void e1000_pci_clear_mwi(struct e1000_hw *hw);
-void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
-void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
 int32_t e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t 
*value);
 void e1000_pcix_set_mmrbc(struct e1000_hw *hw, int mmrbc);
 int e1000_pcix_get_mmrbc(struct e1000_hw *hw);
--- linux-2.6.22-rc3-mm1/drivers/net/e1000/e1000_main.c.old 2007-06-04 
22:03:24.0 +0200
+++ linux-2.6.22-rc3-mm1/drivers/net/e1000/e1000_main.c 2007-06-04 
22:03:40.0 +0200
@@ -4888,6 +4888,8 @@ e1000_pci_clear_mwi(struct e1000_hw *hw)
pci_clear_mwi(adapter-pdev);
 }
 
+#if 0
+
 void
 e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
 {
@@ -4904,6 +4906,8 @@ e1000_write_pci_cfg(struct e1000_hw *hw,
pci_write_config_word(adapter-pdev, reg, *value);
 }
 
+#endif  /*  0  */
+
 int
 e1000_pcix_get_mmrbc(struct e1000_hw *hw)
 {


-
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


[2.6 patch] drivers/net/ns83820.c: fix a check-after-use

2007-07-01 Thread Adrian Bunk
This patch fixes a check-after-use spotted by the Coverity checker.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---
--- linux-2.6.22-rc6-mm1/drivers/net/ns83820.c.old  2007-06-29 
22:12:22.0 +0200
+++ linux-2.6.22-rc6-mm1/drivers/net/ns83820.c  2007-06-29 22:13:59.0 
+0200
@@ -1985,11 +1985,13 @@ static int __devinit ns83820_init_one(st
 
ndev = alloc_etherdev(sizeof(struct ns83820));
dev = PRIV(ndev);
-   dev-ndev = ndev;
+
err = -ENOMEM;
if (!dev)
goto out;
 
+   dev-ndev = ndev;
+
spin_lock_init(dev-rx_info.lock);
spin_lock_init(dev-tx_lock);
spin_lock_init(dev-misc_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


[2.6 patch] bonding/bond_main.c: make 2 functions static

2007-07-01 Thread Adrian Bunk
This patch makes two needleesly global functions static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

This patch has been sent on:
- 31 Mar 2007

 drivers/net/bonding/bond_main.c |5 +++--
 drivers/net/bonding/bonding.h   |2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

--- linux-2.6.21-rc5-mm3/drivers/net/bonding/bonding.h.old  2007-03-31 
21:12:31.0 +0200
+++ linux-2.6.21-rc5-mm3/drivers/net/bonding/bonding.h  2007-03-31 
21:12:42.0 +0200
@@ -301,13 +301,11 @@
 void bond_destroy_slave_symlinks(struct net_device *master, struct net_device 
*slave);
 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
 int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
-int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev);
 void bond_mii_monitor(struct net_device *bond_dev);
 void bond_loadbalance_arp_mon(struct net_device *bond_dev);
 void bond_activebackup_arp_mon(struct net_device *bond_dev);
 void bond_set_mode_ops(struct bonding *bond, int mode);
 int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl);
-const char *bond_mode_name(int mode);
 void bond_select_active_slave(struct bonding *bond);
 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
 void bond_register_arp(struct bonding *);
--- linux-2.6.21-rc5-mm3/drivers/net/bonding/bond_main.c.old2007-03-31 
21:12:50.0 +0200
+++ linux-2.6.21-rc5-mm3/drivers/net/bonding/bond_main.c2007-03-31 
21:13:16.0 +0200
@@ -187,7 +187,7 @@
 
 /* General routines -*/
 
-const char *bond_mode_name(int mode)
+static const char *bond_mode_name(int mode)
 {
switch (mode) {
case BOND_MODE_ROUNDROBIN :
@@ -1224,7 +1224,8 @@
 
 /*-- IOCTL --*/
 
-int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev)
+static int bond_sethwaddr(struct net_device *bond_dev,
+ struct net_device *slave_dev)
 {
dprintk(bond_dev=%p\n, bond_dev);
dprintk(slave_dev=%p\n, slave_dev);

-
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: power down PHY when interface down

2007-07-01 Thread Michael Buesch
On Sunday 01 July 2007 17:00:06 Lennert Buytenhek wrote:
 A multimeter should do the trick, but I would advise against this
 if you're not totally comfortable with hacking hardware.

Ok, the resistor on the board is 100ohm, which is too big
according to the docs of the extender.
So what I tried is to connect a 10ohm resistor between
IDSEL and the AD pin, on the extender itself. But it didn't
do the trick. It still doesn't work.
I also connected a 10ohm resistor between IDSEL and the AD
pin directly on the mainboard. Also doesn't work. So I guess
it's some other issue.
But I have no idea what could be wrong besides that.

-- 
Greetings Michael.
-
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


[-mm patch] make struct dccp_li_cachep static

2007-07-01 Thread Adrian Bunk
On Thu, Jun 28, 2007 at 03:43:21AM -0700, Andrew Morton wrote:
...
 Changes since 2.6.22-rc4-mm2:
...
  git-net.patch
...
  git trees
...


Struct dccp_li_cachep can become static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---
--- linux-2.6.22-rc6-mm1/net/dccp/ccids/lib/loss_interval.c.old 2007-07-01 
00:38:12.0 +0200
+++ linux-2.6.22-rc6-mm1/net/dccp/ccids/lib/loss_interval.c 2007-07-01 
00:38:21.0 +0200
@@ -27,7 +27,7 @@
u32  dccplih_interval;
 };
 
-struct kmem_cache *dccp_li_cachep __read_mostly;
+static struct kmem_cache *dccp_li_cachep __read_mostly;
 
 static inline struct dccp_li_hist_entry *dccp_li_hist_entry_new(const gfp_t 
prio)
 {

-
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: RESEND [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload

2007-07-01 Thread Michael Buesch
On Sunday 01 July 2007 20:56:01 [EMAIL PROTECTED] wrote:
 These changes allow driver close routine to be called during module unload,
 to clean-up buffers and other software resources, flush queues etc. Also,
 hardware is reset to pristine state. 
 
 Signed-off-by: Dhananjay Phadke [EMAIL PROTECTED]
 Signed-off-by: Milan Bag [EMAIL PROTECTED]
 Signed-off-by: Wen Xiong [EMAIL PROTECTED]
 


 + msleep(1);
 + if (netxen_load_firmware(adapter))
 + return;
 + netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
 + }
 +
 + /* clear the register for future unloads/loads */
 + writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
 + printk(KERN_INFO State: 0x%0x\n,
 + readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
 +
 + dma_watchdog_shutdown_request(adapter);
 + mdelay(100);
 + i = 100;
 + while ((dma_watchdog_shutdown_poll_result(adapter) != 1)  i) {
 + printk(KERN_INFO dma_watchdog_shutdown_poll still in 
 progress\n);
 + mdelay(100);
 + i--;
 + }

msleep, please.

-- 
Greetings Michael.
-
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: [2.6 patch] the overdue eepro100 removal

2007-07-01 Thread Kok, Auke

Adrian Bunk wrote:

This patch contains the overdue removal of the eepro100 driver.



...

this needs to be resceduled for 2.6.24 (at least). We're hoping to merge the 
proposed changes (still being worked on) in .23. Milton Miller and David Acker 
are working on that.


Auke
-
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] zd1211rw-mac80211: basic regulatory domain support

2007-07-01 Thread Joerg Mayer
On Sun, Jul 01, 2007 at 05:39:06PM +0100, Daniel Drake wrote:
 This patch causes zd1211rw-mac80211 to interpret the regdomain in the
 EEPROM and restrict the channels accordingly, like the softmac driver does.

The patch only addresses the allowed channels but not the allowed
maximum power levels. Is this intentional?
I've only looked at the patch, so maybe this is handled elsewhere.


 ciao
   Joerg
--
Joerg Mayer   [EMAIL PROTECTED]
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.

-
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: [2.6 patch] the overdue eepro100 removal

2007-07-01 Thread Jeff Garzik

Kok, Auke wrote:
this needs to be resceduled for 2.6.24 (at least). We're hoping to merge 
the proposed changes (still being worked on) in .23. Milton Miller and 
David Acker are working on that.


Quite agreed.

Jeff


-
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 0/4] [IrDA] Update for net-2.6.23

2007-07-01 Thread samuel
Hi Dave,

Here goes an IrDA update for net-2.6.23.

Cheers,
Samuel.

-
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/4] [IrDA] Monitor mode

2007-07-01 Thread samuel
Through the IrDA netlink set mode command, we switch to IrDA monitor mode,
where one IrLAP instance receives all the packets on the media, without ever
responding to them.

Signed-off-by: Samuel Ortiz [EMAIL PROTECTED]

Index: net-2.6-quilt/include/linux/irda.h
===
--- net-2.6-quilt.orig/include/linux/irda.h 2007-05-12 03:04:09.0 
+0300
+++ net-2.6-quilt/include/linux/irda.h  2007-05-12 03:07:41.0 +0300
@@ -242,6 +242,7 @@
 /* IrDA modes */
 #define IRDA_MODE_PRIMARY   0x1
 #define IRDA_MODE_SECONDARY 0x2
+#define IRDA_MODE_MONITOR   0x4
 
 #endif /* KERNEL_IRDA_H */
 
Index: net-2.6-quilt/net/irda/irlap_frame.c
===
--- net-2.6-quilt.orig/net/irda/irlap_frame.c   2007-05-12 03:02:16.0 
+0300
+++ net-2.6-quilt/net/irda/irlap_frame.c2007-05-12 03:07:41.0 
+0300
@@ -101,6 +101,13 @@
 
irlap_insert_info(self, skb);
 
+   if (unlikely(self-mode  IRDA_MODE_MONITOR)) {
+   IRDA_DEBUG(3, %s(): %s is in monitor mode\n, __FUNCTION__,
+  self-netdev-name);
+   dev_kfree_skb(skb);
+   return;
+   }
+
dev_queue_xmit(skb);
 }
 

-- 
-
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/4] [IrDA] Netlink layer

2007-07-01 Thread samuel
First IrDA configuration netlink layer implementation.
Currently, we only support the set/get mode commands.

Signed-off-by: Samuel Ortiz [EMAIL PROTECTED]
---
 include/linux/irda.h |   20 ++
 include/net/irda/irda.h  |3 +
 include/net/irda/irlap.h |2 +
 net/irda/Makefile|2 +-
 net/irda/irmod.c |   46 -
 net/irda/irnetlink.c |  162 ++
 6 files changed, 230 insertions(+), 5 deletions(-)
 create mode 100644 net/irda/irnetlink.c

Index: net-2.6-quilt/include/linux/irda.h
===
--- net-2.6-quilt.orig/include/linux/irda.h 2007-05-24 09:51:05.0 
+0300
+++ net-2.6-quilt/include/linux/irda.h  2007-05-29 09:34:36.0 +0300
@@ -216,6 +216,33 @@
 #define ifr_dtr   ifr_ifru.ifru_line.dtr
 #define ifr_rts   ifr_ifru.ifru_line.rts
 
+
+/* IrDA netlink definitions */
+#define IRDA_NL_NAME irda
+#define IRDA_NL_VERSION 1
+
+enum irda_nl_commands {
+   IRDA_NL_CMD_UNSPEC,
+   IRDA_NL_CMD_SET_MODE,
+   IRDA_NL_CMD_GET_MODE,
+
+   __IRDA_NL_CMD_AFTER_LAST
+};
+#define IRDA_NL_CMD_MAX (__IRDA_NL_CMD_AFTER_LAST - 1)
+
+enum nl80211_attrs {
+   IRDA_NL_ATTR_UNSPEC,
+   IRDA_NL_ATTR_IFNAME,
+   IRDA_NL_ATTR_MODE,
+
+   __IRDA_NL_ATTR_AFTER_LAST
+};
+#define IRDA_NL_ATTR_MAX (__IRDA_NL_ATTR_AFTER_LAST - 1)
+
+/* IrDA modes */
+#define IRDA_MODE_PRIMARY   0x1
+#define IRDA_MODE_SECONDARY 0x2
+
 #endif /* KERNEL_IRDA_H */
 
 
Index: net-2.6-quilt/include/net/irda/irda.h
===
--- net-2.6-quilt.orig/include/net/irda/irda.h  2007-05-24 09:51:05.0 
+0300
+++ net-2.6-quilt/include/net/irda/irda.h   2007-05-24 09:51:21.0 
+0300
@@ -125,6 +125,9 @@
 extern int irsock_init(void);
 extern void irsock_cleanup(void);
 
+extern int irda_nl_register(void);
+extern void irda_nl_unregister(void);
+
 extern int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype,
struct net_device *orig_dev);
Index: net-2.6-quilt/include/net/irda/irlap.h
===
--- net-2.6-quilt.orig/include/net/irda/irlap.h 2007-05-24 09:51:21.0 
+0300
+++ net-2.6-quilt/include/net/irda/irlap.h  2007-05-24 09:51:21.0 
+0300
@@ -208,6 +208,8 @@
intxbofs_delay;   /* Nr of XBOF's used to MTT */
intbofs_count;/* Negotiated extra BOFs */
intnext_bofs; /* Negotiated extra BOFs after next frame */
+
+   intmode; /* IrLAP mode (primary, secondary or monitor) */
 };
 
 /* 
Index: net-2.6-quilt/net/irda/Makefile
===
--- net-2.6-quilt.orig/net/irda/Makefile2007-05-24 09:51:05.0 
+0300
+++ net-2.6-quilt/net/irda/Makefile 2007-05-24 09:51:21.0 +0300
@@ -10,6 +10,6 @@
 irda-y := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \
   irlap.o irlap_event.o irlap_frame.o timer.o qos.o irqueue.o \
   irttp.o irda_device.o irias_object.o wrapper.o af_irda.o \
- discovery.o parameters.o irmod.o
+ discovery.o parameters.o irnetlink.o irmod.o
 irda-$(CONFIG_PROC_FS) += irproc.o
 irda-$(CONFIG_SYSCTL) += irsysctl.o
Index: net-2.6-quilt/net/irda/irmod.c
===
--- net-2.6-quilt.orig/net/irda/irmod.c 2007-05-24 09:51:05.0 +0300
+++ net-2.6-quilt/net/irda/irmod.c  2007-05-24 09:51:21.0 +0300
@@ -88,16 +88,23 @@
  */
 static int __init irda_init(void)
 {
+   int ret = 0;
+
IRDA_DEBUG(0, %s()\n, __FUNCTION__);
 
/* Lower layer of the stack */
irlmp_init();
irlap_init();
 
+   /* Driver/dongle support */
+   irda_device_init();
+
/* Higher layers of the stack */
iriap_init();
irttp_init();
-   irsock_init();
+   ret = irsock_init();
+   if (ret  0)
+   goto out_err_1;
 
/* Add IrDA packet type (Start receiving packets) */
dev_add_pack(irda_packet_type);
@@ -107,13 +114,44 @@
irda_proc_register();
 #endif
 #ifdef CONFIG_SYSCTL
-   irda_sysctl_register();
+   ret = irda_sysctl_register();
+   if (ret  0)
+   goto out_err_2;
 #endif
 
-   /* Driver/dongle support */
-   irda_device_init();
+   ret = irda_nl_register();
+   if (ret  0)
+   goto out_err_3;
 
return 0;
+
+ out_err_3:
+#ifdef CONFIG_SYSCTL
+   irda_sysctl_unregister();
+#endif
+ out_err_2:
+#ifdef CONFIG_PROC_FS
+   irda_proc_unregister();
+#endif
+
+   /* Remove IrDA packet type (stop receiving packets) */
+   dev_remove_pack(irda_packet_type);
+
+   /* Remove higher layers */
+   irsock_cleanup();
+ out_err_1:
+   

[PATCH 3/4] [IrDA] kingsun-sir.c charset fix

2007-07-01 Thread samuel
Cc: Alex Villacís Lasso [EMAIL PROTECTED]
Signed-off-by: Samuel Ortiz [EMAIL PROTECTED]

---
 drivers/net/irda/kingsun-sir.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: net-2.6-quilt/drivers/net/irda/kingsun-sir.c
===
--- net-2.6-quilt.orig/drivers/net/irda/kingsun-sir.c   2007-05-17 
13:26:13.0 +0300
+++ net-2.6-quilt/drivers/net/irda/kingsun-sir.c2007-05-22 
09:48:21.0 +0300
@@ -4,7 +4,7 @@
 * Version:   0.1.1
 * Description:   Irda KingSun/DonShine USB Dongle
 * Status:Experimental
-* Author:Alex Villac�s Lasso [EMAIL PROTECTED]
+* Author:Alex Villacís Lasso [EMAIL PROTECTED]
 *
 *  Based on stir4200 and mcs7780 drivers, with (strange?) differences
 *
@@ -652,6 +652,6 @@
 }
 module_exit(kingsun_cleanup);
 
-MODULE_AUTHOR(Alex Villac�s Lasso [EMAIL PROTECTED]);
+MODULE_AUTHOR(Alex Villacís Lasso [EMAIL PROTECTED]);
 MODULE_DESCRIPTION(IrDA-USB Dongle Driver for KingSun/DonShine);
 MODULE_LICENSE(GPL);

-- 
-
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/4] [IrDA] tsap init routine factorisation

2007-07-01 Thread samuel
This patch extracts common code from irttp_open_tsap() and irttp_dup() 
into a new function to 1) avoid code duplication, 2) help avoid forgetting 
object initialization in the tsap duplication path in the future.

Signed-off-by: G. Liakhovetski [EMAIL PROTECTED]
Signed-off-by: Samuel Ortiz [EMAIL PROTECTED]

--- a/net/irda/irttp.c  2 Apr 2007 10:36:28 -   1.1.1.11.4.2
+++ b/net/irda/irttp.c  30 May 2007 13:14:19 -
@@ -369,6 +369,20 @@ static int irttp_param_max_sdu_size(void
 /* Everything is happily mixed up. Waiting for next clean up - Jean II */
 
 /*
+ * Initialization, that has to be done on new tsap
+ * instance allocation and on duplication
+ */
+static void irttp_init_tsap(struct tsap_cb *tsap)
+{
+   spin_lock_init(tsap-lock);
+   init_timer(tsap-todo_timer);
+
+   skb_queue_head_init(tsap-rx_queue);
+   skb_queue_head_init(tsap-tx_queue);
+   skb_queue_head_init(tsap-rx_fragments);
+}
+
+/*
  * Function irttp_open_tsap (stsap, notify)
  *
  *Create TSAP connection endpoint,
@@ -395,10 +409,11 @@ struct tsap_cb *irttp_open_tsap(__u8 sts
IRDA_DEBUG(0, %s(), unable to kmalloc!\n, __FUNCTION__);
return NULL;
}
-   spin_lock_init(self-lock);
+
+   /* Initialize internal objects */
+   irttp_init_tsap(self);
 
/* Initialise todo timer */
-   init_timer(self-todo_timer);
self-todo_timer.data = (unsigned long) self;
self-todo_timer.function = irttp_todo_expired;
 
@@ -418,9 +433,6 @@ struct tsap_cb *irttp_open_tsap(__u8 sts
self-magic = TTP_TSAP_MAGIC;
self-connected = FALSE;
 
-   skb_queue_head_init(self-rx_queue);
-   skb_queue_head_init(self-tx_queue);
-   skb_queue_head_init(self-rx_fragments);
/*
 *  Create LSAP at IrLMP layer
 */
@@ -1455,12 +1467,9 @@ struct tsap_cb *irttp_dup(struct tsap_cb
 
/* Not everything should be copied */
new-notify.instance = instance;
-   spin_lock_init(new-lock);
-   init_timer(new-todo_timer);
 
-   skb_queue_head_init(new-rx_queue);
-   skb_queue_head_init(new-tx_queue);
-   skb_queue_head_init(new-rx_fragments);
+   /* Initialize internal objects */
+   irttp_init_tsap(new);
 
/* This is locked */
hashbin_insert(irttp-tsaps, (irda_queue_t *) new, (long) new, NULL);

-- 
-
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: r8169 2.2LK: Low link speed after suspend

2007-07-01 Thread Francois Romieu
Peter Missel [EMAIL PROTECTED] :
[...]
 The patch applies without failure; I'm getting a warning during build,
 
   CC [M]  drivers/net/r8169.o
 drivers/net/r8169.c: In function ‘rtl8169_start_xmit’:
 drivers/net/r8169.c:2341: warning: ‘txd’ may be used uninitialized in this 
 function

It's known and harmless. Blame gcc :o)

-- 
Ueimor
-
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


Problem with my network-card, using forcedeth-driver

2007-07-01 Thread Thomas Langås

I've got two boxes, both which uses the forcedeth-driver as the driver
for the network cards.  I've got the same problem on both boxes.  I've
tried various kernels, the latest kernel on my amd64-box is 2.6.22-7
from gutsy (ubuntu).

The problem is as follows:
Once the interface is up, it seems to be working ok, after a little
while with traffic (not much) it becomes off and on when it comes to
response.  If my ssh-session has been idle for a minute or two, and I
hit two keys, key number two will be displayed after some sort of
timeout (30 sec - 1 minute).  Then it becomes reponsive while I use
the session, until I idle again. After a little while with this
behaviour it just becomes totally unresponsive, and I have to restart
the network-device (networking restart) to be able to connect to the
box again.  This is all on eth0.

One of my boxes (amd64-box) is using Asus M2N32-SLI Deluxe as the
motherboard, this has two NICs (same chip on both NICs), and eth1
doesn't have this problem at all, just eth0.  So when eth0 dies, I can
just connect through eth1 and restart the network, and eth0 becomes
responsive again.  But the problem is there still, after a bit.

Since I've had two completely different setups, where one of the few
common factors was the forcedeth.c, and I've seen a few posts around
by other people mentioning the same problems, it seems that the driver
has some bugs or is missing some key functionality for eth0 to become
a usable NIC.

If there's anything I can do to help, please let me know, and I'll
help.  I really want to fix this, so I can use both NICs, and we can
get rid of this error once and for all :-)

This is from lspci, identifying the two NICs:
00:10.0 Bridge: nVidia Corporation MCP55 Ethernet (rev a2)
   Subsystem: ASUSTeK Computer Inc. Unknown device cb84
   Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 509
   Memory at fe02a000 (32-bit, non-prefetchable) [size=4K]
   I/O ports at b400 [size=8]
   Memory at fe029000 (32-bit, non-prefetchable) [size=256]
   Memory at fe028000 (32-bit, non-prefetchable) [size=16]
   Capabilities: [44] Power Management version 2
   Capabilities: [70] MSI-X: Enable- Mask- TabSize=8
   Capabilities: [50] Message Signalled Interrupts: Mask+ 64bit+
Queue=0/3 Enable+
   Capabilities: [6c] HyperTransport: MSI Mapping

00:11.0 Bridge: nVidia Corporation MCP55 Ethernet (rev a2)
   Subsystem: ASUSTeK Computer Inc. Unknown device cb84
   Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 508
   Memory at fe027000 (32-bit, non-prefetchable) [size=4K]
   I/O ports at b000 [size=8]
   Memory at fe026000 (32-bit, non-prefetchable) [size=256]
   Memory at fe025000 (32-bit, non-prefetchable) [size=16]
   Capabilities: [44] Power Management version 2
   Capabilities: [70] MSI-X: Enable- Mask- TabSize=8
   Capabilities: [50] Message Signalled Interrupts: Mask+ 64bit+
Queue=0/3 Enable+
   Capabilities: [6c] HyperTransport: MSI Mapping

--
Thomas
-
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: Please pull from 'from_linus' branch

2007-07-01 Thread Kumar Gala


On Jun 29, 2007, at 6:06 AM, Jeff Garzik wrote:


Kumar Gala wrote:

Please pull from 'for_linus' branch of
	master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git  
for_linus

to receive the following updates:
 drivers/net/gianfar.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Kumar Gala (1):
  gianfar: Fix typo bug introduced by move to udp_hdr()


Why is net driver stuff no longer going through me?

Fixes are regularly going upstream.


Jeff,

Can you either pull this in your upstream-fixes branch for Linus  
before 2.6.22 comes out.


- k
-
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


RESEND [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload

2007-07-01 Thread Dhananjay Phadke
Resending patch 3/3 only.

These changes allow driver close routine to be called during module unload,
to clean-up buffers and other software resources, flush queues etc. Also,
hardware is reset to pristine state. 

Signed-off-by: Dhananjay Phadke [EMAIL PROTECTED]
Signed-off-by: Milan Bag [EMAIL PROTECTED]
Signed-off-by: Wen Xiong [EMAIL PROTECTED]

Index: netdev-2.6/drivers/net/netxen/netxen_nic.h
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic.h
+++ netdev-2.6/drivers/net/netxen/netxen_nic.h
@@ -952,6 +952,24 @@ struct netxen_adapter {
int (*stop_port) (struct netxen_adapter *);
 }; /* netxen_adapter structure */
 
+/*
+ * NetXen dma watchdog control structure
+ *
+ * Bit 0   : enabled = R/O: 1 watchdog active, 0 inactive
+ * Bit 1   : disable_request = 1 req disable dma watchdog
+ * Bit 2   : enable_request =  1 req enable dma watchdog
+ * Bit 3-31: unused
+ */
+
+#define netxen_set_dma_watchdog_disable_req(config_word) \
+   _netxen_set_bits(config_word, 1, 1, 1)
+#define netxen_set_dma_watchdog_enable_req(config_word) \
+   _netxen_set_bits(config_word, 2, 1, 1)
+#define netxen_get_dma_watchdog_enabled(config_word) \
+   ((config_word)  0x1)
+#define netxen_get_dma_watchdog_disabled(config_word) \
+   (((config_word)  1)  0x1)
+
 /* Max number of xmit producer threads that can run simultaneously */
 #defineMAX_XMIT_PRODUCERS  16
 
@@ -1031,8 +1049,8 @@ int netxen_nic_erase_pxe(struct netxen_a
 /* Functions from netxen_nic_init.c */
 void netxen_free_adapter_offload(struct netxen_adapter *adapter);
 int netxen_initialize_adapter_offload(struct netxen_adapter *adapter);
-void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
-void netxen_load_firmware(struct netxen_adapter *adapter);
+int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
+int netxen_load_firmware(struct netxen_adapter *adapter);
 int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose);
 int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp);
 int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr, 
@@ -1234,6 +1252,62 @@ static inline void get_brd_name_by_type(
name = Unknown;
 }
 
+static inline int
+dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
+{
+   u32 ctrl;
+
+   /* check if already inactive */
+   if (netxen_nic_hw_read_wx(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl, 4))
+   printk(KERN_ERR failed to read dma watchdog status\n);
+
+   if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
+   return 1;
+
+   /* Send the disable request */
+   netxen_set_dma_watchdog_disable_req(ctrl);
+   netxen_crb_writelit_adapter(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
+
+   return 0;
+}
+
+static inline int
+dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
+{
+   u32 ctrl;
+
+   if (netxen_nic_hw_read_wx(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl, 4))
+   printk(KERN_ERR failed to read dma watchdog status\n);
+
+   return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) 
+   (netxen_get_dma_watchdog_disabled(ctrl) == 0));
+}
+
+static inline int
+dma_watchdog_wakeup(struct netxen_adapter *adapter)
+{
+   u32 ctrl;
+
+   if (netxen_nic_hw_read_wx(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl, 4))
+   printk(KERN_ERR failed to read dma watchdog status\n);
+
+   if (netxen_get_dma_watchdog_enabled(ctrl))
+   return 1;
+
+   /* send the wakeup request */
+   netxen_set_dma_watchdog_enable_req(ctrl);
+
+   netxen_crb_writelit_adapter(adapter,
+   NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
+
+   return 0;
+}
+
+
 int netxen_is_flash_supported(struct netxen_adapter *adapter);
 int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]);
 extern void netxen_change_ringparam(struct netxen_adapter *adapter);
Index: netdev-2.6/drivers/net/netxen/netxen_nic_hdr.h
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic_hdr.h
+++ netdev-2.6/drivers/net/netxen/netxen_nic_hdr.h
@@ -687,4 +687,6 @@ enum {
 
 #define PCIE_MAX_MASTER_SPLIT  (0x14048)
 
+#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL   (0x14)
+
 #endif /* __NETXEN_NIC_HDR_H_ */
Index: netdev-2.6/drivers/net/netxen/netxen_nic_hw.c
===
--- netdev-2.6.orig/drivers/net/netxen/netxen_nic_hw.c
+++ netdev-2.6/drivers/net/netxen/netxen_nic_hw.c
@@ -377,7 +377,7 @@ int netxen_nic_hw_resources(struct netxe