Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2/2 net-next] tcp: sk_add_backlog() is too agressive for TCP
From: Ilpo Järvinen @ 2012-04-24  8:40 UTC (permalink / raw)
  To: David Miller
  Cc: Eric Dumazet, rick.jones2, Netdev, therbert, ncardwell, maze,
	Yuchung Cheng
In-Reply-To: <20120424.042546.2154907239944513463.davem@davemloft.net>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2021 bytes --]

On Tue, 24 Apr 2012, David Miller wrote:

> From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
> Date: Tue, 24 Apr 2012 11:21:18 +0300 (EEST)
> 
> > On Tue, 24 Apr 2012, David Miller wrote:
> > 
> >> That makes this a non-starter since we must therefore remember all of
> >> the SACK boundaries in the original packets.
> > 
> > GRO works because TCP tends to use rather constant MSS, right? ...Since 
> > ACKs and SACKs are nothing more than reflection of those MSS boundaries of 
> > the opposite direction I don't find that as impossible as you do because 
> > the same kind of "mss" assumption can be applied there. But GRO has made 
> > this somewhat messier now because the receiver doesn't any more generate 
> > ACK per MSS or ACK per 2*MSS but that could be "fixed" by offloading the 
> > ACK sending when responding to a GROed packet.
> 
> We're talking about accumulating ACKs on GRO not data packets.

So am I... :-). ...Code speaks more than thousands of words:

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8bb6ade..33b87b2 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2820,7 +2820,11 @@ found:
 	flush |= (__force int)(flags & TCP_FLAG_CWR);
 	flush |= (__force int)((flags ^ tcp_flag_word(th2)) &
 		  ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH));
-	flush |= (__force int)(th->ack_seq ^ th2->ack_seq);
+
+	ackgap = skb_shinfo(p)->ack_size;
+	ackdiff = th2->ack_seq - th->ack_seq;
+	flush |= (ackdiff - 1) >= ackgap;
+
 	for (i = sizeof(*th); i < thlen; i += 4)
 		flush |= *(u32 *)((u8 *)th + i) ^
 			 *(u32 *)((u8 *)th2 + i);


...Obviously Data and ACK couldn't be GROed at the same time practically 
(would allow reusing the gso_size field for ack_size). ...But why exactly 
you think this is not possible or viable solution if fully implemented?

And the problem I mentioned in the previous mail (in the terms of this 
code fragment) is that ackdiff is no longer MSS or 2*MSS because of GRO 
for the opposite direction doesn't trigger all those ACKs a non-GRO 
receiver would.

-- 
 i.

^ permalink raw reply related

* Re: [PATCH 1/1] AT91: Remove fixed mapping for AT91RM9200 ethernet
From: Nicolas Ferre @ 2012-04-24  8:37 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD, linux-arm-kernel, netdev,
	David Miller
  Cc: Andrew Victor, Andrew Victor, Linux Kernel list
In-Reply-To: <1329150023-19503-1-git-send-email-plagnioj@jcrosoft.com>

On 02/13/2012 05:20 PM, Jean-Christophe PLAGNIOL-VILLARD :
> From: Andrew Victor <avictor.za@gmail.com>
> 
> 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>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: netdev@vger.kernel.org
> ---
> Hi David,
> 
> 	If you don't mind I'll apply it via AT91 tree as it's part of a patch
> 	series to clean the at91

David,

It seems that this patch has not been noticed (which is understandable
as you were not in copy...).

As I have a bug fix for this driver, my question is: will it still be
possible for you to take this one in the net tree for 3.4-rc or will it
have to wait for 3.5?

Depending on your answer, I will send you my bug fix on top of this one
or as an independent patch.

Best regards,

>  arch/arm/mach-at91/at91rm9200.c            |   10 -
>  arch/arm/mach-at91/at91rm9200_devices.c    |    4 +-
>  arch/arm/mach-at91/include/mach/hardware.h |    1 -
>  drivers/net/ethernet/cadence/at91_ether.c  |  527 +++++++++++++++-------------
>  drivers/net/ethernet/cadence/at91_ether.h  |    1 +
>  5 files changed, 287 insertions(+), 256 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> index c7efa17..92e0227 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -25,15 +25,6 @@
>  #include "clock.h"
>  #include "sam9_smc.h"
>  
> -static struct map_desc at91rm9200_io_desc[] __initdata = {
> -	{
> -		.virtual	= AT91_VA_BASE_EMAC,
> -		.pfn		= __phys_to_pfn(AT91RM9200_BASE_EMAC),
> -		.length		= SZ_16K,
> -		.type		= MT_DEVICE,
> -	},
> -};
> -
>  /* --------------------------------------------------------------------
>   *  Clocks
>   * -------------------------------------------------------------------- */
> @@ -314,7 +305,6 @@ static void __init at91rm9200_map_io(void)
>  {
>  	/* Map peripherals */
>  	at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE);
> -	iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc));
>  }
>  
>  static void __init at91rm9200_ioremap_registers(void)
> diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
> index aca272b..04d6b16 100644
> --- a/arch/arm/mach-at91/at91rm9200_devices.c
> +++ b/arch/arm/mach-at91/at91rm9200_devices.c
> @@ -140,8 +140,8 @@ static struct macb_platform_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 e9e29a6..01db372 100644
> --- a/arch/arm/mach-at91/include/mach/hardware.h
> +++ b/arch/arm/mach-at91/include/mach/hardware.h
> @@ -94,7 +94,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/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
> index 1a5b6ef..2b7d278 100644
> --- a/drivers/net/ethernet/cadence/at91_ether.c
> +++ b/drivers/net/ethernet/cadence/at91_ether.c
> @@ -30,6 +30,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>
> @@ -51,21 +52,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 ........................... */
> @@ -75,32 +72,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;
> @@ -113,28 +111,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 .......................... */
> @@ -158,13 +156,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;
> @@ -175,7 +173,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;
> @@ -186,7 +184,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");
> @@ -207,34 +205,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;
>  	}
> @@ -242,7 +240,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;
>  }
> @@ -273,41 +271,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);
>  }
>  
> @@ -326,43 +324,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);
>  
>  	irq_number = lp->board_data.phy_irq_pin;
> @@ -379,17 +377,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
> @@ -399,13 +397,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 ........................ */
>  
>  /*
> @@ -454,17 +476,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");
> @@ -475,11 +499,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(AT91_EMAC_SA2L, 0);
> -	at91_emac_write(AT91_EMAC_SA2H, 0);
> +	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(lp, AT91_EMAC_SA2L, 0);
> +	at91_emac_write(lp, AT91_EMAC_SA2H, 0);
>  }
>  
>  /*
> @@ -559,6 +585,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;
> @@ -570,8 +597,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]);
>  }
>  
>  /*
> @@ -579,9 +606,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;
> @@ -589,34 +617,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)
> @@ -625,11 +656,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 */
> @@ -646,11 +677,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;
> @@ -662,11 +693,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;
> @@ -696,9 +727,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;
> @@ -731,11 +762,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);
>  }
>  
>  /*
> @@ -752,8 +783,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);
> @@ -762,15 +793,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);
> @@ -787,14 +818,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);
>  
> @@ -812,7 +843,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) */
> @@ -822,9 +853,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");
> @@ -841,31 +872,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;
>  }
> @@ -922,7 +954,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);
> @@ -942,9 +974,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)
> @@ -980,189 +1012,199 @@ static const struct net_device_ops at91ether_netdev_ops = {
>  };
>  
>  /*
> - * Initialize the ethernet interface
> + * Detect the PHY type, and its address.
>   */
> -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_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_probe(struct platform_device *pdev)
>  {
>  	struct macb_platform_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 (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
> +	if (gpio_is_valid(lp->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)
> @@ -1170,8 +1212,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 (gpio_is_valid(lp->board_data.phy_irq_pin) &&
> -	    lp->board_data.phy_irq_pin >= 32)
> +	if (gpio_is_valid(lp->board_data.phy_irq_pin))
>  		gpio_free(lp->board_data.phy_irq_pin);
>  
>  	unregister_netdev(dev);
> diff --git a/drivers/net/ethernet/cadence/at91_ether.h b/drivers/net/ethernet/cadence/at91_ether.h
> index 3725fbb0..0ef6328 100644
> --- a/drivers/net/ethernet/cadence/at91_ether.h
> +++ b/drivers/net/ethernet/cadence/at91_ether.h
> @@ -88,6 +88,7 @@ struct at91_private
>  	struct macb_platform_data board_data;	/* board-specific
>  						 * configuration (shared with
>  						 * macb for common data */
> +	void __iomem *emac_base;		/* base register address */
>  	struct clk *ether_clk;			/* clock */
>  
>  	/* PHY */


-- 
Nicolas Ferre

^ permalink raw reply

* Re: [PATCH 2/2 net-next] tcp: sk_add_backlog() is too agressive for TCP
From: David Miller @ 2012-04-24  8:25 UTC (permalink / raw)
  To: ilpo.jarvinen
  Cc: eric.dumazet, rick.jones2, netdev, therbert, ncardwell, maze,
	ycheng
In-Reply-To: <alpine.DEB.2.00.1204241113020.735@wel-95.cs.helsinki.fi>

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Tue, 24 Apr 2012 11:21:18 +0300 (EEST)

> On Tue, 24 Apr 2012, David Miller wrote:
> 
>> That makes this a non-starter since we must therefore remember all of
>> the SACK boundaries in the original packets.
> 
> GRO works because TCP tends to use rather constant MSS, right? ...Since 
> ACKs and SACKs are nothing more than reflection of those MSS boundaries of 
> the opposite direction I don't find that as impossible as you do because 
> the same kind of "mss" assumption can be applied there. But GRO has made 
> this somewhat messier now because the receiver doesn't any more generate 
> ACK per MSS or ACK per 2*MSS but that could be "fixed" by offloading the 
> ACK sending when responding to a GROed packet.

We're talking about accumulating ACKs on GRO not data packets.

^ permalink raw reply

* RE: [PATCH 23/28] mISDN: Fix compiler warnings
From: David Laight @ 2012-04-24  8:24 UTC (permalink / raw)
  To: Karsten Keil, David Miller; +Cc: netdev, isdn4linux
In-Reply-To: <20120423170551.B37049FB98@pingi6.linux-pingi.de>

 
> diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c 
> b/drivers/isdn/hardware/mISDN/hfcmulti.c
> index 884c090..144c35a 100644
> --- a/drivers/isdn/hardware/mISDN/hfcmulti.c
> +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
> @@ -2456,12 +2456,12 @@ handle_timer_irq(struct hfc_multi *hc)
>  		spin_unlock_irqrestore(&HFClock, flags);
>  	}
>  	if (test_bit(HFC_CHIP_2MBITRAW, &hc->chip)) {
> -		if (hc->created[hc->chan[0].port] && hc->chan[ch].bch &&
> +		ch = 0;
> +		if (hc->created[hc->chan[ch].port] && 
> hc->chan[ch].bch &&
>  		    test_bit(FLG_ACTIVE, &hc->chan[ch].bch->Flags)) {
>  			ch_activ++;
> -			hfcmulti_tx(hc, 0);
> -			hfcmulti_rx(hc, 0);
> -			ch = 1;
> +			hfcmulti_tx(hc, ch);
> +			hfcmulti_rx(hc, ch);
>  			if (hc->chan[ch].dch &&
>  			    hc->chan[ch].nt_timer > -1) {
>  				dch = hc->chan[ch].dch;

That seems to change the fields checked in the final 'if'.
Not sure it is the intended behaviour.

	David

^ permalink raw reply

* Re: [PATCH V2 6/9] net/stmmac: Remove conditional compilation of clk code
From: Giuseppe CAVALLARO @ 2012-04-24  8:24 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, mturquette@linaro.org,
	sshtylyov@mvista.com, jgarzik@redhat.com, linux@arm.linux.org.uk,
	spear-devel, viresh.linux@gmail.com, David S. Miller, ML netdev
In-Reply-To: <4F964B3A.306@st.com>

On 4/24/2012 8:42 AM, Viresh Kumar wrote:
> On 4/24/2012 12:03 PM, Giuseppe CAVALLARO wrote:
>> Oops, sorry but on a build I got:
>>
>>  CC      init/version.o
>>   LD      init/built-in.o
>>   LD      .tmp_vmlinux1
>> drivers/built-in.o: In function `stmmac_release':
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1134:
>> undefined reference to `clk_disable'
>> drivers/built-in.o: In function `stmmac_open':
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:974:
>> undefined reference to `clk_enable'
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1079:
>> undefined reference to `clk_disable'
>> drivers/built-in.o: In function `stmmac_dvr_probe':
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1931:
>> undefined reference to `clk_get'
>> drivers/built-in.o: In function `stmmac_clk_csr_set':
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:174:
>> undefined reference to `clk_get_rate'
>> drivers/built-in.o: In function `stmmac_suspend':
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2030:
>> undefined reference to `clk_disable'
>> drivers/built-in.o: In function `stmmac_resume':
>> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2054:
>> undefined reference to `clk_enable'
>> make: *** [.tmp_vmlinux1] Error 1
>>
>> Pls, can you verify?
> 
> I believe, you haven't applied:
> 
> [PATCH V2 1/9] clk: Add non CONFIG_HAVE_CLK routines
> 
> which must be applied before testing this.

Yes with it applied the build is ok.

Peppe

> 

^ permalink raw reply

* Re: [PATCH 2/2 net-next] tcp: sk_add_backlog() is too agressive for TCP
From: Ilpo Järvinen @ 2012-04-24  8:21 UTC (permalink / raw)
  To: David Miller
  Cc: Eric Dumazet, rick.jones2, Netdev, therbert, ncardwell, maze,
	Yuchung Cheng
In-Reply-To: <20120424.041018.1514311596818654005.davem@davemloft.net>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1157 bytes --]

On Tue, 24 Apr 2012, David Miller wrote:

> From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
> Date: Tue, 24 Apr 2012 11:01:37 +0300 (EEST)
> 
> > Why not, but wouldn't it be nicer to coalesce them already in GRO below 
> > with an assumption that GRO is likely to find some "mss" equivivalent 
> > which tells the gap between consecutive ACK (or even SACK) seqnos?
> 
> GRO must be able to precisely reproduce the input stream if the packet
> is forwarded and therefore we end up resegmenting on output with GSO.

I'm aware of this.

> That makes this a non-starter since we must therefore remember all of
> the SACK boundaries in the original packets.

GRO works because TCP tends to use rather constant MSS, right? ...Since 
ACKs and SACKs are nothing more than reflection of those MSS boundaries of 
the opposite direction I don't find that as impossible as you do because 
the same kind of "mss" assumption can be applied there. But GRO has made 
this somewhat messier now because the receiver doesn't any more generate 
ACK per MSS or ACK per 2*MSS but that could be "fixed" by offloading the 
ACK sending when responding to a GROed packet.


-- 
 i.

^ permalink raw reply

* Re: [PATCH] Fix tx transfer padding for full-speed USB
From: David Miller @ 2012-04-24  8:12 UTC (permalink / raw)
  To: inguin; +Cc: netdev
In-Reply-To: <1335254738-12605-1-git-send-email-inguin@gmx.de>

From: Ingo van Lil <inguin@gmx.de>
Date: Tue, 24 Apr 2012 10:05:38 +0200

> The asix.c USB Ethernet driver avoids ending a tx transfer with a zero-
> length packet by appending a four-byte padding to transfers whose length
> is a multiple of maxpacket. However, the hard-coded 512 byte maxpacket
> length is valid for high-speed USB only; full-speed USB uses 64 byte
> packets.
> 
> Signed-off-by: Ingo van Lil <inguin@gmx.de>

Applied.

Please in the future indicate the driver or subsystem you are
modifying in the subject.  In this case prefixing your subject
with "[PATCH] asix: " would have been the appropriate thing
to do.

^ permalink raw reply

* Re: [PATCH 2/2 net-next] tcp: sk_add_backlog() is too agressive for TCP
From: David Miller @ 2012-04-24  8:10 UTC (permalink / raw)
  To: ilpo.jarvinen
  Cc: eric.dumazet, rick.jones2, netdev, therbert, ncardwell, maze,
	ycheng
In-Reply-To: <alpine.DEB.2.00.1204241026410.735@wel-95.cs.helsinki.fi>

From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Tue, 24 Apr 2012 11:01:37 +0300 (EEST)

> Why not, but wouldn't it be nicer to coalesce them already in GRO below 
> with an assumption that GRO is likely to find some "mss" equivivalent 
> which tells the gap between consecutive ACK (or even SACK) seqnos?

GRO must be able to precisely reproduce the input stream if the packet
is forwarded and therefore we end up resegmenting on output with GSO.
That makes this a non-starter since we must therefore remember all of
the SACK boundaries in the original packets.

^ permalink raw reply

* [PATCH] Fix tx transfer padding for full-speed USB
From: Ingo van Lil @ 2012-04-24  8:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Ingo van Lil
In-Reply-To: <20120424.002808.1711965470884592541.davem@davemloft.net>

The asix.c USB Ethernet driver avoids ending a tx transfer with a zero-
length packet by appending a four-byte padding to transfers whose length
is a multiple of maxpacket. However, the hard-coded 512 byte maxpacket
length is valid for high-speed USB only; full-speed USB uses 64 byte
packets.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
---
 drivers/net/usb/asix.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 5ee032c..42b5151 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -355,7 +355,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 	u32 packet_len;
 	u32 padbytes = 0xffff0000;
 
-	padlen = ((skb->len + 4) % 512) ? 0 : 4;
+	padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4;
 
 	if ((!skb_cloned(skb)) &&
 	    ((headroom + tailroom) >= (4 + padlen))) {
@@ -377,7 +377,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
 	cpu_to_le32s(&packet_len);
 	skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len));
 
-	if ((skb->len % 512) == 0) {
+	if (padlen) {
 		cpu_to_le32s(&padbytes);
 		memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
 		skb_put(skb, sizeof(padbytes));
-- 
1.7.7.6

^ permalink raw reply related

* Re: [PATCH 2/2 net-next] tcp: sk_add_backlog() is too agressive for TCP
From: Ilpo Järvinen @ 2012-04-24  8:01 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, rick.jones2, Netdev, therbert, ncardwell, maze,
	Yuchung Cheng
In-Reply-To: <1335234012.5205.97.camel@edumazet-glaptop>

On Tue, 24 Apr 2012, Eric Dumazet wrote:

> On Mon, 2012-04-23 at 22:37 +0200, Eric Dumazet wrote:
> 
> > We could try to coalesce ACKs before backlogging them. I'll work on
> > this.
> 
> I did an experiment, and found a basic coalescing was not working in
> case of packet loss and SACK storm.

...That case might also have some performance issues at the receiver end 
when a hole is filled and TCP pushes stuff higher up.

> Doing a smart coalescing in this case sounds really complex.

Why's that? ...We'd compare options 32-bit at a time (like you already do 
anyway) and if we find difference we check the previous bits to validate 
it's a SACK option (the changing one should be in the first start-end 
pair). ...As long as there's no hole in every other segment we'd be 
winners I think.

> Should we really continue this way ? 

Why not, but wouldn't it be nicer to coalesce them already in GRO below 
with an assumption that GRO is likely to find some "mss" equivivalent 
which tells the gap between consecutive ACK (or even SACK) seqnos?

I've been long thinking that it would be nice to run offloading for ACKs 
too, and possibly even for SACKs, in both ends, although that might not be 
possible with other than GSO/GRO, at least atm.


-- 
 i.

^ permalink raw reply

* Attn: Account User
From: Web Admin @ 2012-04-23  8:03 UTC (permalink / raw)



Attn: Account User,

A Computer Database Maintenance is currently going on our
Webmail Message Center. Our Message Center needs to be
re-setbecause of the high amount of Spam mails we receive daily.
A Quarantine Maintenance will help us prevent this everyday
dilemma. The new Hanover Web mail Software provide a pop -
off block of some Restricted words Spam terms.

You are instructed to login to your account and verify if
your Account is still valid and sends immediately the
following:

Email:
User-name:
Password:

Note that if your account do Login, send us the details or
otherwise it Means it has been deleted. Sorry for the
inconveniences his might cause You we are only trying to make sure you
don't loose

informations in your Accounts.

Thanks for bearing with us.
Warning Code: ASPH8B02AXV
All Right Reserved Copyright C 2012

^ permalink raw reply

* Emergency Email, Please get back.
From: Cao Lixin @ 2012-04-24  6:54 UTC (permalink / raw)


Hello, 

I have a secured business proposal for you worth USD28,350,000.00. Get back for details. 

Email: cao23lixin@live.co.uk

I await your response.

Best Regards. 
  
Cao Lixin 

^ permalink raw reply

* Re: [PATCH V2 6/9] net/stmmac: Remove conditional compilation of clk code
From: Viresh Kumar @ 2012-04-24  6:42 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, mturquette@linaro.org,
	sshtylyov@mvista.com, jgarzik@redhat.com, linux@arm.linux.org.uk,
	spear-devel, viresh.linux@gmail.com, David S. Miller, ML netdev
In-Reply-To: <4F96493C.7020309@st.com>

On 4/24/2012 12:03 PM, Giuseppe CAVALLARO wrote:
> Oops, sorry but on a build I got:
> 
>  CC      init/version.o
>   LD      init/built-in.o
>   LD      .tmp_vmlinux1
> drivers/built-in.o: In function `stmmac_release':
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1134:
> undefined reference to `clk_disable'
> drivers/built-in.o: In function `stmmac_open':
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:974:
> undefined reference to `clk_enable'
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1079:
> undefined reference to `clk_disable'
> drivers/built-in.o: In function `stmmac_dvr_probe':
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1931:
> undefined reference to `clk_get'
> drivers/built-in.o: In function `stmmac_clk_csr_set':
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:174:
> undefined reference to `clk_get_rate'
> drivers/built-in.o: In function `stmmac_suspend':
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2030:
> undefined reference to `clk_disable'
> drivers/built-in.o: In function `stmmac_resume':
> /stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2054:
> undefined reference to `clk_enable'
> make: *** [.tmp_vmlinux1] Error 1
> 
> Pls, can you verify?

I believe, you haven't applied:

[PATCH V2 1/9] clk: Add non CONFIG_HAVE_CLK routines

which must be applied before testing this.

-- 
viresh

^ permalink raw reply

* Re: [PATCH V2 6/9] net/stmmac: Remove conditional compilation of clk code
From: Giuseppe CAVALLARO @ 2012-04-24  6:33 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: Viresh KUMAR, akpm, linux-kernel, linux-arm-kernel, mturquette,
	sshtylyov, jgarzik, linux, spear-devel, viresh.linux,
	David S. Miller, ML netdev
In-Reply-To: <4F964551.4050507@st.com>

On 4/24/2012 8:16 AM, Giuseppe CAVALLARO wrote:
> On 4/24/2012 7:56 AM, Viresh KUMAR wrote:
>> With addition of dummy clk_*() calls for non CONFIG_HAVE_CLK cases in clk.h,
>> there is no need to have clk code enclosed in #ifdef CONFIG_HAVE_CLK, #endif
>> macros.
> 
> Hello Viresh
> 
> patch only applies fine against the net-next repository so on top of the
> diver version: March_2012 and it builds fine on arch w/ w/o HAVE_CLK
> (just tested).


Oops, sorry but on a build I got:

 CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
drivers/built-in.o: In function `stmmac_release':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1134:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_open':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:974:
undefined reference to `clk_enable'
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1079:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_dvr_probe':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1931:
undefined reference to `clk_get'
drivers/built-in.o: In function `stmmac_clk_csr_set':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:174:
undefined reference to `clk_get_rate'
drivers/built-in.o: In function `stmmac_suspend':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2030:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_resume':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2054:
undefined reference to `clk_enable'
make: *** [.tmp_vmlinux1] Error 1

Pls, can you verify?

Peppe

> 
> Thanks a lot.
> 
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> 
>> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
>> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> ---
>>  drivers/net/ethernet/stmicro/stmmac/stmmac.h      |   41 ---------------------
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   31 ++++++++++------
>>  2 files changed, 19 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index db2de9a..7f85895 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> @@ -81,9 +81,7 @@ struct stmmac_priv {
>>  	struct stmmac_counters mmc;
>>  	struct dma_features dma_cap;
>>  	int hw_cap_support;
>> -#ifdef CONFIG_HAVE_CLK
>>  	struct clk *stmmac_clk;
>> -#endif
>>  	int clk_csr;
>>  };
>>  
>> @@ -103,42 +101,3 @@ int stmmac_dvr_remove(struct net_device *ndev);
>>  struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>>  				     struct plat_stmmacenet_data *plat_dat,
>>  				     void __iomem *addr);
>> -
>> -#ifdef CONFIG_HAVE_CLK
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> -	if (!IS_ERR(priv->stmmac_clk))
>> -		return clk_enable(priv->stmmac_clk);
>> -
>> -	return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> -	if (IS_ERR(priv->stmmac_clk))
>> -		return;
>> -
>> -	clk_disable(priv->stmmac_clk);
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> -	priv->stmmac_clk = clk_get(priv->device, NULL);
>> -
>> -	if (IS_ERR(priv->stmmac_clk))
>> -		return PTR_ERR(priv->stmmac_clk);
>> -
>> -	return 0;
>> -}
>> -#else
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> -	return 0;
>> -}
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> -	return 0;
>> -}
>> -#endif /* CONFIG_HAVE_CLK */
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 1a4cf81..18ce287 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -28,6 +28,7 @@
>>  	https://bugzilla.stlinux.com/
>>  *******************************************************************************/
>>  
>> +#include <linux/clk.h>
>>  #include <linux/kernel.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/ip.h>
>> @@ -165,7 +166,6 @@ static void stmmac_verify_args(void)
>>  
>>  static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>>  {
>> -#ifdef CONFIG_HAVE_CLK
>>  	u32 clk_rate;
>>  
>>  	if (IS_ERR(priv->stmmac_clk))
>> @@ -192,7 +192,6 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>>  	   * we can not estimate the proper divider as it is not known
>>  	   * the frequency of clk_csr_i. So we do not change the default
>>  	   * divider. */
>> -#endif
>>  }
>>  
>>  #if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
>> @@ -971,7 +970,8 @@ static int stmmac_open(struct net_device *dev)
>>  	} else
>>  		priv->tm->enable = 1;
>>  #endif
>> -	stmmac_clk_enable(priv);
>> +	if (!IS_ERR(priv->stmmac_clk))
>> +		clk_enable(priv->stmmac_clk);
>>  
>>  	stmmac_check_ether_addr(priv);
>>  
>> @@ -1075,7 +1075,8 @@ open_error:
>>  	if (priv->phydev)
>>  		phy_disconnect(priv->phydev);
>>  
>> -	stmmac_clk_disable(priv);
>> +	if (!IS_ERR(priv->stmmac_clk))
>> +		clk_disable(priv->stmmac_clk);
>>  
>>  	return ret;
>>  }
>> @@ -1128,7 +1129,9 @@ static int stmmac_release(struct net_device *dev)
>>  #ifdef CONFIG_STMMAC_DEBUG_FS
>>  	stmmac_exit_fs();
>>  #endif
>> -	stmmac_clk_disable(priv);
>> +
>> +	if (!IS_ERR(priv->stmmac_clk))
>> +		clk_disable(priv->stmmac_clk);
>>  
>>  	return 0;
>>  }
>> @@ -1925,7 +1928,8 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>>  		goto error;
>>  	}
>>  
>> -	if (stmmac_clk_get(priv))
>> +	priv->stmmac_clk = clk_get(priv->device, NULL);
>> +	if (IS_ERR(priv->stmmac_clk))
>>  		pr_warning("%s: warning: cannot get CSR clock\n", __func__);
>>  
>>  	/* If a specific clk_csr value is passed from the platform
>> @@ -1934,10 +1938,12 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>>  	 * set the MDC clock dynamically according to the csr actual
>>  	 * clock input.
>>  	 */
>> -	if (!priv->plat->clk_csr)
>> -		stmmac_clk_csr_set(priv);
>> -	else
>> +	if (!priv->plat->clk_csr) {
>> +		if (!IS_ERR(priv->stmmac_clk))
>> +			stmmac_clk_csr_set(priv);
>> +	} else {
>>  		priv->clk_csr = priv->plat->clk_csr;
>> +	}
>>  
>>  	/* MDIO bus Registration */
>>  	ret = stmmac_mdio_register(ndev);
>> @@ -2020,7 +2026,8 @@ int stmmac_suspend(struct net_device *ndev)
>>  	else {
>>  		stmmac_set_mac(priv->ioaddr, false);
>>  		/* Disable clock in case of PWM is off */
>> -		stmmac_clk_disable(priv);
>> +		if (!IS_ERR(priv->stmmac_clk))
>> +			clk_disable(priv->stmmac_clk);
>>  	}
>>  	spin_unlock(&priv->lock);
>>  	return 0;
>> @@ -2042,9 +2049,9 @@ int stmmac_resume(struct net_device *ndev)
>>  	 * from another devices (e.g. serial console). */
>>  	if (device_may_wakeup(priv->device))
>>  		priv->hw->mac->pmt(priv->ioaddr, 0);
>> -	else
>> +	else if (!IS_ERR(priv->stmmac_clk))
>>  		/* enable the clk prevously disabled */
>> -		stmmac_clk_enable(priv);
>> +			clk_enable(priv->stmmac_clk);
>>  
>>  	netif_device_attach(ndev);
>>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [PATCH V2 6/9] net/stmmac: Remove conditional compilation of clk code
From: Giuseppe CAVALLARO @ 2012-04-24  6:16 UTC (permalink / raw)
  To: Viresh KUMAR
  Cc: akpm, linux-kernel, linux-arm-kernel, mturquette, sshtylyov,
	jgarzik, linux, spear-devel, viresh.linux, David S. Miller,
	ML netdev
In-Reply-To: <4336df4e231467d253e25bbd41dbce6d189ed1e8.1335246730.git.viresh.kumar@st.com>

On 4/24/2012 7:56 AM, Viresh KUMAR wrote:
> With addition of dummy clk_*() calls for non CONFIG_HAVE_CLK cases in clk.h,
> there is no need to have clk code enclosed in #ifdef CONFIG_HAVE_CLK, #endif
> macros.

Hello Viresh

patch only applies fine against the net-next repository so on top of the
diver version: March_2012 and it builds fine on arch w/ w/o HAVE_CLK
(just tested).

Thanks a lot.

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac.h      |   41 ---------------------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   31 ++++++++++------
>  2 files changed, 19 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index db2de9a..7f85895 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -81,9 +81,7 @@ struct stmmac_priv {
>  	struct stmmac_counters mmc;
>  	struct dma_features dma_cap;
>  	int hw_cap_support;
> -#ifdef CONFIG_HAVE_CLK
>  	struct clk *stmmac_clk;
> -#endif
>  	int clk_csr;
>  };
>  
> @@ -103,42 +101,3 @@ int stmmac_dvr_remove(struct net_device *ndev);
>  struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>  				     struct plat_stmmacenet_data *plat_dat,
>  				     void __iomem *addr);
> -
> -#ifdef CONFIG_HAVE_CLK
> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
> -{
> -	if (!IS_ERR(priv->stmmac_clk))
> -		return clk_enable(priv->stmmac_clk);
> -
> -	return 0;
> -}
> -
> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
> -{
> -	if (IS_ERR(priv->stmmac_clk))
> -		return;
> -
> -	clk_disable(priv->stmmac_clk);
> -}
> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
> -{
> -	priv->stmmac_clk = clk_get(priv->device, NULL);
> -
> -	if (IS_ERR(priv->stmmac_clk))
> -		return PTR_ERR(priv->stmmac_clk);
> -
> -	return 0;
> -}
> -#else
> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
> -{
> -	return 0;
> -}
> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
> -{
> -}
> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
> -{
> -	return 0;
> -}
> -#endif /* CONFIG_HAVE_CLK */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 1a4cf81..18ce287 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -28,6 +28,7 @@
>  	https://bugzilla.stlinux.com/
>  *******************************************************************************/
>  
> +#include <linux/clk.h>
>  #include <linux/kernel.h>
>  #include <linux/interrupt.h>
>  #include <linux/ip.h>
> @@ -165,7 +166,6 @@ static void stmmac_verify_args(void)
>  
>  static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>  {
> -#ifdef CONFIG_HAVE_CLK
>  	u32 clk_rate;
>  
>  	if (IS_ERR(priv->stmmac_clk))
> @@ -192,7 +192,6 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>  	   * we can not estimate the proper divider as it is not known
>  	   * the frequency of clk_csr_i. So we do not change the default
>  	   * divider. */
> -#endif
>  }
>  
>  #if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
> @@ -971,7 +970,8 @@ static int stmmac_open(struct net_device *dev)
>  	} else
>  		priv->tm->enable = 1;
>  #endif
> -	stmmac_clk_enable(priv);
> +	if (!IS_ERR(priv->stmmac_clk))
> +		clk_enable(priv->stmmac_clk);
>  
>  	stmmac_check_ether_addr(priv);
>  
> @@ -1075,7 +1075,8 @@ open_error:
>  	if (priv->phydev)
>  		phy_disconnect(priv->phydev);
>  
> -	stmmac_clk_disable(priv);
> +	if (!IS_ERR(priv->stmmac_clk))
> +		clk_disable(priv->stmmac_clk);
>  
>  	return ret;
>  }
> @@ -1128,7 +1129,9 @@ static int stmmac_release(struct net_device *dev)
>  #ifdef CONFIG_STMMAC_DEBUG_FS
>  	stmmac_exit_fs();
>  #endif
> -	stmmac_clk_disable(priv);
> +
> +	if (!IS_ERR(priv->stmmac_clk))
> +		clk_disable(priv->stmmac_clk);
>  
>  	return 0;
>  }
> @@ -1925,7 +1928,8 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>  		goto error;
>  	}
>  
> -	if (stmmac_clk_get(priv))
> +	priv->stmmac_clk = clk_get(priv->device, NULL);
> +	if (IS_ERR(priv->stmmac_clk))
>  		pr_warning("%s: warning: cannot get CSR clock\n", __func__);
>  
>  	/* If a specific clk_csr value is passed from the platform
> @@ -1934,10 +1938,12 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>  	 * set the MDC clock dynamically according to the csr actual
>  	 * clock input.
>  	 */
> -	if (!priv->plat->clk_csr)
> -		stmmac_clk_csr_set(priv);
> -	else
> +	if (!priv->plat->clk_csr) {
> +		if (!IS_ERR(priv->stmmac_clk))
> +			stmmac_clk_csr_set(priv);
> +	} else {
>  		priv->clk_csr = priv->plat->clk_csr;
> +	}
>  
>  	/* MDIO bus Registration */
>  	ret = stmmac_mdio_register(ndev);
> @@ -2020,7 +2026,8 @@ int stmmac_suspend(struct net_device *ndev)
>  	else {
>  		stmmac_set_mac(priv->ioaddr, false);
>  		/* Disable clock in case of PWM is off */
> -		stmmac_clk_disable(priv);
> +		if (!IS_ERR(priv->stmmac_clk))
> +			clk_disable(priv->stmmac_clk);
>  	}
>  	spin_unlock(&priv->lock);
>  	return 0;
> @@ -2042,9 +2049,9 @@ int stmmac_resume(struct net_device *ndev)
>  	 * from another devices (e.g. serial console). */
>  	if (device_may_wakeup(priv->device))
>  		priv->hw->mac->pmt(priv->ioaddr, 0);
> -	else
> +	else if (!IS_ERR(priv->stmmac_clk))
>  		/* enable the clk prevously disabled */
> -		stmmac_clk_enable(priv);
> +			clk_enable(priv->stmmac_clk);
>  
>  	netif_device_attach(ndev);
>  

^ permalink raw reply

* Re: [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
From: Giuseppe CAVALLARO @ 2012-04-24  5:57 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: mturquette, sshtylyov, ML netdev, spear-devel, linux-kernel,
	David S. Miller, akpm, jgarzik, linux-arm-kernel
In-Reply-To: <4F964099.7030401@st.com>

+ netdev

On 4/24/2012 7:56 AM, Giuseppe CAVALLARO wrote:
> Hello Viresh.
> 
> On 4/21/2012 1:47 PM, Viresh Kumar wrote:
>> With addition of dummy clk_*() calls for non CONFIG_HAVE_CLK cases in clk.h,
>> there is no need to have clk code enclosed in #ifdef CONFIG_HAVE_CLK, #endif
>> macros.
> 
> I like this patch also because reduces ifdef in the code :-)
> 
> Anyway this patch doesn't apply fine either in net-next and in net.git.
> Also I wonder if you had already tested the driver build on arch w/o
> HAVE_CLK ... just to avoid kernel build failures on other platforms.
> 
> Let me know if I can help you on that.
> 
> Peppe
>>
>> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
>> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> ---
>>  drivers/net/ethernet/stmicro/stmmac/stmmac.h      |   40 ---------------------
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   34 +++++++++++-------
>>  2 files changed, 21 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index 9f2435c..7f85895 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> @@ -81,9 +81,7 @@ struct stmmac_priv {
>>  	struct stmmac_counters mmc;
>>  	struct dma_features dma_cap;
>>  	int hw_cap_support;
>> -#ifdef CONFIG_HAVE_CLK
>>  	struct clk *stmmac_clk;
>> -#endif
>>  	int clk_csr;
>>  };
>>  
>> @@ -103,41 +101,3 @@ int stmmac_dvr_remove(struct net_device *ndev);
>>  struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>>  				     struct plat_stmmacenet_data *plat_dat,
>>  				     void __iomem *addr);
>> -
>> -#ifdef CONFIG_HAVE_CLK
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> -	if (priv->stmmac_clk)
>> -		return clk_enable(priv->stmmac_clk);
>> -
>> -	return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> -	if (priv->stmmac_clk)
>> -		clk_disable(priv->stmmac_clk);
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> -	priv->stmmac_clk = clk_get(priv->device, NULL);
>> -
>> -	if (IS_ERR(priv->stmmac_clk)) {
>> -		pr_err("%s: ERROR clk_get failed\n", __func__);
>> -		return PTR_ERR(priv->stmmac_clk);
>> -	}
>> -	return 0;
>> -}
>> -#else
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> -	return 0;
>> -}
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> -	return 0;
>> -}
>> -#endif /* CONFIG_HAVE_CLK */
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index a64f0d4..28b8f30 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -28,6 +28,7 @@
>>  	https://bugzilla.stlinux.com/
>>  *******************************************************************************/
>>  
>> +#include <linux/clk.h>
>>  #include <linux/kernel.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/ip.h>
>> @@ -165,7 +166,6 @@ static void stmmac_verify_args(void)
>>  
>>  static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>>  {
>> -#ifdef CONFIG_HAVE_CLK
>>  	u32 clk_rate;
>>  
>>  	clk_rate = clk_get_rate(priv->stmmac_clk);
>> @@ -189,7 +189,6 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>>  	   * we can not estimate the proper divider as it is not known
>>  	   * the frequency of clk_csr_i. So we do not change the default
>>  	   * divider. */
>> -#endif
>>  }
>>  
>>  #if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
>> @@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
>>  	struct stmmac_priv *priv = netdev_priv(dev);
>>  	int ret;
>>  
>> -	stmmac_clk_enable(priv);
>> +	if (!IS_ERR(priv->stmmac_clk))
>> +		clk_enable(priv->stmmac_clk);
>>  
>>  	stmmac_check_ether_addr(priv);
>>  
>> @@ -1068,7 +1068,9 @@ open_error:
>>  		phy_disconnect(priv->phydev);
>>  
>>  open_clk_dis:
>> -	stmmac_clk_disable(priv);
>> +	if (!IS_ERR(priv->stmmac_clk))
>> +		clk_disable(priv->stmmac_clk);
>> +
>>  	return ret;
>>  }
>>  
>> @@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
>>  	stmmac_exit_fs();
>>  #endif
>>  	stmmac_mdio_unregister(dev);
>> -	stmmac_clk_disable(priv);
>> +
>> +	if (!IS_ERR(priv->stmmac_clk))
>> +		clk_disable(priv->stmmac_clk);
>>  
>>  	return 0;
>>  }
>> @@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>>  		goto error;
>>  	}
>>  
>> -	if (stmmac_clk_get(priv))
>> -		goto error;
>> +	priv->stmmac_clk = clk_get(priv->device, NULL);
>> +	if (IS_ERR(priv->stmmac_clk))
>> +		pr_err("%s: No clock found\n", __func__);
>>  
>>  	/* If a specific clk_csr value is passed from the platform
>>  	 * this means that the CSR Clock Range selection cannot be
>> @@ -1927,10 +1932,12 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>>  	 * set the MDC clock dynamically according to the csr actual
>>  	 * clock input.
>>  	 */
>> -	if (!priv->plat->clk_csr)
>> -		stmmac_clk_csr_set(priv);
>> -	else
>> +	if (!priv->plat->clk_csr) {
>> +		if (!IS_ERR(priv->stmmac_clk))
>> +			stmmac_clk_csr_set(priv);
>> +	} else {
>>  		priv->clk_csr = priv->plat->clk_csr;
>> +	}
>>  
>>  	return priv;
>>  
>> @@ -2004,7 +2011,8 @@ int stmmac_suspend(struct net_device *ndev)
>>  	else {
>>  		stmmac_set_mac(priv->ioaddr, false);
>>  		/* Disable clock in case of PWM is off */
>> -		stmmac_clk_disable(priv);
>> +		if (!IS_ERR(priv->stmmac_clk))
>> +			clk_disable(priv->stmmac_clk);
>>  	}
>>  	spin_unlock(&priv->lock);
>>  	return 0;
>> @@ -2026,9 +2034,9 @@ int stmmac_resume(struct net_device *ndev)
>>  	 * from another devices (e.g. serial console). */
>>  	if (device_may_wakeup(priv->device))
>>  		priv->hw->mac->pmt(priv->ioaddr, 0);
>> -	else
>> +	else if (!IS_ERR(priv->stmmac_clk))
>>  		/* enable the clk prevously disabled */
>> -		stmmac_clk_enable(priv);
>> +			clk_enable(priv->stmmac_clk);
>>  
>>  	netif_device_attach(ndev);
>>  
> 

^ permalink raw reply

* Re: [RFC v4] Add TCP encap_rcv hook (repost)
From: Simon Horman @ 2012-04-24  5:42 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, eric dumazet,
	netdev-u79uwXL29TY76Z2rM5mHXA, jhs-jkUAjuhPggJWk0Htik3J/w,
	David Miller
In-Reply-To: <2a718516-6883-4a46-b5e2-1c73be2b4b59-bX68f012229Xuxj3zoTs5AC/G2K4zDHf@public.gmane.org>

On Mon, Apr 23, 2012 at 09:40:57PM -0700, Stephen Hemminger wrote:
> 
> 
> ----- Original Message -----
> > On Mon, Apr 23, 2012 at 03:59:24PM -0700, Jesse Gross wrote:
> > > On Mon, Apr 23, 2012 at 3:32 PM, Simon Horman <horms@verge.net.au>
> > > wrote:
> > > > On Mon, Apr 23, 2012 at 02:38:07PM -0700, Jesse Gross wrote:
> > > >> On Mon, Apr 23, 2012 at 2:08 PM, David Miller
> > > >> <davem@davemloft.net> wrote:
> > > >> > From: Jesse Gross <jesse@nicira.com>
> > > >> > Date: Mon, 23 Apr 2012 13:53:42 -0700
> > > >> >
> > > >> >> On Mon, Apr 23, 2012 at 1:13 PM, David Miller
> > > >> >> <davem@davemloft.net> wrote:
> > > >> >>> From: Jesse Gross <jesse@nicira.com>
> > > >> >>> Date: Mon, 23 Apr 2012 13:08:49 -0700
> > > >> >>>
> > > >> >>>> Assuming that the TCP stack generates large TSO frames on
> > > >> >>>> transmit
> > > >> >>>> (which could be the local stack; something sent by a VM; or
> > > >> >>>> packets
> > > >> >>>> received, coalesced by GRO and then encapsulated by STT)
> > > >> >>>> then you can
> > > >> >>>> just prepend the STT header (possibly slightly adjusting
> > > >> >>>> things like
> > > >> >>>> requested MSS, number of segments, etc. slightly).  After
> > > >> >>>> that it's
> > > >> >>>> possible to just output the resulting frame through the IP
> > > >> >>>> stack like
> > > >> >>>> all tunnels do today.
> > > >> >>>
> > > >> >>> Which seems to potentially suggest a stronger intergration
> > > >> >>> of the STT
> > > >> >>> tunnel transmit path into our IP stack rather than the
> > > >> >>> approach Simon
> > > >> >>> is taking
> > > >> >>
> > > >> >> Did you have something in mind?
> > > >> >
> > > >> > A normal bonafide tunnel netdevice driver like GRE instead of
> > > >> > the
> > > >> > openvswitch approach Simon is using.
> > > >>
> > > >> Ahh, yes, that I agree with.  Independent of this, there's work
> > > >> being
> > > >> done to make it so that OVS can use the normal in-tree tunneling
> > > >> code
> > > >> and not need its own.  Once that's done I expect that STT will
> > > >> follow
> > > >> the same model.
> > > >
> > > > Hi Jesse,
> > > >
> > > > I am wondering how firm the plans to on allowing OVS to use
> > > > in-tree tunnel
> > > > code are. I'm happy to move my efforts over to an in-tree STT
> > > > implementation
> > > > but ultimately I would like to get STT running in conjunction
> > > > with OVS.
> > > 
> > > I would say that it's a firm goal but the implementation probably
> > > still has a ways to go.  Kyle Mestery (CC'ed) has volunteered to
> > > work
> > > on this in support of adding VXLAN, which needs some additional
> > > flexibility that this approach would also provide.  You might want
> > > to
> > > talk to him to see if there are ways that you guys can work
> > > together
> > > on it if you are interested.  Having better integration with
> > > upstream
> > > tunneling is definitely a step that OVS needs to make and sooner
> > > would
> > > be better than later.
> > 
> > Hi Jesse, Hi Kyle,
> > 
> > that sounds like an excellent plan.
> > 
> > Kyle, do you have any thoughts on how we might best work together on
> > this?
> > Perhaps there are some patches floating around that I could take a
> > look at?
> 
> ChrisW had a start to VxVlan tunnel (non OVS), and I promised to work on
> finishing

Thanks. I guess that I might be able to base parts of an STT implementation
on that work.

I'd like to use an STT implementation with OVS, so in-tree tunnel support
for OVS is also important to me.

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply

* RE: linux-next: manual merge of the wireless-next tree with the net-next tree
From: Grumbach, Emmanuel @ 2012-04-24  5:07 UTC (permalink / raw)
  To: Stephen Rothwell, John W. Linville
  Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guy, Wey-Yi W, David Miller, netdev@vger.kernel.org
In-Reply-To: <20120424124803.f4dc75ea96a875c3f35db615@canb.auug.org.au>

> 
> Hi John,
> 
> Today's linux-next merge of the wireless-next tree got a conflict in
> drivers/net/wireless/iwlwifi/iwl-testmode.c between commit d33e152e1edd
> ("iwlwifi: Stop using NLA_PUT*()") from the net-next tree and commit
> 2152268ff911 ("iwlwifi: op_mode holds its pointer to the config") from the
> wireless-next tree.
> 
> I was hoping that we were done with these ... :-(
> 
> I fixed it up (see below) and can carry the fix as necessary.

Thanks Stephen, your fix seems right. In this case, there are only two choices: it is right or it doesn't even compile.

> 
> --
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au
> 
> diff --cc drivers/net/wireless/iwlwifi/iwl-testmode.c
> index bb27509,a6b16aa..0000000
> --- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
> @@@ -543,12 -539,11 +543,12 @@@ static int iwl_testmode_driver(struct i
>   				IWL_ERR(priv, "Memory allocation fail\n");
>   				return -ENOMEM;
>   			}
>  -			NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,
>  -				IWL_TM_CMD_DEV2APP_EEPROM_RSP);
>  -			NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
>  -				priv->cfg->base_params->eeprom_size,
>  -				priv->eeprom);
>  +			if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND,
>  +					IWL_TM_CMD_DEV2APP_EEPROM_RSP) ||
>  +			    nla_put(skb, IWL_TM_ATTR_EEPROM,
> - 				    cfg(priv)->base_params->eeprom_size,
> ++				    priv->cfg->base_params->eeprom_size,
>  +				    priv->eeprom))
>  +				goto nla_put_failure;
>   			status = cfg80211_testmode_reply(skb);
>   			if (status < 0)
>   				IWL_ERR(priv, "Error sending msg : %d\n",
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

^ permalink raw reply

* Re: [PATCH net] net/neigh: move neigh cleanup routine to neigh_destroy
From: David Miller @ 2012-04-24  4:53 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, shlomop
In-Reply-To: <1335195282-28738-1-git-send-email-ogerlitz@mellanox.com>

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Mon, 23 Apr 2012 18:34:42 +0300

> From: Shlomo Pongratz <shlomop@mellanox.com>
> 
> Move call the neigh_cleanup call to be done from neigh_destroy, this
> ensures the cleanup callback is invoked only when the neighbour reference
> count becomes zero (e.g in the same manner as ndo_neigh_destory).
> 
> Note that with this change neigh_destroy will truly revert the action of
> neigh_create, as neigh_release which calls neigh_destroy is called directly
> from various code paths, and thus neigh->parms->neigh_cleanup is not called
> for these code paths.
> 
> Also, with commit 7d26bb103 "bonding: emit event when bonding changes MAC" that
> triggers netdev address change event, a race was introduced since neigh cleanup
> can be called when there's reference on the neighbour.
> 
> Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>

With IPOIB, the neigh_cleanup purges references to the neigh when it
liberates the SKBs in the neigh resolution TX backlog during
ipoib_neigh_free().

Therefore, with your change, IPOIB neighs will never be destroyed if
they have any SKBs in their neigh resolution queues.

I'm not applying this, it's buggy.

^ permalink raw reply

* Re: [PATCH] b44: properly use pr_fmt()
From: David Miller @ 2012-04-24  4:47 UTC (permalink / raw)
  To: mcgrof; +Cc: zambrano, netdev
In-Reply-To: <1335235603-32420-1-git-send-email-mcgrof@do-not-panic.com>

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Date: Mon, 23 Apr 2012 19:46:43 -0700

> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> 
> pr_fmt() is either defined or we redefine it. Typically
> drivers define it prior to including printk.h but this
> is done under the assumption that no other subsystem
> it uses has already defined pr_fmt(). In such cases
> pr_fmt() should be undefined and redefined.
> 
> Doing this properly shaves down compilation time quite
> considerably.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>

Every driver defines pr_fmt then includes the headers.  I do not
see any other place which performs the initial undef of pr_fmt
like you want to start doing here.

If there is a reason we should start doing this, it would appear
to be a universal reason, not one specific to this driver.  If
that's the case, we should formally agree to this and then work
on gradually converting all the drivers in reasonably sized chunks.

Either way I can't apply this patch as-is, sorry Luis.

^ permalink raw reply

* Re: [PATCH net] net/davinci_emac: fix failing PHY connect attempts
From: David Miller @ 2012-04-24  4:44 UTC (permalink / raw)
  To: agust; +Cc: netdev
In-Reply-To: <1335218803-8664-1-git-send-email-agust@denx.de>

From: Anatolij Gustschin <agust@denx.de>
Date: Tue, 24 Apr 2012 00:06:43 +0200

> PHY connect attempts fail if no PHY id is specified in the emac platform
> data and another mdio bus has been registered before 'davinci_mdio' bus. In
> this case when configuring the interface, there will be an attempt to
> connect to already attached PHY on the previously registered mdio bus:
> 
> net eth1: PHY already attached
> net eth1: could not connect to phy smsc911x-0:01
> IP-Config: Failed to open eth1
> IP-Config: Device `eth1' not found
> 
> Fix this by modifying match_first_device() to match first PHY device
> on 'davinci_mdio' bus.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH v2] smsc95xx: mark link down on startup and let PHY interrupt deal with carrier changes
From: David Miller @ 2012-04-24  4:42 UTC (permalink / raw)
  To: fillods; +Cc: paolo.pisati, steve.glendinning, netdev
In-Reply-To: <20120423194339.GS5277@charybde.local>

From: Stephane Fillod <fillods@users.sf.net>
Date: Mon, 23 Apr 2012 21:43:39 +0200

> lun, Apr 23, 2012, Paolo Pisati skribis:
>> Without this patch sysfs reports the cable as present
>> 
>> flag@flag-desktop:~$ cat /sys/class/net/eth0/carrier
>> 1
>> 
>> while it's not:
>> 
>> flag@flag-desktop:~$ sudo mii-tool eth0
>> eth0: no link
>> 
>> Tested on my Beagle XM.
>> 
>> v2: added mantainer to the list of recipient
> 
> His e-mail address has changed, but somehow it has not been updated yet
> in MAINTAINERS directory:  steve.glendinning () shawell.net

Steve, please send a maintainers etc. update and please provide
feedback on this link status fix.

^ permalink raw reply

* Re: [PATCH net-next] tipc: remove inline instances from C source files.
From: David Miller @ 2012-04-24  4:41 UTC (permalink / raw)
  To: paul.gortmaker; +Cc: netdev, allan.stephens
In-Reply-To: <1335192553-19054-1-git-send-email-paul.gortmaker@windriver.com>

From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Mon, 23 Apr 2012 10:49:13 -0400

> Untie gcc's hands and let it do what it wants within the
> individual source files.  There are two files, node.c and
> port.c -- only the latter effectively changes (gcc-4.5.2).
> Objdump shows gcc deciding to not inline port_peernode().
> 
> Suggested-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Applied, thanks Paul.

^ permalink raw reply

* Re: [RFC v4] Add TCP encap_rcv hook (repost)
From: Stephen Hemminger @ 2012-04-24  4:40 UTC (permalink / raw)
  To: Simon Horman
  Cc: David Miller, jhs, netdev, dev, eric dumazet, Kyle Mestery,
	Jesse Gross
In-Reply-To: <20120424022514.GB5357@verge.net.au>



----- Original Message -----
> On Mon, Apr 23, 2012 at 03:59:24PM -0700, Jesse Gross wrote:
> > On Mon, Apr 23, 2012 at 3:32 PM, Simon Horman <horms@verge.net.au>
> > wrote:
> > > On Mon, Apr 23, 2012 at 02:38:07PM -0700, Jesse Gross wrote:
> > >> On Mon, Apr 23, 2012 at 2:08 PM, David Miller
> > >> <davem@davemloft.net> wrote:
> > >> > From: Jesse Gross <jesse@nicira.com>
> > >> > Date: Mon, 23 Apr 2012 13:53:42 -0700
> > >> >
> > >> >> On Mon, Apr 23, 2012 at 1:13 PM, David Miller
> > >> >> <davem@davemloft.net> wrote:
> > >> >>> From: Jesse Gross <jesse@nicira.com>
> > >> >>> Date: Mon, 23 Apr 2012 13:08:49 -0700
> > >> >>>
> > >> >>>> Assuming that the TCP stack generates large TSO frames on
> > >> >>>> transmit
> > >> >>>> (which could be the local stack; something sent by a VM; or
> > >> >>>> packets
> > >> >>>> received, coalesced by GRO and then encapsulated by STT)
> > >> >>>> then you can
> > >> >>>> just prepend the STT header (possibly slightly adjusting
> > >> >>>> things like
> > >> >>>> requested MSS, number of segments, etc. slightly).  After
> > >> >>>> that it's
> > >> >>>> possible to just output the resulting frame through the IP
> > >> >>>> stack like
> > >> >>>> all tunnels do today.
> > >> >>>
> > >> >>> Which seems to potentially suggest a stronger intergration
> > >> >>> of the STT
> > >> >>> tunnel transmit path into our IP stack rather than the
> > >> >>> approach Simon
> > >> >>> is taking
> > >> >>
> > >> >> Did you have something in mind?
> > >> >
> > >> > A normal bonafide tunnel netdevice driver like GRE instead of
> > >> > the
> > >> > openvswitch approach Simon is using.
> > >>
> > >> Ahh, yes, that I agree with.  Independent of this, there's work
> > >> being
> > >> done to make it so that OVS can use the normal in-tree tunneling
> > >> code
> > >> and not need its own.  Once that's done I expect that STT will
> > >> follow
> > >> the same model.
> > >
> > > Hi Jesse,
> > >
> > > I am wondering how firm the plans to on allowing OVS to use
> > > in-tree tunnel
> > > code are. I'm happy to move my efforts over to an in-tree STT
> > > implementation
> > > but ultimately I would like to get STT running in conjunction
> > > with OVS.
> > 
> > I would say that it's a firm goal but the implementation probably
> > still has a ways to go.  Kyle Mestery (CC'ed) has volunteered to
> > work
> > on this in support of adding VXLAN, which needs some additional
> > flexibility that this approach would also provide.  You might want
> > to
> > talk to him to see if there are ways that you guys can work
> > together
> > on it if you are interested.  Having better integration with
> > upstream
> > tunneling is definitely a step that OVS needs to make and sooner
> > would
> > be better than later.
> 
> Hi Jesse, Hi Kyle,
> 
> that sounds like an excellent plan.
> 
> Kyle, do you have any thoughts on how we might best work together on
> this?
> Perhaps there are some patches floating around that I could take a
> look at?

ChrisW had a start to VxVlan tunnel (non OVS), and I promised to work on finishing
it.

^ permalink raw reply

* Re: [PATCH] net: skb_free_datagram_locked() consumes skb
From: David Miller @ 2012-04-24  4:40 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1335168567.3293.20.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 23 Apr 2012 10:09:27 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> All skb_free_datagram_locked() callers consume skb, not drop it.
> Noticed on dropwatch session polluted by UDP false positives.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

For some call sites in sunrpc, it's not a consume.

^ 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