Netdev List
 help / color / mirror / Atom feed
* [PATCH] PHYLIB: Locking fixes for PHY I/O potentially sleeping
From: Nate Case @ 2008-01-29 16:05 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Andy Fleming, David S. Miller, netdev
In-Reply-To: <479E76A2.8020304@garzik.org>

PHY read/write functions can potentially sleep (e.g., a PHY accessed
via I2C).  The following changes were made to account for this:

    * Change spin locks to mutex locks
    * Add a BUG_ON() to phy_read() phy_write() to warn against
      calling them from an interrupt context.
    * Use work queue for PHY state machine handling since
      it can potentially sleep
    * Change phydev lock from spinlock to mutex

Signed-off-by: Nate Case <ncase@xes-inc.com>
Acked-by: Andy Fleming <afleming@freescale.com>

---
Note: This is a resend of the patch submitted on January 3rd, 2008

 drivers/net/phy/mdio_bus.c   |    2 +-
 drivers/net/phy/phy.c        |   68 ++++++++++++++++++++++++++++-------------
 drivers/net/phy/phy_device.c |   11 +++----
 include/linux/phy.h          |    5 ++-
 4 files changed, 55 insertions(+), 31 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index c30196d..6e9f619 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -49,7 +49,7 @@ int mdiobus_register(struct mii_bus *bus)
 	int i;
 	int err = 0;
 
-	spin_lock_init(&bus->mdio_lock);
+	mutex_init(&bus->mdio_lock);
 
 	if (NULL == bus || NULL == bus->name ||
 			NULL == bus->read ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7c9e6e3..12fccb1 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -26,7 +26,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/spinlock.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/mii.h>
@@ -72,9 +71,11 @@ int phy_read(struct phy_device *phydev, u16 regnum)
 	int retval;
 	struct mii_bus *bus = phydev->bus;
 
-	spin_lock_bh(&bus->mdio_lock);
+	BUG_ON(in_interrupt());
+
+	mutex_lock(&bus->mdio_lock);
 	retval = bus->read(bus, phydev->addr, regnum);
-	spin_unlock_bh(&bus->mdio_lock);
+	mutex_unlock(&bus->mdio_lock);
 
 	return retval;
 }
@@ -95,9 +96,11 @@ int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
 	int err;
 	struct mii_bus *bus = phydev->bus;
 
-	spin_lock_bh(&bus->mdio_lock);
+	BUG_ON(in_interrupt());
+
+	mutex_lock(&bus->mdio_lock);
 	err = bus->write(bus, phydev->addr, regnum, val);
-	spin_unlock_bh(&bus->mdio_lock);
+	mutex_unlock(&bus->mdio_lock);
 
 	return err;
 }
@@ -428,7 +431,7 @@ int phy_start_aneg(struct phy_device *phydev)
 {
 	int err;
 
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 
 	if (AUTONEG_DISABLE == phydev->autoneg)
 		phy_sanitize_settings(phydev);
@@ -449,13 +452,14 @@ int phy_start_aneg(struct phy_device *phydev)
 	}
 
 out_unlock:
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 	return err;
 }
 EXPORT_SYMBOL(phy_start_aneg);
 
 
 static void phy_change(struct work_struct *work);
+static void phy_state_machine(struct work_struct *work);
 static void phy_timer(unsigned long data);
 
 /**
@@ -476,6 +480,7 @@ void phy_start_machine(struct phy_device *phydev,
 {
 	phydev->adjust_state = handler;
 
+	INIT_WORK(&phydev->state_queue, phy_state_machine);
 	init_timer(&phydev->phy_timer);
 	phydev->phy_timer.function = &phy_timer;
 	phydev->phy_timer.data = (unsigned long) phydev;
@@ -493,11 +498,12 @@ void phy_start_machine(struct phy_device *phydev,
 void phy_stop_machine(struct phy_device *phydev)
 {
 	del_timer_sync(&phydev->phy_timer);
+	cancel_work_sync(&phydev->state_queue);
 
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 	if (phydev->state > PHY_UP)
 		phydev->state = PHY_UP;
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 
 	phydev->adjust_state = NULL;
 }
@@ -541,9 +547,9 @@ static void phy_force_reduction(struct phy_device *phydev)
  */
 void phy_error(struct phy_device *phydev)
 {
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 	phydev->state = PHY_HALTED;
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 }
 
 /**
@@ -705,10 +711,10 @@ static void phy_change(struct work_struct *work)
 	if (err)
 		goto phy_err;
 
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 	if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
 		phydev->state = PHY_CHANGELINK;
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 
 	atomic_dec(&phydev->irq_disable);
 	enable_irq(phydev->irq);
@@ -735,7 +741,7 @@ phy_err:
  */
 void phy_stop(struct phy_device *phydev)
 {
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 
 	if (PHY_HALTED == phydev->state)
 		goto out_unlock;
@@ -751,7 +757,7 @@ void phy_stop(struct phy_device *phydev)
 	phydev->state = PHY_HALTED;
 
 out_unlock:
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 
 	/*
 	 * Cannot call flush_scheduled_work() here as desired because
@@ -773,7 +779,7 @@ out_unlock:
  */
 void phy_start(struct phy_device *phydev)
 {
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 
 	switch (phydev->state) {
 		case PHY_STARTING:
@@ -787,19 +793,26 @@ void phy_start(struct phy_device *phydev)
 		default:
 			break;
 	}
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 }
 EXPORT_SYMBOL(phy_stop);
 EXPORT_SYMBOL(phy_start);
 
-/* PHY timer which handles the state machine */
-static void phy_timer(unsigned long data)
+/**
+ * phy_state_machine - Handle the state machine
+ * @work: work_struct that describes the work to be done
+ *
+ * Description: Scheduled by the state_queue workqueue each time
+ *   phy_timer is triggered.
+ */
+static void phy_state_machine(struct work_struct *work)
 {
-	struct phy_device *phydev = (struct phy_device *)data;
+	struct phy_device *phydev =
+			container_of(work, struct phy_device, state_queue);
 	int needs_aneg = 0;
 	int err = 0;
 
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 
 	if (phydev->adjust_state)
 		phydev->adjust_state(phydev->attached_dev);
@@ -965,7 +978,7 @@ static void phy_timer(unsigned long data)
 			break;
 	}
 
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 
 	if (needs_aneg)
 		err = phy_start_aneg(phydev);
@@ -976,3 +989,14 @@ static void phy_timer(unsigned long data)
 	mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
 }
 
+/* PHY timer which schedules the state machine work */
+static void phy_timer(unsigned long data)
+{
+	struct phy_device *phydev = (struct phy_device *)data;
+
+	/*
+	 * PHY I/O operations can potentially sleep so we ensure that
+	 * it's done from a process context
+	 */
+	schedule_work(&phydev->state_queue);
+}
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 5b9e175..f4c4fd8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -25,7 +25,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#include <linux/spinlock.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/mii.h>
@@ -80,7 +79,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
 
 	dev->state = PHY_DOWN;
 
-	spin_lock_init(&dev->lock);
+	mutex_init(&dev->lock);
 
 	return dev;
 }
@@ -656,7 +655,7 @@ static int phy_probe(struct device *dev)
 	if (!(phydrv->flags & PHY_HAS_INTERRUPT))
 		phydev->irq = PHY_POLL;
 
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 
 	/* Start out supporting everything. Eventually,
 	 * a controller will attach, and may modify one
@@ -670,7 +669,7 @@ static int phy_probe(struct device *dev)
 	if (phydev->drv->probe)
 		err = phydev->drv->probe(phydev);
 
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 
 	return err;
 
@@ -682,9 +681,9 @@ static int phy_remove(struct device *dev)
 
 	phydev = to_phy_device(dev);
 
-	spin_lock_bh(&phydev->lock);
+	mutex_lock(&phydev->lock);
 	phydev->state = PHY_DOWN;
-	spin_unlock_bh(&phydev->lock);
+	mutex_unlock(&phydev->lock);
 
 	if (phydev->drv->remove)
 		phydev->drv->remove(phydev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 554836e..5e43ae7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -88,7 +88,7 @@ struct mii_bus {
 
 	/* A lock to ensure that only one thing can read/write
 	 * the MDIO bus at a time */
-	spinlock_t mdio_lock;
+	struct mutex mdio_lock;
 
 	struct device *dev;
 
@@ -284,10 +284,11 @@ struct phy_device {
 
 	/* Interrupt and Polling infrastructure */
 	struct work_struct phy_queue;
+	struct work_struct state_queue;
 	struct timer_list phy_timer;
 	atomic_t irq_disable;
 
-	spinlock_t lock;
+	struct mutex lock;
 
 	struct net_device *attached_dev;
 
-- 
1.5.3.3




^ permalink raw reply related

* SKBs with shared fragments
From: kristrev @ 2008-01-29 16:17 UTC (permalink / raw)
  To: netdev

Hello,

I am working on a patch to the TCP-code that, among others, share
fragments between skbs, and have encountered a problem that I'm not sure
if I have solved correctly.

To share a fragment, I copy the skb_frag-struct to the correct place in
the other skbs frags-array, increase the page-counter, skb->data_len,
skb->len, skb->end_seq and gso_segs/gso_size, and calculate a new
checksum.

The problem is the skb->truesize-variable. Currently I do not increase it,
leading to a SKB BUG because truesize is less than (skb->len +
sizeof(struct skb)). When I increase/decrease truesize, both the
wmem_queue and sk_forward_alloc is something else than zero and the socket
leaks memory.

The kernel does not halt and all the data is received correctly in both
cases.

The reason that I currently don't increase/decrease truesize is that, at
least if I have understod the code correctly, truesize says something
about how much memory an skb actually consumes. And since I only copy
existing fragments into it, I don't use any more memory.

Is this correct, or should I increase/decrease truesize as well? Also, is
there a better way to share fragments between skbs?

Thanks in advance for any replies,
Kristian


^ permalink raw reply

* [PATCH] PHYLIB: Add BCM5482 PHY support
From: Nate Case @ 2008-01-29 16:19 UTC (permalink / raw)
  To: Andy Fleming; +Cc: netdev

This Broadcom PHY is similar to other bcm54xx devices.

Signed-off-by: Nate Case <ncase@xes-inc.com>
---
 drivers/net/phy/broadcom.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 29666c8..5b80358 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -141,6 +141,20 @@ static struct phy_driver bcm5461_driver = {
 	.driver 	= { .owner = THIS_MODULE },
 };
 
+static struct phy_driver bcm5482_driver = {
+    .phy_id		= 0x0143bcb0,
+	.phy_id_mask	= 0xfffffff0,
+	.name		= "Broadcom BCM5482",
+	.features	= PHY_GBIT_FEATURES,
+	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+	.config_init	= bcm54xx_config_init,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
+	.ack_interrupt	= bcm54xx_ack_interrupt,
+	.config_intr	= bcm54xx_config_intr,
+	.driver 	= { .owner = THIS_MODULE },
+};
+
 static int __init broadcom_init(void)
 {
 	int ret;
@@ -154,8 +168,13 @@ static int __init broadcom_init(void)
 	ret = phy_driver_register(&bcm5461_driver);
 	if (ret)
 		goto out_5461;
+	ret = phy_driver_register(&bcm5482_driver);
+	if (ret)
+		goto out_5482;
 	return ret;
 
+out_5482:
+	phy_driver_unregister(&bcm5461_driver);
 out_5461:
 	phy_driver_unregister(&bcm5421_driver);
 out_5421:
@@ -166,6 +185,7 @@ out_5411:
 
 static void __exit broadcom_exit(void)
 {
+	phy_driver_unregister(&bcm5482_driver);
 	phy_driver_unregister(&bcm5461_driver);
 	phy_driver_unregister(&bcm5421_driver);
 	phy_driver_unregister(&bcm5411_driver);
-- 
1.5.3.3




^ permalink raw reply related

* [PATCH] New driver "sfc" for Solarstorm SFC4000 controller
From: Ben Hutchings @ 2008-01-29 16:22 UTC (permalink / raw)
  To: netdev; +Cc: Jeff Garzik, linux-net-drivers

This is a resubmission of a new driver for Solarflare network controllers.

The driver supports several types of PHY (10Gbase-T, XFP, CX4) on six
different 10G and 1G boards.  It is accompanied by an MTD driver that
allows access to the flash/EEPROM.

NICs based on this controller are now available from SMC as part numbers
SMC10GPCIe-XFP and SMC10GPCIe-10BT.

FYI the previous thread was:
  http://marc.info/?l=linux-netdev&m=120067352032298&w=4

Things that have changed since the last patch:

 - Changed ethtool support to use the default ethtool implementations
   where possible
 - Removed unused MDIO functions
 - Combined struct efx_nic and struct efx_nic_port, since the driver
   now only supports 1-port configurations
 - Removed/combined redundant members of struct efx_nic
 - Moved some constant members of struct efx_nic into struct efx_nic_type
 - Moved the two steps of efx_nic::dma_mask initialisation together
 - Eliminated efx_nic::features and efx_nic_type::features; moved all
   feature flag setting into efx_init_netdev()
 - Fixed page-based RX buffer alignment for architectures with strict
   alignment
 - Replaced spinlocks with mutexes where possible
 - Merged efx_{init,fini}_debugfs_nic_symlink into
   efx_{init,fini}_debugfs_netdev
 - Renamed efx_{init,fini}_netdev and corrected comments to
   indicate that they only (un)register the net device
 - Added EFX_FTL - fatal in debug builds otherwise equivalent to EFX_ERR
 - Changed RX FIFO watermarks to more reasonable values
 - Fixed various corner cases in PHY reconfiguration
 - Changed NET_DEV_NAME() to use efx->name, making races with
   (un)registration harmless
 - Fixed repetition of PCI or net device name in log messages
 - Renamed falcon_nic_params structure to falcon_nic_data
 - Fixed spelling, capitalisation, grammar, punctuation, spacing
   in various comments and log messages

We believe this is ready to be merged now and would like to know if
there is anything remaining that we need to fix or improve.

The patch (against netdev-2.6) is at:
  https://support.solarflare.com/netdev/6/netdev-2.6-sfc-2.2.0056.patch

The new files may also be downloaded as a tarball:
  https://support.solarflare.com/netdev/6/netdev-2.6-sfc-2.2.0056.tgz

And for verification there is:
  https://support.solarflare.com/netdev/6/MD5SUMS

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.

^ permalink raw reply

* [PATCH] pktgen: pktgen should not print info that it is spinning
From: Jesse Brandeburg @ 2008-01-28 21:16 UTC (permalink / raw)
  To: netdev; +Cc: davem, auke-jan.h.kok, Jesse Brandeburg, Robert Olsson

when using pktgen to send delay packets the module prints repeatedly to the
kernel log:
sleeping for X
sleeping for X
...

This is probably just a debugging item left in and should not be enabled for
regular use of the module.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Robert Olsson <Robert.Olsson@data.slu.se>
---

 net/core/pktgen.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)


diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 285ec3e..b1b1aba 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2138,7 +2138,6 @@ static void spin(struct pktgen_dev *pkt_dev, __u64 spin_until_us)
 	__u64 now;
 
 	start = now = getCurUs();
-	printk(KERN_INFO "sleeping for %d\n", (int)(spin_until_us - now));
 	while (now < spin_until_us) {
 		/* TODO: optimize sleeping behavior */
 		if (spin_until_us - now > jiffies_to_usecs(1) + 1)


^ permalink raw reply related

* status inquiry#2  (RE: [PATCH 01/03] ISATAP V2 (header file changes))
From: Templin, Fred L @ 2008-01-29 16:41 UTC (permalink / raw)
  To: netdev; +Cc: YOSHIFUJI Hideaki / 吉藤英明
In-Reply-To: <39C363776A4E8C4A94691D2BD9D1C9A1029EDDAC@XCH-NW-7V2.nw.nos.boeing.com>

Would appreciate a status update on this submission, posted 1/15/08.

Thanks - Fred
fred.l.templin@boeing.com 

> -----Original Message-----
> From: Templin, Fred L 
> Sent: Tuesday, January 15, 2008 11:57 AM
> To: netdev@vger.kernel.org
> Cc: YOSHIFUJI Hideaki / 吉藤英明
> Subject: [PATCH 01/03] ISATAP V2 (header file changes)
> 
> This patch updates the Linux the Intra-Site Automatic Tunnel 
> Addressing
> Protocol (ISATAP) implementation. It places the ISATAP 
> potential router
> list (PRL) in the kernel and adds three new private ioctls for PRL
> management. The diffs are specific to the netdev net-2.6.25 
> development
> tree taken by "git pull" on 1/14/08.
> 
> Signed-off-by: Fred L. Templin <fred.l.templin@boeing.com>
> 
> --- net-2.6.25/include/linux/skbuff.h.orig	2008-01-14 
> 15:33:36.000000000 -0800
> +++ net-2.6.25/include/linux/skbuff.h	2008-01-14 
> 15:43:06.000000000 -0800
> @@ -311,7 +311,8 @@ struct sk_buff {
>  	__u16			tc_verd;	/* traffic 
> control verdict */
>  #endif
>  #endif
> -	/* 2 byte hole */
> +	__u8			rtr_type;
> +	/* 1 byte hole */
>  
>  #ifdef CONFIG_NET_DMA
>  	dma_cookie_t		dma_cookie;
> --- net-2.6.25/include/linux/if_tunnel.h.orig	2008-01-14 
> 15:33:36.000000000 -0800
> +++ net-2.6.25/include/linux/if_tunnel.h	2008-01-14 
> 15:42:14.000000000 -0800
> @@ -7,6 +7,9 @@
>  #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
>  #define SIOCDELTUNNEL   (SIOCDEVPRIVATE + 2)
>  #define SIOCCHGTUNNEL   (SIOCDEVPRIVATE + 3)
> +#define SIOCADDPRL      (SIOCDEVPRIVATE + 4)
> +#define SIOCDELPRL      (SIOCDEVPRIVATE + 5)
> +#define SIOCCHGPRL      (SIOCDEVPRIVATE + 6)
>  
>  #define GRE_CSUM	__constant_htons(0x8000)
>  #define GRE_ROUTING	__constant_htons(0x4000)
> @@ -17,9 +20,6 @@
>  #define GRE_FLAGS	__constant_htons(0x00F8)
>  #define GRE_VERSION	__constant_htons(0x0007)
>  
> -/* i_flags values for SIT mode */
> -#define	SIT_ISATAP	0x0001
> -
>  struct ip_tunnel_parm
>  {
>  	char			name[IFNAMSIZ];
> @@ -30,5 +30,15 @@ struct ip_tunnel_parm
>  	__be32			o_key;
>  	struct iphdr		iph;
>  };
> +/* SIT-mode i_flags */
> +#define	SIT_ISATAP	0x0001
> +
> +struct ip_tunnel_prladdr {
> +	__be32			addr;
> +	__be16			flags;
> +	__be16			rsvd;
> +};
> +/* PRL flags */
> +#define	PRL_BORDER		0x0001
>  
>  #endif /* _IF_TUNNEL_H_ */
> --- net-2.6.25/include/net/ipip.h.orig	2008-01-14 
> 15:33:36.000000000 -0800
> +++ net-2.6.25/include/net/ipip.h	2008-01-14 
> 15:41:21.000000000 -0800
> @@ -24,6 +24,13 @@ struct ip_tunnel
>  	int			mlink;
>  
>  	struct ip_tunnel_parm	parms;
> +	struct ip_tunnel_prlent	*prl;		/* potential 
> router list */
> +};
> +
> +struct ip_tunnel_prlent
> +{
> +	struct ip_tunnel_prlent	*next;
> +	struct ip_tunnel_prladdr ent;
>  };
>  
>  #define IPTUNNEL_XMIT() do {					
> 	\
> --- net-2.6.25/include/net/ndisc.h.orig	2008-01-14 
> 15:40:28.000000000 -0800
> +++ net-2.6.25/include/net/ndisc.h	2008-01-15 
> 08:43:21.000000000 -0800
> @@ -12,6 +12,16 @@
>  #define NDISC_REDIRECT			137
>  
>  /*
> + * Router type: cross-layer information from link-layer to
> + * IPv6 layer reported by certain link types (e.g., RFC4214).
> + */
> +
> +#define RTRTYPE_UNSPEC			0 /* 
> unspecified (default) */
> +#define RTRTYPE_HOST			1 /* host or 
> unauthorized router */
> +#define RTRTYPE_INTERIOR		2 /* site-interior router */
> +#define RTRTYPE_BORDER			3 /* site 
> border router */
> +
> +/*
>   *	ndisc options
>   */
> --
> 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: Udev coldplugging loads 8139too driver instead of 8139cp
From: Ondrej Zary @ 2008-01-29 16:53 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Stephen Hemminger, netdev, linux-kernel
In-Reply-To: <479F0369.3080309@msgid.tls.msk.ru>

On Tuesday 29 January 2008 11:43:53 Michael Tokarev wrote:
> Stephen Hemminger wrote:
> > On Tue, 29 Jan 2008 03:46:08 +0300
> > Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> []
>
> >> There are 2 drivers for 8139-based NICs.  For really different two kinds
> >> of hardware, which both uses the same PCI identifiers.  Both drivers
> >> "claims" to work with all NICs with those PCI ids, because "externally"
> >> (by means of udev for example) it's impossible to distinguish the two
> >> kinds of hardware, it becomes clean only when the driver (either of the
> >> two) loads and actually checks which hardware we have here.
> >
> > Is there any chance of using subdevice or subversion to tell them apart?
> > That worked for other vendors like DLINK who slapped same ID on different
> > cards.
>
> If it were that simple... ;)
>
> No.  The difference is in PCI revision number (byte #8 in PCI config
> space). If it's >= 0x40 - it's 8139too, < 0x40 - 8139cp.  Or 0x20 - I
> forgot.

Perhaps a module could be created that will claim this device ID and then use 
the correct driver.

> Here's a code snippet from a shell script I used ages ago to automatically
> load modules (similar to what udev does nowadays):
>
>   # special hack for 8139{too,cp} stuff
>   case "$modalias" in
>   *v000010ECd00008139*)
>     rev="$(dd if="$1/config" bs=1 skip=8 count=1 2>/dev/null)"
>     if [ -n "$rev" ]; then
>       list=
>       for module in $modlist; do
>         case "$module" in
>         8139cp)
>           if [ ".$rev" \< ". " ]; then
>             $vecho1 "$TAG: not loading $module for this device"
>             continue
>           fi
>           ;;
>         8139too)
>           if [ ".$rev" \> ". " ]; then
>             $vecho1 "$TAG: not loading $module for this device"
>             continue
>           fi
>           ;;
>         esac
>         list="$list $module"
>       done
>       modlist="$list"
>     fi
>     ;;
>   esac
>
> /mjt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
Ondrej Zary

^ permalink raw reply

* [PATCH] forcedeth: mac address mcp77/79
From: Ayaz Abdulla @ 2008-01-28 15:24 UTC (permalink / raw)
  To: Jeff Garzik, Andrew Morton, nedev, stable

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

This patch is a critical fix for MCP77 and MCP79 devices. The feature 
flags were missing the define for correct mac address 
(DEV_HAS_CORRECT_MACADDR).

Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>


[-- Attachment #2: patch-forcedeth-macaddr-mcp77-79 --]
[-- Type: text/plain, Size: 4545 bytes --]

--- old/drivers/net/forcedeth.c	2008-01-28 10:15:28.000000000 -0500
+++ new/drivers/net/forcedeth.c	2008-01-28 10:17:38.000000000 -0500
@@ -5603,35 +5603,35 @@
 	},
 	{	/* MCP77 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP77 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP77 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP77 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP79 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP79 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP79 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{	/* MCP79 Ethernet Controller */
 		PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
-		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+		.driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
 	},
 	{0,},
 };

^ permalink raw reply

* Re: forcedeth oops
From: Ayaz Abdulla @ 2008-01-28 15:31 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Andrew Brooks, netdev
In-Reply-To: <479643E0.8070208@garzik.org>



Jeff Garzik wrote:
> Andrew Brooks wrote:
>  > Hello
>  >
>  > I'm getting an oops in forcedeth whenever I shutdown, details below.
>  >
>  > I've tried kernel 2.6.16.59 and the latest forcedeth.c from nvidia.com
>  > which is package-1.23 version-0.62 date-2007/04/27.
>  >
>  > How can I download the latest forcedeth.c (including 2008-01-13 
> patches) ?
>  > It's not in the latest snapshot linux-2.6.24-rc8.
>  >
>  > Also, why is the version on nvidia.com not just older than the one in
>  > the kernel, but it appears to have forked back in May 2006.  Has there
>  > been independent development on each version?  They should be the same!
> 
> We don't run nvidia.com here :)
> 
> 
>  > Here's the diff:
>  > <  *    0.56: 22 Mar 2006: Additional ethtool and moduleparam support.
>  > <  *    0.57: 14 May 2006: Moved mac address writes to nv_probe and 
> nv_remove.
>  > <  *    0.58: 20 May 2006: Optimized rx and tx data paths.
>  > <  *    0.59: 31 May 2006: Added support for sideband management unit.
>  > <  *    0.60: 31 May 2006: Added support for recoverable error.
>  > <  *    0.61: 18 Jul 2006: Added support for suspend/resume.
>  > <  *    0.62: 16 Jan 2007: Fixed statistics, mgmt communication, and 
> low phy speed on S5.
>  > ---
>  >>  *    0.56: 22 Mar 2006: Additional ethtool config and moduleparam 
> support.
>  >>  *    0.57: 14 May 2006: Mac address set in probe/remove and order 
> corrections.
>  >>  *    0.58: 30 Oct 2006: Added support for sideband management unit.
>  >>  *    0.59: 30 Oct 2006: Added support for recoverable error.
>  >>  *    0.60: 20 Jan 2007: Code optimizations for rings, rx & tx data 
> paths, and stats.
>  >
>  >
>  > Here's the details of the oops:
>  > md: md0 switched to read-only mode.
>  > Unable to handle kernel NULL pointer dereference at virtual address 
> 00000000
>  > printing eip:
>  > f8ccdd55
>  > *pde = 36c6a001
>  > Oops: 0000 [#1]
>  > SMP
>  > Modules linked in: nvidia ... forcedeth ... sata_nv
>  > CPU: 1
>  > EIP:
>  > EFLAGS: 00010286 (2.6.16.59 #1)
>  > EIP is at nv_suspend+0x85/0x350 [forcedeth]
>  > eax:
>  > esi:
>  > ds:
>  > Process reboot
>  > Stack:
>  > Call Trace:
>  > show_stack_log
>  > show_registers
>  > die
>  > do_page_fault
>  > error_code
>  > nv_reboot_handler
>  > notifier_call_chain
>  > kernel_restart_prepare
>  > kernel_restart
>  > sys_reboot
>  > sysenter_past_esp
>  > Code: 8b 8c 3a 98 01 00 00 01 c8 8b ...
>  > INIT: no more processes left in this runlevel
> 
> Please reproduce this problem on a modern kernel (2.6.24-rc) without any
> closed source modules or drivers loaded.  Thanks.

Andrew,

The driver from the nvidia.com site was forked because we needed to 
create a backport driver package for older kernels. At some point, we 
need to converge the two branches again.

Let us know if you still have an issue with the latest kernel as Jeff 
mentioned.

Regards,
Ayaz


> 
>         Jeff
> 
> 
> 
> --
> 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
> 

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply

* Still oopsing in nf_nat_move_storage()
From: Chuck Ebbert @ 2008-01-29 17:11 UTC (permalink / raw)
  To: Netdev

nf_nat_move_storage():
/usr/src/debug/kernel-2.6.23/linux-2.6.23.i686/net/ipv4/netfilter/nf_nat_core.c:612
      87:       f7 47 64 80 01 00 00    testl  $0x180,0x64(%edi)
      8e:       74 39                   je     c9 <nf_nat_move_storage+0x65>

line 612:
        if (!(ct->status & IPS_NAT_DONE_MASK))
                return;

ct is NULL



To reproduce, this is the Fedora iptables config file:

*nat
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to :21
COMMIT

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p icmp --icmp-type any -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

^ permalink raw reply

* Re: [PATCH] SELinux: Fix double free in selinux_netlbl_sock_setsid()
From: Paul Moore @ 2008-01-29 17:13 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, netdev, selinux, bunk, jmorris
In-Reply-To: <20080128.195124.188485009.davem@davemloft.net>

On Monday 28 January 2008 10:51:24 pm David Miller wrote:
> From: Paul Moore <paul.moore@hp.com>
> Date: Mon, 28 Jan 2008 21:20:26 -0500
>
> > As pointed out by Adrian Bunk, commit
> > 45c950e0f839fded922ebc0bfd59b1081cc71b70 caused a double-free when
> > security_netlbl_sid_to_secattr() fails.  This patch fixes this by
> > removing the netlbl_secattr_destroy() call from that function since we
> > are already releasing the secattr memory in
> > selinux_netlbl_sock_setsid().
> >
> > Signed-off-by: Paul Moore <paul.moore@hp.com>
>
> Applied, and I'll queue this up for -stable too.

Thanks.  Sorry for not catching this in the first place.

> Please, when mentioning specific commits please also provide
> the changelog headline along with the SHA1 hash.
>
> The reason is that when this fix is moved over to another
> tree where the SHA1 of the causing change is different people
> studying your fix won't be able to find it without more stable
> contextual information.

Noted, I'll make sure to include the patch description in the future.  I 
wasn't aware that the hash took into account anything other than the 
individual commit it represented.  However, now that I think about it, since 
order is so critical it only makes sense to have the hash take into account 
at least the previous commit.

-- 
paul moore
linux security @ hp

^ permalink raw reply

* Re: Still oopsing in nf_nat_move_storage()
From: Patrick McHardy @ 2008-01-29 17:18 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: Netdev, Netfilter Development Mailinglist
In-Reply-To: <479F5E5A.8050108@redhat.com>

Chuck Ebbert wrote:
> nf_nat_move_storage():
> /usr/src/debug/kernel-2.6.23/linux-2.6.23.i686/net/ipv4/netfilter/nf_nat_core.c:612
>       87:       f7 47 64 80 01 00 00    testl  $0x180,0x64(%edi)
>       8e:       74 39                   je     c9 <nf_nat_move_storage+0x65>
> 
> line 612:
>         if (!(ct->status & IPS_NAT_DONE_MASK))
>                 return;
> 
> ct is NULL

The current kernel (and 2.6.23-stable) have:

         if (!ct || !(ct->status & IPS_NAT_DONE_MASK))
                 return;

so it seems you're using an old version.

^ permalink raw reply

* Re: [PATCH] bfin_mac: Make the MDIO polling faster
From: Bryan Wu @ 2008-01-29 17:47 UTC (permalink / raw)
  To: Kalle Pokki; +Cc: netdev, Bryan Wu
In-Reply-To: <Pine.LNX.4.64.0801291427300.7503@pc-213-140-179-32.aina.net>


On Tue, 2008-01-29 at 20:28 +0800, Kalle Pokki wrote:
> The poll routine always got 10 ms penalty when called immediately 
> after starting the transfer. The MDIO transfer takes 25.6 us at the 
> noinal 2.5 MHz, so MAX_TIMEOUT_CNT being 500 is still big enough. 

Exactly, but we got a same fixing already.
It will be sent out soon.

Thanks a lot
-Bryan

> --- 
>  drivers/net/bfin_mac.c |    2 +- 
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c 
> index c199633..d2e6813 100644 
> --- a/drivers/net/bfin_mac.c 
> +++ b/drivers/net/bfin_mac.c 
> @@ -296,7 +296,7 @@ static void mdio_poll(void) 
>   
>         /* poll the STABUSY bit */ 
>         while ((bfin_read_EMAC_STAADD()) & STABUSY) { 
> -               mdelay(10); 
> +               udelay(1); 
>                 if (timeout_cnt-- < 0) { 
>                         printk(KERN_ERR DRV_NAME 
>                         ": wait MDC/MDIO transaction to complete
> timeout\n"); 
> -- 
> 1.4.4.2
> 

^ permalink raw reply

* Re: [PATCH] bfin_mac: Fix MDIO clock frequency
From: Bryan Wu @ 2008-01-29 18:01 UTC (permalink / raw)
  To: Kalle Pokki; +Cc: netdev, Bryan Wu
In-Reply-To: <Pine.LNX.4.64.0801291421440.7503@pc-213-140-179-32.aina.net>


On Tue, 2008-01-29 at 20:27 +0800, Kalle Pokki wrote:
> The clock divisor is set to all ones at reset. 
> --- 
>  drivers/net/bfin_mac.c |    2 +- 
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c 
> index eb97175..c199633 100644 
> --- a/drivers/net/bfin_mac.c 
> +++ b/drivers/net/bfin_mac.c 
> @@ -425,7 +425,7 @@ static int mii_probe(struct net_device *dev) 
>   
>         /* MDC  = 2.5 MHz */ 
>         sysctl = bfin_read_EMAC_SYSCTL(); 
> -       sysctl |= SET_MDCDIV(24); 
> +       sysctl = (sysctl & ~MDCDIV) | SET_MDCDIV(24); 

Good catch, I will apply this. 
Actually, another patch will modified this operation, you patch can not
be applied cleanly:

>From e347fc2fdb8d8ecd8fa563929fcfa51759d5ac1c Mon Sep 17 00:00:00 2001
From: Bryan Wu <bryan.wu@analog.com>
Date: Fri, 11 Jan 2008 15:17:03 +0800
Subject: [PATCH] [Blackfin] EMAC driver: define MDC_CLK=2.5MHz and caculate mdc_div according to SCLK.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
 drivers/net/bfin_mac.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 4006a5d..ee39819 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -412,20 +412,26 @@ static void bf537_adjust_link(struct net_device *dev)
 	spin_unlock_irqrestore(&lp->lock, flags);
 }
 
+/* MDC  = 2.5 MHz */
+#define MDC_CLK 2500000
+
 static int mii_probe(struct net_device *dev)
 {
 	struct bf537mac_local *lp = netdev_priv(dev);
 	struct phy_device *phydev = NULL;
 	unsigned short sysctl;
 	int i;
+	u32 sclk, mdc_div;
 
 	/* Enable PHY output early */
 	if (!(bfin_read_VR_CTL() & PHYCLKOE))
 		bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE);
 
-	/* MDC  = 2.5 MHz */
+	sclk = get_sclk();
+	mdc_div = ((sclk / MDC_CLK) / 2) - 1;
+
 	sysctl = bfin_read_EMAC_SYSCTL();
-	sysctl |= SET_MDCDIV(24);
+	sysctl |= SET_MDCDIV(mdc_div);
 	bfin_write_EMAC_SYSCTL(sysctl);
 
 	/* search for connect PHY device */
@@ -477,8 +483,10 @@ static int mii_probe(struct net_device *dev)
 	lp->phydev = phydev;
 
 	printk(KERN_INFO "%s: attached PHY driver [%s] "
-	       "(mii_bus:phy_addr=%s, irq=%d)\n",
-	       DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+	       "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
+	       "@sclk=%dMHz)\n",
+	       DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq,
+	       MDC_CLK, mdc_div, sclk/1000000);
 
 	return 0;
 }
-- 
1.5.3.4

Do you mind I modified you patch to against this one and send out as a patch set to upstream?

Regards,
-Bryan

^ permalink raw reply related

* Lots of "BUG eth1 code -5 qlen 0" messages in 2.6.24
From: Erik Mouw @ 2008-01-29 18:47 UTC (permalink / raw)
  To: netdev; +Cc: Peter P Waskiewicz Jr

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

Hi,

I've just started to use 2.6.24 on my home firewall (before it was
running 2.6.24-rc2 for about 65 days) and I noticed a couple of error
messages I've never seen before:

Jan 29 07:50:54 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 08:28:30 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 08:57:30 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 09:44:04 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 10:01:35 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 10:01:35 gateway last message repeated 2 times
Jan 29 10:16:48 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 10:16:48 gateway last message repeated 2 times
Jan 29 10:45:48 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 10:45:48 gateway last message repeated 2 times
Jan 29 11:10:01 gateway kernel: BUG eth1 code -5 qlen 0
Jan 29 11:10:02 gateway last message repeated 9 times

The message seems to be coming from the qdisc_restart() in
net/sched/sch_generic.c which was changed with commit
5f1a485d5905aa641f33009019b3699076666a4c .

The NIC is an IBM EtherJet cardbus card using the xircom_cb driver:

05:00.0 Ethernet controller: Xircom Cardbus Ethernet 10/100 (rev 03)
        Subsystem: IBM 10/100 EtherJet Cardbus Adapter
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
        ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium
        >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 64 (5000ns min, 10000ns max)
        Interrupt: pin A routed to IRQ 11
        Region 0: I/O ports at 1800 [size=128]
        Region 1: Memory at 2c000000 (32-bit, non-prefetchable)
        [size=2K]
        Region 2: Memory at 2c000800 (32-bit, non-prefetchable)
        [size=2K]
        [virtual] Expansion ROM at 28000000 [disabled] [size=16K]
        Capabilities: [dc] Power Management version 1
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
                Status: D0 PME-Enable- DSel=0 DScale=2 PME-
00: 5d 11 03 00 07 00 10 02 03 00 00 02 00 40 00 00
10: 01 18 00 00 00 00 00 2c 00 08 00 2c 00 00 00 00
20: 00 00 00 00 00 00 00 00 07 01 00 00 14 10 81 81
30: 00 00 00 00 dc 00 00 00 00 00 00 00 0b 01 14 28

PCI: Enabling device 0000:05:00.0 (0000 -> 0003)
ACPI: PCI Interrupt 0000:05:00.0[A] -> Link [LNKB] -> GSI 11 (level, low) -> IRQ 11
PCI: Setting latency timer of device 0000:05:00.0 to 64
eth1: Xircom cardbus revision 3 at irq 11

Question is: do I need to worry about these messages or are they
harmless?


Erik

-- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery

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

^ permalink raw reply

* Re: [PATCH] bfin_mac: Fix MDIO clock frequency
From: Kalle Pokki @ 2008-01-29 20:05 UTC (permalink / raw)
  To: Bryan Wu; +Cc: netdev
In-Reply-To: <1201629697.26902.21.camel@roc-laptop>

On Wed, 30 Jan 2008, Bryan Wu wrote:

> 
> On Tue, 2008-01-29 at 20:27 +0800, Kalle Pokki wrote:
> > The clock divisor is set to all ones at reset. 
> > --- 
> >  drivers/net/bfin_mac.c |    2 +- 
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c 
> > index eb97175..c199633 100644 
> > --- a/drivers/net/bfin_mac.c 
> > +++ b/drivers/net/bfin_mac.c 
> > @@ -425,7 +425,7 @@ static int mii_probe(struct net_device *dev) 
> >   
> >         /* MDC  = 2.5 MHz */ 
> >         sysctl = bfin_read_EMAC_SYSCTL(); 
> > -       sysctl |= SET_MDCDIV(24); 
> > +       sysctl = (sysctl & ~MDCDIV) | SET_MDCDIV(24); 
> 
> Good catch, I will apply this. 
> Actually, another patch will modified this operation, you patch can not
> be applied cleanly:
> 
> >From e347fc2fdb8d8ecd8fa563929fcfa51759d5ac1c Mon Sep 17 00:00:00 2001
> From: Bryan Wu <bryan.wu@analog.com>
> Date: Fri, 11 Jan 2008 15:17:03 +0800
> Subject: [PATCH] [Blackfin] EMAC driver: define MDC_CLK=2.5MHz and caculate mdc_div according to SCLK.
> 
> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
> ---
>  drivers/net/bfin_mac.c |   16 ++++++++++++----
>  1 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
> index 4006a5d..ee39819 100644
> --- a/drivers/net/bfin_mac.c
> +++ b/drivers/net/bfin_mac.c
> @@ -412,20 +412,26 @@ static void bf537_adjust_link(struct net_device *dev)
>  	spin_unlock_irqrestore(&lp->lock, flags);
>  }
>  
> +/* MDC  = 2.5 MHz */
> +#define MDC_CLK 2500000
> +
>  static int mii_probe(struct net_device *dev)
>  {
>  	struct bf537mac_local *lp = netdev_priv(dev);
>  	struct phy_device *phydev = NULL;
>  	unsigned short sysctl;
>  	int i;
> +	u32 sclk, mdc_div;
>  
>  	/* Enable PHY output early */
>  	if (!(bfin_read_VR_CTL() & PHYCLKOE))
>  		bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE);
>  
> -	/* MDC  = 2.5 MHz */
> +	sclk = get_sclk();
> +	mdc_div = ((sclk / MDC_CLK) / 2) - 1;
> +
>  	sysctl = bfin_read_EMAC_SYSCTL();
> -	sysctl |= SET_MDCDIV(24);
> +	sysctl |= SET_MDCDIV(mdc_div);
>  	bfin_write_EMAC_SYSCTL(sysctl);
>  
>  	/* search for connect PHY device */
> @@ -477,8 +483,10 @@ static int mii_probe(struct net_device *dev)
>  	lp->phydev = phydev;
>  
>  	printk(KERN_INFO "%s: attached PHY driver [%s] "
> -	       "(mii_bus:phy_addr=%s, irq=%d)\n",
> -	       DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
> +	       "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
> +	       "@sclk=%dMHz)\n",
> +	       DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq,
> +	       MDC_CLK, mdc_div, sclk/1000000);
>  
>  	return 0;
>  }
> -- 
> 1.5.3.4
> 
> Do you mind I modified you patch to against this one and send out as a patch set to upstream?

No, I don't mind.

^ permalink raw reply

* RE: Lots of "BUG eth1 code -5 qlen 0" messages in 2.6.24
From: Waskiewicz Jr, Peter P @ 2008-01-29 19:57 UTC (permalink / raw)
  To: Erik Mouw, netdev
In-Reply-To: <20080129184726.GA29300@gateway.home>

> I've just started to use 2.6.24 on my home firewall (before 
> it was running 2.6.24-rc2 for about 65 days) and I noticed a 
> couple of error messages I've never seen before:
> 
> Jan 29 07:50:54 gateway kernel: BUG eth1 code -5 qlen 0 Jan 
> 29 08:28:30 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 08:57:30 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 09:44:04 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 10:01:35 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 10:01:35 gateway last message repeated 2 times Jan 29 
> 10:16:48 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 10:16:48 gateway last message repeated 2 times Jan 29 
> 10:45:48 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 10:45:48 gateway last message repeated 2 times Jan 29 
> 11:10:01 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> 11:10:02 gateway last message repeated 9 times
> 
> The message seems to be coming from the qdisc_restart() in 
> net/sched/sch_generic.c which was changed with commit 
> 5f1a485d5905aa641f33009019b3699076666a4c .
> 
> The NIC is an IBM EtherJet cardbus card using the xircom_cb driver:

Are you using any specific qdisc, or just the default pfifo_fast?  Have
you done any specific tuning on your qdisc as well?  The default qlen
seems to have been changed.

Basically your queue is being overrun, and with the current checks in
the kernel in the stack, it's allowing the skb into the driver.  I've
known about this issue, and I'm hesitant to push a patch to re-add the
netif_queue_stopped() check into qdisc_restart().  I'd rather push a
one-time patch to the drivers that interacts with
netif_stop_subqueue(netdev, 0), so we can completely decouple the single
queue from the netdev.

I'd say you can somewhat ignore the messages for now.  But there is work
to be done here, and it's obvious I need to do this sooner than later.
Please let me know about the qdisc parameters though when you get a
chance.

Thanks,

-PJ Waskiewicz
<peter.p.waskiewicz.jr@intel.com>

^ permalink raw reply

* netdev->priv and netdev_priv(dev)
From: Krzysztof Halasa @ 2008-01-29 20:10 UTC (permalink / raw)
  To: netdev

A commit few months ago introduced a change:

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
 
 static inline void *netdev_priv(const struct net_device *dev)
 {
-       return (char *)dev + ((sizeof(struct net_device)
-                                       + NETDEV_ALIGN_CONST)
-                               & ~NETDEV_ALIGN_CONST);
+       return dev->priv;
 }
 
This change caused some problems for drivers which used
netdev_priv(dev) and dev->priv for different purposes.


The following patch restores previous behaviour.

Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -584,7 +584,10 @@ struct net_device
 
 static inline void *netdev_priv(const struct net_device *dev)
 {
-	return dev->priv;
+	return (char *)dev + ((sizeof(struct net_device) +
+			       sizeof(struct net_device_subqueue) *
+			       (dev->egress_subqueue_count - 1) +
+			       NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
 }
 
 #define SET_MODULE_OWNER(dev) do { } while (0)
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3693,13 +3693,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
 		(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
 	dev->padded = (char *)dev - (char *)p;
 
-	if (sizeof_priv) {
-		dev->priv = ((char *)dev +
-			     ((sizeof(struct net_device) +
-			       (sizeof(struct net_device_subqueue) *
-				(queue_count - 1)) + NETDEV_ALIGN_CONST)
-			      & ~NETDEV_ALIGN_CONST));
-	}
+	if (sizeof_priv)
+		dev->priv = netdev_priv(dev);
 
 	dev->egress_subqueue_count = queue_count;
 

^ permalink raw reply

* Re: [PATCH] PHYLIB: Locking fixes for PHY I/O potentially sleeping
From: Haavard Skinnemoen @ 2008-01-29 20:12 UTC (permalink / raw)
  To: Nate Case; +Cc: Jeff Garzik, Andy Fleming, David S. Miller, netdev
In-Reply-To: <1201622709.12444.118.camel@localhost.localdomain>

On Tue, 29 Jan 2008 10:05:09 -0600
Nate Case <ncase@xes-inc.com> wrote:

> +/* PHY timer which schedules the state machine work */
> +static void phy_timer(unsigned long data)
> +{
> +	struct phy_device *phydev = (struct phy_device *)data;
> +
> +	/*
> +	 * PHY I/O operations can potentially sleep so we ensure that
> +	 * it's done from a process context
> +	 */
> +	schedule_work(&phydev->state_queue);
> +}

If you use schedule_delayed_work() instead, you can get rid of the
timer.

Haavard

^ permalink raw reply

* [PATCH 1/1 resend][arm/at91_ether.c]  logical/bitand typo in function reset_phy() (inactive), drivers/net/arm/at91_ether.c
From: Roel Kluin @ 2008-01-29 20:14 UTC (permalink / raw)
  To: andrew, Jeff Garzik; +Cc: netdev, linux-arm-kernel

include/linux/mii.h:48:#define BMCR_RESET 0x8000

The function reset_phy() is in "#if 0" inactivated code
--
Replace logical "&&" by bit "&" before BMCR_RESET

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 25b114a..0ae0d83 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -384,7 +384,7 @@ static void reset_phy(struct net_device *dev)
 	/* Wait until PHY reset is complete */
 	do {
 		read_phy(lp->phy_address, MII_BMCR, &bmcr);
-	} while (!(bmcr && BMCR_RESET));
+	} while (!(bmcr & BMCR_RESET));
 
 	disable_mdi();
 	spin_unlock_irq(&lp->lock);


^ permalink raw reply related

* [PATCH] netdev->priv and netdev_priv(dev)
From: Krzysztof Halasa @ 2008-01-29 20:19 UTC (permalink / raw)
  To: netdev

[This version shouldn't confuse git/patch]

A commit few months ago introduced a change:

- a/include/linux/netdevice.h
+ b/include/linux/netdevice.h
 
 static inline void *netdev_priv(const struct net_device *dev)
 {
-       return (char *)dev + ((sizeof(struct net_device)
-                                       + NETDEV_ALIGN_CONST)
-                               & ~NETDEV_ALIGN_CONST);
+       return dev->priv;
 }
 
This change caused some problems for drivers which used
netdev_priv(dev) and dev->priv for different purposes.


The following patch restores previous behaviour.

Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -584,7 +584,10 @@ struct net_device
 
 static inline void *netdev_priv(const struct net_device *dev)
 {
-	return dev->priv;
+	return (char *)dev + ((sizeof(struct net_device) +
+			       sizeof(struct net_device_subqueue) *
+			       (dev->egress_subqueue_count - 1) +
+			       NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
 }
 
 #define SET_MODULE_OWNER(dev) do { } while (0)
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3693,13 +3693,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
 		(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
 	dev->padded = (char *)dev - (char *)p;
 
-	if (sizeof_priv) {
-		dev->priv = ((char *)dev +
-			     ((sizeof(struct net_device) +
-			       (sizeof(struct net_device_subqueue) *
-				(queue_count - 1)) + NETDEV_ALIGN_CONST)
-			      & ~NETDEV_ALIGN_CONST));
-	}
+	if (sizeof_priv)
+		dev->priv = netdev_priv(dev);
 
 	dev->egress_subqueue_count = queue_count;
 

^ permalink raw reply

* PATCH[1/1]: Add ctr-aes support to ipsec
From: Joy Latten @ 2008-01-29 20:18 UTC (permalink / raw)
  To: netdev; +Cc: davem, herbert

The below patch allows IPsec to use CTR mode with
AES encryption algorithm. Tested this using setkey
in ipsec-tools.

regards,
Joy

diff -urpN net-2.6.25/include/linux/pfkeyv2.h net-2.6.25.patch/include/linux/pfkeyv2.h
--- net-2.6.25/include/linux/pfkeyv2.h	2008-01-29 11:48:00.000000000 -0600
+++ net-2.6.25.patch/include/linux/pfkeyv2.h	2008-01-29 13:43:59.000000000 -0600
@@ -298,6 +298,7 @@ struct sadb_x_sec_ctx {
 #define SADB_X_EALG_BLOWFISHCBC		7
 #define SADB_EALG_NULL			11
 #define SADB_X_EALG_AESCBC		12
+#define SADB_X_EALG_AESCTR		13
 #define SADB_X_EALG_CAMELLIACBC		22
 #define SADB_EALG_MAX                   253 /* last EALG */
 /* private allocations should use 249-255 (RFC2407) */
diff -urpN net-2.6.25/net/xfrm/xfrm_algo.c net-2.6.25.patch/net/xfrm/xfrm_algo.c
--- net-2.6.25/net/xfrm/xfrm_algo.c	2008-01-29 11:48:03.000000000 -0600
+++ net-2.6.25.patch/net/xfrm/xfrm_algo.c	2008-01-29 13:42:43.000000000 -0600
@@ -300,6 +300,23 @@ static struct xfrm_algo_desc ealg_list[]
 		.sadb_alg_maxbits = 256
 	}
 },
+{
+	.name = "rfc3686(ctr(aes))",
+
+	.uinfo = {
+		.encr = {
+			.blockbits = 128,
+			.defkeybits = 160, /* 128-bit key + 32-bit nonce */
+		}
+	},
+
+	.desc = {
+		.sadb_alg_id = SADB_X_EALG_AESCTR,
+		.sadb_alg_ivlen	= 8,
+		.sadb_alg_minbits = 128,
+		.sadb_alg_maxbits = 256
+	}
+},
 };
 
 static struct xfrm_algo_desc calg_list[] = {

^ permalink raw reply

* Re: netdev->priv and netdev_priv(dev)
From: Stephen Hemminger @ 2008-01-29 20:42 UTC (permalink / raw)
  To: netdev
In-Reply-To: <m3tzkwv1ev.fsf@maximus.localdomain>

On Tue, 29 Jan 2008 21:10:00 +0100
Krzysztof Halasa <khc@pm.waw.pl> wrote:

> A commit few months ago introduced a change:
> 
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
>  
>  static inline void *netdev_priv(const struct net_device *dev)
>  {
> -       return (char *)dev + ((sizeof(struct net_device)
> -                                       + NETDEV_ALIGN_CONST)
> -                               & ~NETDEV_ALIGN_CONST);
> +       return dev->priv;
>  }
>  
> This change caused some problems for drivers which used
> netdev_priv(dev) and dev->priv for different purposes.
> 

Those drivers were making a incorrect assumption and should be fixed.
The in-tree drivers were fixed when this was done. If you have an out
of tree driver, then too bad for you.

> 
> The following patch restores previous behaviour.
> 
> Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
> 
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -584,7 +584,10 @@ struct net_device
>  
>  static inline void *netdev_priv(const struct net_device *dev)
>  {
> -	return dev->priv;
> +	return (char *)dev + ((sizeof(struct net_device) +
> +			       sizeof(struct net_device_subqueue) *
> +			       (dev->egress_subqueue_count - 1) +
> +			       NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
>  }
>  
>  #define SET_MODULE_OWNER(dev) do { } while (0)
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3693,13 +3693,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
>  		(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
>  	dev->padded = (char *)dev - (char *)p;
>  
> -	if (sizeof_priv) {
> -		dev->priv = ((char *)dev +
> -			     ((sizeof(struct net_device) +
> -			       (sizeof(struct net_device_subqueue) *
> -				(queue_count - 1)) + NETDEV_ALIGN_CONST)
> -			      & ~NETDEV_ALIGN_CONST));
> -	}
> +	if (sizeof_priv)
> +		dev->priv = netdev_priv(dev);
>  
>  	dev->egress_subqueue_count = queue_count;
>  

The additional overhead of the address calculation would slow down the
well behaved drivers.  There was discussion of alternative layouts of
the network device allocation or limiting the number of subqueue's so
that netdev_priv could be a simple addition again, but nothing came of
it.



-- 
Stephen Hemminger <stephen.hemminger@vyatta.com>



^ permalink raw reply

* Re: [NET_SCHED]: sch_ingress: remove netfilter support
From: jamal @ 2008-01-29 20:54 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David S. Miller, Linux Netdev List
In-Reply-To: <479F460B.2060104@trash.net>


About time - Thanks Patrick.

Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>

 
cheers,
jamal


^ permalink raw reply

* RE: Lots of "BUG eth1 code -5 qlen 0" messages in 2.6.24
From: jamal @ 2008-01-29 20:57 UTC (permalink / raw)
  To: Waskiewicz Jr, Peter P; +Cc: Erik Mouw, netdev
In-Reply-To: <D5C1322C3E673F459512FB59E0DDC329046C6CC7@orsmsx414.amr.corp.intel.com>

On Tue, 2008-29-01 at 11:57 -0800, Waskiewicz Jr, Peter P wrote:
> > I've just started to use 2.6.24 on my home firewall (before 
> > it was running 2.6.24-rc2 for about 65 days) and I noticed a 
> > couple of error messages I've never seen before:
> > 
> > Jan 29 07:50:54 gateway kernel: BUG eth1 code -5 qlen 0 Jan 
> > 29 08:28:30 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 08:57:30 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 09:44:04 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 10:01:35 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 10:01:35 gateway last message repeated 2 times Jan 29 
> > 10:16:48 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 10:16:48 gateway last message repeated 2 times Jan 29 
> > 10:45:48 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 10:45:48 gateway last message repeated 2 times Jan 29 
> > 11:10:01 gateway kernel: BUG eth1 code -5 qlen 0 Jan 29 
> > 11:10:02 gateway last message repeated 9 times
> > 
> > The message seems to be coming from the qdisc_restart() in 
> > net/sched/sch_generic.c which was changed with commit 
> > 5f1a485d5905aa641f33009019b3699076666a4c .
> > 
> > The NIC is an IBM EtherJet cardbus card using the xircom_cb driver:
> 
> Are you using any specific qdisc, or just the default pfifo_fast?  Have
> you done any specific tuning on your qdisc as well?  The default qlen
> seems to have been changed.

The driver seems buggy. Make it return NETDEV_TX_BUSY instead of -EIO
in xircom_start_xmit() and the messages will go away.

cheers,
jamal




^ 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