net driver fixes
Subsystems (3)
PATCH 1/1 net driver fixes
Please pull from 'upstream-fixes' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
to receive the following updates:
drivers/net/8139too.c | 38 +++++-- drivers/net/Kconfig | 7 - drivers/net/bonding/bond_main.c | 15 ++- drivers/net/bonding/bond_sysfs.c | 6 - drivers/net/e100.c | 2 drivers/net/gianfar.c | 24 ++--- drivers/net/gianfar.h | 8 - drivers/net/gianfar_ethtool.c | 8 - drivers/net/gianfar_mii.c | 17 +-- drivers/net/r8169.c | 13 +- drivers/net/sis900.h | 1 drivers/net/sky2.c | 186 +++++++++++++++++++++++++++++---------- drivers/net/sky2.h | 9 - drivers/net/tulip/uli526x.c | 2 drivers/net/wan/dscc4.c | 2 15 files changed, 222 insertions(+), 116 deletions(-)
Alexey Dobriyan:
dscc4: fix dscc4_init_dummy_skb check
dscc4: fix dscc4_init_dummy_skb check
[same change, two different paths. -ed]
Andrew Morton:
uli526x warning fix
Andy Gospodarek:
r8169: fix forced-mode link settings
Francois Romieu:
r8169: prevent excessive busy-waiting
8139too: fix a TX timeout watchdog thread against NAPI softirq race
Jay Vosburgh:
bonding: allow bond to use TSO if slaves support it
Jesse Brandeburg:
e100: remove init_hw call to fix panic
Kumar Gala:
gianfar: Fix sparse warnings
Lennert Buytenhek:
sis900: remove cfgpmcsr I/O space register define
Luiz Fernando Capitulino:
bonding: Sparse warnings fix
Paolo 'Blaisorblade' Giarrusso:
Kbuild menu - hide empty NETDEVICES menu when NET is disabled
Stephen Hemminger:
sky2: power management fix
sky2: pci config space checking
sky2: ethtool rx_coalesce settings fix
sky2: set mac address fix
sky2: clear irq race
sky2: add irq to entropy pool
sky2: support msi interrupt (revised)
sky2: version 0.15 update
drivers/net/8139too.c +26 -12
@@ -586,6 +586,7 @@ struct rtl8139_private {dma_addr_t tx_bufs_dma;signed char phys[4 ];/* MII device addresses. */ char twistie, twist_row, twist_col;/* Twister tune state. */ + unsigned int watchdog_fired : 1; unsigned int default_port : 4; /* Last dev->if_port value. */ unsigned int have_thread : 1;spinlock_t lock;
@@ -638,6 +639,7 @@ static void rtl8139_set_rx_mode (structstatic void __set_rx_mode (struct net_device *dev);static void rtl8139_hw_start (struct net_device *dev);static void rtl8139_thread (void *_data); +static void rtl8139_tx_timeout_task (void *_data);static struct ethtool_ops rtl8139_ethtool_ops;/* write MMIO register, with flush */
@@ -1598,13 +1600,14 @@ static void rtl8139_thread (void *_data) {struct net_device *dev = _data;struct rtl8139_private *tp =netdev_priv (dev); -unsigned long thr_delay; +unsigned long thr_delay = next_tick; -if (rtnl_shlock_nowait () ==0 ) { +if (tp->watchdog_fired) { + tp->watchdog_fired =0 ; +rtl8139_tx_timeout_task (_data); + }else if (rtnl_shlock_nowait () ==0 ) {rtl8139_thread_iter (dev, tp, tp->mmio_addr);rtnl_unlock (); - - thr_delay = next_tick; }else {/* unlikely race. mitigate with fast poll. */ thr_delay =HZ /2 ;
@@ -1631,7 +1634,8 @@ static void rtl8139_stop_thread(struct rif (tp->have_thread) {cancel_rearming_delayed_work (&tp->thread); tp->have_thread =0 ; - } + }else +flush_scheduled_work (); }static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
@@ -1642,14 +1646,13 @@ static inline void rtl8139_tx_clear (str/* XXX account for unsent Tx packets in tp->stats.tx_dropped */ } - -static void rtl8139_tx_timeout (struct net_device *dev) +static void rtl8139_tx_timeout_task (void *_data) { +struct net_device *dev = _data;struct rtl8139_private *tp =netdev_priv (dev);void __iomem *ioaddr = tp->mmio_addr;int i;u8 tmp8; -unsigned long flags; printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x " "media %2.2x.\n", dev->name, RTL_R8 (ChipCmd),
@@ -1670,23 +1673,34 @@ static void rtl8139_tx_timeout (struct nif (tmp8 & CmdTxEnb)RTL_W8 (ChipCmd, CmdRxEnb); -spin_lock (&tp->rx_lock); +spin_lock_bh (&tp->rx_lock);/* Disable interrupts by clearing the interrupt mask. */ RTL_W16 (IntrMask,0x0000 );/* Stop a shared interrupt from scavenging while we are. */ -spin_lock_irqsave (&tp->lock, flags); +spin_lock_irq (&tp->lock);rtl8139_tx_clear (tp); -spin_unlock_irqrestore (&tp->lock, flags); +spin_unlock_irq (&tp->lock);/* ...and finally, reset everything */ if (netif_running (dev)) {rtl8139_hw_start (dev);netif_wake_queue (dev); } -spin_unlock (&tp->rx_lock); +spin_unlock_bh (&tp->rx_lock); } +static void rtl8139_tx_timeout (struct net_device *dev) +{ +struct rtl8139_private *tp =netdev_priv (dev); + +if (!tp->have_thread) { +INIT_WORK (&tp->thread, rtl8139_tx_timeout_task, dev); +schedule_delayed_work (&tp->thread, next_tick); + }else + tp->watchdog_fired =1 ; + +}static int rtl8139_start_xmit (struct sk_buff *skb,struct net_device *dev) {
drivers/net/Kconfig +1 -6
@@ -4,9 +4,9 @@ # menu "Network device support" + depends on NET config NETDEVICES - depends on NET default y if UML bool "Network device support" ---help---
@@ -24,9 +24,6 @@ config NETDEVICES If unsure, say Y. -# All the following symbols are dependent on NETDEVICES - do not repeat -# that for each of the symbols. -if NETDEVICES config IFB tristate "Intermediate Functional Block support"
@@ -2718,8 +2715,6 @@ config NETCONSOLE If you want to log kernel messages over the network, enable this. See <file:Documentation/networking/netconsole.txt> for details. -endif #NETDEVICES - config NETPOLL def_bool NETCONSOLE
drivers/net/bonding/bond_main.c +14 -1
@@ -1145,7 +1145,8 @@ int bond_sethwaddr(struct net_device *bo }#define BOND_INTERSECT_FEATURES \ - (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) + (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\ + NETIF_F_TSO|NETIF_F_UFO)/* * Compute the common dev->feature set available to all slaves. Some
@@ -1168,6 +1169,16 @@ static int bond_compute_features(struct NETIF_F_HW_CSUM))) features &= ~NETIF_F_SG; +/* +* features will include NETIF_F_TSO (NETIF_F_UFO) iff all +* slave devices support NETIF_F_TSO (NETIF_F_UFO), which +* implies that all slaves also support scatter-gather +* (NETIF_F_SG), which implies that features also includes +* NETIF_F_SG. So no need to check whether we have an +* illegal combination of NETIF_F_{TSO,UFO} and +* !NETIF_F_SG +*/ + features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES ); bond_dev->features = features;
@@ -4080,6 +4091,8 @@ static void bond_ethtool_get_drvinfo(strstatic struct ethtool_ops bond_ethtool_ops = { .get_tx_csum = ethtool_op_get_tx_csum, + .get_tso = ethtool_op_get_tso, + .get_ufo = ethtool_op_get_ufo, .get_sg = ethtool_op_get_sg, .get_drvinfo = bond_ethtool_get_drvinfo, };
drivers/net/bonding/bond_sysfs.c +3 -3
@@ -260,7 +260,7 @@ static ssize_t bonding_store_slaves(struchar *ifname;int i, res, found, ret = count;struct slave *slave; -struct net_device *dev =0 ; +struct net_device *dev =NULL ;struct bonding *bond =to_bond (cd);/* Quick sanity check -- is the bond interface up? */
@@ -995,7 +995,7 @@ static ssize_t bonding_store_primary(str printk(KERN_INFO DRV_NAME": %s: Setting primary slave to None.\n" , bond->dev->name); - bond->primary_slave =0 ; + bond->primary_slave =NULL ;bond_select_active_slave (bond); }else { printk(KERN_INFO DRV_NAME
@@ -1123,7 +1123,7 @@ static ssize_t bonding_store_active_slav printk(KERN_INFO DRV_NAME": %s: Setting active slave to None.\n" , bond->dev->name); - bond->primary_slave =0 ; + bond->primary_slave =NULL ;bond_select_active_slave (bond); }else { printk(KERN_INFO DRV_NAME
drivers/net/e100.c +0 -2
@@ -2752,8 +2752,6 @@ static int e100_resume(struct pci_dev *p retval =pci_enable_wake (pdev,0 ,0 );if (retval)DPRINTK (PROBE ,ERR ,"Error clearing wake events\n" ); -if (e100_hw_init (nic)) -DPRINTK (HW ,ERR ,"e100_hw_init failed\n" );netif_device_attach (netdev);if (netif_running (netdev))
drivers/net/gianfar.c +11 -13
@@ -199,8 +199,7 @@ static int gfar_probe(struct platform_de/* get a pointer to the register memory */ r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - priv->regs = (struct gfar *) -ioremap (r->start,sizeof (struct gfar )); + priv->regs =ioremap (r->start,sizeof (struct gfar ));if (NULL == priv->regs) { err = -ENOMEM ;
@@ -369,7 +368,7 @@ static int gfar_probe(struct platform_dereturn 0 ; register_fail: -iounmap ((void *) priv->regs); +iounmap (priv->regs); regs_fail:free_netdev (dev);return err;
@@ -382,7 +381,7 @@ static int gfar_remove(struct platform_dplatform_set_drvdata (pdev,NULL ); -iounmap ((void *) priv->regs); +iounmap (priv->regs);free_netdev (dev);return 0 ;
@@ -454,8 +453,7 @@ static void init_registers(struct net_de/* Zero out the rmon mib registers if it has them */ if (priv->einfo->device_flags &FSL_GIANFAR_DEV_HAS_RMON ) { -memset ((void *) &(priv->regs->rmon),0 , -sizeof (struct rmon_mib )); +memset_io (&(priv->regs->rmon),0 ,sizeof (struct rmon_mib ));/* Mask off the CAM interrupts */ gfar_write (&priv->regs->rmon.cam1,0xffffffff );
@@ -477,7 +475,7 @@ static void init_registers(struct net_devoid gfar_halt (struct net_device *dev) {struct gfar_private *priv =netdev_priv (dev); -struct gfar *regs = priv->regs; +struct gfar __iomem *regs = priv->regs;u32 tempval;/* Mask all interrupts */
@@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev)void stop_gfar (struct net_device *dev) {struct gfar_private *priv =netdev_priv (dev); -struct gfar *regs = priv->regs; +struct gfar __iomem *regs = priv->regs;unsigned long flags;phy_stop (priv->phydev);
@@ -590,7 +588,7 @@ static void free_skb_resources(struct gfvoid gfar_start (struct net_device *dev) {struct gfar_private *priv =netdev_priv (dev); -struct gfar *regs = priv->regs; +struct gfar __iomem *regs = priv->regs;u32 tempval;/* Enable Rx and Tx in MACCFG1 */
@@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev)unsigned long vaddr;int i;struct gfar_private *priv =netdev_priv (dev); -struct gfar *regs = priv->regs; +struct gfar __iomem *regs = priv->regs;int err =0 ;u32 rctrl =0 ;u32 attrs =0 ;
@@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irstatic void adjust_link (struct net_device *dev) {struct gfar_private *priv =netdev_priv (dev); -struct gfar *regs = priv->regs; +struct gfar __iomem *regs = priv->regs;unsigned long flags;struct phy_device *phydev = priv->phydev;int new_state =0 ;
@@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_de {struct dev_mc_list *mc_ptr;struct gfar_private *priv =netdev_priv (dev); -struct gfar *regs = priv->regs; +struct gfar __iomem *regs = priv->regs;u32 tempval;if (dev->flags &IFF_PROMISC ) {
@@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(structint idx;char tmpbuf[MAC_ADDR_LEN ];u32 tempval; -u32 *macptr = &priv->regs->macstnaddr1; +u32 __iomem *macptr = &priv->regs->macstnaddr1; macptr += num*2 ;
drivers/net/gianfar.h +4 -4
@@ -682,8 +682,8 @@ struct gfar_private {struct rxbd8 *cur_rx;/* Next free rx ring entry */ struct txbd8 *cur_tx;/* Next free ring entry */ struct txbd8 *dirty_tx;/* The Ring entry to be freed. */ -struct gfar *regs;/* Pointer to the GFAR memory mapped Registers */ -u32 *hash_regs[16 ]; +struct gfar __iomem *regs;/* Pointer to the GFAR memory mapped Registers */ +u32 __iomem *hash_regs[16 ];int hash_width;struct net_device_stats stats;/* linux network statistics */ struct gfar_extra_stats extra_stats;
@@ -718,14 +718,14 @@ struct gfar_private {uint32_t msg_enable; }; -static inline u32 gfar_read (volatile unsigned *addr) +static inline u32 gfar_read (volatile unsigned __iomem *addr) {u32 val; val =in_be32 (addr);return val; } -static inline void gfar_write (volatile unsigned *addr,u32 val) +static inline void gfar_write (volatile unsigned __iomem *addr,u32 val) {out_be32 (addr, val); }
drivers/net/gianfar_ethtool.c +4 -4
@@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_du64 *extra = (u64 *) & priv->extra_stats;if (priv->einfo->device_flags &FSL_GIANFAR_DEV_HAS_RMON ) { -u32 *rmon = (u32 *) & priv->regs->rmon; +u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon;struct gfar_stats *stats = (struct gfar_stats *) buf;for (i =0 ; i <GFAR_RMON_LEN ; i++) - stats->rmon[i] = (u64) (rmon[i]); + stats->rmon[i] = (u64 )gfar_read (&rmon[i]);for (i =0 ; i <GFAR_EXTRA_STATS_LEN ; i++) stats->extra[i] = extra[i];
@@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_dev {int i;struct gfar_private *priv =netdev_priv (dev); -u32 *theregs = (u32 *) priv->regs; +u32 __iomem *theregs = (u32 __iomem *) priv->regs;u32 *buf = (u32 *) regbuf;for (i =0 ; i <sizeof (struct gfar ) /sizeof (u32); i++) - buf[i] = theregs[i]; + buf[i] =gfar_read (&theregs[i]); }/* Convert microseconds to ethernet clock ticks, which changes
drivers/net/gianfar_mii.c +8 -9
@@ -50,7 +50,7 @@* All PHY configuration is done through the TSEC1 MIIM regs */ int gfar_mdio_write (struct mii_bus *bus,int mii_id,int regnum,u16 value) { -struct gfar_mii *regs = bus->priv; +struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;/* Set the PHY address and the register address we want to write */ gfar_write (®s->miimadd, (mii_id <<8 ) | regnum);
@@ -70,7 +70,7 @@ int gfar_mdio_write(struct mii_bus *bus,* configuration has to be done through the TSEC1 MIIM regs */ int gfar_mdio_read (struct mii_bus *bus,int mii_id,int regnum) { -struct gfar_mii *regs = bus->priv; +struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;u16 value;/* Set the PHY address and the register address we want to read */
@@ -94,7 +94,7 @@ int gfar_mdio_read(struct mii_bus *bus,/* Reset the MIIM registers, and wait for the bus to free */ int gfar_mdio_reset (struct mii_bus *bus) { -struct gfar_mii *regs = bus->priv; +struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;unsigned int timeout =PHY_INIT_TIMEOUT ;spin_lock_bh (&bus->mdio_lock);
@@ -126,7 +126,7 @@ int gfar_mdio_probe(struct device *dev) {struct platform_device *pdev =to_platform_device (dev);struct gianfar_mdio_data *pdata; -struct gfar_mii *regs; +struct gfar_mii __iomem *regs;struct mii_bus *new_bus;struct resource *r;int err =0 ;
@@ -155,15 +155,14 @@ int gfar_mdio_probe(struct device *dev) r =platform_get_resource (pdev,IORESOURCE_MEM ,0 );/* Set the PHY base address */ - regs = (struct gfar_mii *)ioremap (r->start, -sizeof (struct gfar_mii )); + regs =ioremap (r->start,sizeof (struct gfar_mii ));if (NULL == regs) { err = -ENOMEM ; goto reg_map_fail; } - new_bus->priv = regs; + new_bus->priv = (void __force *)regs; new_bus->irq = pdata->irq;
@@ -181,7 +180,7 @@ int gfar_mdio_probe(struct device *dev)return 0 ; bus_register_fail: -iounmap ((void *) regs); +iounmap (regs); reg_map_fail:kfree (new_bus);
@@ -197,7 +196,7 @@ int gfar_mdio_remove(struct device *dev)dev_set_drvdata (dev,NULL ); -iounmap ((void *) (&bus->priv)); +iounmap ((void __iomem *)bus->priv); bus->priv =NULL ;kfree (bus);
drivers/net/r8169.c +7 -6
@@ -484,13 +484,12 @@ static void mdio_write(void __iomem *ioaint i;RTL_W32 (PHYAR ,0x80000000 | (RegAddr &0xFF ) <<16 | value); -udelay (1000 ); -for (i =2000 ; i >0 ; i--) { +for (i =20 ; i >0 ; i--) {/* Check if the RTL8169 has completed writing to the specified MII register */ if (!(RTL_R32 (PHYAR ) &0x80000000 ))break ; -udelay (100 ); +udelay (25 ); } }
@@ -499,15 +498,14 @@ static int mdio_read(void __iomem *ioaddint i, value =-1 ;RTL_W32 (PHYAR ,0x0 | (RegAddr &0xFF ) <<16 ); -udelay (1000 ); -for (i =2000 ; i >0 ; i--) { +for (i =20 ; i >0 ; i--) {/* Check if the RTL8169 has completed retrieving data from the specified MII register */ if (RTL_R32 (PHYAR ) &0x80000000 ) { value = (int ) (RTL_R32 (PHYAR ) &0xFFFF );break ; } -udelay (100 ); +udelay (25 ); }return value; }
@@ -677,6 +675,9 @@ static int rtl8169_set_speed_xmii(structif (duplex ==DUPLEX_HALF ) auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full); + +if (duplex ==DUPLEX_FULL ) + auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_100_Half); } tp->phy_auto_nego_reg = auto_nego;
drivers/net/sis900.h +0 -1
@@ -33,7 +33,6 @@ enum sis900_registers { rxcfg=0x34 ,//Receive Configuration Register flctrl=0x38 ,//Flow Control Register rxlen=0x3c ,//Receive Packet Length Register - cfgpmcsr=0x44 ,//Configuration Power Management Control/Status Register rfcr=0x48 ,//Receive Filter Control Register rfdr=0x4C ,//Receive Filter Data Register pmctrl=0xB0, //Power Management Control Register
drivers/net/sky2.c +141 -45
324 lines not on this page · raw message
drivers/net/sky2.h +1 -8
@@ -1841,6 +1841,7 @@ struct sky2_hw {struct net_device *dev[2 ];int pm_cap; +int msi;u8 chip_id;u8 chip_rev;u8 copper;
@@ -1867,14 +1868,6 @@ static inline u8 sky2_read8(const structreturn readb (hw->regs + reg); } -/* This should probably go away, bus based tweeks suck */ -static inline int is_pciex (const struct sky2_hw *hw) -{ -u32 status; -pci_read_config_dword (hw->pdev,PCI_DEV_STATUS , &status); -return (status &PCI_OS_PCI_X ) ==0 ; -} -static inline void sky2_write32 (const struct sky2_hw *hw,unsigned reg,u32 val) {writel (val, hw->regs + reg);
drivers/net/tulip/uli526x.c +1 -1
@@ -214,7 +214,7 @@ static u32 uli526x_cr6_user_set;/* For module input parameter */ static int debug;static u32 cr6set; -static unsigned char mode =8 ; +static int mode =8 ;/* function declaration ------------------------------------- */ static int uli526x_open (struct net_device *);
drivers/net/wan/dscc4.c +1 -1
@@ -1943,7 +1943,7 @@ static int dscc4_init_ring(struct net_de (++i%TX_RING_SIZE)*sizeof(*tx_fd)); }while (i <TX_RING_SIZE ); -if (dscc4_init_dummy_skb (dpriv) <0 ) +if (!dscc4_init_dummy_skb (dpriv)) goto err_free_dma_tx;memset (dpriv->rx_skbuff,0 ,sizeof (struct sk_buff *)*RX_RING_SIZE );