Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] linux-firmware: bnx2: Update firmware and version
From: Michael Chan @ 2011-05-10 23:19 UTC (permalink / raw)
  To: David Woodhouse; +Cc: netdev@vger.kernel.org
In-Reply-To: <1305069055.30435.99.camel@i7.infradead.org>


On Tue, 2011-05-10 at 16:10 -0700, David Woodhouse wrote:
> On Tue, 2011-05-10 at 15:16 -0700, Michael Chan wrote:
> > upstream kernel commit dc187cb381f1bceb30498861ece510245c43ed9f
> 
> This stuff should no longer get changed in the upstream kernel; what's
> there is *historical* and due for deletion.

OK, no more from now on.

> 
> > Update 5709 mips firmware to 6.2.1a to fix iSCSI performance
> > regression.  There was an unnecessary context read in the fast path
> > affecting performance. 
> 
> Is this update not ABI compatible? You have changed the soname of the
> firmware... was that intentional?
> 

The firmware is tightly coupled to the driver.  We only test one
combination of driver/firmware and don't guarantee compatibility with
other combinations.



^ permalink raw reply

* Re: [PATCH] linux-firmware: bnx2: Update firmware and version
From: David Woodhouse @ 2011-05-10 23:27 UTC (permalink / raw)
  To: Michael Chan; +Cc: netdev@vger.kernel.org
In-Reply-To: <1305069556.9029.133.camel@nseg_linux_HP1.broadcom.com>

On Tue, 2011-05-10 at 16:19 -0700, Michael Chan wrote:
> > > Update 5709 mips firmware to 6.2.1a to fix iSCSI performance
> > > regression.  There was an unnecessary context read in the fast path
> > > affecting performance. 
> > 
> > Is this update not ABI compatible? You have changed the soname of the
> > firmware... was that intentional?
> > 
> 
> The firmware is tightly coupled to the driver.  We only test one
> combination of driver/firmware and don't guarantee compatibility with
> other combinations.

OK, patch applied and pushed; thanks.

-- 
dwmw2


^ permalink raw reply

* Re: [Bridge] Bug#625914: linux-image-2.6.38-2-amd64: bridging is not interacting well with multicast in 2.6.38-4
From: Noah Meyerhans @ 2011-05-10 23:35 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Ben Hutchings, 625914, bridge, netdev
In-Reply-To: <20110510151100.52a9f8fa@nehalam>

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

On Tue, May 10, 2011 at 03:11:00PM -0700, Stephen Hemminger wrote:
> There were two more follow on commits in stable related to this.
> I recommend merging 2.6.38.6 which includes these.

The problem still exists in the current 2.6.38.6.  Backing out 5f1c356a
still solves the problem there.

I have not yet tried anything outside the stable-2.6.38.y tree, but it
seems like these same changes are present there, and it's unlikely that
other releases will work any better.

noah


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] ehea: Fix memory hotplug oops
From: Anton Blanchard @ 2011-05-11  2:17 UTC (permalink / raw)
  To: leitao; +Cc: netdev


The ehea driver oopses during memory hotplug if the ports are not
up. A simple testcase:

# ifconfig ethX down
# echo offline > /sys/devices/system/memory/memory32/state

Oops: Kernel access of bad area, sig: 11 [#1]
last sysfs file: /sys/devices/system/memory/memory32/state
REGS: c000000709393110 TRAP: 0300   Not tainted  (2.6.39-rc2-01385-g7ef73bc-dirty)
DAR: 0000000000000000, DSISR: 40000000
...
NIP [c000000000067c98] .__wake_up_common+0x48/0xf0
LR [c00000000006d034] .__wake_up+0x54/0x90
Call Trace:
[c00000000006d034] .__wake_up+0x54/0x90
[d000000006bb6270] .ehea_rereg_mrs+0x140/0x730 [ehea]
[d000000006bb69c4] .ehea_mem_notifier+0x164/0x170 [ehea]
[c0000000006fc8a8] .notifier_call_chain+0x78/0xf0
[c0000000000b3d70] .__blocking_notifier_call_chain+0x70/0xb0
[c000000000458d78] .memory_notify+0x28/0x40
[c0000000001871d8] .remove_memory+0x208/0x6d0
[c000000000458264] .memory_section_action+0x94/0x140
[c0000000004583ec] .memory_block_change_state+0xdc/0x1d0
[c0000000004585cc] .store_mem_state+0xec/0x160
[c00000000044768c] .sysdev_store+0x3c/0x50
[c00000000020b48c] .sysfs_write_file+0xec/0x1f0
[c00000000018f86c] .vfs_write+0xec/0x1e0
[c00000000018fa88] .SyS_write+0x58/0xd0

To fix this, initialise the waitqueues during port probe instead
of port open.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@kernel.org
---

Index: linux-net/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-net.orig/drivers/net/ehea/ehea_main.c	2011-05-11 11:54:18.751672569 +1000
+++ linux-net/drivers/net/ehea/ehea_main.c	2011-05-11 11:56:27.423964456 +1000
@@ -2688,9 +2688,6 @@ static int ehea_open(struct net_device *
 		netif_start_queue(dev);
 	}
 
-	init_waitqueue_head(&port->swqe_avail_wq);
-	init_waitqueue_head(&port->restart_wq);
-
 	mutex_unlock(&port->port_lock);
 
 	return ret;
@@ -3278,6 +3275,9 @@ struct ehea_port *ehea_setup_single_port
 
 	INIT_WORK(&port->reset_task, ehea_reset_port);
 
+	init_waitqueue_head(&port->swqe_avail_wq);
+	init_waitqueue_head(&port->restart_wq);
+
 	ret = register_netdev(dev);
 	if (ret) {
 		pr_err("register_netdev failed. ret=%d\n", ret);

^ permalink raw reply

* Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb
From: Eric Dumazet @ 2011-05-11  3:12 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Vegard Nossum, Pekka Enberg, casteyde.christian, Andrew Morton,
	netdev, bugzilla-daemon, bugme-daemon
In-Reply-To: <alpine.DEB.2.00.1105101619430.4023@router.home>

Le mardi 10 mai 2011 à 16:22 -0500, Christoph Lameter a écrit :
> On Tue, 10 May 2011, Eric Dumazet wrote:
> 
> > > No the other cpu cannot free the page since the page is pinned by
> > > the current cpu (see PageFrozen()).
> > >
> >
> > What happens then ? Other cpu calls kfree() on last nonfreed object for
> > this slab, and yet the page stay frozen ? How this page is going to be
> > freed at all ?
> 
> Yes the page stays frozen. The freed objects are used to replenish the
> percpu free list when it becomes empty.
> 
> The page is going to be freed when a kmalloc() finds that the per cpu
> freelist is empty and that the freelist of the page is also empty. Then
> interrupts are disabled, the old page is unfrozen and a new
> page is acquired for allocation.
> 
> > > > Maybe I am just tired tonight, this seems very obvious, I must miss
> > > > something.
> > >
> > > Yeah you are way off thinking about cpu to cpu concurrency issues that do
> > > not apply here.
> >
> > I fail to understand how current cpu can assert page ownership, if IRQs
> > are enabled, this seems obvious it cannot.
> 
> The cpu sets a page flag called PageFrozen() and points a per cpu pointer
> to the page.
> 
> 

So, if I understand you, there is no problem at all and no patch even
needed ? I can start a stress test and you guarantee there wont be a
crash ?

Sorry, its 5h11 in the morning here ;)




^ permalink raw reply

* Re: GIT net-2.6 rolled back 8 commits...
From: Eric Dumazet @ 2011-05-11  3:31 UTC (permalink / raw)
  To: David Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20110510.150814.226778453.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

Le mardi 10 mai 2011 à 15:08 -0700, David Miller a écrit :
> I made a mistake and applied to net-2.6 a patch from Eric Dumazet that
> only is applicable for net-next-2.6
> 
> I really don't want to have to toss Linus that commit and a revert commit
> just to fix it up.
> 
> So I rewound the net-2.6 tree by 8 commits.
> 
> So if you've pulled in the past 3 hours, please reset your pull and repull.
> 

Thanks David

Would it be possible you sync net-next-2.6 and pull net-2.6 in it ?

Eric


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: AT91: Remove fixed mapping for AT91RM9200 ethernet
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-05-11  4:02 UTC (permalink / raw)
  To: Andrew Victor, David S. Miller; +Cc: netdev, Nicolas Ferre, linux-arm-kernel
In-Reply-To: <20110511034901.GA22009@game.jcrosoft.org>

On 05:49 Wed 11 May     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 21:54 Sun 08 May     , Andrew Victor wrote:
> > The AT91RM9200 Ethernet controller still has a fixed IO mapping.
> > So:
> > * Remove the fixed IO mapping and AT91_VA_BASE_EMAC definition.
> > * Pass the physical base-address via platform-resources to the driver.
> > * Convert at91_ether.c driver to perform an ioremap().
> > * Ethernet PHY detection needs to be performed during the driver
> > initialization process, it can no longer be done first.
> we need to pass the irq too as the hw ip does not belong to Atmel
> so it can be attached to any irq
> 
> ca we split is in two file on for -net and the other one for at91 tree
forget we can not split it

David don't you mind if we apply it through the at91 tree

Best Regards,
J.
> 
> Best Regards,
> J.
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: AT91: Remove fixed mapping for AT91RM9200 ethernet
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-05-11  4:03 UTC (permalink / raw)
  To: Andrew Victor, David S. Miller; +Cc: netdev, Nicolas Ferre, linux-arm-kernel
In-Reply-To: <1304884489.6089.13.camel@redbox>

Hi,

	put david in cc

Best Regards,
J.
On 21:54 Sun 08 May     , Andrew Victor wrote:
> The AT91RM9200 Ethernet controller still has a fixed IO mapping.
> So:
> * Remove the fixed IO mapping and AT91_VA_BASE_EMAC definition.
> * Pass the physical base-address via platform-resources to the driver.
> * Convert at91_ether.c driver to perform an ioremap().
> * Ethernet PHY detection needs to be performed during the driver
> initialization process, it can no longer be done first.
> 
> Signed-off-by: Andrew Victor <linux@maxim.org.za>
> 
> 
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> index da2cc9a..bc4165a 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -29,11 +29,6 @@ static struct map_desc at91rm9200_io_desc[] __initdata = {
>  		.length		= SZ_4K,
>  		.type		= MT_DEVICE,
>  	}, {
> -		.virtual	= AT91_VA_BASE_EMAC,
> -		.pfn		= __phys_to_pfn(AT91RM9200_BASE_EMAC),
> -		.length		= SZ_16K,
> -		.type		= MT_DEVICE,
> -	}, {
>  		.virtual	= AT91_IO_VIRT_BASE - AT91RM9200_SRAM_SIZE,
>  		.pfn		= __phys_to_pfn(AT91RM9200_SRAM_BASE),
>  		.length		= AT91RM9200_SRAM_SIZE,
> diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
> index 70ab781..18319b1 100644
> --- a/arch/arm/mach-at91/at91rm9200_devices.c
> +++ b/arch/arm/mach-at91/at91rm9200_devices.c
> @@ -131,8 +131,8 @@ static struct at91_eth_data eth_data;
>  
>  static struct resource eth_resources[] = {
>  	[0] = {
> -		.start	= AT91_VA_BASE_EMAC,
> -		.end	= AT91_VA_BASE_EMAC + SZ_16K - 1,
> +		.start	= AT91RM9200_BASE_EMAC,
> +		.end	= AT91RM9200_BASE_EMAC + SZ_16K - 1,
>  		.flags	= IORESOURCE_MEM,
>  	},
>  	[1] = {
> diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
> index 3d64a75..36b6cfb 100644
> --- a/arch/arm/mach-at91/include/mach/hardware.h
> +++ b/arch/arm/mach-at91/include/mach/hardware.h
> @@ -63,7 +63,6 @@
>   * Virtual to Physical Address mapping for IO devices.
>   */
>  #define AT91_VA_BASE_SYS	AT91_IO_P2V(AT91_BASE_SYS)
> -#define AT91_VA_BASE_EMAC	AT91_IO_P2V(AT91RM9200_BASE_EMAC)
>  
>   /* Internal SRAM is mapped below the IO devices */
>  #define AT91_SRAM_MAX		SZ_1M
> diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
> index e07b314..3d9e662 100644
> --- a/drivers/net/arm/at91_ether.c
> +++ b/drivers/net/arm/at91_ether.c
> @@ -28,6 +28,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
>  #include <linux/gfp.h>
> +#include <linux/phy.h>
>  
>  #include <asm/io.h>
>  #include <asm/uaccess.h>
> @@ -49,21 +50,17 @@
>  /*
>   * Read from a EMAC register.
>   */
> -static inline unsigned long at91_emac_read(unsigned int reg)
> +static inline unsigned long at91_emac_read(struct at91_private *lp, unsigned int reg)
>  {
> -	void __iomem *emac_base = (void __iomem *)AT91_VA_BASE_EMAC;
> -
> -	return __raw_readl(emac_base + reg);
> +	return __raw_readl(lp->emac_base + reg);
>  }
>  
>  /*
>   * Write to a EMAC register.
>   */
> -static inline void at91_emac_write(unsigned int reg, unsigned long value)
> +static inline void at91_emac_write(struct at91_private *lp, unsigned int reg, unsigned long value)
>  {
> -	void __iomem *emac_base = (void __iomem *)AT91_VA_BASE_EMAC;
> -
> -	__raw_writel(value, emac_base + reg);
> +	__raw_writel(value, lp->emac_base + reg);
>  }
>  
>  /* ........................... PHY INTERFACE ........................... */
> @@ -73,32 +70,33 @@ static inline void at91_emac_write(unsigned int reg, unsigned long value)
>   * When not called from an interrupt-handler, access to the PHY must be
>   *  protected by a spinlock.
>   */
> -static void enable_mdi(void)
> +static void enable_mdi(struct at91_private *lp)
>  {
>  	unsigned long ctl;
>  
> -	ctl = at91_emac_read(AT91_EMAC_CTL);
> -	at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_MPE);	/* enable management port */
> +	ctl = at91_emac_read(lp, AT91_EMAC_CTL);
> +	at91_emac_write(lp, AT91_EMAC_CTL, ctl | AT91_EMAC_MPE);	/* enable management port */
>  }
>  
>  /*
>   * Disable the MDIO bit in the MAC control register
>   */
> -static void disable_mdi(void)
> +static void disable_mdi(struct at91_private *lp)
>  {
>  	unsigned long ctl;
>  
> -	ctl = at91_emac_read(AT91_EMAC_CTL);
> -	at91_emac_write(AT91_EMAC_CTL, ctl & ~AT91_EMAC_MPE);	/* disable management port */
> +	ctl = at91_emac_read(lp, AT91_EMAC_CTL);
> +	at91_emac_write(lp, AT91_EMAC_CTL, ctl & ~AT91_EMAC_MPE);	/* disable management port */
>  }
>  
>  /*
>   * Wait until the PHY operation is complete.
>   */
> -static inline void at91_phy_wait(void) {
> +static inline void at91_phy_wait(struct at91_private *lp)
> +{
>  	unsigned long timeout = jiffies + 2;
>  
> -	while (!(at91_emac_read(AT91_EMAC_SR) & AT91_EMAC_SR_IDLE)) {
> +	while (!(at91_emac_read(lp, AT91_EMAC_SR) & AT91_EMAC_SR_IDLE)) {
>  		if (time_after(jiffies, timeout)) {
>  			printk("at91_ether: MIO timeout\n");
>  			break;
> @@ -111,28 +109,28 @@ static inline void at91_phy_wait(void) {
>   * Write value to the a PHY register
>   * Note: MDI interface is assumed to already have been enabled.
>   */
> -static void write_phy(unsigned char phy_addr, unsigned char address, unsigned int value)
> +static void write_phy(struct at91_private *lp, unsigned char phy_addr, unsigned char address, unsigned int value)
>  {
> -	at91_emac_write(AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_W
> +	at91_emac_write(lp, AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_W
>  		| ((phy_addr & 0x1f) << 23) | (address << 18) | (value & AT91_EMAC_DATA));
>  
>  	/* Wait until IDLE bit in Network Status register is cleared */
> -	at91_phy_wait();
> +	at91_phy_wait(lp);
>  }
>  
>  /*
>   * Read value stored in a PHY register.
>   * Note: MDI interface is assumed to already have been enabled.
>   */
> -static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int *value)
> +static void read_phy(struct at91_private *lp, unsigned char phy_addr, unsigned char address, unsigned int *value)
>  {
> -	at91_emac_write(AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_R
> +	at91_emac_write(lp, AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_R
>  		| ((phy_addr & 0x1f) << 23) | (address << 18));
>  
>  	/* Wait until IDLE bit in Network Status register is cleared */
> -	at91_phy_wait();
> +	at91_phy_wait(lp);
>  
> -	*value = at91_emac_read(AT91_EMAC_MAN) & AT91_EMAC_DATA;
> +	*value = at91_emac_read(lp, AT91_EMAC_MAN) & AT91_EMAC_DATA;
>  }
>  
>  /* ........................... PHY MANAGEMENT .......................... */
> @@ -156,13 +154,13 @@ static void update_linkspeed(struct net_device *dev, int silent)
>  	}
>  
>  	/* Link up, or auto-negotiation still in progress */
> -	read_phy(lp->phy_address, MII_BMSR, &bmsr);
> -	read_phy(lp->phy_address, MII_BMCR, &bmcr);
> +	read_phy(lp, lp->phy_address, MII_BMSR, &bmsr);
> +	read_phy(lp, lp->phy_address, MII_BMCR, &bmcr);
>  	if (bmcr & BMCR_ANENABLE) {				/* AutoNegotiation is enabled */
>  		if (!(bmsr & BMSR_ANEGCOMPLETE))
>  			return;			/* Do nothing - another interrupt generated when negotiation complete */
>  
> -		read_phy(lp->phy_address, MII_LPA, &lpa);
> +		read_phy(lp, lp->phy_address, MII_LPA, &lpa);
>  		if ((lpa & LPA_100FULL) || (lpa & LPA_100HALF)) speed = SPEED_100;
>  		else speed = SPEED_10;
>  		if ((lpa & LPA_100FULL) || (lpa & LPA_10FULL)) duplex = DUPLEX_FULL;
> @@ -173,7 +171,7 @@ static void update_linkspeed(struct net_device *dev, int silent)
>  	}
>  
>  	/* Update the MAC */
> -	mac_cfg = at91_emac_read(AT91_EMAC_CFG) & ~(AT91_EMAC_SPD | AT91_EMAC_FD);
> +	mac_cfg = at91_emac_read(lp, AT91_EMAC_CFG) & ~(AT91_EMAC_SPD | AT91_EMAC_FD);
>  	if (speed == SPEED_100) {
>  		if (duplex == DUPLEX_FULL)		/* 100 Full Duplex */
>  			mac_cfg |= AT91_EMAC_SPD | AT91_EMAC_FD;
> @@ -184,7 +182,7 @@ static void update_linkspeed(struct net_device *dev, int silent)
>  			mac_cfg |= AT91_EMAC_FD;
>  		else {}					/* 10 Half Duplex */
>  	}
> -	at91_emac_write(AT91_EMAC_CFG, mac_cfg);
> +	at91_emac_write(lp, AT91_EMAC_CFG, mac_cfg);
>  
>  	if (!silent)
>  		printk(KERN_INFO "%s: Link now %i-%s\n", dev->name, speed, (duplex == DUPLEX_FULL) ? "FullDuplex" : "HalfDuplex");
> @@ -205,34 +203,34 @@ static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id)
>  	 * level-triggering.  We therefore have to check if the PHY actually has
>  	 * an IRQ pending.
>  	 */
> -	enable_mdi();
> +	enable_mdi(lp);
>  	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {
> -		read_phy(lp->phy_address, MII_DSINTR_REG, &phy);	/* ack interrupt in Davicom PHY */
> +		read_phy(lp, lp->phy_address, MII_DSINTR_REG, &phy);	/* ack interrupt in Davicom PHY */
>  		if (!(phy & (1 << 0)))
>  			goto done;
>  	}
>  	else if (lp->phy_type == MII_LXT971A_ID) {
> -		read_phy(lp->phy_address, MII_ISINTS_REG, &phy);	/* ack interrupt in Intel PHY */
> +		read_phy(lp, lp->phy_address, MII_ISINTS_REG, &phy);	/* ack interrupt in Intel PHY */
>  		if (!(phy & (1 << 2)))
>  			goto done;
>  	}
>  	else if (lp->phy_type == MII_BCM5221_ID) {
> -		read_phy(lp->phy_address, MII_BCMINTR_REG, &phy);	/* ack interrupt in Broadcom PHY */
> +		read_phy(lp, lp->phy_address, MII_BCMINTR_REG, &phy);	/* ack interrupt in Broadcom PHY */
>  		if (!(phy & (1 << 0)))
>  			goto done;
>  	}
>  	else if (lp->phy_type == MII_KS8721_ID) {
> -		read_phy(lp->phy_address, MII_TPISTATUS, &phy);		/* ack interrupt in Micrel PHY */
> +		read_phy(lp, lp->phy_address, MII_TPISTATUS, &phy);		/* ack interrupt in Micrel PHY */
>  		if (!(phy & ((1 << 2) | 1)))
>  			goto done;
>  	}
> -	else if (lp->phy_type == MII_T78Q21x3_ID) {			/* ack interrupt in Teridian PHY */
> -		read_phy(lp->phy_address, MII_T78Q21INT_REG, &phy);
> +	else if (lp->phy_type == MII_T78Q21x3_ID) {					/* ack interrupt in Teridian PHY */
> +		read_phy(lp, lp->phy_address, MII_T78Q21INT_REG, &phy);
>  		if (!(phy & ((1 << 2) | 1)))
>  			goto done;
>  	}
>  	else if (lp->phy_type == MII_DP83848_ID) {
> -		read_phy(lp->phy_address, MII_DPPHYSTS_REG, &phy);	/* ack interrupt in DP83848 PHY */
> +		read_phy(lp, lp->phy_address, MII_DPPHYSTS_REG, &phy);	/* ack interrupt in DP83848 PHY */
>  		if (!(phy & (1 << 7)))
>  			goto done;
>  	}
> @@ -240,7 +238,7 @@ static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id)
>  	update_linkspeed(dev, 0);
>  
>  done:
> -	disable_mdi();
> +	disable_mdi(lp);
>  
>  	return IRQ_HANDLED;
>  }
> @@ -271,41 +269,41 @@ static void enable_phyirq(struct net_device *dev)
>  	}
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  
>  	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {	/* for Davicom PHY */
> -		read_phy(lp->phy_address, MII_DSINTR_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_DSINTR_REG, &dsintr);
>  		dsintr = dsintr & ~0xf00;		/* clear bits 8..11 */
> -		write_phy(lp->phy_address, MII_DSINTR_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_DSINTR_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_LXT971A_ID) {	/* for Intel PHY */
> -		read_phy(lp->phy_address, MII_ISINTE_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_ISINTE_REG, &dsintr);
>  		dsintr = dsintr | 0xf2;			/* set bits 1, 4..7 */
> -		write_phy(lp->phy_address, MII_ISINTE_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_ISINTE_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_BCM5221_ID) {	/* for Broadcom PHY */
>  		dsintr = (1 << 15) | ( 1 << 14);
> -		write_phy(lp->phy_address, MII_BCMINTR_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_BCMINTR_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_KS8721_ID) {	/* for Micrel PHY */
>  		dsintr = (1 << 10) | ( 1 << 8);
> -		write_phy(lp->phy_address, MII_TPISTATUS, dsintr);
> +		write_phy(lp, lp->phy_address, MII_TPISTATUS, dsintr);
>  	}
>  	else if (lp->phy_type == MII_T78Q21x3_ID) {	/* for Teridian PHY */
> -		read_phy(lp->phy_address, MII_T78Q21INT_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_T78Q21INT_REG, &dsintr);
>  		dsintr = dsintr | 0x500;		/* set bits 8, 10 */
> -		write_phy(lp->phy_address, MII_T78Q21INT_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_T78Q21INT_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_DP83848_ID) {	/* National Semiconductor DP83848 PHY */
> -		read_phy(lp->phy_address, MII_DPMISR_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_DPMISR_REG, &dsintr);
>  		dsintr = dsintr | 0x3c;			/* set bits 2..5 */
> -		write_phy(lp->phy_address, MII_DPMISR_REG, dsintr);
> -		read_phy(lp->phy_address, MII_DPMICR_REG, &dsintr);
> +		write_phy(lp, lp->phy_address, MII_DPMISR_REG, dsintr);
> +		read_phy(lp, lp->phy_address, MII_DPMICR_REG, &dsintr);
>  		dsintr = dsintr | 0x3;			/* set bits 0,1 */
> -		write_phy(lp->phy_address, MII_DPMICR_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_DPMICR_REG, dsintr);
>  	}
>  
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  }
>  
> @@ -325,43 +323,43 @@ static void disable_phyirq(struct net_device *dev)
>  	}
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  
>  	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {	/* for Davicom PHY */
> -		read_phy(lp->phy_address, MII_DSINTR_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_DSINTR_REG, &dsintr);
>  		dsintr = dsintr | 0xf00;			/* set bits 8..11 */
> -		write_phy(lp->phy_address, MII_DSINTR_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_DSINTR_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_LXT971A_ID) {	/* for Intel PHY */
> -		read_phy(lp->phy_address, MII_ISINTE_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_ISINTE_REG, &dsintr);
>  		dsintr = dsintr & ~0xf2;			/* clear bits 1, 4..7 */
> -		write_phy(lp->phy_address, MII_ISINTE_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_ISINTE_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_BCM5221_ID) {	/* for Broadcom PHY */
> -		read_phy(lp->phy_address, MII_BCMINTR_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_BCMINTR_REG, &dsintr);
>  		dsintr = ~(1 << 14);
> -		write_phy(lp->phy_address, MII_BCMINTR_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_BCMINTR_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_KS8721_ID) {	/* for Micrel PHY */
> -		read_phy(lp->phy_address, MII_TPISTATUS, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_TPISTATUS, &dsintr);
>  		dsintr = ~((1 << 10) | (1 << 8));
> -		write_phy(lp->phy_address, MII_TPISTATUS, dsintr);
> +		write_phy(lp, lp->phy_address, MII_TPISTATUS, dsintr);
>  	}
>  	else if (lp->phy_type == MII_T78Q21x3_ID) {	/* for Teridian PHY */
> -		read_phy(lp->phy_address, MII_T78Q21INT_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_T78Q21INT_REG, &dsintr);
>  		dsintr = dsintr & ~0x500;			/* clear bits 8, 10 */
> -		write_phy(lp->phy_address, MII_T78Q21INT_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_T78Q21INT_REG, dsintr);
>  	}
>  	else if (lp->phy_type == MII_DP83848_ID) {	/* National Semiconductor DP83848 PHY */
> -		read_phy(lp->phy_address, MII_DPMICR_REG, &dsintr);
> +		read_phy(lp, lp->phy_address, MII_DPMICR_REG, &dsintr);
>  		dsintr = dsintr & ~0x3;				/* clear bits 0, 1 */
> -		write_phy(lp->phy_address, MII_DPMICR_REG, dsintr);
> -		read_phy(lp->phy_address, MII_DPMISR_REG, &dsintr);
> +		write_phy(lp, lp->phy_address, MII_DPMICR_REG, dsintr);
> +		read_phy(lp, lp->phy_address, MII_DPMISR_REG, &dsintr);
>  		dsintr = dsintr & ~0x3c;			/* clear bits 2..5 */
> -		write_phy(lp->phy_address, MII_DPMISR_REG, dsintr);
> +		write_phy(lp, lp->phy_address, MII_DPMISR_REG, dsintr);
>  	}
>  
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  
>  	free_irq(irq_number, dev);			/* Free interrupt handler */
> @@ -377,17 +375,17 @@ static void reset_phy(struct net_device *dev)
>  	unsigned int bmcr;
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  
>  	/* Perform PHY reset */
> -	write_phy(lp->phy_address, MII_BMCR, BMCR_RESET);
> +	write_phy(lp, lp->phy_address, MII_BMCR, BMCR_RESET);
>  
>  	/* Wait until PHY reset is complete */
>  	do {
> -		read_phy(lp->phy_address, MII_BMCR, &bmcr);
> +		read_phy(lp, lp->phy_address, MII_BMCR, &bmcr);
>  	} while (!(bmcr & BMCR_RESET));
>  
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  }
>  #endif
> @@ -397,13 +395,37 @@ static void at91ether_check_link(unsigned long dev_id)
>  	struct net_device *dev = (struct net_device *) dev_id;
>  	struct at91_private *lp = netdev_priv(dev);
>  
> -	enable_mdi();
> +	enable_mdi(lp);
>  	update_linkspeed(dev, 1);
> -	disable_mdi();
> +	disable_mdi(lp);
>  
>  	mod_timer(&lp->check_timer, jiffies + LINK_POLL_INTERVAL);
>  }
>  
> +/*
> + * Perform any PHY-specific initialization.
> + */
> +static void __init initialize_phy(struct at91_private *lp)
> +{
> +	unsigned int val;
> +
> +	spin_lock_irq(&lp->lock);
> +	enable_mdi(lp);
> +
> +	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {
> +		read_phy(lp, lp->phy_address, MII_DSCR_REG, &val);
> +		if ((val & (1 << 10)) == 0)			/* DSCR bit 10 is 0 -- fiber mode */
> +			lp->phy_media = PORT_FIBRE;
> +	} else if (machine_is_csb337()) {
> +		/* mix link activity status into LED2 link state */
> +		write_phy(lp, lp->phy_address, MII_LEDCTRL_REG, 0x0d22);
> +	} else if (machine_is_ecbat91())
> +		write_phy(lp, lp->phy_address, MII_LEDCTRL_REG, 0x156A);
> +
> +	disable_mdi(lp);
> +	spin_unlock_irq(&lp->lock);
> +}
> +
>  /* ......................... ADDRESS MANAGEMENT ........................ */
>  
>  /*
> @@ -452,17 +474,19 @@ static short __init unpack_mac_address(struct net_device *dev, unsigned int hi,
>   */
>  static void __init get_mac_address(struct net_device *dev)
>  {
> +	struct at91_private *lp = netdev_priv(dev);
> +
>  	/* Check Specific-Address 1 */
> -	if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA1H), at91_emac_read(AT91_EMAC_SA1L)))
> +	if (unpack_mac_address(dev, at91_emac_read(lp, AT91_EMAC_SA1H), at91_emac_read(lp, AT91_EMAC_SA1L)))
>  		return;
>  	/* Check Specific-Address 2 */
> -	if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA2H), at91_emac_read(AT91_EMAC_SA2L)))
> +	if (unpack_mac_address(dev, at91_emac_read(lp, AT91_EMAC_SA2H), at91_emac_read(lp, AT91_EMAC_SA2L)))
>  		return;
>  	/* Check Specific-Address 3 */
> -	if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA3H), at91_emac_read(AT91_EMAC_SA3L)))
> +	if (unpack_mac_address(dev, at91_emac_read(lp, AT91_EMAC_SA3H), at91_emac_read(lp, AT91_EMAC_SA3L)))
>  		return;
>  	/* Check Specific-Address 4 */
> -	if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA4H), at91_emac_read(AT91_EMAC_SA4L)))
> +	if (unpack_mac_address(dev, at91_emac_read(lp, AT91_EMAC_SA4H), at91_emac_read(lp, AT91_EMAC_SA4L)))
>  		return;
>  
>  	printk(KERN_ERR "at91_ether: Your bootloader did not configure a MAC address.\n");
> @@ -473,11 +497,13 @@ static void __init get_mac_address(struct net_device *dev)
>   */
>  static void update_mac_address(struct net_device *dev)
>  {
> -	at91_emac_write(AT91_EMAC_SA1L, (dev->dev_addr[3] << 24) | (dev->dev_addr[2] << 16) | (dev->dev_addr[1] << 8) | (dev->dev_addr[0]));
> -	at91_emac_write(AT91_EMAC_SA1H, (dev->dev_addr[5] << 8) | (dev->dev_addr[4]));
> +	struct at91_private *lp = netdev_priv(dev);
> +
> +	at91_emac_write(lp, AT91_EMAC_SA1L, (dev->dev_addr[3] << 24) | (dev->dev_addr[2] << 16) | (dev->dev_addr[1] << 8) | (dev->dev_addr[0]));
> +	at91_emac_write(lp, AT91_EMAC_SA1H, (dev->dev_addr[5] << 8) | (dev->dev_addr[4]));
>  
> -	at91_emac_write(AT91_EMAC_SA2L, 0);
> -	at91_emac_write(AT91_EMAC_SA2H, 0);
> +	at91_emac_write(lp, AT91_EMAC_SA2L, 0);
> +	at91_emac_write(lp, AT91_EMAC_SA2H, 0);
>  }
>  
>  /*
> @@ -557,6 +583,7 @@ static int hash_get_index(__u8 *addr)
>   */
>  static void at91ether_sethashtable(struct net_device *dev)
>  {
> +	struct at91_private *lp = netdev_priv(dev);
>  	struct netdev_hw_addr *ha;
>  	unsigned long mc_filter[2];
>  	unsigned int bitnr;
> @@ -568,8 +595,8 @@ static void at91ether_sethashtable(struct net_device *dev)
>  		mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
>  	}
>  
> -	at91_emac_write(AT91_EMAC_HSL, mc_filter[0]);
> -	at91_emac_write(AT91_EMAC_HSH, mc_filter[1]);
> +	at91_emac_write(lp, AT91_EMAC_HSL, mc_filter[0]);
> +	at91_emac_write(lp, AT91_EMAC_HSH, mc_filter[1]);
>  }
>  
>  /*
> @@ -577,9 +604,10 @@ static void at91ether_sethashtable(struct net_device *dev)
>   */
>  static void at91ether_set_multicast_list(struct net_device *dev)
>  {
> +	struct at91_private *lp = netdev_priv(dev);
>  	unsigned long cfg;
>  
> -	cfg = at91_emac_read(AT91_EMAC_CFG);
> +	cfg = at91_emac_read(lp, AT91_EMAC_CFG);
>  
>  	if (dev->flags & IFF_PROMISC)			/* Enable promiscuous mode */
>  		cfg |= AT91_EMAC_CAF;
> @@ -587,34 +615,37 @@ static void at91ether_set_multicast_list(struct net_device *dev)
>  		cfg &= ~AT91_EMAC_CAF;
>  
>  	if (dev->flags & IFF_ALLMULTI) {		/* Enable all multicast mode */
> -		at91_emac_write(AT91_EMAC_HSH, -1);
> -		at91_emac_write(AT91_EMAC_HSL, -1);
> +		at91_emac_write(lp, AT91_EMAC_HSH, -1);
> +		at91_emac_write(lp, AT91_EMAC_HSL, -1);
>  		cfg |= AT91_EMAC_MTI;
>  	} else if (!netdev_mc_empty(dev)) { /* Enable specific multicasts */
>  		at91ether_sethashtable(dev);
>  		cfg |= AT91_EMAC_MTI;
>  	} else if (dev->flags & (~IFF_ALLMULTI)) {	/* Disable all multicast mode */
> -		at91_emac_write(AT91_EMAC_HSH, 0);
> -		at91_emac_write(AT91_EMAC_HSL, 0);
> +		at91_emac_write(lp, AT91_EMAC_HSH, 0);
> +		at91_emac_write(lp, AT91_EMAC_HSL, 0);
>  		cfg &= ~AT91_EMAC_MTI;
>  	}
>  
> -	at91_emac_write(AT91_EMAC_CFG, cfg);
> +	at91_emac_write(lp, AT91_EMAC_CFG, cfg);
>  }
>  
>  /* ......................... ETHTOOL SUPPORT ........................... */
>  
>  static int mdio_read(struct net_device *dev, int phy_id, int location)
>  {
> +	struct at91_private *lp = netdev_priv(dev);
>  	unsigned int value;
>  
> -	read_phy(phy_id, location, &value);
> +	read_phy(lp, phy_id, location, &value);
>  	return value;
>  }
>  
>  static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
>  {
> -	write_phy(phy_id, location, value);
> +	struct at91_private *lp = netdev_priv(dev);
> +
> +	write_phy(lp, phy_id, location, value);
>  }
>  
>  static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> @@ -623,11 +654,11 @@ static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cm
>  	int ret;
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  
>  	ret = mii_ethtool_gset(&lp->mii, cmd);
>  
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  
>  	if (lp->phy_media == PORT_FIBRE) {		/* override media type since mii.c doesn't know */
> @@ -644,11 +675,11 @@ static int at91ether_set_settings(struct net_device *dev, struct ethtool_cmd *cm
>  	int ret;
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  
>  	ret = mii_ethtool_sset(&lp->mii, cmd);
>  
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  
>  	return ret;
> @@ -660,11 +691,11 @@ static int at91ether_nwayreset(struct net_device *dev)
>  	int ret;
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  
>  	ret = mii_nway_restart(&lp->mii);
>  
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  
>  	return ret;
> @@ -694,9 +725,9 @@ static int at91ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
>  		return -EINVAL;
>  
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  	res = generic_mii_ioctl(&lp->mii, if_mii(rq), cmd, NULL);
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  
>  	return res;
> @@ -729,11 +760,11 @@ static void at91ether_start(struct net_device *dev)
>  	lp->rxBuffIndex = 0;
>  
>  	/* Program address of descriptor list in Rx Buffer Queue register */
> -	at91_emac_write(AT91_EMAC_RBQP, (unsigned long) dlist_phys);
> +	at91_emac_write(lp, AT91_EMAC_RBQP, (unsigned long) dlist_phys);
>  
>  	/* Enable Receive and Transmit */
> -	ctl = at91_emac_read(AT91_EMAC_CTL);
> -	at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_RE | AT91_EMAC_TE);
> +	ctl = at91_emac_read(lp, AT91_EMAC_CTL);
> +	at91_emac_write(lp, AT91_EMAC_CTL, ctl | AT91_EMAC_RE | AT91_EMAC_TE);
>  }
>  
>  /*
> @@ -750,8 +781,8 @@ static int at91ether_open(struct net_device *dev)
>  	clk_enable(lp->ether_clk);		/* Re-enable Peripheral clock */
>  
>  	/* Clear internal statistics */
> -	ctl = at91_emac_read(AT91_EMAC_CTL);
> -	at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_CSR);
> +	ctl = at91_emac_read(lp, AT91_EMAC_CTL);
> +	at91_emac_write(lp, AT91_EMAC_CTL, ctl | AT91_EMAC_CSR);
>  
>  	/* Update the MAC address (incase user has changed it) */
>  	update_mac_address(dev);
> @@ -760,15 +791,15 @@ static int at91ether_open(struct net_device *dev)
>  	enable_phyirq(dev);
>  
>  	/* Enable MAC interrupts */
> -	at91_emac_write(AT91_EMAC_IER, AT91_EMAC_RCOM | AT91_EMAC_RBNA
> +	at91_emac_write(lp, AT91_EMAC_IER, AT91_EMAC_RCOM | AT91_EMAC_RBNA
>  				| AT91_EMAC_TUND | AT91_EMAC_RTRY | AT91_EMAC_TCOM
>  				| AT91_EMAC_ROVR | AT91_EMAC_ABT);
>  
>  	/* Determine current link speed */
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  	update_linkspeed(dev, 0);
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  
>  	at91ether_start(dev);
> @@ -785,14 +816,14 @@ static int at91ether_close(struct net_device *dev)
>  	unsigned long ctl;
>  
>  	/* Disable Receiver and Transmitter */
> -	ctl = at91_emac_read(AT91_EMAC_CTL);
> -	at91_emac_write(AT91_EMAC_CTL, ctl & ~(AT91_EMAC_TE | AT91_EMAC_RE));
> +	ctl = at91_emac_read(lp, AT91_EMAC_CTL);
> +	at91_emac_write(lp, AT91_EMAC_CTL, ctl & ~(AT91_EMAC_TE | AT91_EMAC_RE));
>  
>  	/* Disable PHY interrupt */
>  	disable_phyirq(dev);
>  
>  	/* Disable MAC interrupts */
> -	at91_emac_write(AT91_EMAC_IDR, AT91_EMAC_RCOM | AT91_EMAC_RBNA
> +	at91_emac_write(lp, AT91_EMAC_IDR, AT91_EMAC_RCOM | AT91_EMAC_RBNA
>  				| AT91_EMAC_TUND | AT91_EMAC_RTRY | AT91_EMAC_TCOM
>  				| AT91_EMAC_ROVR | AT91_EMAC_ABT);
>  
> @@ -810,7 +841,7 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  {
>  	struct at91_private *lp = netdev_priv(dev);
>  
> -	if (at91_emac_read(AT91_EMAC_TSR) & AT91_EMAC_TSR_BNQ) {
> +	if (at91_emac_read(lp, AT91_EMAC_TSR) & AT91_EMAC_TSR_BNQ) {
>  		netif_stop_queue(dev);
>  
>  		/* Store packet information (to free when Tx completed) */
> @@ -820,9 +851,9 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  		dev->stats.tx_bytes += skb->len;
>  
>  		/* Set address of the data in the Transmit Address register */
> -		at91_emac_write(AT91_EMAC_TAR, lp->skb_physaddr);
> +		at91_emac_write(lp, AT91_EMAC_TAR, lp->skb_physaddr);
>  		/* Set length of the packet in the Transmit Control register */
> -		at91_emac_write(AT91_EMAC_TCR, skb->len);
> +		at91_emac_write(lp, AT91_EMAC_TCR, skb->len);
>  
>  	} else {
>  		printk(KERN_ERR "at91_ether.c: at91ether_start_xmit() called, but device is busy!\n");
> @@ -839,31 +870,32 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev)
>   */
>  static struct net_device_stats *at91ether_stats(struct net_device *dev)
>  {
> +	struct at91_private *lp = netdev_priv(dev);
>  	int ale, lenerr, seqe, lcol, ecol;
>  
>  	if (netif_running(dev)) {
> -		dev->stats.rx_packets += at91_emac_read(AT91_EMAC_OK);		/* Good frames received */
> -		ale = at91_emac_read(AT91_EMAC_ALE);
> +		dev->stats.rx_packets += at91_emac_read(lp, AT91_EMAC_OK);	/* Good frames received */
> +		ale = at91_emac_read(lp, AT91_EMAC_ALE);
>  		dev->stats.rx_frame_errors += ale;				/* Alignment errors */
> -		lenerr = at91_emac_read(AT91_EMAC_ELR) + at91_emac_read(AT91_EMAC_USF);
> +		lenerr = at91_emac_read(lp, AT91_EMAC_ELR) + at91_emac_read(lp, AT91_EMAC_USF);
>  		dev->stats.rx_length_errors += lenerr;				/* Excessive Length or Undersize Frame error */
> -		seqe = at91_emac_read(AT91_EMAC_SEQE);
> +		seqe = at91_emac_read(lp, AT91_EMAC_SEQE);
>  		dev->stats.rx_crc_errors += seqe;				/* CRC error */
> -		dev->stats.rx_fifo_errors += at91_emac_read(AT91_EMAC_DRFC);	/* Receive buffer not available */
> +		dev->stats.rx_fifo_errors += at91_emac_read(lp, AT91_EMAC_DRFC);/* Receive buffer not available */
>  		dev->stats.rx_errors += (ale + lenerr + seqe
> -			+ at91_emac_read(AT91_EMAC_CDE) + at91_emac_read(AT91_EMAC_RJB));
> +			+ at91_emac_read(lp, AT91_EMAC_CDE) + at91_emac_read(lp, AT91_EMAC_RJB));
>  
> -		dev->stats.tx_packets += at91_emac_read(AT91_EMAC_FRA);		/* Frames successfully transmitted */
> -		dev->stats.tx_fifo_errors += at91_emac_read(AT91_EMAC_TUE);	/* Transmit FIFO underruns */
> -		dev->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE);	/* Carrier Sense errors */
> -		dev->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */
> +		dev->stats.tx_packets += at91_emac_read(lp, AT91_EMAC_FRA);	/* Frames successfully transmitted */
> +		dev->stats.tx_fifo_errors += at91_emac_read(lp, AT91_EMAC_TUE);	/* Transmit FIFO underruns */
> +		dev->stats.tx_carrier_errors += at91_emac_read(lp, AT91_EMAC_CSE);	/* Carrier Sense errors */
> +		dev->stats.tx_heartbeat_errors += at91_emac_read(lp, AT91_EMAC_SQEE);/* Heartbeat error */
>  
> -		lcol = at91_emac_read(AT91_EMAC_LCOL);
> -		ecol = at91_emac_read(AT91_EMAC_ECOL);
> +		lcol = at91_emac_read(lp, AT91_EMAC_LCOL);
> +		ecol = at91_emac_read(lp, AT91_EMAC_ECOL);
>  		dev->stats.tx_window_errors += lcol;			/* Late collisions */
>  		dev->stats.tx_aborted_errors += ecol;			/* 16 collisions */
>  
> -		dev->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + lcol + ecol);
> +		dev->stats.collisions += (at91_emac_read(lp, AT91_EMAC_SCOL) + at91_emac_read(lp, AT91_EMAC_MCOL) + lcol + ecol);
>  	}
>  	return &dev->stats;
>  }
> @@ -920,7 +952,7 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id)
>  
>  	/* MAC Interrupt Status register indicates what interrupts are pending.
>  	   It is automatically cleared once read. */
> -	intstatus = at91_emac_read(AT91_EMAC_ISR);
> +	intstatus = at91_emac_read(lp, AT91_EMAC_ISR);
>  
>  	if (intstatus & AT91_EMAC_RCOM)		/* Receive complete */
>  		at91ether_rx(dev);
> @@ -940,9 +972,9 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id)
>  
>  	/* Work-around for Errata #11 */
>  	if (intstatus & AT91_EMAC_RBNA) {
> -		ctl = at91_emac_read(AT91_EMAC_CTL);
> -		at91_emac_write(AT91_EMAC_CTL, ctl & ~AT91_EMAC_RE);
> -		at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_RE);
> +		ctl = at91_emac_read(lp, AT91_EMAC_CTL);
> +		at91_emac_write(lp, AT91_EMAC_CTL, ctl & ~AT91_EMAC_RE);
> +		at91_emac_write(lp, AT91_EMAC_CTL, ctl | AT91_EMAC_RE);
>  	}
>  
>  	if (intstatus & AT91_EMAC_ROVR)
> @@ -978,189 +1010,198 @@ static const struct net_device_ops at91ether_netdev_ops = {
>  };
>  
>  /*
> - * Initialize the ethernet interface
> + * Detect the PHY type, and its address.
> + */
> +static int __init at91ether_phy_detect(struct at91_private *lp)
> +{
> +	unsigned int phyid1, phyid2;
> +	unsigned long phy_id;
> +	unsigned short phy_address = 0;
> +
> +	while (phy_address < PHY_MAX_ADDR) {
> +		/* Read the PHY ID registers */
> +		enable_mdi(lp);
> +		read_phy(lp, phy_address, MII_PHYSID1, &phyid1);
> +		read_phy(lp, phy_address, MII_PHYSID2, &phyid2);
> +		disable_mdi(lp);
> +
> +		phy_id = (phyid1 << 16) | (phyid2 & 0xfff0);
> +		switch (phy_id) {
> +			case MII_DM9161_ID:		/* Davicom 9161: PHY_ID1 = 0x181, PHY_ID2 = B881 */
> +			case MII_DM9161A_ID:		/* Davicom 9161A: PHY_ID1 = 0x181, PHY_ID2 = B8A0 */
> +			case MII_LXT971A_ID:		/* Intel LXT971A: PHY_ID1 = 0x13, PHY_ID2 = 78E0 */
> +			case MII_RTL8201_ID:		/* Realtek RTL8201: PHY_ID1 = 0, PHY_ID2 = 0x8201 */
> +			case MII_BCM5221_ID:		/* Broadcom BCM5221: PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */
> +			case MII_DP83847_ID:		/* National Semiconductor DP83847:  */
> +			case MII_DP83848_ID:		/* National Semiconductor DP83848:  */
> +			case MII_AC101L_ID:		/* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */
> +			case MII_KS8721_ID:		/* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */
> +			case MII_T78Q21x3_ID:		/* Teridian 78Q21x3: PHY_ID1 = 0x0E, PHY_ID2 = 7237 */
> +			case MII_LAN83C185_ID:		/* SMSC LAN83C185: PHY_ID1 = 0x0007, PHY_ID2 = 0xC0A1 */
> +				/* store detected values */
> +				lp->phy_type = phy_id;		/* Type of PHY connected */
> +				lp->phy_address = phy_address;	/* MDI address of PHY */
> +				return 1;
> +		}
> +
> +		phy_address++;
> +	}
> +
> +	return 0;		/* not detected */
> +}
> +
> +
> +/*
> + * Detect MAC & PHY and perform ethernet interface initialization
>   */
> -static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address,
> -			struct platform_device *pdev, struct clk *ether_clk)
> +static int __init at91ether_probe(struct platform_device *pdev)
>  {
>  	struct at91_eth_data *board_data = pdev->dev.platform_data;
> +	struct resource *regs;
>  	struct net_device *dev;
>  	struct at91_private *lp;
> -	unsigned int val;
>  	int res;
>  
> +	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!regs)
> +		return -ENOENT;
> +
>  	dev = alloc_etherdev(sizeof(struct at91_private));
>  	if (!dev)
>  		return -ENOMEM;
>  
> -	dev->base_addr = AT91_VA_BASE_EMAC;
> -	dev->irq = AT91RM9200_ID_EMAC;
> +	lp = netdev_priv(dev);
> +	lp->board_data = *board_data;
> +	spin_lock_init(&lp->lock);
> +
> +	dev->base_addr = regs->start;		/* physical base address */
> +	lp->emac_base = ioremap(regs->start, regs->end - regs->start + 1);
> +	if (!lp->emac_base) {
> +		res = -ENOMEM;
> +		goto err_free_dev;
> +	}
> +
> +	/* Clock */
> +	lp->ether_clk = clk_get(&pdev->dev, "ether_clk");
> +	if (IS_ERR(lp->ether_clk)) {
> +		res = -ENODEV;
> +		goto err_ioumap;
> +	}
> +	clk_enable(lp->ether_clk);
>  
>  	/* Install the interrupt handler */
> +	dev->irq = platform_get_irq(pdev, 0);
>  	if (request_irq(dev->irq, at91ether_interrupt, 0, dev->name, dev)) {
> -		free_netdev(dev);
> -		return -EBUSY;
> +		res = -EBUSY;
> +		goto err_disable_clock;
>  	}
>  
>  	/* Allocate memory for DMA Receive descriptors */
> -	lp = netdev_priv(dev);
>  	lp->dlist = (struct recv_desc_bufs *) dma_alloc_coherent(NULL, sizeof(struct recv_desc_bufs), (dma_addr_t *) &lp->dlist_phys, GFP_KERNEL);
>  	if (lp->dlist == NULL) {
> -		free_irq(dev->irq, dev);
> -		free_netdev(dev);
> -		return -ENOMEM;
> +		res = -ENOMEM;
> +		goto err_free_irq;
>  	}
> -	lp->board_data = *board_data;
> -	lp->ether_clk = ether_clk;
> -	platform_set_drvdata(pdev, dev);
> -
> -	spin_lock_init(&lp->lock);
>  
>  	ether_setup(dev);
>  	dev->netdev_ops = &at91ether_netdev_ops;
>  	dev->ethtool_ops = &at91ether_ethtool_ops;
> -
> +	platform_set_drvdata(pdev, dev);
>  	SET_NETDEV_DEV(dev, &pdev->dev);
>  
>  	get_mac_address(dev);		/* Get ethernet address and store it in dev->dev_addr */
>  	update_mac_address(dev);	/* Program ethernet address into MAC */
>  
> -	at91_emac_write(AT91_EMAC_CTL, 0);
> +	at91_emac_write(lp, AT91_EMAC_CTL, 0);
>  
> -	if (lp->board_data.is_rmii)
> -		at91_emac_write(AT91_EMAC_CFG, AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG | AT91_EMAC_RMII);
> +	if (board_data->is_rmii)
> +		at91_emac_write(lp, AT91_EMAC_CFG, AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG | AT91_EMAC_RMII);
>  	else
> -		at91_emac_write(AT91_EMAC_CFG, AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG);
> +		at91_emac_write(lp, AT91_EMAC_CFG, AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG);
>  
> -	/* Perform PHY-specific initialization */
> -	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> -	if ((phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) {
> -		read_phy(phy_address, MII_DSCR_REG, &val);
> -		if ((val & (1 << 10)) == 0)			/* DSCR bit 10 is 0 -- fiber mode */
> -			lp->phy_media = PORT_FIBRE;
> -	} else if (machine_is_csb337()) {
> -		/* mix link activity status into LED2 link state */
> -		write_phy(phy_address, MII_LEDCTRL_REG, 0x0d22);
> -	} else if (machine_is_ecbat91())
> -		write_phy(phy_address, MII_LEDCTRL_REG, 0x156A);
> +	/* Detect PHY */
> +	if (!at91ether_phy_detect(lp)) {
> +		printk(KERN_ERR "at91_ether: Could not detect ethernet PHY\n");
> +		res = -ENODEV;
> +		goto err_free_dmamem;
> +	}
>  
> -	disable_mdi();
> -	spin_unlock_irq(&lp->lock);
> +	initialize_phy(lp);
>  
>  	lp->mii.dev = dev;		/* Support for ethtool */
>  	lp->mii.mdio_read = mdio_read;
>  	lp->mii.mdio_write = mdio_write;
> -	lp->mii.phy_id = phy_address;
> +	lp->mii.phy_id = lp->phy_address;
>  	lp->mii.phy_id_mask = 0x1f;
>  	lp->mii.reg_num_mask = 0x1f;
>  
> -	lp->phy_type = phy_type;	/* Type of PHY connected */
> -	lp->phy_address = phy_address;	/* MDI address of PHY */
> -
>  	/* Register the network interface */
>  	res = register_netdev(dev);
> -	if (res) {
> -		free_irq(dev->irq, dev);
> -		free_netdev(dev);
> -		dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
> -		return res;
> -	}
> +	if (res)
> +		goto err_free_dmamem;
>  
>  	/* Determine current link speed */
>  	spin_lock_irq(&lp->lock);
> -	enable_mdi();
> +	enable_mdi(lp);
>  	update_linkspeed(dev, 0);
> -	disable_mdi();
> +	disable_mdi(lp);
>  	spin_unlock_irq(&lp->lock);
>  	netif_carrier_off(dev);		/* will be enabled in open() */
>  
> -	/* If board has no PHY IRQ, use a timer to poll the PHY */
> -	if (!lp->board_data.phy_irq_pin) {
> +	if (board_data->phy_irq_pin)
> +		gpio_request(board_data->phy_irq_pin, "ethernet_phy");
> +	else {
> +		/* If board has no PHY IRQ, use a timer to poll the PHY */
>  		init_timer(&lp->check_timer);
>  		lp->check_timer.data = (unsigned long)dev;
>  		lp->check_timer.function = at91ether_check_link;
> -	} else if (lp->board_data.phy_irq_pin >= 32)
> -		gpio_request(lp->board_data.phy_irq_pin, "ethernet_phy");
> +	}
>  
>  	/* Display ethernet banner */
>  	printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%pM)\n",
>  	       dev->name, (uint) dev->base_addr, dev->irq,
> -	       at91_emac_read(AT91_EMAC_CFG) & AT91_EMAC_SPD ? "100-" : "10-",
> -	       at91_emac_read(AT91_EMAC_CFG) & AT91_EMAC_FD ? "FullDuplex" : "HalfDuplex",
> +	       at91_emac_read(lp, AT91_EMAC_CFG) & AT91_EMAC_SPD ? "100-" : "10-",
> +	       at91_emac_read(lp, AT91_EMAC_CFG) & AT91_EMAC_FD ? "FullDuplex" : "HalfDuplex",
>  	       dev->dev_addr);
> -	if ((phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID))
> +	if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID))
>  		printk(KERN_INFO "%s: Davicom 9161 PHY %s\n", dev->name, (lp->phy_media == PORT_FIBRE) ? "(Fiber)" : "(Copper)");
> -	else if (phy_type == MII_LXT971A_ID)
> +	else if (lp->phy_type == MII_LXT971A_ID)
>  		printk(KERN_INFO "%s: Intel LXT971A PHY\n", dev->name);
> -	else if (phy_type == MII_RTL8201_ID)
> +	else if (lp->phy_type == MII_RTL8201_ID)
>  		printk(KERN_INFO "%s: Realtek RTL8201(B)L PHY\n", dev->name);
> -	else if (phy_type == MII_BCM5221_ID)
> +	else if (lp->phy_type == MII_BCM5221_ID)
>  		printk(KERN_INFO "%s: Broadcom BCM5221 PHY\n", dev->name);
> -	else if (phy_type == MII_DP83847_ID)
> +	else if (lp->phy_type == MII_DP83847_ID)
>  		printk(KERN_INFO "%s: National Semiconductor DP83847 PHY\n", dev->name);
> -	else if (phy_type == MII_DP83848_ID)
> +	else if (lp->phy_type == MII_DP83848_ID)
>  		printk(KERN_INFO "%s: National Semiconductor DP83848 PHY\n", dev->name);
> -	else if (phy_type == MII_AC101L_ID)
> +	else if (lp->phy_type == MII_AC101L_ID)
>  		printk(KERN_INFO "%s: Altima AC101L PHY\n", dev->name);
> -	else if (phy_type == MII_KS8721_ID)
> +	else if (lp->phy_type == MII_KS8721_ID)
>  		printk(KERN_INFO "%s: Micrel KS8721 PHY\n", dev->name);
> -	else if (phy_type == MII_T78Q21x3_ID)
> +	else if (lp->phy_type == MII_T78Q21x3_ID)
>  		printk(KERN_INFO "%s: Teridian 78Q21x3 PHY\n", dev->name);
> -	else if (phy_type == MII_LAN83C185_ID)
> +	else if (lp->phy_type == MII_LAN83C185_ID)
>  		printk(KERN_INFO "%s: SMSC LAN83C185 PHY\n", dev->name);
>  
> -	return 0;
> -}
> -
> -/*
> - * Detect MAC and PHY and perform initialization
> - */
> -static int __init at91ether_probe(struct platform_device *pdev)
> -{
> -	unsigned int phyid1, phyid2;
> -	int detected = -1;
> -	unsigned long phy_id;
> -	unsigned short phy_address = 0;
> -	struct clk *ether_clk;
> -
> -	ether_clk = clk_get(&pdev->dev, "ether_clk");
> -	if (IS_ERR(ether_clk)) {
> -		printk(KERN_ERR "at91_ether: no clock defined\n");
> -		return -ENODEV;
> -	}
> -	clk_enable(ether_clk);					/* Enable Peripheral clock */
> -
> -	while ((detected != 0) && (phy_address < 32)) {
> -		/* Read the PHY ID registers */
> -		enable_mdi();
> -		read_phy(phy_address, MII_PHYSID1, &phyid1);
> -		read_phy(phy_address, MII_PHYSID2, &phyid2);
> -		disable_mdi();
> -
> -		phy_id = (phyid1 << 16) | (phyid2 & 0xfff0);
> -		switch (phy_id) {
> -			case MII_DM9161_ID:		/* Davicom 9161: PHY_ID1 = 0x181, PHY_ID2 = B881 */
> -			case MII_DM9161A_ID:		/* Davicom 9161A: PHY_ID1 = 0x181, PHY_ID2 = B8A0 */
> -			case MII_LXT971A_ID:		/* Intel LXT971A: PHY_ID1 = 0x13, PHY_ID2 = 78E0 */
> -			case MII_RTL8201_ID:		/* Realtek RTL8201: PHY_ID1 = 0, PHY_ID2 = 0x8201 */
> -			case MII_BCM5221_ID:		/* Broadcom BCM5221: PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */
> -			case MII_DP83847_ID:		/* National Semiconductor DP83847:  */
> -			case MII_DP83848_ID:		/* National Semiconductor DP83848:  */
> -			case MII_AC101L_ID:		/* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */
> -			case MII_KS8721_ID:		/* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */
> -			case MII_T78Q21x3_ID:		/* Teridian 78Q21x3: PHY_ID1 = 0x0E, PHY_ID2 = 7237 */
> -			case MII_LAN83C185_ID:		/* SMSC LAN83C185: PHY_ID1 = 0x0007, PHY_ID2 = 0xC0A1 */
> -				detected = at91ether_setup(phy_id, phy_address, pdev, ether_clk);
> -				break;
> -		}
> +	clk_disable(lp->ether_clk);					/* Disable Peripheral clock */
>  
> -		phy_address++;
> -	}
> +	return 0;
>  
> -	clk_disable(ether_clk);					/* Disable Peripheral clock */
>  
> -	return detected;
> +err_free_dmamem:
> +	platform_set_drvdata(pdev, NULL);
> +	dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
> +err_free_irq:
> +	free_irq(dev->irq, dev);
> +err_disable_clock:
> +	clk_disable(lp->ether_clk);
> +	clk_put(lp->ether_clk);
> +err_ioumap:
> +	iounmap(lp->emac_base);
> +err_free_dev:
> +	free_netdev(dev);
> +	return res;
>  }
>  
>  static int __devexit at91ether_remove(struct platform_device *pdev)
> @@ -1168,7 +1209,7 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
>  	struct net_device *dev = platform_get_drvdata(pdev);
>  	struct at91_private *lp = netdev_priv(dev);
>  
> -	if (lp->board_data.phy_irq_pin >= 32)
> +	if (lp->board_data.phy_irq_pin)
>  		gpio_free(lp->board_data.phy_irq_pin);
>  
>  	unregister_netdev(dev);
> diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h
> index 353f4da..90377d2 100644
> --- a/drivers/net/arm/at91_ether.h
> +++ b/drivers/net/arm/at91_ether.h
> @@ -86,6 +86,7 @@ struct at91_private
>  {
>  	struct mii_if_info mii;			/* ethtool support */
>  	struct at91_eth_data board_data;	/* board-specific configuration */
> +	void __iomem *emac_base;		/* base register address */
>  	struct clk *ether_clk;			/* clock */
>  
>  	/* PHY */
> 

^ permalink raw reply

* Re: [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.
From: Ralf Baechle @ 2011-05-11 11:53 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips, netdev, linux-wireless, Florian Fainelli
In-Reply-To: <1305063094-26656-2-git-send-email-hauke@hauke-m.de>

Thanks, queued for 2.6.40.

  Ralf

^ permalink raw reply

* [PATCH] Add libertas_disablemesh module parameter to disable mesh interface
From: Sascha Silbe @ 2011-05-11 12:52 UTC (permalink / raw)
  To: linux-wireless
  Cc: libertas-dev, Dan Williams, netdev, John W. Linville,
	linux-kernel, devel

This allows individual users and deployments to disable mesh support at
runtime, i.e. without having to build and maintain a custom kernel.

Based on a patch by Paul Fox <pgf@laptop.org>.
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
---
 drivers/net/wireless/libertas/main.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

The patch is based on the OLPC 2.6.35 kernel tree, but applies cleanly to
wireless-next.

diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 8445473..62069e2 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -41,6 +41,10 @@ unsigned int lbs_debug;
 EXPORT_SYMBOL_GPL(lbs_debug);
 module_param_named(libertas_debug, lbs_debug, int, 0644);

+unsigned int lbs_disablemesh;
+EXPORT_SYMBOL_GPL(lbs_disablemesh);
+module_param_named(libertas_disablemesh, lbs_disablemesh, int, 0644);
+

 /* This global structure is used to send the confirm_sleep command as
  * fast as possible down to the firmware. */
@@ -1086,7 +1090,10 @@ int lbs_start_card(struct lbs_private *priv)

 	lbs_update_channel(priv);

-	lbs_init_mesh(priv);
+	if (!lbs_disablemesh)
+		lbs_init_mesh(priv);
+	else
+		lbs_pr_info("%s: mesh disabled\n", dev->name);

 	/*
 	 * While rtap isn't related to mesh, only mesh-enabled
--
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] tcp_cubic: limit delayed_ack ratio to prevent divide error
From: TB @ 2011-05-11 14:49 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Brandeburg, Jesse, David Miller, Sangtae Ha, Injong Rhee,
	Valdis.Kletnieks@vt.edu, rdunlap@xenotime.net,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20110506095359.57c4fb38@nehalam>

On 11-05-06 12:53 PM, Stephen Hemminger wrote:
> On Fri, 06 May 2011 12:15:46 -0400
> TB <lkml@techboom.com> wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 11-05-04 04:53 PM, Brandeburg, Jesse wrote:
>>>
>>>
>>> On Wed, 4 May 2011, Stephen Hemminger wrote:
>>>
>>>> TCP Cubic keeps a metric that estimates the amount of delayed
>>>> acknowledgements to use in adjusting the window. If an abnormally
>>>> large number of packets are acknowledged at once, then the update
>>>> could wrap and reach zero. This kind of ACK could only
>>>> happen when there was a large window and huge number of
>>>> ACK's were lost.
>>>>
>>>> This patch limits the value of delayed ack ratio. The choice of 32
>>>> is just a conservative value since normally it should be range of 
>>>> 1 to 4 packets.
>>>>
>>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>>>
>>> patch seems fine, but please credit the reporter (lkml@techboom.com) with 
>>> reporting the issue with logs, maybe even with Reported-by: and some kind 
>>> of reference to the panic message or the email thread in the text or 
>>> header?
>>
>> We're currently testing the patch on 6 production servers
> 
> Thank you, is there some regularity to the failures previously?

This is now being tested on about 50 servers and we just had another
panic, on a server with 2.6.38.5 and this patch.

[405542.454073] ------------[ cut here ]------------
[405542.454109] kernel BUG at net/ipv4/tcp_output.c:1006!
[405542.454136] invalid opcode: 0000 [#1]

[405542.454166] last sysfs file:
/sys/devices/pci0000:00/0000:00:1f.2/host6/scsi_host/host6/proc_name
[405542.454213] CPU 0

[405542.454220] Modules linked in:
 i2c_i801
 evdev
 i2c_core
 button
 [last unloaded: scsi_wait_scan]

[405542.454300]
[405542.454320] Pid: 0, comm: swapper Not tainted 2.6.38.5 #8

/

[405542.454379] RIP: 0010:[<ffffffff814e7ed2>]
 [<ffffffff814e7ed2>] tcp_fragment+0x22/0x29a
[405542.454433] RSP: 0018:ffff8800bf403a30  EFLAGS: 00010202
[405542.454460] RAX: ffff88000cd35000 RBX: ffff88006b84f480 RCX:
0000000000000218
[405542.454504] RDX: 0000000000001708 RSI: ffff88006b84f480 RDI:
ffff880008d6b200
[405542.454548] RBP: 0000000000001540 R08: 0000000000000002 R09:
000000001027984a
[405542.454592] R10: ffff8800b915f428 R11: ffff880008d6b200 R12:
ffff88006b84f4a8
[405542.454636] R13: 0000000000001708 R14: 0000000000000000 R15:
ffff880008d6b200
[405542.454680] FS:  0000000000000000(0000) GS:ffff8800bf400000(0000)
knlGS:0000000000000000
[405542.454726] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[405542.454754] CR2: 00007f94055c7000 CR3: 000000083e0bd000 CR4:
00000000000006f0
[405542.454798] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[405542.454842] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
0000000000000400
[405542.454886] Process swapper (pid: 0, threadinfo ffffffff8176c000,
task ffffffff81777020)
[405542.454931] Stack:
[405542.454951]  0000000000000000
 0000021808d6b798
 00000002000005b4
 ffff88006b84f480

[405542.455006]  ffff880008d6b200
 ffff88006b84f4a8
 0000000000000015
 0000000000000000

[405542.455061]  ffff880008d6b300
 ffffffff814df7a4
 ffff8802a3965140
 00000000000001a0

[405542.455115] Call Trace:
[405542.455137]  <IRQ>

[405542.455162]  [<ffffffff814df7a4>] ? tcp_mark_head_lost+0x13c/0x202
[405542.455192]  [<ffffffff814e33a8>] ? tcp_ack+0xe98/0x1a89
[405542.455220]  [<ffffffff814e42ca>] ? tcp_validate_incoming+0x69/0x290
[405542.455250]  [<ffffffff814e4c9b>] ? tcp_rcv_established+0x7aa/0xa13
[405542.455281]  [<ffffffff814ec60b>] ? tcp_v4_do_rcv+0x1b2/0x382
[405542.455310]  [<ffffffff814c95d4>] ? nf_iterate+0x40/0x78
[405542.455338]  [<ffffffff814ecc5f>] ? tcp_v4_rcv+0x484/0x797
[405542.455368]  [<ffffffff814d11c7>] ? ip_local_deliver_finish+0xab/0x139
[405542.455398]  [<ffffffff814ae2b3>] ? __netif_receive_skb+0x31c/0x349
[405542.455428]  [<ffffffff814aec82>] ? netif_receive_skb+0x67/0x6d
[405542.455457]  [<ffffffff814af1fb>] ? napi_gro_receive+0x9d/0xab
[405542.455485]  [<ffffffff814aed57>] ? napi_skb_finish+0x1c/0x31
[405542.455516]  [<ffffffff813e4248>] ? igb_poll+0x7d5/0xb2e
[405542.455544]  [<ffffffff813e432f>] ? igb_poll+0x8bc/0xb2e
[405542.455572]  [<ffffffff813e211a>] ? igb_msix_ring+0x6e/0x75
[405542.455602]  [<ffffffff8106749c>] ? handle_IRQ_event+0x51/0x119
[405542.455631]  [<ffffffff814af337>] ? net_rx_action+0xa7/0x212
[405542.455661]  [<ffffffff8103b6c2>] ? __do_softirq+0xbe/0x184
[405542.455690]  [<ffffffff8100364c>] ? call_softirq+0x1c/0x28
[405542.455719]  [<ffffffff81005085>] ? do_softirq+0x31/0x63
[405542.455746]  [<ffffffff8103b56c>] ? irq_exit+0x36/0x78
[405542.455773]  [<ffffffff81004784>] ? do_IRQ+0x98/0xae
[405542.455802]  [<ffffffff81562ed3>] ? ret_from_intr+0x0/0xe
[405542.455829]  <EOI>

[405542.455860]  [<ffffffff81009a41>] ? mwait_idle+0xb9/0xf3
[405542.455888]  [<ffffffff81001c6e>] ? cpu_idle+0x57/0x8d
[405542.455921]  [<ffffffff81801c49>] ? start_kernel+0x34e/0x35a
[405542.455950]  [<ffffffff81801398>] ? x86_64_start_kernel+0xf3/0xf9
[405542.455977] Code:
f>

[405542.456239] RIP
 [<ffffffff814e7ed2>] tcp_fragment+0x22/0x29a
[405542.456270]  RSP <ffff8800bf403a30>
[405542.456543] ---[ end trace 231aaa222f893065 ]---
[405542.456600] Kernel panic - not syncing: Fatal exception in interrupt
[405542.456659] Pid: 0, comm: swapper Tainted: G      D     2.6.38.5 #8
[405542.456719] Call Trace:
[405542.456770]  <IRQ>
 [<ffffffff81560960>] ? panic+0x9d/0x1a0
[405542.456863]  [<ffffffff81562ed3>] ? ret_from_intr+0x0/0xe
[405542.456923]  [<ffffffff810365bb>] ? kmsg_dump+0x46/0xec
[405542.456981]  [<ffffffff81006176>] ? oops_end+0x9f/0xac
[405542.457039]  [<ffffffff81003f83>] ? do_invalid_op+0x85/0x8f
[405542.457097]  [<ffffffff814e7ed2>] ? tcp_fragment+0x22/0x29a
[405542.457156]  [<ffffffff814e80a9>] ? tcp_fragment+0x1f9/0x29a
[405542.457216]  [<ffffffff810033d5>] ? invalid_op+0x15/0x20
[405542.457276]  [<ffffffff814e7ed2>] ? tcp_fragment+0x22/0x29a
[405542.457337]  [<ffffffff814df7a4>] ? tcp_mark_head_lost+0x13c/0x202
[405542.457400]  [<ffffffff814e33a8>] ? tcp_ack+0xe98/0x1a89
[405542.457461]  [<ffffffff814e42ca>] ? tcp_validate_incoming+0x69/0x290
[405542.457524]  [<ffffffff814e4c9b>] ? tcp_rcv_established+0x7aa/0xa13
[405542.457586]  [<ffffffff814ec60b>] ? tcp_v4_do_rcv+0x1b2/0x382
[405542.457645]  [<ffffffff814c95d4>] ? nf_iterate+0x40/0x78
[405542.457703]  [<ffffffff814ecc5f>] ? tcp_v4_rcv+0x484/0x797
[405542.457761]  [<ffffffff814d11c7>] ? ip_local_deliver_finish+0xab/0x139
[405542.457827]  [<ffffffff814ae2b3>] ? __netif_receive_skb+0x31c/0x349
[405542.457894]  [<ffffffff814aec82>] ? netif_receive_skb+0x67/0x6d
[405542.457953]  [<ffffffff814af1fb>] ? napi_gro_receive+0x9d/0xab
[405542.458021]  [<ffffffff814aed57>] ? napi_skb_finish+0x1c/0x31
[405542.458080]  [<ffffffff813e4248>] ? igb_poll+0x7d5/0xb2e
[405542.458138]  [<ffffffff813e432f>] ? igb_poll+0x8bc/0xb2e
[405542.458196]  [<ffffffff813e211a>] ? igb_msix_ring+0x6e/0x75
[405542.458254]  [<ffffffff8106749c>] ? handle_IRQ_event+0x51/0x119
[405542.458313]  [<ffffffff814af337>] ? net_rx_action+0xa7/0x212
[405542.458371]  [<ffffffff8103b6c2>] ? __do_softirq+0xbe/0x184
[405542.458430]  [<ffffffff8100364c>] ? call_softirq+0x1c/0x28
[405542.458488]  [<ffffffff81005085>] ? do_softirq+0x31/0x63
[405542.458545]  [<ffffffff8103b56c>] ? irq_exit+0x36/0x78
[405542.458602]  [<ffffffff81004784>] ? do_IRQ+0x98/0xae
[405542.458660]  [<ffffffff81562ed3>] ? ret_from_intr+0x0/0xe
[405542.458717]  <EOI>
 [<ffffffff81009a41>] ? mwait_idle+0xb9/0xf3
[405542.458810]  [<ffffffff81001c6e>] ? cpu_idle+0x57/0x8d
[405542.458867]  [<ffffffff81801c49>] ? start_kernel+0x34e/0x35a
[405542.458926]  [<ffffffff81801398>] ? x86_64_start_kernel+0xf3/0xf9

^ permalink raw reply

* Re: [PATCH] tcp_cubic: limit delayed_ack ratio to prevent divide error
From: Stephen Hemminger @ 2011-05-11 15:22 UTC (permalink / raw)
  To: TB
  Cc: Brandeburg, Jesse, David Miller, Sangtae Ha, Injong Rhee,
	Valdis.Kletnieks@vt.edu, rdunlap@xenotime.net,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <4DCAA1DD.6010609@techboom.com>

On Wed, 11 May 2011 10:49:01 -0400
TB <lkml@techboom.com> wrote:

> On 11-05-06 12:53 PM, Stephen Hemminger wrote:
> > On Fri, 06 May 2011 12:15:46 -0400
> > TB <lkml@techboom.com> wrote:
> > 
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >>
> >> On 11-05-04 04:53 PM, Brandeburg, Jesse wrote:
> >>>
> >>>
> >>> On Wed, 4 May 2011, Stephen Hemminger wrote:
> >>>
> >>>> TCP Cubic keeps a metric that estimates the amount of delayed
> >>>> acknowledgements to use in adjusting the window. If an abnormally
> >>>> large number of packets are acknowledged at once, then the update
> >>>> could wrap and reach zero. This kind of ACK could only
> >>>> happen when there was a large window and huge number of
> >>>> ACK's were lost.
> >>>>
> >>>> This patch limits the value of delayed ack ratio. The choice of 32
> >>>> is just a conservative value since normally it should be range of 
> >>>> 1 to 4 packets.
> >>>>
> >>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

> >>>
> >>> patch seems fine, but please credit the reporter (lkml@techboom.com) with 
> >>> reporting the issue with logs, maybe even with Reported-by: and some kind 
> >>> of reference to the panic message or the email thread in the text or 
> >>> header?
> >>
> >> We're currently testing the patch on 6 production servers
> > 
> > Thank you, is there some regularity to the failures previously?
> 
> This is now being tested on about 50 servers and we just had another
> panic, on a server with 2.6.38.5 and this patch.
> 
> [405542.454073] ------------[ cut here ]------------
> [405542.454109] kernel BUG at net/ipv4/tcp_output.c:1006!
> [405542.454136] invalid opcode: 0000 [#1]
> 
> [405542.454166] last sysfs file:
> /sys/devices/pci0000:00/0000:00:1f.2/host6/scsi_host/host6/proc_name
> [405542.454213] CPU 0
> 
> [405542.454220] Modules linked in:
>  i2c_i801
>  evdev
>  i2c_core
>  button
>  [last unloaded: scsi_wait_scan]
> 
> [405542.454300]
> [405542.454320] Pid: 0, comm: swapper Not tainted 2.6.38.5 #8
> 
> /
> 
> [405542.454379] RIP: 0010:[<ffffffff814e7ed2>]
>  [<ffffffff814e7ed2>] tcp_fragment+0x22/0x29a
> [405542.454433] RSP: 0018:ffff8800bf403a30  EFLAGS: 00010202
> [405542.454460] RAX: ffff88000cd35000 RBX: ffff88006b84f480 RCX:
> 0000000000000218
> [405542.454504] RDX: 0000000000001708 RSI: ffff88006b84f480 RDI:
> ffff880008d6b200
> [405542.454548] RBP: 0000000000001540 R08: 0000000000000002 R09:
> 000000001027984a
> [405542.454592] R10: ffff8800b915f428 R11: ffff880008d6b200 R12:
> ffff88006b84f4a8
> [405542.454636] R13: 0000000000001708 R14: 0000000000000000 R15:
> ffff880008d6b200
> [405542.454680] FS:  0000000000000000(0000) GS:ffff8800bf400000(0000)
> knlGS:0000000000000000
> [405542.454726] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> [405542.454754] CR2: 00007f94055c7000 CR3: 000000083e0bd000 CR4:
> 00000000000006f0
> [405542.454798] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
> 0000000000000000
> [405542.454842] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
> 0000000000000400
> [405542.454886] Process swapper (pid: 0, threadinfo ffffffff8176c000,
> task ffffffff81777020)
> [405542.454931] Stack:
> [405542.454951]  0000000000000000
>  0000021808d6b798
>  00000002000005b4
>  ffff88006b84f480
> 
> [405542.455006]  ffff880008d6b200
>  ffff88006b84f4a8
>  0000000000000015
>  0000000000000000
> 
> [405542.455061]  ffff880008d6b300
>  ffffffff814df7a4
>  ffff8802a3965140
>  00000000000001a0
> 
> [405542.455115] Call Trace:
> [405542.455137]  <IRQ>
> 
> [405542.455162]  [<ffffffff814df7a4>] ? tcp_mark_head_lost+0x13c/0x202
> [405542.455192]  [<ffffffff814e33a8>] ? tcp_ack+0xe98/0x1a89
> [405542.455220]  [<ffffffff814e42ca>] ? tcp_validate_incoming+0x69/0x290
> [405542.455250]  [<ffffffff814e4c9b>] ? tcp_rcv_established+0x7aa/0xa13
> [405542.455281]  [<ffffffff814ec60b>] ? tcp_v4_do_rcv+0x1b2/0x382
> [405542.455310]  [<ffffffff814c95d4>] ? nf_iterate+0x40/0x78
> [405542.455338]  [<ffffffff814ecc5f>] ? tcp_v4_rcv+0x484/0x797
> [405542.455368]  [<ffffffff814d11c7>] ? ip_local_deliver_finish+0xab/0x139
> [405542.455398]  [<ffffffff814ae2b3>] ? __netif_receive_skb+0x31c/0x349
> [405542.455428]  [<ffffffff814aec82>] ? netif_receive_skb+0x67/0x6d
> [405542.455457]  [<ffffffff814af1fb>] ? napi_gro_receive+0x9d/0xab
> [405542.455485]  [<ffffffff814aed57>] ? napi_skb_finish+0x1c/0x31
> [405542.455516]  [<ffffffff813e4248>] ? igb_poll+0x7d5/0xb2e
> [405542.455544]  [<ffffffff813e432f>] ? igb_poll+0x8bc/0xb2e
> [405542.455572]  [<ffffffff813e211a>] ? igb_msix_ring+0x6e/0x75
> [405542.455602]  [<ffffffff8106749c>] ? handle_IRQ_event+0x51/0x119
> [405542.455631]  [<ffffffff814af337>] ? net_rx_action+0xa7/0x212
> [405542.455661]  [<ffffffff8103b6c2>] ? __do_softirq+0xbe/0x184
> [405542.455690]  [<ffffffff8100364c>] ? call_softirq+0x1c/0x28
> [405542.455719]  [<ffffffff81005085>] ? do_softirq+0x31/0x63
> [405542.455746]  [<ffffffff8103b56c>] ? irq_exit+0x36/0x78
> [405542.455773]  [<ffffffff81004784>] ? do_IRQ+0x98/0xae
> [405542.455802]  [<ffffffff81562ed3>] ? ret_from_intr+0x0/0xe
> [405542.455829]  <EOI>
> 
> [405542.455860]  [<ffffffff81009a41>] ? mwait_idle+0xb9/0xf3
> [405542.455888]  [<ffffffff81001c6e>] ? cpu_idle+0x57/0x8d
> [405542.455921]  [<ffffffff81801c49>] ? start_kernel+0x34e/0x35a
> [405542.455950]  [<ffffffff81801398>] ? x86_64_start_kernel+0xf3/0xf9

This panic is different than the last one.
It is coming from TCP fragment code being
called with an invalid skb. If I read the registers correctly,
skb->len (R14) = 0 and len (EDX) = 1708; the check here is failing.

int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
		 unsigned int mss_now)
{

	BUG_ON(len > skb->len);


Are you running with large (or small) MTU? What netfilter rules, perhaps
the firewall rule altered the packet.
-- 

^ permalink raw reply

* Re: [PATCH] tcp_cubic: limit delayed_ack ratio to prevent divide error
From: TB @ 2011-05-11 15:35 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Brandeburg, Jesse, David Miller, Sangtae Ha, Injong Rhee,
	Valdis.Kletnieks@vt.edu, rdunlap@xenotime.net,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20110511082238.1ef1c190@nehalam>

On 11-05-11 11:22 AM, Stephen Hemminger wrote:
> On Wed, 11 May 2011 10:49:01 -0400
> TB <lkml@techboom.com> wrote:
> 
>> On 11-05-06 12:53 PM, Stephen Hemminger wrote:
>>> On Fri, 06 May 2011 12:15:46 -0400
>>> TB <lkml@techboom.com> wrote:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> On 11-05-04 04:53 PM, Brandeburg, Jesse wrote:
>>>>>
>>>>>
>>>>> On Wed, 4 May 2011, Stephen Hemminger wrote:
>>>>>
>>>>>> TCP Cubic keeps a metric that estimates the amount of delayed
>>>>>> acknowledgements to use in adjusting the window. If an abnormally
>>>>>> large number of packets are acknowledged at once, then the update
>>>>>> could wrap and reach zero. This kind of ACK could only
>>>>>> happen when there was a large window and huge number of
>>>>>> ACK's were lost.
>>>>>>
>>>>>> This patch limits the value of delayed ack ratio. The choice of 32
>>>>>> is just a conservative value since normally it should be range of 
>>>>>> 1 to 4 packets.
>>>>>>
>>>>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
>>>>>
>>>>> patch seems fine, but please credit the reporter (lkml@techboom.com) with 
>>>>> reporting the issue with logs, maybe even with Reported-by: and some kind 
>>>>> of reference to the panic message or the email thread in the text or 
>>>>> header?
>>>>
>>>> We're currently testing the patch on 6 production servers
>>>
>>> Thank you, is there some regularity to the failures previously?
>>
>> This is now being tested on about 50 servers and we just had another
>> panic, on a server with 2.6.38.5 and this patch.
>>
>> [405542.454073] ------------[ cut here ]------------
>> [405542.454109] kernel BUG at net/ipv4/tcp_output.c:1006!
>> [405542.454136] invalid opcode: 0000 [#1]
>>
>> [405542.454166] last sysfs file:
>> /sys/devices/pci0000:00/0000:00:1f.2/host6/scsi_host/host6/proc_name
>> [405542.454213] CPU 0
>>
>> [405542.454220] Modules linked in:
>>  i2c_i801
>>  evdev
>>  i2c_core
>>  button
>>  [last unloaded: scsi_wait_scan]
>>
>> [405542.454300]
>> [405542.454320] Pid: 0, comm: swapper Not tainted 2.6.38.5 #8
>>
>> /
>>
>> [405542.454379] RIP: 0010:[<ffffffff814e7ed2>]
>>  [<ffffffff814e7ed2>] tcp_fragment+0x22/0x29a
>> [405542.454433] RSP: 0018:ffff8800bf403a30  EFLAGS: 00010202
>> [405542.454460] RAX: ffff88000cd35000 RBX: ffff88006b84f480 RCX:
>> 0000000000000218
>> [405542.454504] RDX: 0000000000001708 RSI: ffff88006b84f480 RDI:
>> ffff880008d6b200
>> [405542.454548] RBP: 0000000000001540 R08: 0000000000000002 R09:
>> 000000001027984a
>> [405542.454592] R10: ffff8800b915f428 R11: ffff880008d6b200 R12:
>> ffff88006b84f4a8
>> [405542.454636] R13: 0000000000001708 R14: 0000000000000000 R15:
>> ffff880008d6b200
>> [405542.454680] FS:  0000000000000000(0000) GS:ffff8800bf400000(0000)
>> knlGS:0000000000000000
>> [405542.454726] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> [405542.454754] CR2: 00007f94055c7000 CR3: 000000083e0bd000 CR4:
>> 00000000000006f0
>> [405542.454798] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
>> 0000000000000000
>> [405542.454842] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
>> 0000000000000400
>> [405542.454886] Process swapper (pid: 0, threadinfo ffffffff8176c000,
>> task ffffffff81777020)
>> [405542.454931] Stack:
>> [405542.454951]  0000000000000000
>>  0000021808d6b798
>>  00000002000005b4
>>  ffff88006b84f480
>>
>> [405542.455006]  ffff880008d6b200
>>  ffff88006b84f4a8
>>  0000000000000015
>>  0000000000000000
>>
>> [405542.455061]  ffff880008d6b300
>>  ffffffff814df7a4
>>  ffff8802a3965140
>>  00000000000001a0
>>
>> [405542.455115] Call Trace:
>> [405542.455137]  <IRQ>
>>
>> [405542.455162]  [<ffffffff814df7a4>] ? tcp_mark_head_lost+0x13c/0x202
>> [405542.455192]  [<ffffffff814e33a8>] ? tcp_ack+0xe98/0x1a89
>> [405542.455220]  [<ffffffff814e42ca>] ? tcp_validate_incoming+0x69/0x290
>> [405542.455250]  [<ffffffff814e4c9b>] ? tcp_rcv_established+0x7aa/0xa13
>> [405542.455281]  [<ffffffff814ec60b>] ? tcp_v4_do_rcv+0x1b2/0x382
>> [405542.455310]  [<ffffffff814c95d4>] ? nf_iterate+0x40/0x78
>> [405542.455338]  [<ffffffff814ecc5f>] ? tcp_v4_rcv+0x484/0x797
>> [405542.455368]  [<ffffffff814d11c7>] ? ip_local_deliver_finish+0xab/0x139
>> [405542.455398]  [<ffffffff814ae2b3>] ? __netif_receive_skb+0x31c/0x349
>> [405542.455428]  [<ffffffff814aec82>] ? netif_receive_skb+0x67/0x6d
>> [405542.455457]  [<ffffffff814af1fb>] ? napi_gro_receive+0x9d/0xab
>> [405542.455485]  [<ffffffff814aed57>] ? napi_skb_finish+0x1c/0x31
>> [405542.455516]  [<ffffffff813e4248>] ? igb_poll+0x7d5/0xb2e
>> [405542.455544]  [<ffffffff813e432f>] ? igb_poll+0x8bc/0xb2e
>> [405542.455572]  [<ffffffff813e211a>] ? igb_msix_ring+0x6e/0x75
>> [405542.455602]  [<ffffffff8106749c>] ? handle_IRQ_event+0x51/0x119
>> [405542.455631]  [<ffffffff814af337>] ? net_rx_action+0xa7/0x212
>> [405542.455661]  [<ffffffff8103b6c2>] ? __do_softirq+0xbe/0x184
>> [405542.455690]  [<ffffffff8100364c>] ? call_softirq+0x1c/0x28
>> [405542.455719]  [<ffffffff81005085>] ? do_softirq+0x31/0x63
>> [405542.455746]  [<ffffffff8103b56c>] ? irq_exit+0x36/0x78
>> [405542.455773]  [<ffffffff81004784>] ? do_IRQ+0x98/0xae
>> [405542.455802]  [<ffffffff81562ed3>] ? ret_from_intr+0x0/0xe
>> [405542.455829]  <EOI>
>>
>> [405542.455860]  [<ffffffff81009a41>] ? mwait_idle+0xb9/0xf3
>> [405542.455888]  [<ffffffff81001c6e>] ? cpu_idle+0x57/0x8d
>> [405542.455921]  [<ffffffff81801c49>] ? start_kernel+0x34e/0x35a
>> [405542.455950]  [<ffffffff81801398>] ? x86_64_start_kernel+0xf3/0xf9
> 
> This panic is different than the last one.
> It is coming from TCP fragment code being
> called with an invalid skb. If I read the registers correctly,
> skb->len (R14) = 0 and len (EDX) = 1708; the check here is failing.
> 
> int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
> 		 unsigned int mss_now)
> {
> 
> 	BUG_ON(len > skb->len);
> 
> 
> Are you running with large (or small) MTU? What netfilter rules, perhaps
> the firewall rule altered the packet.


MTU 1500, No firewall rules (empty rules for filter, no mangle, no nat
modules)

^ permalink raw reply

* Re: [PATCH] ehea: Fix memory hotplug oops
From: Breno Leitao @ 2011-05-11 12:46 UTC (permalink / raw)
  To: David Miller; +Cc: Anton Blanchard, netdev
In-Reply-To: <20110511121710.05ab8c2e@kryten>

On 05/10/2011 11:17 PM, Anton Blanchard wrote:
>
>  The ehea driver oopses during memory hotplug if the ports are not
>  up. A simple testcase:
>
>  # ifconfig ethX down
>  # echo offline > /sys/devices/system/memory/memory32/state
>
>  Oops: Kernel access of bad area, sig: 11 [#1]
>  last sysfs file: /sys/devices/system/memory/memory32/state
>  REGS: c000000709393110 TRAP: 0300 Not tainted 
(2.6.39-rc2-01385-g7ef73bc-dirty)
>  DAR: 0000000000000000, DSISR: 40000000
>  ...
>  NIP [c000000000067c98] .__wake_up_common+0x48/0xf0
>  LR [c00000000006d034] .__wake_up+0x54/0x90
>  Call Trace:
>  [c00000000006d034] .__wake_up+0x54/0x90
>  [d000000006bb6270] .ehea_rereg_mrs+0x140/0x730 [ehea]
>  [d000000006bb69c4] .ehea_mem_notifier+0x164/0x170 [ehea]
>  [c0000000006fc8a8] .notifier_call_chain+0x78/0xf0
>  [c0000000000b3d70] .__blocking_notifier_call_chain+0x70/0xb0
>  [c000000000458d78] .memory_notify+0x28/0x40
>  [c0000000001871d8] .remove_memory+0x208/0x6d0
>  [c000000000458264] .memory_section_action+0x94/0x140
>  [c0000000004583ec] .memory_block_change_state+0xdc/0x1d0
>  [c0000000004585cc] .store_mem_state+0xec/0x160
>  [c00000000044768c] .sysdev_store+0x3c/0x50
>  [c00000000020b48c] .sysfs_write_file+0xec/0x1f0
>  [c00000000018f86c] .vfs_write+0xec/0x1e0
>  [c00000000018fa88] .SyS_write+0x58/0xd0
>
>  To fix this, initialise the waitqueues during port probe instead
>  of port open.
>
>  Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Breno Leitao <leitao@linux.vnet.ibm.com>


^ permalink raw reply

* Re: [PATCH net-next 1/2 RESEND v3] net: use NETIF_F_ALL_TSO for vlan features
From: Dimitris Michailidis @ 2011-05-11 16:35 UTC (permalink / raw)
  To: Shan Wei; +Cc: David Miller, netdev, eilong, leedom
In-Reply-To: <4DCA2B86.9030205@cn.fujitsu.com>

On 05/10/2011 11:24 PM, Shan Wei wrote:
> As Dimitris Michailidis suggested, use NETIF_F_ALL_TSO for vlan_features,
> which is a mask, but not hw_features.
> 
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>

While these changes aren't wrong I don't see a good reason to make them.  I am 
also curious why you're changing only these three drivers.

> ---
>  drivers/net/bnx2x/bnx2x_main.c     |    2 +-
>  drivers/net/cxgb4/cxgb4_main.c     |    2 +-
>  drivers/net/cxgb4vf/cxgb4vf_main.c |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
> index 2762edf..172684b 100644
> --- a/drivers/net/bnx2x/bnx2x_main.c
> +++ b/drivers/net/bnx2x/bnx2x_main.c
> @@ -9267,7 +9267,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
>  		NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_TX;
>  
>  	dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
> -		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
> +		NETIF_F_ALL_TSO | NETIF_F_HIGHDMA;
>  
>  	dev->features |= dev->hw_features | NETIF_F_HW_VLAN_RX;
>  	if (bp->flags & USING_DAC_FLAG)
> diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
> index 7e3cfbe..21a163c 100644
> --- a/drivers/net/cxgb4/cxgb4_main.c
> +++ b/drivers/net/cxgb4/cxgb4_main.c
> @@ -3528,7 +3528,7 @@ static void free_some_resources(struct adapter *adapter)
>  }
>  
>  #define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
> -#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \
> +#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_ALL_TSO | \
>  		   NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)
>  
>  static int __devinit init_one(struct pci_dev *pdev,
> diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
> index e71c08e..b55c521 100644
> --- a/drivers/net/cxgb4vf/cxgb4vf_main.c
> +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
> @@ -2604,7 +2604,7 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
>  		netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
>  			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>  			NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
> -		netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
> +		netdev->vlan_features = NETIF_F_SG | NETIF_F_ALL_TSO |
>  			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>  			NETIF_F_HIGHDMA;
>  		netdev->features = netdev->hw_features |


^ permalink raw reply

* Re: [PATCH net-next 2/2 V3] net: driver: use NETIF_F_GSO_SOFTWARE masks directly
From: Michał Mirosław @ 2011-05-11 10:07 UTC (permalink / raw)
  To: Shan Wei
  Cc: David Miller, netdev, rusty, Michael S. Tsirkin, Eric Dumazet,
	krkumar2, Ben Hutchings
In-Reply-To: <4DCA2BEB.4000308@cn.fujitsu.com>

2011/5/11 Shan Wei <shanwei@cn.fujitsu.com>:
> For loopback device can support any offload, so directly using
> NETIF_F_GSO_SOFTWARE offload mask is enough safe.
> And as Michał Mirosław suggested, add NETIF_F_HIGHDMA to hw_features.
>
>
> For virtio_net driver, safely using NETIF_F_GSO_SOFTWARE offload mask for bit operation.
>
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
> ---
>  drivers/net/loopback.c   |   16 +++++-----------
>  drivers/net/virtio_net.c |    3 ++-
>  2 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
> index 4ce9e5f..e6cccec 100644
> --- a/drivers/net/loopback.c
> +++ b/drivers/net/loopback.c
> @@ -165,17 +165,11 @@ static void loopback_setup(struct net_device *dev)
>        dev->type               = ARPHRD_LOOPBACK;      /* 0x0001*/
>        dev->flags              = IFF_LOOPBACK;
>        dev->priv_flags        &= ~IFF_XMIT_DST_RELEASE;
> -       dev->hw_features        = NETIF_F_ALL_TSO | NETIF_F_UFO;
> -       dev->features           = NETIF_F_SG | NETIF_F_FRAGLIST
> -               | NETIF_F_ALL_TSO
> -               | NETIF_F_UFO
> -               | NETIF_F_NO_CSUM
> -               | NETIF_F_RXCSUM
> -               | NETIF_F_HIGHDMA
> -               | NETIF_F_LLTX
> -               | NETIF_F_NETNS_LOCAL
> -               | NETIF_F_VLAN_CHALLENGED
> -               | NETIF_F_LOOPBACK;
> +       dev->hw_features        = NETIF_F_GSO_SOFTWARE | NETIF_F_HIGHDMA;
> +       dev->features           = dev->hw_features | NETIF_F_SG
> +               | NETIF_F_FRAGLIST | NETIF_F_NO_CSUM | NETIF_F_RXCSUM
> +               | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL
> +               | NETIF_F_VLAN_CHALLENGED | NETIF_F_LOOPBACK;
>        dev->ethtool_ops        = &loopback_ethtool_ops;
>        dev->header_ops         = &eth_header_ops;
>        dev->netdev_ops         = &loopback_ops;
[...]

Looks ok. For loopback, more features are actually changeable - only
last 4 are really forced here.

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: [PATCH 0/2] wireless: Make and use const struct ieee80211_channel
From: John W. Linville @ 2011-05-11 16:57 UTC (permalink / raw)
  To: Joe Perches
  Cc: libertas-dev, linux-wireless, orinoco-users, orinoco-devel,
	netdev, LKML
In-Reply-To: <1304698221.11874.6.camel@Joe-Laptop>

On Fri, May 06, 2011 at 09:10:21AM -0700, Joe Perches wrote:
> On Fri, 2011-05-06 at 09:19 -0400, John W. Linville wrote:
> > On Thu, May 05, 2011 at 03:21:47PM -0700, Joe Perches wrote:
> > > On Thu, 2011-05-05 at 14:49 -0400, John W. Linville wrote:
> > > > These patches generated a lot of warnings in net/mac80211.  Did you
> > > > actually build them?
> > > Yes.
> > > Did you apply patch 1/2 first?
> > > It's a dependent patch.
> > That's the one that cause most of the warnings...
> 
> Consider the 2 patches as a single patch.
> Do you have new build warnings after applying both
> patches 1 and 2?

Yes, of course.

  CC [M]  net/mac80211/scan.o
net/mac80211/scan.c: In function ‘ieee80211_scan_state_decision’:
net/mac80211/scan.c:509:12: warning: assignment discards qualifiers from pointer target type
net/mac80211/scan.c: In function ‘ieee80211_scan_state_set_channel’:
net/mac80211/scan.c:610:7: warning: assignment discards qualifiers from pointer target type
  CC [M]  net/mac80211/offchannel.o
  CC [M]  net/mac80211/ht.o
  CC [M]  net/mac80211/agg-tx.o
  CC [M]  net/mac80211/agg-rx.o
  CC [M]  net/mac80211/ibss.o
net/mac80211/ibss.c: In function ‘ieee80211_sta_join_ibss’:
net/mac80211/ibss.c:250:7: warning: passing argument 4 of ‘__ieee80211_sta_join_ibss’ discards qualifiers from pointer target type
net/mac80211/ibss.c:64:13: note: expected ‘struct ieee80211_channel *’ but argument is of type ‘const struct ieee80211_channel *’
net/mac80211/ibss.c: In function ‘ieee80211_ibss_join’:
net/mac80211/ibss.c:918:24: warning: assignment discards qualifiers from pointer target type
net/mac80211/ibss.c:923:30: warning: assignment discards qualifiers from pointer target type
  CC [M]  net/mac80211/mlme.o
net/mac80211/mlme.c: In function ‘ieee80211_mgd_auth’:
net/mac80211/mlme.c:2350:11: warning: assignment discards qualifiers from pointer target type
net/mac80211/mlme.c: In function ‘ieee80211_mgd_assoc’:
net/mac80211/mlme.c:2500:11: warning: assignment discards qualifiers from pointer target type
  CC [M]  net/mac80211/work.o
  CC [M]  net/mac80211/iface.o
  CC [M]  net/mac80211/rate.o
  CC [M]  net/mac80211/tkip.o
  CC [M]  net/mac80211/aes_ccm.o
  CC [M]  net/mac80211/aes_cmac.o
  CC [M]  net/mac80211/cfg.o
net/mac80211/cfg.c:2083:2: warning: initialization from incompatible pointer type
net/mac80211/cfg.c:2101:2: warning: initialization from incompatible pointer type
net/mac80211/cfg.c:2103:2: warning: initialization from incompatible pointer type
  CC [M]  net/mac80211/rx.o

commit 07daa458f14226deff1e464f594a44111168e7ee
Author: Joe Perches <joe@perches.com>
Date:   Thu Apr 28 22:25:08 2011 -0700

    wireless: Use const struct ieee80211_channel where possible
    
    Make some structure uses const.
    
    Signed-off-by: Joe Perches <joe@perches.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>

commit 5c9adfae8855fc744f77b24df322060a7117c521
Author: Joe Perches <joe@perches.com>
Date:   Thu Apr 28 22:25:07 2011 -0700

    wireless: Make struct ieee80211_channel const where possible
    
    Useful for declarations of static const.
    
    Signed-off-by: Joe Perches <joe@perches.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>

<commits were temporary, not applied now>

I'm dropping these patches -- feel free to repost if/when the warnings
disappear.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [PATCH] Add libertas_disablemesh module parameter to disable mesh interface
From: Randy Dunlap @ 2011-05-11 17:00 UTC (permalink / raw)
  To: Sascha Silbe
  Cc: linux-wireless, devel, Dan Williams, John W. Linville,
	libertas-dev, netdev, linux-kernel
In-Reply-To: <1305118354-17337-1-git-send-email-silbe@activitycentral.com>

On Wed, 11 May 2011 14:52:34 +0200 Sascha Silbe wrote:

> This allows individual users and deployments to disable mesh support at
> runtime, i.e. without having to build and maintain a custom kernel.

I guess a user could want to do this on a per-driver basis, but ISTM that
it would be better to be something like a sysctl that applies to all (wireless)
drivers.

Do other wireless drivers have something like this?


> Based on a patch by Paul Fox <pgf@laptop.org>.
> Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
> ---
>  drivers/net/wireless/libertas/main.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> The patch is based on the OLPC 2.6.35 kernel tree, but applies cleanly to
> wireless-next.
> 
> diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
> index 8445473..62069e2 100644
> --- a/drivers/net/wireless/libertas/main.c
> +++ b/drivers/net/wireless/libertas/main.c
> @@ -41,6 +41,10 @@ unsigned int lbs_debug;
>  EXPORT_SYMBOL_GPL(lbs_debug);
>  module_param_named(libertas_debug, lbs_debug, int, 0644);
> 
> +unsigned int lbs_disablemesh;
> +EXPORT_SYMBOL_GPL(lbs_disablemesh);
> +module_param_named(libertas_disablemesh, lbs_disablemesh, int, 0644);
> +
> 
>  /* This global structure is used to send the confirm_sleep command as
>   * fast as possible down to the firmware. */
> @@ -1086,7 +1090,10 @@ int lbs_start_card(struct lbs_private *priv)
> 
>  	lbs_update_channel(priv);
> 
> -	lbs_init_mesh(priv);
> +	if (!lbs_disablemesh)
> +		lbs_init_mesh(priv);
> +	else
> +		lbs_pr_info("%s: mesh disabled\n", dev->name);
> 
>  	/*
>  	 * While rtap isn't related to mesh, only mesh-enabled
> --


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* Re: [PATCH 00/18] virtio and vhost-net performance enhancements
From: Krishna Kumar2 @ 2011-05-11 17:10 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Christian Borntraeger, Carsten Otte, habanero, Heiko Carstens,
	kvm, lguest, linux-kernel, linux-s390, linux390, netdev,
	Rusty Russell, Martin Schwidefsky, steved, Tom Lendacky,
	virtualization, Shirley Ma
In-Reply-To: <cover.1304541918.git.mst@redhat.com>

"Michael S. Tsirkin" <mst@redhat.com> wrote on 05/05/2011 02:20:18 AM:

> [PATCH 00/18] virtio and vhost-net performance enhancements
>
> OK, here's a large patchset that implements the virtio spec update that I
> sent earlier. It supercedes the PUBLISH_USED_IDX patches
> I sent out earlier.
>
> I know it's a lot to ask but please test, and please consider for
2.6.40 :)
>
> I see nice performance improvements: one run showed going from 12
> to 18 Gbit/s host to guest with netperf, but I did not spend a lot
> of time testing performance, so no guarantees it's not a fluke,
> I hope others will try this out and report.
> Pls note I will be away from keyboard for the next week.

I tested with the git tree (which also contains the later
additional patch), and get this error on guest:

May 11 08:06:08 localhost kernel: net eth0: Unexpected TX queue failure:
-28
May 11 08:06:08 localhost kernel: net eth0: Unexpected TX queue failure:
-28
May 11 08:06:08 localhost kernel: net eth0: Unexpected TX queue failure:
-28
May 11 08:06:08 localhost kernel: net eth0: Unexpected TX queue failure:
-28
...

The network stops after that and requires a modprobe "restart" to
get it working again. This is with the new qemu/vhost/virtio-net.

Please let me know if I am missing something.

thanks,

- KK

^ permalink raw reply

* Re: future developments of usbnet
From: Oliver Neukum @ 2011-05-11 17:37 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Alan Stern, Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20110509084649.127ec0da@nehalam>

Am Montag, 9. Mai 2011, 17:46:49 schrieb Stephen Hemminger:
> On Mon, 9 May 2011 11:31:16 -0400 (EDT)
> Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> wrote:

> > How do other network drivers handle this problem?  Can the same 
> > strategy be used?
> > 
> > Alan Stern
> 
> Most Ethernet drivers have a fixed size receive ring and pass preallocated
> memory (skb's or pages) for the hardware to fill in. When NAPI poll is run
> it refills the ring and passes the data up to netif_receive_skb. NAPI allows
> the poll routine to process a limited number of packets (weight) and after
> that the poll loop exits and gets rerun by soft interrupt.  If data is
> arriving faster than the kernel can process, eventually the receive ring
> passed to hardware gets exhausted and the hardware drops packets.

How is the frequency NAPI uses to poll determined? We could abuse
this and resubmit the rx URBs only at poll time, but this feels dirty,
because we would still leave interrupts enabled.

Is there no other driver which faces this problem?

	Regards
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: future developments of usbnet
From: David Miller @ 2011-05-11 17:47 UTC (permalink / raw)
  To: oliver-GvhC2dPhHPQdnm+yROfE0A
  Cc: shemminger-ZtmgI6mnKB3QT0dZR+AlfA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	tom.leiming-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <201105111937.47448.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>

From: Oliver Neukum <oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
Date: Wed, 11 May 2011 19:37:47 +0200

> How is the frequency NAPI uses to poll determined? We could abuse
> this and resubmit the rx URBs only at poll time, but this feels dirty,
> because we would still leave interrupts enabled.

It's not a frequency determined internally by the networking.

It is purely event based (meaning triggered by the device's interrupt).

Control flow is:

IRQ --> irq_handler()
	my_netdevice_disable_device_irq();
	napi_schedule();
		--> schedule POLL soft irq
SOFTIRQ --> net_rx_action()
	budget = netdev_budget;
	for_each_net_device_needing_polling() {
		...
		weight = napi_state->weight;
		...
		work = n->poll(n, weight);
		...
		budget -= work;
		...
	}

That's the general idea.

Basically once you take you interrupt, and disable device interrupts,
the generic net device layer calls your ->poll() routing with a "weight"
You should not process more RX packets than this value.

If you have less than "weight" work to do, you should do a napi_complete(),
which takes you out of the polling group, and re-enable device interrupts.

So the idea is that you keep getting ->poll()'d until there is no more
RX work to do.

The "weight" argument implements fairness amongst competing, actively
polling, devices on the same CPU.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 00/21] tipc updates for the next round
From: David Miller @ 2011-05-11 18:01 UTC (permalink / raw)
  To: paul.gortmaker; +Cc: netdev, Allan.Stephens
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>

From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Tue, 10 May 2011 16:44:16 -0400

> Another mixed bag of tipc commits.  It leads off with some largely
> cosmetic stuff, but then gets into what should be some more of the
> useful/functional fixes with a bit more complexity.  There really
> isn't any new functionality here -- just fixes or robustness type
> improvements.
 ...
>   git://git.kernel.org/pub/scm/linux/kernel/git/paulg/net-next-2.6.git tipc-May10-2011

Pulled, thanks a lot.

^ permalink raw reply

* RE: [PATCH net-next 00/21] tipc updates for the next round
From: Stephens, Allan @ 2011-05-11 18:02 UTC (permalink / raw)
  To: Gortmaker, Paul; +Cc: netdev@vger.kernel.org
In-Reply-To: <20110511.110111.193684522.davem@davemloft.net>

Excellent!

-- Al

> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, May 11, 2011 2:01 PM
> To: Gortmaker, Paul
> Cc: netdev@vger.kernel.org; Stephens, Allan
> Subject: Re: [PATCH net-next 00/21] tipc updates for the next round
> 
> From: Paul Gortmaker <paul.gortmaker@windriver.com>
> Date: Tue, 10 May 2011 16:44:16 -0400
> 
> > Another mixed bag of tipc commits.  It leads off with some largely
> > cosmetic stuff, but then gets into what should be some more of the
> > useful/functional fixes with a bit more complexity.  There really
> > isn't any new functionality here -- just fixes or robustness type
> > improvements.
>  ...
> >   git://git.kernel.org/pub/scm/linux/kernel/git/paulg/net-next-2.6.git
> > tipc-May10-2011
> 
> Pulled, thanks a lot.

^ permalink raw reply

* Re: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps
From: Florian Weimer @ 2011-05-11  9:47 UTC (permalink / raw)
  To: David Decotigny
  Cc: Giuseppe Cavallaro, David S. Miller, Joe Perches,
	Stanislaw Gruszka, netdev, linux-kernel
In-Reply-To: <1304986748-15809-3-git-send-email-decot@google.com>

* David Decotigny:

> Tested: module compiling, NOT tested on real hardware.

To my knowledge, dl2k is broken.  Some sort of synchronization
primitives are missing.  Under load, the NIC's notion of ring buffer
status diverges from the host's view. 8-(

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

^ permalink raw reply

* Re: GIT net-2.6 rolled back 8 commits...
From: David Miller @ 2011-05-11 18:29 UTC (permalink / raw)
  To: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1305084687.2437.44.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 11 May 2011 05:31:27 +0200

> Would it be possible you sync net-next-2.6 and pull net-2.6 in it ?

I'm taking care of this right now.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox