Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net: stmicro: stmac: do not grab a mutex in irq off section
From: David Miller @ 2014-02-19 20:23 UTC (permalink / raw)
  To: bigeasy; +Cc: peppe.cavallaro, netdev
In-Reply-To: <1392744843-6324-1-git-send-email-bigeasy@linutronix.de>

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Tue, 18 Feb 2014 18:34:03 +0100

> I captured this:
> 
> |libphy: stmmac-0:04 - Link is Up - 1000/Full
> |BUG: sleeping function called from invalid context at kernel/mutex.c:616
> |in_atomic(): 1, irqs_disabled(): 128, pid: 31, name: kworker/1:1
> |CPU: 1 PID: 31 Comm: kworker/1:1 Not tainted 3.12.0-00324-g28301d2-dirty #5
> |[<8042f8e8>] (mutex_lock_nested+0x28/0x3cc) from [<802a226c>] (mdiobus_read+0x38/0x64)
> |[<802a226c>] (mdiobus_read+0x38/0x64) from [<802a1968>] (genphy_update_link+0x18/0x50)
> |[<802a1968>] (genphy_update_link+0x18/0x50) from [<802a19ac>] (genphy_read_status+0xc/0x180)
> |[<802a19ac>] (genphy_read_status+0xc/0x180) from [<8029fb0c>] (phy_init_eee+0x4c/0x2ac)
> |[<8029fb0c>] (phy_init_eee+0x4c/0x2ac) from [<802a7550>] (stmmac_eee_init+0x40/0x104)
> |[<802a7550>] (stmmac_eee_init+0x40/0x104) from [<802a8678>] (stmmac_adjust_link+0x118/0x228)
> |[<802a8678>] (stmmac_adjust_link+0x118/0x228) from [<802a0af4>] (phy_state_machine+0x23c/0x39c)
> |[<802a0af4>] (phy_state_machine+0x23c/0x39c) from [<800371b8>] (process_one_work+0x1a4/0x44c)
> |[<800371b8>] (process_one_work+0x1a4/0x44c) from [<80037884>] (worker_thread+0x138/0x390)
> |[<80037884>] (worker_thread+0x138/0x390) from [<8003e850>] (kthread+0xb4/0xb8)
> |[<8003e850>] (kthread+0xb4/0xb8) from [<8000e5a8>] (ret_from_fork+0x14/0x2c)
> |stmmac: Energy-Efficient Ethernet initialized
> 
> stmmac_eee_init() is called in other places without this lock.
> phy_print_status() is just a printk() and the if condition is not
> protected by the lock so I moved the unlock part just before that.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

It does look like a problem though, two concurrent calls into
stmmac_eee_init would be really bad.  Two threads could see
eee enabled being false at the same time, and both try to
initialize the eee state.

stmmac_hw_setup()'s invocation is fine because we doing something like
bringing the device up or bringing it back after resume, and thus are
synchonized by the RTNL semaphore.

Actually, the same "mutex in irq off section" problem exists in that
code path, because stmmac_resume() invokes stmmac_hw_setup() with
the priv->lock held.

This is a much deeper problem then what your patch is tackling, and
thus a lot more thought about how to fix this is needed.

I'm not applying this, sorry.

^ permalink raw reply

* Re: [PATCH net-next 0/3] bonding: More ether_addr_copy and neatenings.
From: David Miller @ 2014-02-19 20:38 UTC (permalink / raw)
  To: dingtianhong; +Cc: joe, netdev, linux-kernel
In-Reply-To: <53040C96.2020600@huawei.com>

From: Ding Tianhong <dingtianhong@huawei.com>
Date: Wed, 19 Feb 2014 09:44:54 +0800

> On 2014/2/19 1:42, Joe Perches wrote:
>> Joe Perches (3):
>>   bonding: More use of ether_addr_copy
>>   bonding: Remove unnecessary else
>>   bonding: Invert test
>> 
>>  drivers/net/bonding/bond_3ad.c  | 21 ++++++++++-----------
>>  drivers/net/bonding/bond_alb.c  | 17 ++++++++---------
>>  drivers/net/bonding/bond_main.c |  6 +++---
>>  3 files changed, 21 insertions(+), 23 deletions(-)
>> 
> 
> Reviewed-by: Ding Tianhong <dingtianhong@huawei.com>

Series applied, thanks Joe.

^ permalink raw reply

* Re: [PATCH] Drivers: net: ethernet: 3com: 3c589_cs fixed coding style issues
From: Justin van Wijngaarden @ 2014-02-19 21:04 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: gregkh, hsweeten, davem, netdev, linux-kernel
In-Reply-To: <5304E64F.3060501@windriver.com>

Thanks for the feedback, I'll try to be less cryptic next time.

Also got some good feedback from Joe Perches, so expect a few more patches! :)

Justin

On Wed, Feb 19, 2014 at 12:13:51PM -0500, Paul Gortmaker wrote:
> On 14-02-17 05:58 PM, Justin van Wijngaarden wrote:
> > checkpatch.pl clean-up, from 14 error/ 277 warnings, to 0 errors, 7 warnings
> 
> I see Dave has already applied this, but FWIW, I objdump'd the before
> and after, and diff'd them to confirm no real changes crept in.  Maybe
> in the future you could mention whatever similar validations you'd used
> to confirm it was a 100% cosmetic cleanup, since sometimes extra ";"
> can sneak in or similar, and in a change this size, they can be hard
> to spot.
> 
> Thanks,
> Paul.
> --
> 
> > 
> > Signed-off-by: Justin van Wijngaarden <justinvanwijngaarden@gmail.com>
> > ---
> >  drivers/net/ethernet/3com/3c589_cs.c | 1127 ++++++++++++++++++----------------
> >  1 file changed, 584 insertions(+), 543 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/3com/3c589_cs.c b/drivers/net/ethernet/3com/3c589_cs.c
> > index 5992860..063557e 100644
> > --- a/drivers/net/ethernet/3com/3c589_cs.c
> > +++ b/drivers/net/ethernet/3com/3c589_cs.c
> > @@ -1,23 +1,24 @@
> > -/*======================================================================
> > -
> > -    A PCMCIA ethernet driver for the 3com 3c589 card.
> > -
> > -    Copyright (C) 1999 David A. Hinds -- dahinds@users.sourceforge.net
> > -
> > -    3c589_cs.c 1.162 2001/10/13 00:08:50
> > -
> > -    The network driver code is based on Donald Becker's 3c589 code:
> > -
> > -    Written 1994 by Donald Becker.
> > -    Copyright 1993 United States Government as represented by the
> > -    Director, National Security Agency.  This software may be used and
> > -    distributed according to the terms of the GNU General Public License,
> > -    incorporated herein by reference.
> > -    Donald Becker may be reached at becker@scyld.com
> > -
> > -    Updated for 2.5.x by Alan Cox <alan@lxorguk.ukuu.org.uk>
> > -
> > -======================================================================*/
> > +/* ======================================================================
> > + *
> > + * A PCMCIA ethernet driver for the 3com 3c589 card.
> > + *
> > + * Copyright (C) 1999 David A. Hinds -- dahinds@users.sourceforge.net
> > + *
> > + * 3c589_cs.c 1.162 2001/10/13 00:08:50
> > + *
> > + * The network driver code is based on Donald Becker's 3c589 code:
> > + *
> > + * Written 1994 by Donald Becker.
> > + * Copyright 1993 United States Government as represented by the
> > + * Director, National Security Agency.  This software may be used and
> > + * distributed according to the terms of the GNU General Public License,
> > + * incorporated herein by reference.
> > + * Donald Becker may be reached at becker@scyld.com
> > + *
> > + * Updated for 2.5.x by Alan Cox <alan@lxorguk.ukuu.org.uk>
> > + *
> > + * ======================================================================
> > + */
> >  
> >  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >  
> > @@ -41,18 +42,20 @@
> >  #include <linux/ioport.h>
> >  #include <linux/bitops.h>
> >  #include <linux/jiffies.h>
> > +#include <linux/uaccess.h>
> > +#include <linux/io.h>
> >  
> >  #include <pcmcia/cistpl.h>
> >  #include <pcmcia/cisreg.h>
> >  #include <pcmcia/ciscode.h>
> >  #include <pcmcia/ds.h>
> >  
> > -#include <asm/uaccess.h>
> > -#include <asm/io.h>
> >  
> >  /* To minimize the size of the driver source I only define operating
> > -   constants if they are used several times.  You'll need the manual
> > -   if you want to understand driver details. */
> > + * constants if they are used several times. You'll need the manual
> > + * if you want to understand driver details.
> > + */
> > +
> >  /* Offsets from base I/O address. */
> >  #define EL3_DATA	0x00
> >  #define EL3_TIMER	0x0a
> > @@ -65,7 +68,9 @@
> >  #define EL3WINDOW(win_num) outw(SelectWindow + (win_num), ioaddr + EL3_CMD)
> >  
> >  /* The top five bits written to EL3_CMD are a command, the lower
> > -   11 bits are the parameter, if applicable. */
> > + * 11 bits are the parameter, if applicable.
> > + */
> > +
> >  enum c509cmd {
> >  	TotalReset	= 0<<11,
> >  	SelectWindow	= 1<<11,
> > @@ -190,138 +195,142 @@ static const struct net_device_ops el3_netdev_ops = {
> >  
> >  static int tc589_probe(struct pcmcia_device *link)
> >  {
> > -    struct el3_private *lp;
> > -    struct net_device *dev;
> > +	struct el3_private *lp;
> > +	struct net_device *dev;
> >  
> > -    dev_dbg(&link->dev, "3c589_attach()\n");
> > +	dev_dbg(&link->dev, "3c589_attach()\n");
> >  
> > -    /* Create new ethernet device */
> > -    dev = alloc_etherdev(sizeof(struct el3_private));
> > -    if (!dev)
> > -	 return -ENOMEM;
> > -    lp = netdev_priv(dev);
> > -    link->priv = dev;
> > -    lp->p_dev = link;
> > +	/* Create new ethernet device */
> > +	dev = alloc_etherdev(sizeof(struct el3_private));
> > +	if (!dev)
> > +		return -ENOMEM;
> > +	lp = netdev_priv(dev);
> > +	link->priv = dev;
> > +	lp->p_dev = link;
> >  
> > -    spin_lock_init(&lp->lock);
> > -    link->resource[0]->end = 16;
> > -    link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
> > +	spin_lock_init(&lp->lock);
> > +	link->resource[0]->end = 16;
> > +	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
> >  
> > -    link->config_flags |= CONF_ENABLE_IRQ;
> > -    link->config_index = 1;
> > +	link->config_flags |= CONF_ENABLE_IRQ;
> > +	link->config_index = 1;
> >  
> > -    dev->netdev_ops = &el3_netdev_ops;
> > -    dev->watchdog_timeo = TX_TIMEOUT;
> > +	dev->netdev_ops = &el3_netdev_ops;
> > +	dev->watchdog_timeo = TX_TIMEOUT;
> >  
> > -    SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
> > +	SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
> >  
> > -    return tc589_config(link);
> > +	return tc589_config(link);
> >  }
> >  
> >  static void tc589_detach(struct pcmcia_device *link)
> >  {
> > -    struct net_device *dev = link->priv;
> > +	struct net_device *dev = link->priv;
> >  
> > -    dev_dbg(&link->dev, "3c589_detach\n");
> > +	dev_dbg(&link->dev, "3c589_detach\n");
> >  
> > -    unregister_netdev(dev);
> > +	unregister_netdev(dev);
> >  
> > -    tc589_release(link);
> > +	tc589_release(link);
> >  
> > -    free_netdev(dev);
> > +	free_netdev(dev);
> >  } /* tc589_detach */
> >  
> >  static int tc589_config(struct pcmcia_device *link)
> >  {
> > -    struct net_device *dev = link->priv;
> > -    __be16 *phys_addr;
> > -    int ret, i, j, multi = 0, fifo;
> > -    unsigned int ioaddr;
> > -    static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
> > -    u8 *buf;
> > -    size_t len;
> > -
> > -    dev_dbg(&link->dev, "3c589_config\n");
> > -
> > -    phys_addr = (__be16 *)dev->dev_addr;
> > -    /* Is this a 3c562? */
> > -    if (link->manf_id != MANFID_3COM)
> > -	    dev_info(&link->dev, "hmmm, is this really a 3Com card??\n");
> > -    multi = (link->card_id == PRODID_3COM_3C562);
> > -
> > -    link->io_lines = 16;
> > -
> > -    /* For the 3c562, the base address must be xx00-xx7f */
> > -    for (i = j = 0; j < 0x400; j += 0x10) {
> > -	if (multi && (j & 0x80)) continue;
> > -	link->resource[0]->start = j ^ 0x300;
> > -	i = pcmcia_request_io(link);
> > -	if (i == 0)
> > -		break;
> > -    }
> > -    if (i != 0)
> > -	goto failed;
> > -
> > -    ret = pcmcia_request_irq(link, el3_interrupt);
> > -    if (ret)
> > -	    goto failed;
> > -
> > -    ret = pcmcia_enable_device(link);
> > -    if (ret)
> > -	    goto failed;
> > -
> > -    dev->irq = link->irq;
> > -    dev->base_addr = link->resource[0]->start;
> > -    ioaddr = dev->base_addr;
> > -    EL3WINDOW(0);
> > -
> > -    /* The 3c589 has an extra EEPROM for configuration info, including
> > -       the hardware address.  The 3c562 puts the address in the CIS. */
> > -    len = pcmcia_get_tuple(link, 0x88, &buf);
> > -    if (buf && len >= 6) {
> > -	    for (i = 0; i < 3; i++)
> > -		    phys_addr[i] = htons(le16_to_cpu(buf[i*2]));
> > -	    kfree(buf);
> > -    } else {
> > -	kfree(buf); /* 0 < len < 6 */
> > -	for (i = 0; i < 3; i++)
> > -	    phys_addr[i] = htons(read_eeprom(ioaddr, i));
> > -	if (phys_addr[0] == htons(0x6060)) {
> > -	    dev_err(&link->dev, "IO port conflict at 0x%03lx-0x%03lx\n",
> > -		    dev->base_addr, dev->base_addr+15);
> > -	    goto failed;
> > +	struct net_device *dev = link->priv;
> > +	__be16 *phys_addr;
> > +	int ret, i, j, multi = 0, fifo;
> > +	unsigned int ioaddr;
> > +	static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
> > +	u8 *buf;
> > +	size_t len;
> > +
> > +	dev_dbg(&link->dev, "3c589_config\n");
> > +
> > +	phys_addr = (__be16 *)dev->dev_addr;
> > +	/* Is this a 3c562? */
> > +	if (link->manf_id != MANFID_3COM)
> > +		dev_info(&link->dev, "hmmm, is this really a 3Com card??\n");
> > +	multi = (link->card_id == PRODID_3COM_3C562);
> > +
> > +	link->io_lines = 16;
> > +
> > +	/* For the 3c562, the base address must be xx00-xx7f */
> > +	for (i = j = 0; j < 0x400; j += 0x10) {
> > +		if (multi && (j & 0x80))
> > +			continue;
> > +		link->resource[0]->start = j ^ 0x300;
> > +		i = pcmcia_request_io(link);
> > +		if (i == 0)
> > +			break;
> >  	}
> > -    }
> > -
> > -    /* The address and resource configuration register aren't loaded from
> > -       the EEPROM and *must* be set to 0 and IRQ3 for the PCMCIA version. */
> > -    outw(0x3f00, ioaddr + 8);
> > -    fifo = inl(ioaddr);
> > -
> > -    /* The if_port symbol can be set when the module is loaded */
> > -    if ((if_port >= 0) && (if_port <= 3))
> > -	dev->if_port = if_port;
> > -    else
> > -	dev_err(&link->dev, "invalid if_port requested\n");
> > -
> > -    SET_NETDEV_DEV(dev, &link->dev);
> > -
> > -    if (register_netdev(dev) != 0) {
> > -	    dev_err(&link->dev, "register_netdev() failed\n");
> > -	goto failed;
> > -    }
> > -
> > -    netdev_info(dev, "3Com 3c%s, io %#3lx, irq %d, hw_addr %pM\n",
> > -		(multi ? "562" : "589"), dev->base_addr, dev->irq,
> > -		dev->dev_addr);
> > -    netdev_info(dev, "  %dK FIFO split %s Rx:Tx, %s xcvr\n",
> > -		(fifo & 7) ? 32 : 8, ram_split[(fifo >> 16) & 3],
> > -		if_names[dev->if_port]);
> > -    return 0;
> > +	if (i != 0)
> > +		goto failed;
> > +
> > +	ret = pcmcia_request_irq(link, el3_interrupt);
> > +	if (ret)
> > +		goto failed;
> > +
> > +	ret = pcmcia_enable_device(link);
> > +	if (ret)
> > +		goto failed;
> > +
> > +	dev->irq = link->irq;
> > +	dev->base_addr = link->resource[0]->start;
> > +	ioaddr = dev->base_addr;
> > +	EL3WINDOW(0);
> > +
> > +	/* The 3c589 has an extra EEPROM for configuration info, including
> > +	 * the hardware address.  The 3c562 puts the address in the CIS.
> > +	 */
> > +	len = pcmcia_get_tuple(link, 0x88, &buf);
> > +	if (buf && len >= 6) {
> > +		for (i = 0; i < 3; i++)
> > +			phys_addr[i] = htons(le16_to_cpu(buf[i*2]));
> > +		kfree(buf);
> > +	} else {
> > +		kfree(buf); /* 0 < len < 6 */
> > +		for (i = 0; i < 3; i++)
> > +			phys_addr[i] = htons(read_eeprom(ioaddr, i));
> > +		if (phys_addr[0] == htons(0x6060)) {
> > +			dev_err(&link->dev, "IO port conflict at 0x%03lx-0x%03lx\n",
> > +					dev->base_addr, dev->base_addr+15);
> > +			goto failed;
> > +		}
> > +	}
> > +
> > +	/* The address and resource configuration register aren't loaded from
> > +	 * the EEPROM and *must* be set to 0 and IRQ3 for the PCMCIA version.
> > +	 */
> > +
> > +	outw(0x3f00, ioaddr + 8);
> > +	fifo = inl(ioaddr);
> > +
> > +	/* The if_port symbol can be set when the module is loaded */
> > +	if ((if_port >= 0) && (if_port <= 3))
> > +		dev->if_port = if_port;
> > +	else
> > +		dev_err(&link->dev, "invalid if_port requested\n");
> > +
> > +	SET_NETDEV_DEV(dev, &link->dev);
> > +
> > +	if (register_netdev(dev) != 0) {
> > +		dev_err(&link->dev, "register_netdev() failed\n");
> > +		goto failed;
> > +	}
> > +
> > +	netdev_info(dev, "3Com 3c%s, io %#3lx, irq %d, hw_addr %pM\n",
> > +			(multi ? "562" : "589"), dev->base_addr, dev->irq,
> > +			dev->dev_addr);
> > +	netdev_info(dev, "  %dK FIFO split %s Rx:Tx, %s xcvr\n",
> > +			(fifo & 7) ? 32 : 8, ram_split[(fifo >> 16) & 3],
> > +			if_names[dev->if_port]);
> > +	return 0;
> >  
> >  failed:
> > -    tc589_release(link);
> > -    return -ENODEV;
> > +	tc589_release(link);
> > +	return -ENODEV;
> >  } /* tc589_config */
> >  
> >  static void tc589_release(struct pcmcia_device *link)
> > @@ -353,113 +362,120 @@ static int tc589_resume(struct pcmcia_device *link)
> >  
> >  /*====================================================================*/
> >  
> > -/*
> > -  Use this for commands that may take time to finish
> > -*/
> > +/* Use this for commands that may take time to finish */
> > +
> >  static void tc589_wait_for_completion(struct net_device *dev, int cmd)
> >  {
> > -    int i = 100;
> > -    outw(cmd, dev->base_addr + EL3_CMD);
> > -    while (--i > 0)
> > -	if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break;
> > -    if (i == 0)
> > -	netdev_warn(dev, "command 0x%04x did not complete!\n", cmd);
> > +	int i = 100;
> > +	outw(cmd, dev->base_addr + EL3_CMD);
> > +	while (--i > 0)
> > +		if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000))
> > +			break;
> > +	if (i == 0)
> > +		netdev_warn(dev, "command 0x%04x did not complete!\n", cmd);
> >  }
> >  
> > -/*
> > -  Read a word from the EEPROM using the regular EEPROM access register.
> > -  Assume that we are in register window zero.
> > -*/
> > +/* Read a word from the EEPROM using the regular EEPROM access register.
> > + * Assume that we are in register window zero.
> > + */
> > +
> >  static u16 read_eeprom(unsigned int ioaddr, int index)
> >  {
> > -    int i;
> > -    outw(EEPROM_READ + index, ioaddr + 10);
> > -    /* Reading the eeprom takes 162 us */
> > -    for (i = 1620; i >= 0; i--)
> > -	if ((inw(ioaddr + 10) & EEPROM_BUSY) == 0)
> > -	    break;
> > -    return inw(ioaddr + 12);
> > +	int i;
> > +	outw(EEPROM_READ + index, ioaddr + 10);
> > +	/* Reading the eeprom takes 162 us */
> > +	for (i = 1620; i >= 0; i--)
> > +		if ((inw(ioaddr + 10) & EEPROM_BUSY) == 0)
> > +			break;
> > +	return inw(ioaddr + 12);
> >  }
> >  
> > -/*
> > -  Set transceiver type, perhaps to something other than what the user
> > -  specified in dev->if_port.
> > -*/
> > +/* Set transceiver type, perhaps to something other than what the user
> > + * specified in dev->if_port.
> > + */
> > +
> >  static void tc589_set_xcvr(struct net_device *dev, int if_port)
> >  {
> > -    struct el3_private *lp = netdev_priv(dev);
> > -    unsigned int ioaddr = dev->base_addr;
> > -
> > -    EL3WINDOW(0);
> > -    switch (if_port) {
> > -    case 0: case 1: outw(0, ioaddr + 6); break;
> > -    case 2: outw(3<<14, ioaddr + 6); break;
> > -    case 3: outw(1<<14, ioaddr + 6); break;
> > -    }
> > -    /* On PCMCIA, this just turns on the LED */
> > -    outw((if_port == 2) ? StartCoax : StopCoax, ioaddr + EL3_CMD);
> > -    /* 10baseT interface, enable link beat and jabber check. */
> > -    EL3WINDOW(4);
> > -    outw(MEDIA_LED | ((if_port < 2) ? MEDIA_TP : 0), ioaddr + WN4_MEDIA);
> > -    EL3WINDOW(1);
> > -    if (if_port == 2)
> > -	lp->media_status = ((dev->if_port == 0) ? 0x8000 : 0x4000);
> > -    else
> > -	lp->media_status = ((dev->if_port == 0) ? 0x4010 : 0x8800);
> > +	struct el3_private *lp = netdev_priv(dev);
> > +	unsigned int ioaddr = dev->base_addr;
> > +
> > +	EL3WINDOW(0);
> > +	switch (if_port) {
> > +	case 0:
> > +	case 1:
> > +		outw(0, ioaddr + 6);
> > +		break;
> > +	case 2:
> > +		outw(3<<14, ioaddr + 6);
> > +		break;
> > +	case 3:
> > +		outw(1<<14, ioaddr + 6);
> > +		break;
> > +	}
> > +	/* On PCMCIA, this just turns on the LED */
> > +	outw((if_port == 2) ? StartCoax : StopCoax, ioaddr + EL3_CMD);
> > +	/* 10baseT interface, enable link beat and jabber check. */
> > +	EL3WINDOW(4);
> > +	outw(MEDIA_LED | ((if_port < 2) ? MEDIA_TP : 0), ioaddr + WN4_MEDIA);
> > +	EL3WINDOW(1);
> > +	if (if_port == 2)
> > +		lp->media_status = ((dev->if_port == 0) ? 0x8000 : 0x4000);
> > +	else
> > +		lp->media_status = ((dev->if_port == 0) ? 0x4010 : 0x8800);
> >  }
> >  
> >  static void dump_status(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -    EL3WINDOW(1);
> > -    netdev_info(dev, "  irq status %04x, rx status %04x, tx status %02x  tx free %04x\n",
> > -		inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS),
> > -		inb(ioaddr+TX_STATUS), inw(ioaddr+TX_FREE));
> > -    EL3WINDOW(4);
> > -    netdev_info(dev, "  diagnostics: fifo %04x net %04x ethernet %04x media %04x\n",
> > -		inw(ioaddr+0x04), inw(ioaddr+0x06), inw(ioaddr+0x08),
> > -		inw(ioaddr+0x0a));
> > -    EL3WINDOW(1);
> > +	unsigned int ioaddr = dev->base_addr;
> > +	EL3WINDOW(1);
> > +	netdev_info(dev, "  irq status %04x, rx status %04x, tx status %02x  tx free %04x\n",
> > +			inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS),
> > +			inb(ioaddr+TX_STATUS), inw(ioaddr+TX_FREE));
> > +	EL3WINDOW(4);
> > +	netdev_info(dev, "  diagnostics: fifo %04x net %04x ethernet %04x media %04x\n",
> > +			inw(ioaddr+0x04), inw(ioaddr+0x06), inw(ioaddr+0x08),
> > +			inw(ioaddr+0x0a));
> > +	EL3WINDOW(1);
> >  }
> >  
> >  /* Reset and restore all of the 3c589 registers. */
> >  static void tc589_reset(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -    int i;
> > -
> > -    EL3WINDOW(0);
> > -    outw(0x0001, ioaddr + 4);			/* Activate board. */
> > -    outw(0x3f00, ioaddr + 8);			/* Set the IRQ line. */
> > -
> > -    /* Set the station address in window 2. */
> > -    EL3WINDOW(2);
> > -    for (i = 0; i < 6; i++)
> > -	outb(dev->dev_addr[i], ioaddr + i);
> > -
> > -    tc589_set_xcvr(dev, dev->if_port);
> > -
> > -    /* Switch to the stats window, and clear all stats by reading. */
> > -    outw(StatsDisable, ioaddr + EL3_CMD);
> > -    EL3WINDOW(6);
> > -    for (i = 0; i < 9; i++)
> > -	inb(ioaddr+i);
> > -    inw(ioaddr + 10);
> > -    inw(ioaddr + 12);
> > -
> > -    /* Switch to register set 1 for normal use. */
> > -    EL3WINDOW(1);
> > -
> > -    set_rx_mode(dev);
> > -    outw(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */
> > -    outw(RxEnable, ioaddr + EL3_CMD); /* Enable the receiver. */
> > -    outw(TxEnable, ioaddr + EL3_CMD); /* Enable transmitter. */
> > -    /* Allow status bits to be seen. */
> > -    outw(SetStatusEnb | 0xff, ioaddr + EL3_CMD);
> > -    /* Ack all pending events, and set active indicator mask. */
> > -    outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
> > +	unsigned int ioaddr = dev->base_addr;
> > +	int i;
> > +
> > +	EL3WINDOW(0);
> > +	outw(0x0001, ioaddr + 4);			/* Activate board. */
> > +	outw(0x3f00, ioaddr + 8);			/* Set the IRQ line. */
> > +
> > +	/* Set the station address in window 2. */
> > +	EL3WINDOW(2);
> > +	for (i = 0; i < 6; i++)
> > +		outb(dev->dev_addr[i], ioaddr + i);
> > +
> > +	tc589_set_xcvr(dev, dev->if_port);
> > +
> > +	/* Switch to the stats window, and clear all stats by reading. */
> > +	outw(StatsDisable, ioaddr + EL3_CMD);
> > +	EL3WINDOW(6);
> > +	for (i = 0; i < 9; i++)
> > +		inb(ioaddr+i);
> > +	inw(ioaddr + 10);
> > +	inw(ioaddr + 12);
> > +
> > +	/* Switch to register set 1 for normal use. */
> > +	EL3WINDOW(1);
> > +
> > +	set_rx_mode(dev);
> > +	outw(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */
> > +	outw(RxEnable, ioaddr + EL3_CMD); /* Enable the receiver. */
> > +	outw(TxEnable, ioaddr + EL3_CMD); /* Enable transmitter. */
> > +	/* Allow status bits to be seen. */
> > +	outw(SetStatusEnb | 0xff, ioaddr + EL3_CMD);
> > +	/* Ack all pending events, and set active indicator mask. */
> > +	outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
> >  	 ioaddr + EL3_CMD);
> > -    outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete | StatsFull
> > +	outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete | StatsFull
> >  	 | AdapterFailure, ioaddr + EL3_CMD);
> >  }
> >  
> > @@ -478,381 +494,406 @@ static const struct ethtool_ops netdev_ethtool_ops = {
> >  
> >  static int el3_config(struct net_device *dev, struct ifmap *map)
> >  {
> > -    if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
> > -	if (map->port <= 3) {
> > -	    dev->if_port = map->port;
> > -	    netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]);
> > -	    tc589_set_xcvr(dev, dev->if_port);
> > -	} else
> > -	    return -EINVAL;
> > -    }
> > -    return 0;
> > +	if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
> > +		if (map->port <= 3) {
> > +			dev->if_port = map->port;
> > +			netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]);
> > +			tc589_set_xcvr(dev, dev->if_port);
> > +		} else {
> > +			return -EINVAL;
> > +		}
> > +	}
> > +	return 0;
> >  }
> >  
> >  static int el3_open(struct net_device *dev)
> >  {
> > -    struct el3_private *lp = netdev_priv(dev);
> > -    struct pcmcia_device *link = lp->p_dev;
> > +	struct el3_private *lp = netdev_priv(dev);
> > +	struct pcmcia_device *link = lp->p_dev;
> >  
> > -    if (!pcmcia_dev_present(link))
> > -	return -ENODEV;
> > +	if (!pcmcia_dev_present(link))
> > +		return -ENODEV;
> >  
> > -    link->open++;
> > -    netif_start_queue(dev);
> > +	link->open++;
> > +	netif_start_queue(dev);
> >  
> > -    tc589_reset(dev);
> > -    init_timer(&lp->media);
> > -    lp->media.function = media_check;
> > -    lp->media.data = (unsigned long) dev;
> > -    lp->media.expires = jiffies + HZ;
> > -    add_timer(&lp->media);
> > +	tc589_reset(dev);
> > +	init_timer(&lp->media);
> > +	lp->media.function = media_check;
> > +	lp->media.data = (unsigned long) dev;
> > +	lp->media.expires = jiffies + HZ;
> > +	add_timer(&lp->media);
> >  
> > -    dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
> > +	dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
> >  	  dev->name, inw(dev->base_addr + EL3_STATUS));
> >  
> > -    return 0;
> > +	return 0;
> >  }
> >  
> >  static void el3_tx_timeout(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -
> > -    netdev_warn(dev, "Transmit timed out!\n");
> > -    dump_status(dev);
> > -    dev->stats.tx_errors++;
> > -    dev->trans_start = jiffies; /* prevent tx timeout */
> > -    /* Issue TX_RESET and TX_START commands. */
> > -    tc589_wait_for_completion(dev, TxReset);
> > -    outw(TxEnable, ioaddr + EL3_CMD);
> > -    netif_wake_queue(dev);
> > +	unsigned int ioaddr = dev->base_addr;
> > +
> > +	netdev_warn(dev, "Transmit timed out!\n");
> > +	dump_status(dev);
> > +	dev->stats.tx_errors++;
> > +	dev->trans_start = jiffies; /* prevent tx timeout */
> > +	/* Issue TX_RESET and TX_START commands. */
> > +	tc589_wait_for_completion(dev, TxReset);
> > +	outw(TxEnable, ioaddr + EL3_CMD);
> > +	netif_wake_queue(dev);
> >  }
> >  
> >  static void pop_tx_status(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -    int i;
> > -
> > -    /* Clear the Tx status stack. */
> > -    for (i = 32; i > 0; i--) {
> > -	u_char tx_status = inb(ioaddr + TX_STATUS);
> > -	if (!(tx_status & 0x84)) break;
> > -	/* reset transmitter on jabber error or underrun */
> > -	if (tx_status & 0x30)
> > -		tc589_wait_for_completion(dev, TxReset);
> > -	if (tx_status & 0x38) {
> > -		netdev_dbg(dev, "transmit error: status 0x%02x\n", tx_status);
> > -		outw(TxEnable, ioaddr + EL3_CMD);
> > -		dev->stats.tx_aborted_errors++;
> > +	unsigned int ioaddr = dev->base_addr;
> > +	int i;
> > +
> > +	/* Clear the Tx status stack. */
> > +	for (i = 32; i > 0; i--) {
> > +		u_char tx_status = inb(ioaddr + TX_STATUS);
> > +		if (!(tx_status & 0x84))
> > +			break;
> > +		/* reset transmitter on jabber error or underrun */
> > +		if (tx_status & 0x30)
> > +			tc589_wait_for_completion(dev, TxReset);
> > +		if (tx_status & 0x38) {
> > +			netdev_dbg(dev, "transmit error: status 0x%02x\n", tx_status);
> > +			outw(TxEnable, ioaddr + EL3_CMD);
> > +			dev->stats.tx_aborted_errors++;
> > +		}
> > +		outb(0x00, ioaddr + TX_STATUS); /* Pop the status stack. */
> >  	}
> > -	outb(0x00, ioaddr + TX_STATUS); /* Pop the status stack. */
> > -    }
> >  }
> >  
> >  static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
> >  					struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -    struct el3_private *priv = netdev_priv(dev);
> > -    unsigned long flags;
> > +	unsigned int ioaddr = dev->base_addr;
> > +	struct el3_private *priv = netdev_priv(dev);
> > +	unsigned long flags;
> >  
> > -    netdev_dbg(dev, "el3_start_xmit(length = %ld) called, status %4.4x.\n",
> > +	netdev_dbg(dev, "el3_start_xmit(length = %ld) called, status %4.4x.\n",
> >  	       (long)skb->len, inw(ioaddr + EL3_STATUS));
> >  
> > -    spin_lock_irqsave(&priv->lock, flags);
> > +	spin_lock_irqsave(&priv->lock, flags);
> >  
> > -    dev->stats.tx_bytes += skb->len;
> > +	dev->stats.tx_bytes += skb->len;
> >  
> > -    /* Put out the doubleword header... */
> > -    outw(skb->len, ioaddr + TX_FIFO);
> > -    outw(0x00, ioaddr + TX_FIFO);
> > -    /* ... and the packet rounded to a doubleword. */
> > -    outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2);
> > +	/* Put out the doubleword header... */
> > +	outw(skb->len, ioaddr + TX_FIFO);
> > +	outw(0x00, ioaddr + TX_FIFO);
> > +	/* ... and the packet rounded to a doubleword. */
> > +	outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2);
> >  
> > -    if (inw(ioaddr + TX_FREE) <= 1536) {
> > -	netif_stop_queue(dev);
> > -	/* Interrupt us when the FIFO has room for max-sized packet. */
> > -	outw(SetTxThreshold + 1536, ioaddr + EL3_CMD);
> > -    }
> > +	if (inw(ioaddr + TX_FREE) <= 1536) {
> > +		netif_stop_queue(dev);
> > +		/* Interrupt us when the FIFO has room for max-sized packet. */
> > +		outw(SetTxThreshold + 1536, ioaddr + EL3_CMD);
> > +	}
> >  
> > -    pop_tx_status(dev);
> > -    spin_unlock_irqrestore(&priv->lock, flags);
> > -    dev_kfree_skb(skb);
> > +	pop_tx_status(dev);
> > +	spin_unlock_irqrestore(&priv->lock, flags);
> > +	dev_kfree_skb(skb);
> >  
> > -    return NETDEV_TX_OK;
> > +	return NETDEV_TX_OK;
> >  }
> >  
> >  /* The EL3 interrupt handler. */
> >  static irqreturn_t el3_interrupt(int irq, void *dev_id)
> >  {
> > -    struct net_device *dev = (struct net_device *) dev_id;
> > -    struct el3_private *lp = netdev_priv(dev);
> > -    unsigned int ioaddr;
> > -    __u16 status;
> > -    int i = 0, handled = 1;
> > +	struct net_device *dev = (struct net_device *) dev_id;
> > +	struct el3_private *lp = netdev_priv(dev);
> > +	unsigned int ioaddr;
> > +	__u16 status;
> > +	int i = 0, handled = 1;
> >  
> > -    if (!netif_device_present(dev))
> > -	return IRQ_NONE;
> > +	if (!netif_device_present(dev))
> > +		return IRQ_NONE;
> >  
> > -    ioaddr = dev->base_addr;
> > +	ioaddr = dev->base_addr;
> >  
> > -    netdev_dbg(dev, "interrupt, status %4.4x.\n", inw(ioaddr + EL3_STATUS));
> > +	netdev_dbg(dev, "interrupt, status %4.4x.\n", inw(ioaddr + EL3_STATUS));
> >  
> > -    spin_lock(&lp->lock);
> > -    while ((status = inw(ioaddr + EL3_STATUS)) &
> > +	spin_lock(&lp->lock);
> > +	while ((status = inw(ioaddr + EL3_STATUS)) &
> >  	(IntLatch | RxComplete | StatsFull)) {
> > -	if ((status & 0xe000) != 0x2000) {
> > -		netdev_dbg(dev, "interrupt from dead card\n");
> > -		handled = 0;
> > -		break;
> > -	}
> > -	if (status & RxComplete)
> > -		el3_rx(dev);
> > -	if (status & TxAvailable) {
> > -		netdev_dbg(dev, "    TX room bit was handled.\n");
> > -		/* There's room in the FIFO for a full-sized packet. */
> > -		outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
> > -		netif_wake_queue(dev);
> > -	}
> > -	if (status & TxComplete)
> > -		pop_tx_status(dev);
> > -	if (status & (AdapterFailure | RxEarly | StatsFull)) {
> > -	    /* Handle all uncommon interrupts. */
> > -	    if (status & StatsFull)		/* Empty statistics. */
> > -		update_stats(dev);
> > -	    if (status & RxEarly) {		/* Rx early is unused. */
> > -		el3_rx(dev);
> > -		outw(AckIntr | RxEarly, ioaddr + EL3_CMD);
> > -	    }
> > -	    if (status & AdapterFailure) {
> > -		u16 fifo_diag;
> > -		EL3WINDOW(4);
> > -		fifo_diag = inw(ioaddr + 4);
> > -		EL3WINDOW(1);
> > -		netdev_warn(dev, "adapter failure, FIFO diagnostic register %04x.\n",
> > +		if ((status & 0xe000) != 0x2000) {
> > +			netdev_dbg(dev, "interrupt from dead card\n");
> > +			handled = 0;
> > +			break;
> > +		}
> > +		if (status & RxComplete)
> > +			el3_rx(dev);
> > +		if (status & TxAvailable) {
> > +			netdev_dbg(dev, "    TX room bit was handled.\n");
> > +			/* There's room in the FIFO for a full-sized packet. */
> > +			outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
> > +			netif_wake_queue(dev);
> > +		}
> > +		if (status & TxComplete)
> > +			pop_tx_status(dev);
> > +		if (status & (AdapterFailure | RxEarly | StatsFull)) {
> > +			/* Handle all uncommon interrupts. */
> > +			if (status & StatsFull)		/* Empty statistics. */
> > +				update_stats(dev);
> > +			if (status & RxEarly) {
> > +				/* Rx early is unused. */
> > +				el3_rx(dev);
> > +				outw(AckIntr | RxEarly, ioaddr + EL3_CMD);
> > +			}
> > +			if (status & AdapterFailure) {
> > +				u16 fifo_diag;
> > +				EL3WINDOW(4);
> > +				fifo_diag = inw(ioaddr + 4);
> > +				EL3WINDOW(1);
> > +				netdev_warn(dev, "adapter failure, FIFO diagnostic register %04x.\n",
> >  			    fifo_diag);
> > -		if (fifo_diag & 0x0400) {
> > -		    /* Tx overrun */
> > -		    tc589_wait_for_completion(dev, TxReset);
> > -		    outw(TxEnable, ioaddr + EL3_CMD);
> > +				if (fifo_diag & 0x0400) {
> > +					/* Tx overrun */
> > +					tc589_wait_for_completion(dev, TxReset);
> > +					outw(TxEnable, ioaddr + EL3_CMD);
> > +				}
> > +				if (fifo_diag & 0x2000) {
> > +					/* Rx underrun */
> > +					tc589_wait_for_completion(dev, RxReset);
> > +					set_rx_mode(dev);
> > +					outw(RxEnable, ioaddr + EL3_CMD);
> > +				}
> > +				outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD);
> > +			}
> >  		}
> > -		if (fifo_diag & 0x2000) {
> > -		    /* Rx underrun */
> > -		    tc589_wait_for_completion(dev, RxReset);
> > -		    set_rx_mode(dev);
> > -		    outw(RxEnable, ioaddr + EL3_CMD);
> > +		if (++i > 10) {
> > +			netdev_err(dev, "infinite loop in interrupt, status %4.4x.\n",
> > +					status);
> > +			/* Clear all interrupts */
> > +			outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
> > +			break;
> >  		}
> > -		outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD);
> > -	    }
> > +		/* Acknowledge the IRQ. */
> > +		outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
> >  	}
> > -	if (++i > 10) {
> > -		netdev_err(dev, "infinite loop in interrupt, status %4.4x.\n",
> > -			   status);
> > -		/* Clear all interrupts */
> > -		outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
> > -		break;
> > -	}
> > -	/* Acknowledge the IRQ. */
> > -	outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
> > -    }
> > -    lp->last_irq = jiffies;
> > -    spin_unlock(&lp->lock);
> > -    netdev_dbg(dev, "exiting interrupt, status %4.4x.\n",
> > -	       inw(ioaddr + EL3_STATUS));
> > -    return IRQ_RETVAL(handled);
> > +	lp->last_irq = jiffies;
> > +	spin_unlock(&lp->lock);
> > +	netdev_dbg(dev, "exiting interrupt, status %4.4x.\n",
> > +			inw(ioaddr + EL3_STATUS));
> > +	return IRQ_RETVAL(handled);
> >  }
> >  
> >  static void media_check(unsigned long arg)
> >  {
> > -    struct net_device *dev = (struct net_device *)(arg);
> > -    struct el3_private *lp = netdev_priv(dev);
> > -    unsigned int ioaddr = dev->base_addr;
> > -    u16 media, errs;
> > -    unsigned long flags;
> > +	struct net_device *dev = (struct net_device *)(arg);
> > +	struct el3_private *lp = netdev_priv(dev);
> > +	unsigned int ioaddr = dev->base_addr;
> > +	u16 media, errs;
> > +	unsigned long flags;
> >  
> > -    if (!netif_device_present(dev)) goto reschedule;
> > +	if (!netif_device_present(dev))
> > +		goto reschedule;
> >  
> > -    /* Check for pending interrupt with expired latency timer: with
> > -       this, we can limp along even if the interrupt is blocked */
> > -    if ((inw(ioaddr + EL3_STATUS) & IntLatch) &&
> > +	/* Check for pending interrupt with expired latency timer: with
> > +	 * this, we can limp along even if the interrupt is blocked
> > +	 */
> > +	if ((inw(ioaddr + EL3_STATUS) & IntLatch) &&
> >  	(inb(ioaddr + EL3_TIMER) == 0xff)) {
> > -	if (!lp->fast_poll)
> > -		netdev_warn(dev, "interrupt(s) dropped!\n");
> > -
> > -	local_irq_save(flags);
> > -	el3_interrupt(dev->irq, dev);
> > -	local_irq_restore(flags);
> > -
> > -	lp->fast_poll = HZ;
> > -    }
> > -    if (lp->fast_poll) {
> > -	lp->fast_poll--;
> > -	lp->media.expires = jiffies + HZ/100;
> > -	add_timer(&lp->media);
> > -	return;
> > -    }
> > -
> > -    /* lp->lock guards the EL3 window. Window should always be 1 except
> > -       when the lock is held */
> > -    spin_lock_irqsave(&lp->lock, flags);
> > -    EL3WINDOW(4);
> > -    media = inw(ioaddr+WN4_MEDIA) & 0xc810;
> > -
> > -    /* Ignore collisions unless we've had no irq's recently */
> > -    if (time_before(jiffies, lp->last_irq + HZ)) {
> > -	media &= ~0x0010;
> > -    } else {
> > -	/* Try harder to detect carrier errors */
> > -	EL3WINDOW(6);
> > -	outw(StatsDisable, ioaddr + EL3_CMD);
> > -	errs = inb(ioaddr + 0);
> > -	outw(StatsEnable, ioaddr + EL3_CMD);
> > -	dev->stats.tx_carrier_errors += errs;
> > -	if (errs || (lp->media_status & 0x0010)) media |= 0x0010;
> > -    }
> > +		if (!lp->fast_poll)
> > +			netdev_warn(dev, "interrupt(s) dropped!\n");
> > +
> > +		local_irq_save(flags);
> > +		el3_interrupt(dev->irq, dev);
> > +		local_irq_restore(flags);
> > +
> > +		lp->fast_poll = HZ;
> > +	}
> > +	if (lp->fast_poll) {
> > +		lp->fast_poll--;
> > +		lp->media.expires = jiffies + HZ/100;
> > +		add_timer(&lp->media);
> > +		return;
> > +	}
> > +
> > +	/* lp->lock guards the EL3 window. Window should always be 1 except
> > +	 * when the lock is held
> > +	 */
> > +
> > +	spin_lock_irqsave(&lp->lock, flags);
> > +	EL3WINDOW(4);
> > +	media = inw(ioaddr+WN4_MEDIA) & 0xc810;
> > +
> > +	/* Ignore collisions unless we've had no irq's recently */
> > +	if (time_before(jiffies, lp->last_irq + HZ)) {
> > +		media &= ~0x0010;
> > +	} else {
> > +		/* Try harder to detect carrier errors */
> > +		EL3WINDOW(6);
> > +		outw(StatsDisable, ioaddr + EL3_CMD);
> > +		errs = inb(ioaddr + 0);
> > +		outw(StatsEnable, ioaddr + EL3_CMD);
> > +		dev->stats.tx_carrier_errors += errs;
> > +		if (errs || (lp->media_status & 0x0010))
> > +			media |= 0x0010;
> > +	}
> >  
> > -    if (media != lp->media_status) {
> > -	if ((media & lp->media_status & 0x8000) &&
> > -	    ((lp->media_status ^ media) & 0x0800))
> > +	if (media != lp->media_status) {
> > +		if ((media & lp->media_status & 0x8000) &&
> > +				((lp->media_status ^ media) & 0x0800))
> >  		netdev_info(dev, "%s link beat\n",
> > -			    (lp->media_status & 0x0800 ? "lost" : "found"));
> > -	else if ((media & lp->media_status & 0x4000) &&
> > +				(lp->media_status & 0x0800 ? "lost" : "found"));
> > +		else if ((media & lp->media_status & 0x4000) &&
> >  		 ((lp->media_status ^ media) & 0x0010))
> >  		netdev_info(dev, "coax cable %s\n",
> > -			    (lp->media_status & 0x0010 ? "ok" : "problem"));
> > -	if (dev->if_port == 0) {
> > -	    if (media & 0x8000) {
> > -		if (media & 0x0800)
> > -			netdev_info(dev, "flipped to 10baseT\n");
> > -		else
> > +				(lp->media_status & 0x0010 ? "ok" : "problem"));
> > +		if (dev->if_port == 0) {
> > +			if (media & 0x8000) {
> > +				if (media & 0x0800)
> > +					netdev_info(dev, "flipped to 10baseT\n");
> > +				else
> >  			tc589_set_xcvr(dev, 2);
> > -	    } else if (media & 0x4000) {
> > -		if (media & 0x0010)
> > -		    tc589_set_xcvr(dev, 1);
> > -		else
> > -		    netdev_info(dev, "flipped to 10base2\n");
> > -	    }
> > +			} else if (media & 0x4000) {
> > +				if (media & 0x0010)
> > +					tc589_set_xcvr(dev, 1);
> > +				else
> > +					netdev_info(dev, "flipped to 10base2\n");
> > +			}
> > +		}
> > +		lp->media_status = media;
> >  	}
> > -	lp->media_status = media;
> > -    }
> >  
> > -    EL3WINDOW(1);
> > -    spin_unlock_irqrestore(&lp->lock, flags);
> > +	EL3WINDOW(1);
> > +	spin_unlock_irqrestore(&lp->lock, flags);
> >  
> >  reschedule:
> > -    lp->media.expires = jiffies + HZ;
> > -    add_timer(&lp->media);
> > +	lp->media.expires = jiffies + HZ;
> > +	add_timer(&lp->media);
> >  }
> >  
> >  static struct net_device_stats *el3_get_stats(struct net_device *dev)
> >  {
> > -    struct el3_private *lp = netdev_priv(dev);
> > -    unsigned long flags;
> > -    struct pcmcia_device *link = lp->p_dev;
> > +	struct el3_private *lp = netdev_priv(dev);
> > +	unsigned long flags;
> > +	struct pcmcia_device *link = lp->p_dev;
> >  
> > -    if (pcmcia_dev_present(link)) {
> > -	spin_lock_irqsave(&lp->lock, flags);
> > -	update_stats(dev);
> > -	spin_unlock_irqrestore(&lp->lock, flags);
> > -    }
> > -    return &dev->stats;
> > +	if (pcmcia_dev_present(link)) {
> > +		spin_lock_irqsave(&lp->lock, flags);
> > +		update_stats(dev);
> > +		spin_unlock_irqrestore(&lp->lock, flags);
> > +	}
> > +	return &dev->stats;
> >  }
> >  
> > -/*
> > -  Update statistics.  We change to register window 6, so this should be run
> > -  single-threaded if the device is active. This is expected to be a rare
> > -  operation, and it's simpler for the rest of the driver to assume that
> > -  window 1 is always valid rather than use a special window-state variable.
> > -
> > -  Caller must hold the lock for this
> > +/* Update statistics.  We change to register window 6, so this should be run
> > +* single-threaded if the device is active. This is expected to be a rare
> > +* operation, and it's simpler for the rest of the driver to assume that
> > +* window 1 is always valid rather than use a special window-state variable.
> > +*
> > +* Caller must hold the lock for this
> >  */
> > +
> >  static void update_stats(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -
> > -    netdev_dbg(dev, "updating the statistics.\n");
> > -    /* Turn off statistics updates while reading. */
> > -    outw(StatsDisable, ioaddr + EL3_CMD);
> > -    /* Switch to the stats window, and read everything. */
> > -    EL3WINDOW(6);
> > -    dev->stats.tx_carrier_errors	+= inb(ioaddr + 0);
> > -    dev->stats.tx_heartbeat_errors	+= inb(ioaddr + 1);
> > -    /* Multiple collisions. */		inb(ioaddr + 2);
> > -    dev->stats.collisions		+= inb(ioaddr + 3);
> > -    dev->stats.tx_window_errors		+= inb(ioaddr + 4);
> > -    dev->stats.rx_fifo_errors		+= inb(ioaddr + 5);
> > -    dev->stats.tx_packets		+= inb(ioaddr + 6);
> > -    /* Rx packets   */			inb(ioaddr + 7);
> > -    /* Tx deferrals */			inb(ioaddr + 8);
> > -    /* Rx octets */			inw(ioaddr + 10);
> > -    /* Tx octets */			inw(ioaddr + 12);
> > -
> > -    /* Back to window 1, and turn statistics back on. */
> > -    EL3WINDOW(1);
> > -    outw(StatsEnable, ioaddr + EL3_CMD);
> > +	unsigned int ioaddr = dev->base_addr;
> > +
> > +	netdev_dbg(dev, "updating the statistics.\n");
> > +	/* Turn off statistics updates while reading. */
> > +	outw(StatsDisable, ioaddr + EL3_CMD);
> > +	/* Switch to the stats window, and read everything. */
> > +	EL3WINDOW(6);
> > +	dev->stats.tx_carrier_errors	+= inb(ioaddr + 0);
> > +	dev->stats.tx_heartbeat_errors	+= inb(ioaddr + 1);
> > +	/* Multiple collisions. */
> > +	inb(ioaddr + 2);
> > +	dev->stats.collisions		+= inb(ioaddr + 3);
> > +	dev->stats.tx_window_errors		+= inb(ioaddr + 4);
> > +	dev->stats.rx_fifo_errors		+= inb(ioaddr + 5);
> > +	dev->stats.tx_packets		+= inb(ioaddr + 6);
> > +	/* Rx packets   */
> > +	inb(ioaddr + 7);
> > +	/* Tx deferrals */
> > +	inb(ioaddr + 8);
> > +	/* Rx octets */
> > +	inw(ioaddr + 10);
> > +	/* Tx octets */
> > +	inw(ioaddr + 12);
> > +
> > +	/* Back to window 1, and turn statistics back on. */
> > +	EL3WINDOW(1);
> > +	outw(StatsEnable, ioaddr + EL3_CMD);
> >  }
> >  
> >  static int el3_rx(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -    int worklimit = 32;
> > -    short rx_status;
> > +	unsigned int ioaddr = dev->base_addr;
> > +	int worklimit = 32;
> > +	short rx_status;
> >  
> > -    netdev_dbg(dev, "in rx_packet(), status %4.4x, rx_status %4.4x.\n",
> > +	netdev_dbg(dev, "in rx_packet(), status %4.4x, rx_status %4.4x.\n",
> >  	       inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
> > -    while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
> > +	while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
> >  		    worklimit > 0) {
> > -	worklimit--;
> > -	if (rx_status & 0x4000) { /* Error, update stats. */
> > -	    short error = rx_status & 0x3800;
> > -	    dev->stats.rx_errors++;
> > -	    switch (error) {
> > -	    case 0x0000:	dev->stats.rx_over_errors++; break;
> > -	    case 0x0800:	dev->stats.rx_length_errors++; break;
> > -	    case 0x1000:	dev->stats.rx_frame_errors++; break;
> > -	    case 0x1800:	dev->stats.rx_length_errors++; break;
> > -	    case 0x2000:	dev->stats.rx_frame_errors++; break;
> > -	    case 0x2800:	dev->stats.rx_crc_errors++; break;
> > -	    }
> > -	} else {
> > -	    short pkt_len = rx_status & 0x7ff;
> > -	    struct sk_buff *skb;
> > -
> > -	    skb = netdev_alloc_skb(dev, pkt_len + 5);
> > -
> > -	    netdev_dbg(dev, "    Receiving packet size %d status %4.4x.\n",
> > +		worklimit--;
> > +		if (rx_status & 0x4000) { /* Error, update stats. */
> > +			short error = rx_status & 0x3800;
> > +			dev->stats.rx_errors++;
> > +			switch (error) {
> > +			case 0x0000:
> > +				dev->stats.rx_over_errors++;
> > +				break;
> > +			case 0x0800:
> > +				dev->stats.rx_length_errors++;
> > +				break;
> > +			case 0x1000:
> > +				dev->stats.rx_frame_errors++;
> > +				break;
> > +			case 0x1800:
> > +				dev->stats.rx_length_errors++;
> > +				break;
> > +			case 0x2000:
> > +				dev->stats.rx_frame_errors++;
> > +				break;
> > +			case 0x2800:
> > +				dev->stats.rx_crc_errors++;
> > +				break;
> > +			}
> > +		} else {
> > +			short pkt_len = rx_status & 0x7ff;
> > +			struct sk_buff *skb;
> > +
> > +			skb = netdev_alloc_skb(dev, pkt_len + 5);
> > +
> > +			netdev_dbg(dev, "    Receiving packet size %d status %4.4x.\n",
> >  		       pkt_len, rx_status);
> > -	    if (skb != NULL) {
> > -		skb_reserve(skb, 2);
> > -		insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len),
> > +			if (skb != NULL) {
> > +				skb_reserve(skb, 2);
> > +				insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len),
> >  			(pkt_len+3)>>2);
> > -		skb->protocol = eth_type_trans(skb, dev);
> > -		netif_rx(skb);
> > -		dev->stats.rx_packets++;
> > -		dev->stats.rx_bytes += pkt_len;
> > -	    } else {
> > -		netdev_dbg(dev, "couldn't allocate a sk_buff of size %d.\n",
> > +				skb->protocol = eth_type_trans(skb, dev);
> > +				netif_rx(skb);
> > +				dev->stats.rx_packets++;
> > +				dev->stats.rx_bytes += pkt_len;
> > +			} else {
> > +				netdev_dbg(dev, "couldn't allocate a sk_buff of size %d.\n",
> >  			   pkt_len);
> > -		dev->stats.rx_dropped++;
> > -	    }
> > +				dev->stats.rx_dropped++;
> > +			}
> > +		}
> > +		/* Pop the top of the Rx FIFO */
> > +		tc589_wait_for_completion(dev, RxDiscard);
> >  	}
> > -	/* Pop the top of the Rx FIFO */
> > -	tc589_wait_for_completion(dev, RxDiscard);
> > -    }
> > -    if (worklimit == 0)
> > -	netdev_warn(dev, "too much work in el3_rx!\n");
> > -    return 0;
> > +	if (worklimit == 0)
> > +		netdev_warn(dev, "too much work in el3_rx!\n");
> > +	return 0;
> >  }
> >  
> >  static void set_rx_mode(struct net_device *dev)
> >  {
> > -    unsigned int ioaddr = dev->base_addr;
> > -    u16 opts = SetRxFilter | RxStation | RxBroadcast;
> > -
> > -    if (dev->flags & IFF_PROMISC)
> > -	opts |= RxMulticast | RxProm;
> > -    else if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI))
> > -	opts |= RxMulticast;
> > -    outw(opts, ioaddr + EL3_CMD);
> > +	unsigned int ioaddr = dev->base_addr;
> > +	u16 opts = SetRxFilter | RxStation | RxBroadcast;
> > +
> > +	if (dev->flags & IFF_PROMISC)
> > +		opts |= RxMulticast | RxProm;
> > +	else if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI))
> > +		opts |= RxMulticast;
> > +	outw(opts, ioaddr + EL3_CMD);
> >  }
> >  
> >  static void set_multicast_list(struct net_device *dev)
> > @@ -867,44 +908,44 @@ static void set_multicast_list(struct net_device *dev)
> >  
> >  static int el3_close(struct net_device *dev)
> >  {
> > -    struct el3_private *lp = netdev_priv(dev);
> > -    struct pcmcia_device *link = lp->p_dev;
> > -    unsigned int ioaddr = dev->base_addr;
> > -
> > -    dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
> > +	struct el3_private *lp = netdev_priv(dev);
> > +	struct pcmcia_device *link = lp->p_dev;
> > +	unsigned int ioaddr = dev->base_addr;
> > +
> > +	dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
> > +
> > +	if (pcmcia_dev_present(link)) {
> > +		/* Turn off statistics ASAP.  We update dev->stats below. */
> > +		outw(StatsDisable, ioaddr + EL3_CMD);
> > +
> > +		/* Disable the receiver and transmitter. */
> > +		outw(RxDisable, ioaddr + EL3_CMD);
> > +		outw(TxDisable, ioaddr + EL3_CMD);
> > +
> > +		if (dev->if_port == 2)
> > +			/* Turn off thinnet power.  Green! */
> > +			outw(StopCoax, ioaddr + EL3_CMD);
> > +		else if (dev->if_port == 1) {
> > +			/* Disable link beat and jabber */
> > +			EL3WINDOW(4);
> > +			outw(0, ioaddr + WN4_MEDIA);
> > +		}
> >  
> > -    if (pcmcia_dev_present(link)) {
> > -	/* Turn off statistics ASAP.  We update dev->stats below. */
> > -	outw(StatsDisable, ioaddr + EL3_CMD);
> > +		/* Switching back to window 0 disables the IRQ. */
> > +		EL3WINDOW(0);
> > +		/* But we explicitly zero the IRQ line select anyway. */
> > +		outw(0x0f00, ioaddr + WN0_IRQ);
> >  
> > -	/* Disable the receiver and transmitter. */
> > -	outw(RxDisable, ioaddr + EL3_CMD);
> > -	outw(TxDisable, ioaddr + EL3_CMD);
> > -
> > -	if (dev->if_port == 2)
> > -	    /* Turn off thinnet power.  Green! */
> > -	    outw(StopCoax, ioaddr + EL3_CMD);
> > -	else if (dev->if_port == 1) {
> > -	    /* Disable link beat and jabber */
> > -	    EL3WINDOW(4);
> > -	    outw(0, ioaddr + WN4_MEDIA);
> > +		/* Check if the card still exists */
> > +		if ((inw(ioaddr+EL3_STATUS) & 0xe000) == 0x2000)
> > +			update_stats(dev);
> >  	}
> >  
> > -	/* Switching back to window 0 disables the IRQ. */
> > -	EL3WINDOW(0);
> > -	/* But we explicitly zero the IRQ line select anyway. */
> > -	outw(0x0f00, ioaddr + WN0_IRQ);
> > -
> > -	/* Check if the card still exists */
> > -	if ((inw(ioaddr+EL3_STATUS) & 0xe000) == 0x2000)
> > -	    update_stats(dev);
> > -    }
> > -
> > -    link->open--;
> > -    netif_stop_queue(dev);
> > -    del_timer_sync(&lp->media);
> > +	link->open--;
> > +	netif_stop_queue(dev);
> > +	del_timer_sync(&lp->media);
> >  
> > -    return 0;
> > +	return 0;
> >  }
> >  
> >  static const struct pcmcia_device_id tc589_ids[] = {
> > 

^ permalink raw reply

* Re: [PATCH net-next 1/8] cxgb4: Add support to recognize 40G links
From: Steve Wise @ 2014-02-19 21:12 UTC (permalink / raw)
  To: Hariprasad Shenai; +Cc: netdev, davem, dm, leedom, nirranjan, kumaras, santosh
In-Reply-To: <1392726375-32001-2-git-send-email-hariprasad@chelsio.com>

On 2/18/2014 6:26 AM, Hariprasad Shenai wrote:
> From: Kumar Sanghvi <kumaras@chelsio.com>
>
> Also, create a new Common Code interface to translate Firmware Port Technology
> Type values (enum fw_port_type) to string descriptions.  This will allow us
> to maintain the description translation table in one place rather than in
> every driver.
>
> Based on original work by Scott Bardone and Casey Leedom <leedom@chelsio.com>
>
> Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
> ---
>   drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      |  2 +-
>   drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 24 +++++++++++------
>   drivers/net/ethernet/chelsio/cxgb4/t4_hw.c      | 35 ++++++++++++++++++++++++-
>   drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   |  3 +++
>   4 files changed, 54 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> index 1f4b9b3..0c4edd1 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> @@ -957,7 +957,7 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data,
>   	       u64 *parity);
>   int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data,
>   		u64 *parity);
> -
> +const char *t4_get_port_type_description(enum fw_port_type port_type);
>   void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
>   void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
>   void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> index 43ab35f..ee2f123 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> @@ -432,6 +432,9 @@ static void link_report(struct net_device *dev)
>   		case SPEED_100:
>   			s = "100Mbps";
>   			break;
> +		case 40000: /* Need a SPEED_40000 in ethtool.h */
> +			s = "40Gbps";
> +			break;

You probably should add SPEED_40000 to include/uapi/linux/ethtool.h as 
part of this series.

Steve.

^ permalink raw reply

* Re: [PATCH net-next] hyperv: Add latest NetVSP versions to auto negotiation
From: David Miller @ 2014-02-19 21:23 UTC (permalink / raw)
  To: haiyangz; +Cc: olaf, netdev, jasowang, driverdev-devel, linux-kernel
In-Reply-To: <1392755334-25884-1-git-send-email-haiyangz@microsoft.com>

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Tue, 18 Feb 2014 12:28:54 -0800

> +	u32 ver_list[] = {NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2,
> +		NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5};

Please put a space after "{" and before "}".

> +	int i, num_ver = 4; /* number of different NVSP versions */
> +
>  
>  	net_device = get_outbound_net_device(device);

Please delete the extraneous empty line.

> +	for (i = num_ver - 1; i >= 0; i--)
> +		if (negotiate_nvsp_ver(device, net_device, init_packet,
> +			ver_list[i])  == 0) {

This is not indented properly, "ver_list[i])" should begin precisely after
the openning parenthesis of the negotiate_nvsp_ver() function call.

^ permalink raw reply

* Re: [PATCH net-next] ipv6: honor IPV6_PKTINFO with v4 mapped addresses on sendmsg
From: David Miller @ 2014-02-19 21:28 UTC (permalink / raw)
  To: hannes; +Cc: netdev, gert, tore
In-Reply-To: <20140218203808.GA19788@order.stressinduktion.org>

From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Tue, 18 Feb 2014 21:38:08 +0100

> In case we decide in udp6_sendmsg to send the packet down the ipv4
> udp_sendmsg path because the destination is either of family AF_INET or
> the destination is an ipv4 mapped ipv6 address, we don't honor the
> maybe specified ipv4 mapped ipv6 address in IPV6_PKTINFO.
> 
> We simply can check for this option in ip_cmsg_send because no calls to
> ipv6 module functions are needed to do so.
> 
> Reported-by: Gert Doering <gert@space.net>
> Cc: Tore Anderson <tore@fud.no>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Looks great, applied, thanks Hannes.

^ permalink raw reply

* Re: [PATCH v2] net: ethoc: document OF bindings
From: David Miller @ 2014-02-19 21:36 UTC (permalink / raw)
  To: jcmvbkbc
  Cc: netdev, devicetree, linux-kernel, grant.likely, robherring2,
	sergei.shtylyov, f.fainelli
In-Reply-To: <1392763610-19197-1-git-send-email-jcmvbkbc@gmail.com>

From: Max Filippov <jcmvbkbc@gmail.com>
Date: Wed, 19 Feb 2014 02:46:50 +0400

> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH next resend] tcp: use zero-window when free_space is low
From: David Miller @ 2014-02-19 21:36 UTC (permalink / raw)
  To: eric.dumazet; +Cc: fw, netdev, ncardwell, ycheng
In-Reply-To: <1392765133.18849.0.camel@edumazet-glaptop2.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 18 Feb 2014 15:12:13 -0800

> On Tue, 2014-02-18 at 09:30 -0800, Eric Dumazet wrote:
>> On Mon, 2014-02-17 at 21:52 +0100, Florian Westphal wrote:
>> > David Miller <davem@davemloft.net> wrote:
>> > > From: Florian Westphal <fw@strlen.de>
>> > > Date: Thu, 13 Feb 2014 12:52:30 +0100
>> > > 
>> > > >  V1 of this patch was deferred, resending to get discussion going again.
>> > > >  Changes since v1:
>> > > >   - add reproducer to commit message
>> > > > 
>> > > >  Unfortunately I couldn't come up with something that has no magic
>> > > >  ('allowed >> 4') value.  I chose >>4 (1/16th) because it didn't cause
>> > > >  tput limitations in my 'full-mss-sized, steady state' netcat tests.
>> > > > 
>> > > >  Maybe someone has better idea?
>> > > 
>> > > I know this is going to be frustrating, but I've marked this 'deferred'
>> > > again.  Please resubmit after the testing and further discussions have
>> > > been worked out.
>> > 
>> > Thanks for letting me know.  I understand why you are reluctant to just
>> > apply this.
>> > 
>> > I will submit another patch shortly that introduces snmp counter for zero-window
>> > (what Eric suggested), perhaps it helps him or others to find a better solution
>> > in the scenario.
>> 
>> Sorry for the delay guys, I was on vacation.
>> 
>> I started the tests this morning, results in about 2/3 hours.
> 
> No regression found, feel free to add my :
> 
> Acked-by: Eric Dumazet <edumazet@google.com>
> Tested-by: Eric Dumazet <edumazet@google.com>

Florian please resend with Eric's tags and I'll apply.

^ permalink raw reply

* Re: [PATCH] atm: ambassador: use NULL instead of 0 for pointer
From: David Miller @ 2014-02-19 21:39 UTC (permalink / raw)
  To: daeseok.youn; +Cc: chas, linux-atm-general, netdev, linux-kernel
In-Reply-To: <4982315.WAlBt88ElR@daeseok-laptop.cloud.net>

From: Daeseok Youn <daeseok.youn@gmail.com>
Date: Wed, 19 Feb 2014 14:11:15 +0900

> From 932e928d53b1e588dc17019e7f9fa7a61b8b7468 Mon Sep 17 00:00:00 2001
> From: Daeseok Youn <daeseok.youn@gmail.com>
> Date: Wed, 19 Feb 2014 10:35:41 +0900
> Subject: [PATCH] atm: ambassador: use NULL instead of 0 for pointer
> 
> sparse says:
> 
> drivers/atm/ambassador.c:1928:24: warning:
>  Using plain integer as NULL pointer
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH] atm: nicstar: use NULL instead of 0 for pointer
From: David Miller @ 2014-02-19 21:39 UTC (permalink / raw)
  To: daeseok.youn; +Cc: chas, linux-atm-general, netdev, linux-kernel
In-Reply-To: <1738246.bUPoQjSxLC@daeseok-laptop.cloud.net>

From: Daeseok Youn <daeseok.youn@gmail.com>
Date: Wed, 19 Feb 2014 14:12:46 +0900

> From c320d2ea1ed51c88255c33a50c74fa3598ab7be6 Mon Sep 17 00:00:00 2001
> From: Daeseok Youn <daeseok.youn@gmail.com>
> Date: Wed, 19 Feb 2014 10:10:11 +0900
> Subject: [PATCH] atm: nicstar: use NULL instead of 0 for pointer
> 
> sparse says:
> 
> drivers/atm/nicstar.c:642:27: warning:
>  Using plain integer as NULL pointer
> drivers/atm/nicstar.c:644:27:
>  warning: Using plain integer as NULL pointer
> drivers/atm/nicstar.c:982:51:
>  warning: Using plain integer as NULL pointer
> drivers/atm/nicstar.c:996:51:
>  warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH] atm: solos-pci: make solos_bh() as static
From: David Miller @ 2014-02-19 21:39 UTC (permalink / raw)
  To: daeseok.youn; +Cc: chas, linux-atm-general, netdev, linux-kernel
In-Reply-To: <1547067.MtNWZjBp8J@daeseok-laptop.cloud.net>

From: Daeseok Youn <daeseok.youn@gmail.com>
Date: Wed, 19 Feb 2014 14:13:54 +0900

> From 6297aabeff748777b520cc0ee835af0a3ddc79e2 Mon Sep 17 00:00:00 2001
> From: Daeseok Youn <daeseok.youn@gmail.com>
> Date: Wed, 19 Feb 2014 10:49:12 +0900
> Subject: [PATCH] atm: solos-pci: make solos_bh() as static
> 
> sparse says:
> 
> drivers/atm/solos-pci.c:763:6: warning:
>  symbol 'solos_bh' was not declared. Should it be static?
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v2] tipc: failed transmissions should return error
From: David Miller @ 2014-02-19 21:41 UTC (permalink / raw)
  To: erik.hugne
  Cc: netdev, tipc-discussion, ying.xue, paul.gortmaker, jon.maloy,
	maloy
In-Reply-To: <1392795478-13434-1-git-send-email-erik.hugne@ericsson.com>

From: <erik.hugne@ericsson.com>
Date: Wed, 19 Feb 2014 08:37:58 +0100

> From: Erik Hugne <erik.hugne@ericsson.com>
> 
> When a message could not be sent out because the destination node
> or link could not be found, the full message size is returned from
> sendmsg() as if it had been sent successfully. An application will
> then get a false indication that it's making forward progress. This
> problem has existed since the initial commit in 2.6.16.
> 
> We change this to return -ENETUNREACH if the message cannot be
> delivered due to the destination node/link being unavailable. We
> also get rid of the redundant tipc_reject_msg call since freeing
> the buffer and doing a tipc_port_iovec_reject accomplishes exactly
> the same thing.
> 
> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>

Applied, thank you.

^ permalink raw reply

* Re: [PATCH v2 net-next] ethtool: Remove inactive code snippet in ethtool_set_rxfh_indir
From: David Miller @ 2014-02-19 21:42 UTC (permalink / raw)
  To: VenkatKumar.Duvvuru; +Cc: netdev
In-Reply-To: <d966666f-7494-449a-a48f-728f77614738@CMEXHTCAS2.ad.emulex.com>

From: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
Date: Wed, 19 Feb 2014 13:20:25 +0530

> ethtool_rxfh_indir_default is invoked inside ethtool_set_rxfh_indir when
> user_size is zero. However user_size can only be zero when dev_size is
> zero in which case ethtool_get_rxfh_indir itself would return
> EOPNOTSUPP error. "user_size = 0" can never happen unless userspace
> ethtool sends user_size as zero beforing invoking the ioctl for
> ETHTOOL_SRSSH, in which case we should return -EINVAL.
> 
> v2: Modified commit message.
> 
> Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>

It looks like the author of this code intended user_size == 0 as a way
to reset the indirection table to the default, did this ever work?

^ permalink raw reply

* Re: [PATCH] be2net: Bugfix for packet drop with kernel param swiotlb=force
From: David Miller @ 2014-02-19 21:44 UTC (permalink / raw)
  To: jiang.biao2
  Cc: netdev, sathya.perla, subbu.seetharaman, ajit.khaparde,
	wang.liang82, cai.qu, li.fengmao, long.chun
In-Reply-To: <OF433C3BAF.359D84C5-ON48257C84.002D80B1-48257C84.002E4C8C@zte.com.cn>

From: jiang.biao2@zte.com.cn
Date: Wed, 19 Feb 2014 16:25:40 +0800

> +        dma_unmap_page(&adapter->pdev->dev,
> +               dma_unmap_addr(rx_page_info, bus),
> +               rx_frag_size, DMA_FROM_DEVICE);

This is not indented properly.

Arguments on the second and subsequent lines of a function call must
start exactly at the first column after the openning parenthesis of the
function call on the first line.

You must use the appropriate number of TAB and SPACE characters
necessary to do so.

If you are indenting only using TAB characters, you are doing it wrong.

^ permalink raw reply

* Re: [PATCH net] qeth: postpone freeing of qdio memory
From: David Miller @ 2014-02-19 21:47 UTC (permalink / raw)
  To: blaschka; +Cc: netdev, linux-s390
In-Reply-To: <20140219091451.GA17591@tuxmaker.boeblingen.de.ibm.com>

From: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Date: Wed, 19 Feb 2014 10:14:51 +0100

> @@ -4919,6 +4919,7 @@ retry:
>  	if (rc)
>  		goto retriable;
>  	rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
> +	qdio_free(CARD_DDEV(card));
>  retriable:
>  	if (rc == -ERESTARTSYS) {
>  		QETH_DBF_TEXT(SETUP, 2, "break1");

You do not want to do the qdio_free() if the qeth_qdio_clear_card() returns
an error value that causes a retry, and yes that can indeed happen.  The halt
paths return things like -ETIME etc.

^ permalink raw reply

* Re: [PATCH next v3] tcp: use zero-window when free_space is low
From: David Miller @ 2014-02-19 21:48 UTC (permalink / raw)
  To: fw; +Cc: netdev, ncardwell, ycheng
In-Reply-To: <1392810670-3543-1-git-send-email-fw@strlen.de>

From: Florian Westphal <fw@strlen.de>
Date: Wed, 19 Feb 2014 12:51:10 +0100

> Currently the kernel tries to announce a zero window when free_space
> is below the current receiver mss estimate.
> 
> When a sender is transmitting small packets and reader consumes data
> slowly (or not at all), receiver might be unable to shrink the receive
> win because
> 
> a) we cannot withdraw already-commited receive window, and,
> b) we have to round the current rwin up to a multiple of the wscale
>    factor, else we would shrink the current window.
> 
> This causes the receive buffer to fill up until the rmem limit is hit.
> When this happens, we start dropping packets.
> 
> Moreover, tcp_clamp_window may continue to grow sk_rcvbuf towards rmem[2]
> even if socket is not being read from.
> 
> As we cannot avoid the "current_win is rounded up to multiple of mss"
> issue [we would violate a) above] at least try to prevent the receive buf
> growth towards tcp_rmem[2] limit by attempting to move to zero-window
> announcement when free_space becomes less than 1/16 of the current
> allowed receive buffer maximum.  If tcp_rmem[2] is large, this will
> increase our chances to get a zero-window announcement out in time.
> 
> Reproducer:
> On server:
> $ nc -l -p 12345
> <suspend it: CTRL-Z>
> 
> Client:
> #!/usr/bin/env python
> import socket
> import time
> 
> sock = socket.socket()
> sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
> sock.connect(("192.168.4.1", 12345));
> while True:
>    sock.send('A' * 23)
>    time.sleep(0.005)
> 
> 
> socket buffer on server-side will grow until tcp_rmem[2] is hit,
> at which point the client rexmits data until -EDTIMEOUT:
> 
> tcp_data_queue invokes tcp_try_rmem_schedule which will call
> tcp_prune_queue which calls tcp_clamp_window().  And that function will
> grow sk->sk_rcvbuf up until it eventually hits tcp_rmem[2].
> 
> Thanks to Eric Dumazet for running regression tests.
> 
> Cc: Neal Cardwell <ncardwell@google.com>
> Cc: Yuchung Cheng <ycheng@google.com>
> Acked-by: Eric Dumazet <edumazet@google.com>
> Tested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  no changes since v2; resend with Erics Ack/Tested-by tags
>  V1 of this patch was deferred, resending to get discussion going again.
>  Changes since v1:
>   - add reproducer to commit message

Applied, thanks!

^ permalink raw reply

* Re: [PATCH net-next V1 0/3] net/mlx4: Mellanox driver update 01-01-2014
From: David Miller @ 2014-02-19 21:50 UTC (permalink / raw)
  To: amirv; +Cc: netdev, yevgenyp, ogerlitz
In-Reply-To: <1392814684-2129-1-git-send-email-amirv@mellanox.com>

From: Amir Vadai <amirv@mellanox.com>
Date: Wed, 19 Feb 2014 14:58:01 +0200

> V0 of this patch was sent before previous net-next got closed, and
> now we would like to resume it.
> 
> Yuval has reworked the affinity hint patch, according to Ben's comments. The
> patch was actually rewritten.
> After a discussion with Yuval Mintz, use of netif_get_num_default_rss_queues()
> is not reverted, but done in the right place. Instead of limiting the number of
> IRQ's for the driver it will limit the number of queues in RSS.
> 
> Patchset was applied and tested against commit: cb6e926 "ipv6:fix checkpatch
> errors with assignment in if condition"

Influencing IRQs to be allocated on the same NUMA code as the one where
the card resides doesn't sound like an mlx4 specific desire to me.

Other devices, both networking and non-networking, probably might like
that as well.

Therefore doing this by hand in a specific driver doesn't seem
appropriate at all.

^ permalink raw reply

* Re: [PATCH net] xen-netfront: reset skb network header before checksum
From: David Miller @ 2014-02-19 21:53 UTC (permalink / raw)
  To: wei.liu2; +Cc: xen-devel, netdev, linux, konrad.wilk, paul.durrant
In-Reply-To: <1392835714-26480-1-git-send-email-wei.liu2@citrix.com>

From: Wei Liu <wei.liu2@citrix.com>
Date: Wed, 19 Feb 2014 18:48:34 +0000

> In ed1f50c3a ("net: add skb_checksum_setup") we introduced some checksum
> functions in core driver. Subsequent change b5cf66cd1 ("xen-netfront:
> use new skb_checksum_setup function") made use of those functions to
> replace its own implementation.
> 
> However with that change netfront is broken. It sees a lot of checksum
> error. That's because its own implementation of checksum function was a
> bit hacky (dereferencing skb->data directly) while the new function was
> implemented using ip_hdr(). The network header is not reset before skb
> is passed to the new function. When the new function tries to do its
> job, it's confused and reports error.
> 
> The fix is simple, we need to reset network header before passing skb to
> checksum function. Netback is not affected as it already does the right
> thing.
> 
> Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Applied, thanks.

^ permalink raw reply

* RE: [PATCH net-next] hyperv: Add latest NetVSP versions to auto negotiation
From: Haiyang Zhang @ 2014-02-19 23:00 UTC (permalink / raw)
  To: David Miller
  Cc: netdev@vger.kernel.org, KY Srinivasan, olaf@aepfle.de,
	jasowang@redhat.com, linux-kernel@vger.kernel.org,
	driverdev-devel@linuxdriverproject.org
In-Reply-To: <20140219.162312.1711517042878098859.davem@davemloft.net>



> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, February 19, 2014 4:23 PM
> To: Haiyang Zhang
> Cc: netdev@vger.kernel.org; KY Srinivasan; olaf@aepfle.de;
> jasowang@redhat.com; linux-kernel@vger.kernel.org; driverdev-
> devel@linuxdriverproject.org
> Subject: Re: [PATCH net-next] hyperv: Add latest NetVSP versions to auto
> negotiation
> 
> From: Haiyang Zhang <haiyangz@microsoft.com>
> Date: Tue, 18 Feb 2014 12:28:54 -0800
> 
> > +	u32 ver_list[] = {NVSP_PROTOCOL_VERSION_1,
> NVSP_PROTOCOL_VERSION_2,
> > +		NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5};
> 
> Please put a space after "{" and before "}".
> 
> > +	int i, num_ver = 4; /* number of different NVSP versions */
> > +
> >
> >  	net_device = get_outbound_net_device(device);
> 
> Please delete the extraneous empty line.
> 
> > +	for (i = num_ver - 1; i >= 0; i--)
> > +		if (negotiate_nvsp_ver(device, net_device, init_packet,
> > +			ver_list[i])  == 0) {
> 
> This is not indented properly, "ver_list[i])" should begin precisely after the
> openning parenthesis of the negotiate_nvsp_ver() function call.

I have sent out a new patch with the suggested updates.

Thanks,
- Haiyang

^ permalink raw reply

* [PATCH net-next, v2] hyperv: Add latest NetVSP versions to auto negotiation
From: Haiyang Zhang @ 2014-02-19 23:49 UTC (permalink / raw)
  To: davem, netdev; +Cc: olaf, jasowang, driverdev-devel, linux-kernel, haiyangz

It auto negotiates the highest NetVSP version supported by both guest and host.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/net/hyperv/hyperv_net.h |   53 +++++++++++++++++++++++++++++++++++++++
 drivers/net/hyperv/netvsc.c     |   25 +++++++++++------
 drivers/net/hyperv/netvsc_drv.c |    2 +-
 3 files changed, 70 insertions(+), 10 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 01a16ea..39fc230 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -139,6 +139,8 @@ int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac);
 
 #define NVSP_PROTOCOL_VERSION_1		2
 #define NVSP_PROTOCOL_VERSION_2		0x30002
+#define NVSP_PROTOCOL_VERSION_4		0x40000
+#define NVSP_PROTOCOL_VERSION_5		0x50000
 
 enum {
 	NVSP_MSG_TYPE_NONE = 0,
@@ -193,6 +195,23 @@ enum {
 
 	NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE,
 	NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
+
+	NVSP_MSG2_MAX = NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
+
+	/* Version 4 messages */
+	NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION,
+	NVSP_MSG4_TYPE_SWITCH_DATA_PATH,
+	NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED,
+
+	NVSP_MSG4_MAX = NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED,
+
+	/* Version 5 messages */
+	NVSP_MSG5_TYPE_OID_QUERY_EX,
+	NVSP_MSG5_TYPE_OID_QUERY_EX_COMP,
+	NVSP_MSG5_TYPE_SUBCHANNEL,
+	NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE,
+
+	NVSP_MSG5_MAX = NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE,
 };
 
 enum {
@@ -447,10 +466,44 @@ union nvsp_2_message_uber {
 	struct nvsp_2_free_rxbuf free_rxbuf;
 } __packed;
 
+enum nvsp_subchannel_operation {
+	NVSP_SUBCHANNEL_NONE = 0,
+	NVSP_SUBCHANNEL_ALLOCATE,
+	NVSP_SUBCHANNEL_MAX
+};
+
+struct nvsp_5_subchannel_request {
+	u32 op;
+	u32 num_subchannels;
+} __packed;
+
+struct nvsp_5_subchannel_complete {
+	u32 status;
+	u32 num_subchannels; /* Actual number of subchannels allocated */
+} __packed;
+
+struct nvsp_5_send_indirect_table {
+	/* The number of entries in the send indirection table */
+	u32 count;
+
+	/* The offset of the send indireciton table from top of this struct.
+	 * The send indirection table tells which channel to put the send
+	 * traffic on. Each entry is a channel number.
+	 */
+	u32 offset;
+} __packed;
+
+union nvsp_5_message_uber {
+	struct nvsp_5_subchannel_request subchn_req;
+	struct nvsp_5_subchannel_complete subchn_comp;
+	struct nvsp_5_send_indirect_table send_table;
+} __packed;
+
 union nvsp_all_messages {
 	union nvsp_message_init_uber init_msg;
 	union nvsp_1_message_uber v1_msg;
 	union nvsp_2_message_uber v2_msg;
+	union nvsp_5_message_uber v5_msg;
 } __packed;
 
 /* ALL Messages */
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 9a0e9c6..1a0280d 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -290,7 +290,7 @@ static int negotiate_nvsp_ver(struct hv_device *device,
 	    NVSP_STAT_SUCCESS)
 		return -EINVAL;
 
-	if (nvsp_ver != NVSP_PROTOCOL_VERSION_2)
+	if (nvsp_ver == NVSP_PROTOCOL_VERSION_1)
 		return 0;
 
 	/* NVSPv2 only: Send NDIS config */
@@ -314,6 +314,9 @@ static int netvsc_connect_vsp(struct hv_device *device)
 	struct nvsp_message *init_packet;
 	int ndis_version;
 	struct net_device *ndev;
+	u32 ver_list[] = { NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2,
+		NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5 };
+	int i, num_ver = 4; /* number of different NVSP versions */
 
 	net_device = get_outbound_net_device(device);
 	if (!net_device)
@@ -323,13 +326,14 @@ static int netvsc_connect_vsp(struct hv_device *device)
 	init_packet = &net_device->channel_init_pkt;
 
 	/* Negotiate the latest NVSP protocol supported */
-	if (negotiate_nvsp_ver(device, net_device, init_packet,
-			       NVSP_PROTOCOL_VERSION_2) == 0) {
-		net_device->nvsp_version = NVSP_PROTOCOL_VERSION_2;
-	} else if (negotiate_nvsp_ver(device, net_device, init_packet,
-				    NVSP_PROTOCOL_VERSION_1) == 0) {
-		net_device->nvsp_version = NVSP_PROTOCOL_VERSION_1;
-	} else {
+	for (i = num_ver - 1; i >= 0; i--)
+		if (negotiate_nvsp_ver(device, net_device, init_packet,
+				       ver_list[i])  == 0) {
+			net_device->nvsp_version = ver_list[i];
+			break;
+		}
+
+	if (i < 0) {
 		ret = -EPROTO;
 		goto cleanup;
 	}
@@ -339,7 +343,10 @@ static int netvsc_connect_vsp(struct hv_device *device)
 	/* Send the ndis version */
 	memset(init_packet, 0, sizeof(struct nvsp_message));
 
-	ndis_version = 0x00050001;
+	if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_4)
+		ndis_version = 0x00050001;
+	else
+		ndis_version = 0x0006001e;
 
 	init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_NDIS_VER;
 	init_packet->msg.v1_msg.
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 1eadc13..3cc9eb3 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -317,7 +317,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
 	if (nvdev == NULL || nvdev->destroy)
 		return -ENODEV;
 
-	if (nvdev->nvsp_version == NVSP_PROTOCOL_VERSION_2)
+	if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
 		limit = NETVSC_MTU;
 
 	if (mtu < 68 || mtu > limit)
-- 
1.7.4.1

^ permalink raw reply related

* Re: RTL8153 fails to get link after applying c7de7dec2 to 3.8 kernel
From: Grant Grundler @ 2014-02-20  0:08 UTC (permalink / raw)
  To: hayeswang; +Cc: Inki Yoo, netdev
In-Reply-To: <CANEJEGtGbVajk+GOSkRk1QXDkOOPCM8vO8VA8Zc=TEOfZDjwNQ@mail.gmail.com>

On Fri, Feb 14, 2014 at 1:53 PM, Grant Grundler <grundler@google.com> wrote:
...
>>> /sys/devices/12110000.usb/usb3/3-2/bConfigurationValue
>>
>> Yes. Modify the value from 2 to 1.

Hayes,
Good News! :)

Setting bConfigurationValue to 1 automatically resulted in the r8152 device
driver getting loaded, claiming the device, and establishing a link when the
 last patch is included.

The first time I tried, I might have mucked something up and was
getting something about "interrupt status -71". I disconnected the
device, rebooted, and started with a clean slate. It worked fine the
second time.  I will temporarily add the udev rule you previously
posted in order to automate testing this until I can get HW that comes
up in "vendor mode".

> This value was 1 by default on the ARM systems

I think I was confused by previous attempts to set the value,
rebooting and still
seeing it set to 1. The ARM system now came up with value 2 after
removing/inserting the Realtek 8153 USB dongle.

> where I don't have
> r815x driver and r8152 is claiming the device. I previously tried to
> set this value to 1 and I'm wondering if that value will now "stick"
> until I reboot. I will add c7de7dec patch again and see what it says.

After "echo 1 > ..../bConfigurationValue" dmesg now says:
[  107.676386] r8152 2-1:1.0 eth0: v1.04.0 (2014/01/15)
[  107.676508] usbcore: registered new interface driver r8152
[  107.695634] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  110.765036] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Thanks for the help Hayes!


cheers,
grant

^ permalink raw reply

* Re: [PATCH net-next,v2] hyperv: Add latest NetVSP versions to auto negotiation
From: David Miller @ 2014-02-20  0:53 UTC (permalink / raw)
  To: haiyangz; +Cc: olaf, netdev, jasowang, driverdev-devel, linux-kernel
In-Reply-To: <1392853785-2492-1-git-send-email-haiyangz@microsoft.com>

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Wed, 19 Feb 2014 15:49:45 -0800

> It auto negotiates the highest NetVSP version supported by both guest and host.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>

Applied, thanks.

^ permalink raw reply

* Re: [RFC v2 2/4] net: enables interface option to skip IP
From: Dan Williams @ 2014-02-20  0:56 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Zoltan Kiss, netdev@vger.kernel.org, xen-devel, kvm,
	linux-kernel@vger.kernel.org, David S. Miller, Alexey Kuznetsov,
	James Morris, Hideaki YOSHIFUJI, Patrick McHardy
In-Reply-To: <CAB=NE6VpUqwNNY4pgbS6du2VsZ6dH0TzQYXmiw6GGN-EiOsV6g@mail.gmail.com>

On Wed, 2014-02-19 at 09:20 -0800, Luis R. Rodriguez wrote:
> On Wed, Feb 19, 2014 at 8:45 AM, Dan Williams <dcbw@redhat.com> wrote:
> > On Tue, 2014-02-18 at 13:19 -0800, Luis R. Rodriguez wrote:
> >> On Mon, Feb 17, 2014 at 12:23 PM, Dan Williams <dcbw@redhat.com> wrote:
> >> > On Fri, 2014-02-14 at 18:59 -0800, Luis R. Rodriguez wrote:
> >> >> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> >> >>
> >> >> Some interfaces do not need to have any IPv4 or IPv6
> >> >> addresses, so enable an option to specify this. One
> >> >> example where this is observed are virtualization
> >> >> backend interfaces which just use the net_device
> >> >> constructs to help with their respective frontends.
> >> >>
> >> >> This should optimize boot time and complexity on
> >> >> virtualization environments for each backend interface
> >> >> while also avoiding triggering SLAAC and DAD, which is
> >> >> simply pointless for these type of interfaces.
> >> >
> >> > Would it not be better/cleaner to use disable_ipv6 and then add a
> >> > disable_ipv4 sysctl, then use those with that interface?
> >>
> >> Sure, but note that the both disable_ipv6 and accept_dada sysctl
> >> parameters are global. ipv4 and ipv6 interfaces are created upon
> >> NETDEVICE_REGISTER, which will get triggered when a driver calls
> >> register_netdev(). The goal of this patch was to enable an early
> >> optimization for drivers that have no need ever for ipv4 or ipv6
> >> interfaces.
> >
> > Each interface gets override sysctls too though, eg:
> >
> > /proc/sys/net/ipv6/conf/enp0s25/disable_ipv6
> 
> I hadn't seen those, thanks!

Note that there isn't yet a disable_ipv4 knob though, I was
perhaps-too-subtly trying to get you to send a patch for it, since I can
use it too :)

Dan

> > which is the one I meant; you're obviously right that the global ones
> > aren't what you want here.  But the specific ones should be suitable?
> 
> Under the approach Stephen mentioned by first ensuring the interface
> is down yes. There's one use case I can consider to still want the
> patch though, more on that below.
> 
> > If you set that on a per-interface basis, then you'll get EPERM or
> > something whenever you try to add IPv6 addresses or do IPv6 routing.
> 
> Neat, thanks.
> 
> >> Zoltan has noted though some use cases of IPv4 or IPv6 addresses on
> >> backends though, as such this is no longer applicable as a
> >> requirement. The ipv4 sysctl however still seems like a reasonable
> >> approach to enable optimizations of the network in topologies where
> >> its known we won't need them but -- we'd need to consider a much more
> >> granular solution, not just global as it is now for disable_ipv6, and
> >> we'd also have to figure out a clean way to do this to not incur the
> >> cost of early address interface addition upon register_netdev().
> >>
> >> Given that we have a use case for ipv4 and ipv6 addresses on
> >> xen-netback we no longer have an immediate use case for such early
> >> optimization primitives though, so I'll drop this.
> >>
> >> > The IFF_SKIP_IP seems to duplicate at least part of what disable_ipv6 is
> >> > already doing.
> >>
> >> disable_ipv6 is global, the goal was to make this granular and skip
> >> the cost upon early boot, but its been clarified we don't need this.
> >
> > Like Stephen says, you need to make sure you set them before IFF_UP, but
> > beyond that, wouldn't the interface-specific sysctls work?
> 
> Yeah that'll do it, unless there is a measurable run time benefit cost
> to never even add these in the first place. Consider a host with tons
> of guests, not sure how many is 'a lot' these days. One would have to
> measure the cost of reducing the amount of time it takes to boot these
> up. As discussed in the other threads though there *is* some use cases
> of assigning IPv4 or IPv6 addresses to the backend interfaces though:
> routing them (although its unclear to me if iptables can be used
> instead, Zoltan?). So at least now there no clear requirement to
> remove these interfaces or not have them at all. The boot time cost
> savings should be considered though if this is ultimately desirable. I
> saw tons of timers and events that'd get triggered with any IPv4 or
> IPv6 interface laying around.
> 
>   Luis
> --
> 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: [RFC v2 2/4] net: enables interface option to skip IP
From: Hannes Frederic Sowa @ 2014-02-20  0:58 UTC (permalink / raw)
  To: Dan Williams
  Cc: Luis R. Rodriguez, Zoltan Kiss, netdev@vger.kernel.org, xen-devel,
	kvm, linux-kernel@vger.kernel.org, David S. Miller,
	Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy
In-Reply-To: <1392857777.22693.14.camel@dcbw.local>

On Wed, Feb 19, 2014 at 06:56:17PM -0600, Dan Williams wrote:
> Note that there isn't yet a disable_ipv4 knob though, I was
> perhaps-too-subtly trying to get you to send a patch for it, since I can
> use it too :)

Do you plan to implement
<http://datatracker.ietf.org/doc/draft-ietf-sunset4-noipv4/>?

;)

^ permalink raw reply

* Re: [PATCH net] veth: Fix vlan_features so as to be able to use stacked vlan interfaces
From: Flavio Leitner @ 2014-02-20  1:02 UTC (permalink / raw)
  To: Toshiaki Makita; +Cc: David S . Miller, netdev
In-Reply-To: <53043F7E.804@lab.ntt.co.jp>

On Wed, Feb 19, 2014 at 02:22:06PM +0900, Toshiaki Makita wrote:
> (2014/02/19 13:13), Flavio Leitner wrote:
> > On Tue, Feb 18, 2014 at 09:20:08PM +0900, Toshiaki Makita wrote:
> >> Even if we create a stacked vlan interface such as veth0.10.20, it sends
> >> single tagged frames (tagged with only vid 10).
> >> Because vlan_features of a veth interface has the
> >> NETIF_F_HW_VLAN_[CTAG/STAG]_TX bits, veth0.10 also has that feature, so
> >> dev_hard_start_xmit(veth0.10) doesn't call __vlan_put_tag() and
> >> vlan_dev_hard_start_xmit(veth0.10) overwrites vlan_tci.
> >> This prevents us from using a combination of 802.1ad and 802.1Q
> >> in containers, etc.
> >>
> >> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> >> ---
> >>  drivers/net/veth.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> >> index 2ec2041..5b37437 100644
> >> --- a/drivers/net/veth.c
> >> +++ b/drivers/net/veth.c
> >> @@ -285,7 +285,8 @@ static void veth_setup(struct net_device *dev)
> >>  	dev->ethtool_ops = &veth_ethtool_ops;
> >>  	dev->features |= NETIF_F_LLTX;
> >>  	dev->features |= VETH_FEATURES;
> >> -	dev->vlan_features = dev->features;
> >> +	dev->vlan_features = dev->features &
> >> +			     ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX);
> >>  	dev->destructor = veth_dev_free;
> >>  
> >>  	dev->hw_features = VETH_FEATURES;
> >> -- 
> >> 1.8.1.2
> >>
> > 
> > Why that isn't a problem with another software device?
> > Although this patch might fix the issue, it seems to me that
> > the middle devices shouldn't use the same feature flags.
> > I mean, vlan.20 should add the header, then vlan.10 should
> > offload the tag to veth.  Otherwise, for any vlan on top of
> > veth there will be an unneeded memmove().
> 
> In this case with this patch, vlan_dev_hard_start_xmit(veth0.10.20) set
> vlan_tci, dev_hard_start_xmit(veth0.10) put it into skb->data, and
> vlan_dev_hard_start_xmit(veth0.10) set vlan_tci again.
> dev_hard_start_xmit(veth0) doesn't put it into skb->data because veth0
> has NETIF_F_HW_VLAN_*TAG_TX feature.
> 
> Similarly, in not stacked vlan case, for example if veth0.10 has no vlan
> intarface on it, vlan_dev_hard_start_xmit(veth0.10) set vlan_tci and
> dev_hard_start_xmit(veth0) doesn't put it into skb->data.
> There will be no unnecessary memmove().
> 
> Although I haven't looked over all, other drivers don't seem to have
> NETIF_F_HW_VLAN_*TAG_TX in vlan_features (at least, bridge, vxlan,
> e1000e, and bnx2x don't).
> 
> Thanks,
> Toshiaki Makita
> 

Alright, the code looks good and I didn't notice anything
different on my testing env.

Acked-by: Flavio Leitner <fbl@redhat.com>

Thanks!
fbl

^ 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