Skip to contentSkip to conversation

2.6.x net driver updates

PATCH In review Jeff Garzik 8 participants 12 messages Jan 12, 2006 – Jan 14, 2006

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6.x net driver updates

Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

to receive the following updates:

 drivers/net/bonding/bond_alb.c |    4 
 drivers/net/bonding/bonding.h  |    4 
 drivers/net/e100.c             |   32 +++++
 drivers/net/gianfar.c          |    6 -
 drivers/net/gianfar_mii.c      |    5 
 drivers/net/phy/mdio_bus.c     |    2 
 drivers/net/phy/phy.c          |    2 
 drivers/net/tulip/uli526x.c    |    6 -
 drivers/net/via-velocity.c     |    2 
 drivers/net/wireless/Kconfig   |    2 
 drivers/net/wireless/atmel.c   |  227 ++++++++++++++++++++++++++++++++++++++++-
 include/linux/fsl_devices.h    |    6 -
 include/linux/phy.h            |    3 
 include/net/ieee80211.h        |    6 -
 14 files changed, 281 insertions(+), 26 deletions(-)

Dan Williams:
wireless/atmel: add IWENCODEEXT, IWAUTH, and association event support

dann frazier:
CONFIG_AIRO needs CONFIG_CRYPTO

Eric Sesterhenn / snakebyte:
replace MODULE_PARM in tulip/uli526x.c

Jay Vosburgh:
bonding: UPDATED hash-table corruption in bond_alb.c

Johannes Berg:
fix wrong comments in ieee80211.h

John W. Linville:
via-velocity: use NETIF_F_IP_CSUM (hardware only support IPv4)

Kumar Gala:
gfar: fix compile error
gianfar mii: Use proper resource for MII memory region
phy: Added a macro to represent the string format used to match a phy device
gianfar: Use new PHY_ID_FMT macro

ODonnell, Michael:
corruption during e100 MDI register access

drivers/net/bonding/bond_alb.c +2 -2
index 854ddfb..f2a6318 100644
@@ -169,9 +169,9 @@ static void tlb_clear_slave(struct bondi
 		index = next_index;
 	}
 
-	_unlock_tx_hashtbl(bond);
-
 	tlb_init_slave(slave);
+
+	_unlock_tx_hashtbl(bond);
 }
 
 /* Must be called before starting the monitor timer */
drivers/net/bonding/bonding.h +2 -2
index f20bb85..3dd78d0 100644
@@ -22,8 +22,8 @@
 #include "bond_3ad.h"
 #include "bond_alb.h"
 
-#define DRV_VERSION	"3.0.0"
-#define DRV_RELDATE	"November 8, 2005"
+#define DRV_VERSION	"3.0.1"
+#define DRV_RELDATE	"January 9, 2006"
 #define DRV_NAME	"bonding"
 #define DRV_DESCRIPTION	"Ethernet Channel Bonding Driver"
 
drivers/net/e100.c +29 -3
index 22cd045..23de226 100644
@@ -132,6 +132,10 @@
  * 	TODO:
  * 	o several entry points race with dev->close
  * 	o check for tx-no-resources/stop Q races with tx clean/wake Q
+ *
+ *	FIXES:
+ * 2005/12/02 - Michael O'Donnell <Michael.ODonnell at stratus dot com>
+ *	- Stratus87247: protect MDI control register manipulations
  */
 
 #include <linux/config.h>
@@ -578,6 +582,7 @@ struct nic {
 	u16 leds;
 	u16 eeprom_wc;
 	u16 eeprom[256];
+	spinlock_t mdio_lock;
 };
 
 static inline void e100_write_flush(struct nic *nic)
@@ -876,15 +881,35 @@ static u16 mdio_ctrl(struct nic *nic, u3
 {
 	u32 data_out = 0;
 	unsigned int i;
+	unsigned long flags;
+
 
+	/*
+	 * Stratus87247: we shouldn't be writing the MDI control
+	 * register until the Ready bit shows True.  Also, since
+	 * manipulation of the MDI control registers is a multi-step
+	 * procedure it should be done under lock.
+	 */
+	spin_lock_irqsave(&nic->mdio_lock, flags);
+	for (i = 100; i; --i) {
+		if (readl(&nic->csr->mdi_ctrl) & mdi_ready)
+			break;
+		udelay(20);
+	}
+	if (unlikely(!i)) {
+		printk("e100.mdio_ctrl(%s) won't go Ready\n",
+			nic->netdev->name );
+		spin_unlock_irqrestore(&nic->mdio_lock, flags);
+		return 0;		/* No way to indicate timeout error */
+	}
 	writel((reg << 16) | (addr << 21) | dir | data, &nic->csr->mdi_ctrl);
 
-	for(i = 0; i < 100; i++) {
+	for (i = 0; i < 100; i++) {
 		udelay(20);
-		if((data_out = readl(&nic->csr->mdi_ctrl)) & mdi_ready)
+		if ((data_out = readl(&nic->csr->mdi_ctrl)) & mdi_ready)
 			break;
 	}
-
+	spin_unlock_irqrestore(&nic->mdio_lock, flags);
 	DPRINTK(HW, DEBUG,
 		"%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n",
 		dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out);
@@ -2562,6 +2587,7 @@ static int __devinit e100_probe(struct p
 	/* locks must be initialized before calling hw_reset */
 	spin_lock_init(&nic->cb_lock);
 	spin_lock_init(&nic->cmd_lock);
+	spin_lock_init(&nic->mdio_lock);
 
 	/* Reset the device before pci_set_master() in case device is in some
 	 * funky state and has an interrupt pending - hint: we don't have the
drivers/net/gianfar.c +5 -1
index 146f951..0c18dbd 100644
@@ -84,6 +84,7 @@
 #include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
+#include <linux/in.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -398,12 +399,15 @@ static int init_phy(struct net_device *d
 		priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ?
 		SUPPORTED_1000baseT_Full : 0;
 	struct phy_device *phydev;
+	char phy_id[BUS_ID_SIZE];
 
 	priv->oldlink = 0;
 	priv->oldspeed = 0;
 	priv->oldduplex = -1;
 
-	phydev = phy_connect(dev, priv->einfo->bus_id, &adjust_link, 0);
+	snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id);
+
+	phydev = phy_connect(dev, phy_id, &adjust_link, 0);
 
 	if (IS_ERR(phydev)) {
 		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
drivers/net/gianfar_mii.c +4 -1
index 04a462c..74e52fc 100644
@@ -128,6 +128,7 @@ int gfar_mdio_probe(struct device *dev)
 	struct gianfar_mdio_data *pdata;
 	struct gfar_mii *regs;
 	struct mii_bus *new_bus;
+	struct resource *r;
 	int err = 0;
 
 	if (NULL == dev)
@@ -151,8 +152,10 @@ int gfar_mdio_probe(struct device *dev)
 		return -ENODEV;
 	}
 
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
 	/* Set the PHY base address */
-	regs = (struct gfar_mii *) ioremap(pdata->paddr, 
+	regs = (struct gfar_mii *) ioremap(r->start,
 			sizeof (struct gfar_mii));
 
 	if (NULL == regs) {
drivers/net/phy/mdio_bus.c +1 -1
index 02940c0..459443b 100644
@@ -81,7 +81,7 @@ int mdiobus_register(struct mii_bus *bus
 
 			phydev->dev.parent = bus->dev;
 			phydev->dev.bus = &mdio_bus_type;
-			sprintf(phydev->dev.bus_id, "phy%d:%d", bus->id, i);
+			snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i);
 
 			phydev->bus = bus;
 
drivers/net/phy/phy.c +1 -1
index b8686e4..1474b7c 100644
@@ -42,7 +42,7 @@
  */
 void phy_print_status(struct phy_device *phydev)
 {
-	pr_info("%s: Link is %s", phydev->dev.bus_id,
+	pr_info("PHY: %s - Link is %s", phydev->dev.bus_id,
 			phydev->link ? "Up" : "Down");
 	if (phydev->link)
 		printk(" - %d/%s", phydev->speed,
drivers/net/tulip/uli526x.c +3 -3
index 1a43163..9839816 100644
@@ -1689,9 +1689,9 @@ MODULE_AUTHOR("Peer Chen, peer.chen@uli.
 MODULE_DESCRIPTION("ULi M5261/M5263 fast ethernet driver");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(debug, "i");
-MODULE_PARM(mode, "i");
-MODULE_PARM(cr6set, "i");
+module_param(debug, int, 0644);
+module_param(mode, int, 0);
+module_param(cr6set, int, 0);
 MODULE_PARM_DESC(debug, "ULi M5261/M5263 enable debugging (0-1)");
 MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8: HomePNA");
 
drivers/net/via-velocity.c +1 -1
index 82c6b75..c2d5907 100644
@@ -791,7 +791,7 @@ static int __devinit velocity_found1(str
 #endif
 
 	if (vptr->flags & VELOCITY_FLAGS_TX_CSUM) {
-		dev->features |= NETIF_F_HW_CSUM;
+		dev->features |= NETIF_F_IP_CSUM;
 	}
 
 	ret = register_netdev(dev);
drivers/net/wireless/Kconfig +1 -1
index 24f7967..c1a6e69 100644
@@ -243,7 +243,7 @@ config IPW2200_DEBUG
 
 config AIRO
 	tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
-	depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN)
+	depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN)
 	---help---
 	  This is the standard Linux driver to support Cisco/Aironet ISA and
 	  PCI 802.11 wireless cards.
drivers/net/wireless/atmel.c +223 -4

288 lines not on this page · raw message

include/linux/fsl_devices.h +2 -4
index 934aa9b..a9f1cfd 100644
@@ -50,14 +50,12 @@ struct gianfar_platform_data {
 
 	/* board specific information */
 	u32 board_flags;
-	const char *bus_id;
+	u32 bus_id;
+	u32 phy_id;
 	u8 mac_addr[6];
 };
 
 struct gianfar_mdio_data {
-	/* device specific information */
-	u32 paddr;
-
 	/* board specific information */
 	int irq[32];
 };
include/linux/phy.h +3 -0
index 92a9696..331521a 100644
@@ -53,6 +53,9 @@
 
 #define PHY_MAX_ADDR 32
 
+/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
+#define PHY_ID_FMT "%x:%02x"
+
 /* The Bus class for PHYs.  Devices which provide access to
  * PHYs should register using this structure */
 struct mii_bus {
include/net/ieee80211.h +4 -2
index cde2f4f..df05f46 100644
@@ -363,8 +363,9 @@ enum ieee80211_reasoncode {
 #define IEEE80211_OFDM_SHIFT_MASK_A         4
 
 /* NOTE: This data is for statistical purposes; not all hardware provides this
- *       information for frames received.  Not setting these will not cause
- *       any adverse affects. */
+ *       information for frames received.
+ *       For ieee80211_rx_mgt, you need to set at least the 'len' parameter.
+ */
 struct ieee80211_rx_stats {
 	u32 mac_time;
 	s8 rssi;
@@ -1088,6 +1089,7 @@ extern int ieee80211_tx_frame(struct iee
 /* ieee80211_rx.c */
 extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 			struct ieee80211_rx_stats *rx_stats);
+/* make sure to set stats->len */
 extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
 			     struct ieee80211_hdr_4addr *header,
 			     struct ieee80211_rx_stats *stats);
#1 lore raw
Quoted 3 lines · Jeff Garzik

dann frazier:
CONFIG_AIRO needs CONFIG_CRYPTO

I think this is done wrong.

It should "select CRYPTO" rather than "depends on CRYPTO".

Otherwise people won't see it just because they don't have crypto enabled, which is not very user-friendly.

Btw, why are these casts there? Either the functions are of the right type, or they aren't. In neither case is the cast correct.

I do realize that there are comments in <net/iw_handler.h> that says that you should do the cast, but that's no excuse for crap or stupid code.

If it's an issue of trying to make greppable code, why not have just the comment?

drivers/net/wireless/atmel.c static const iw_handler atmel_handler[] · line 2570

Quoted 6 lines
drivers/net/wireless/atmel.c +2 -0
@@ -2378,6 +2566,15 @@ static const iw_handler atmel_handler[] 
 	(iw_handler) atmel_get_encode,		/* SIOCGIWENCODE */
 	(iw_handler) atmel_set_power,		/* SIOCSIWPOWER */
 	(iw_handler) atmel_get_power,		/* SIOCGIWPOWER */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) NULL,			/* -- hole -- */

...

Hmm?

Linus

#2 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Jeff Garzik

dann frazier:
CONFIG_AIRO needs CONFIG_CRYPTO

Quoted 7 lines

I think this is done wrong.

It should "select CRYPTO" rather than "depends on CRYPTO".

Otherwise people won't see it just because they don't have crypto enabled, which is not very user-friendly.

Yes, I think that's much more Aunt-Nellie-friendly, but Roman considers it abuse of the Kconfig system in ways which I never completely understood?

#3 lore raw
Quoted 3 lines · Andrew Morton

Yes, I think that's much more Aunt-Nellie-friendly, but Roman considers it abuse of the Kconfig system in ways which I never completely understood?

Hmm. If Roman dislikes it, he must dislike the fact that we already do exactly this for a ton of different things. There's something like 2000+ "select" statements in the kernel Kconfig tree, and just grepping for "select.*CRYPTO" gets 52 hits..

So this isn't new..

Linus

#4 lore raw

Hi,

Quoted 7 lines · Linus Torvalds
Quoted 2 lines

Yes, I think that's much more Aunt-Nellie-friendly, but Roman considers it abuse of the Kconfig system in ways which I never completely understood?

Hmm. If Roman dislikes it, he must dislike the fact that we already do exactly this for a ton of different things. There's something like 2000+ "select" statements in the kernel Kconfig tree, and just grepping for "select.*CRYPTO" gets 52 hits..

The basic problem is that it overrides any other dependencies and it makes easy to screw them up.
The basic rule should be to use select only to include library functionality, which is mostly independent and has no other dependencies. Selecting larger subsystem, which may require more configuration itself, should be avoided.

bye, Roman

#5 lore raw
In reply to Andrew Morton
Quoted 9 lines · Andrew Morton
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Jeff Garzik

dann frazier:
CONFIG_AIRO needs CONFIG_CRYPTO

I think this is done wrong.

Quoted 8 lines
Quoted 5 lines

It should "select CRYPTO" rather than "depends on CRYPTO".

Otherwise people won't see it just because they don't have crypto enabled, which is not very user-friendly.

Yes, I think that's much more Aunt-Nellie-friendly, but Roman considers it abuse of the Kconfig system in ways which I never completely understood?

'select' is really cool as a concept, but when you can't figure out why you cannot disable CONFIG_FOO because CONFIG_BAR selects it it's really annoying. Would be nice to actually be able to see if another option has selected this option.

Signature · 1 line
Jens Axboe
#6 lore raw
Quoted 5 lines · Jens Axboe

'select' is really cool as a concept, but when you can't figure out why you cannot disable CONFIG_FOO because CONFIG_BAR selects it it's really annoying. Would be nice to actually be able to see if another option has selected this option.

In menuconfig:

Typing '?' on CONFIG_HOTPLUG revealed:
Selected by: PCCARD || HOTPLUG_PCI && PCI && EXPERIMENTAL || FW_LOADER

Then use '/' to search for the CONFIG_ symbols to see where they are defined.

Sam

#7 lore raw
Quoted 7 lines · Sam Ravnborg
Quoted 5 lines · Jens Axboe

'select' is really cool as a concept, but when you can't figure out why you cannot disable CONFIG_FOO because CONFIG_BAR selects it it's really annoying. Would be nice to actually be able to see if another option has selected this option.

Quoted 7 lines

In menuconfig:

Typing '?' on CONFIG_HOTPLUG revealed:
Selected by: PCCARD || HOTPLUG_PCI && PCI && EXPERIMENTAL || FW_LOADER

Then use '/' to search for the CONFIG_ symbols to see where they are defined.

Live and learn, thanks, didn't know you could do that!

Signature · 1 line
Jens Axboe
#8 lore raw
In reply to Sam Ravnborg
Quoted 7 lines · Sam Ravnborg
Quoted 5 lines · Jens Axboe

'select' is really cool as a concept, but when you can't figure out why you cannot disable CONFIG_FOO because CONFIG_BAR selects it it's really annoying. Would be nice to actually be able to see if another option has selected this option.

Quoted 5 lines

In menuconfig:

Typing '?' on CONFIG_HOTPLUG revealed:
Selected by: PCCARD || HOTPLUG_PCI && PCI && EXPERIMENTAL || FW_LOADER
...

Is there any trick to see them all when they are longer than the line in the terminal (e.g. what selects FW_LOADER?)?

Quoted 1 line

Sam

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#9 lore raw
Quoted 8 lines · On Sat, 14 Jan 2006 03:29:49 +0100 Adrian Bunk wrote:
Quoted 7 lines · Sam Ravnborg
Quoted 5 lines · Jens Axboe

'select' is really cool as a concept, but when you can't figure out why you cannot disable CONFIG_FOO because CONFIG_BAR selects it it's really annoying. Would be nice to actually be able to see if another option has selected this option.

Quoted 8 lines
Quoted 5 lines

In menuconfig:

Typing '?' on CONFIG_HOTPLUG revealed:
Selected by: PCCARD || HOTPLUG_PCI && PCI && EXPERIMENTAL || FW_LOADER
...

Is there any trick to see them all when they are longer than the line in the terminal (e.g. what selects FW_LOADER?)?

Use the right/left arrow keys to scroll horizontally.

---
~Randy

#10 lore raw
In reply to Linus Torvalds
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Jeff Garzik

dann frazier:
CONFIG_AIRO needs CONFIG_CRYPTO

I think this is done wrong.

It should "select CRYPTO" rather than "depends on CRYPTO".

OK

Quoted 20 lines

Otherwise people won't see it just because they don't have crypto enabled, which is not very user-friendly.

Btw, why are these casts there? Either the functions are of the right type, or they aren't. In neither case is the cast correct.

I do realize that there are comments in <net/iw_handler.h> that says that you should do the cast, but that's no excuse for crap or stupid code.

If it's an issue of trying to make greppable code, why not have just the comment?

Quoted 6 lines
drivers/net/wireless/atmel.c +2 -0
@@ -2378,6 +2566,15 @@ static const iw_handler atmel_handler[] 
 	(iw_handler) atmel_get_encode,		/* SIOCGIWENCODE */
 	(iw_handler) atmel_set_power,		/* SIOCSIWPOWER */
 	(iw_handler) atmel_get_power,		/* SIOCGIWPOWER */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) NULL,			/* -- hole -- */

...

Quoted 1 line

Hmm?

Welcome to the awful wireless driver API. This type crapola is a key thing that needs changing, but its not the only thing. There are also some nasty wireless APIs which do casts based on variable (passed-in) struct offsets...

This needs to change to a type-safe thingy like struct ethtool_ops, but the above is what we were lumped with.

Jeff

#11 lore raw
Quoted 8 lines · Jeff Garzik
Quoted 7 lines · Linus Torvalds
Quoted 3 lines · Jeff Garzik

dann frazier:
CONFIG_AIRO needs CONFIG_CRYPTO

Quoted 6 lines
Quoted 3 lines

I think this is done wrong.

It should "select CRYPTO" rather than "depends on CRYPTO".

OK
...

What was wrong with my patch [1] that did not only this, but also fixes the same bug with AIRO_CS and removes all the #ifdef's for the non-compiling CRYPTO=n case from the driver?

Quoted 1 line

Jeff

cu
Adrian

[1] http://lkml.org/lkml/2006/1/10/328

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed