netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Natsemi DP83815 driver spaming
       [not found] <46365887.3010705@interia.pl>
@ 2007-05-01  3:55 ` Andrew Morton
       [not found]   ` <4636E970.3010602@interia.pl>
  2007-05-01  8:46   ` Mark Brown
  0 siblings, 2 replies; 14+ messages in thread
From: Andrew Morton @ 2007-05-01  3:55 UTC (permalink / raw)
  To: Rafał Bilski; +Cc: linux-kernel, netdev, Mark Brown

On Mon, 30 Apr 2007 22:58:47 +0200 Rafał Bilski <rafalbilski@interia.pl> wrote:

> Hello,
> 
> I have Wyse 3360SE terminal running Linux 2.6.21-rc7. Everything 
> works great with one small exception. Natsemi DP83815 driver is 
> filling log with:
> > ezri user.info kernel: eth0: DSPCFG accepted after 0 usec.
> > ezri user.notice kernel: eth0: Wake-up event 0x80000a
> > ezri user.info kernel: eth0: Setting full-duplex based on negotiated link capability.
> every 5 seconds. I can comment out these messages, but I would 
> like to turn off the source of wake up event. It is a bit 
> strange to see wakeup event on running system. 
> 
> Please CC me.
> 
> Thank You
> Rafał
> 
> natsemi dp8381x driver, version 2.1, Sept 11, 2006
>   originally by Donald Becker <becker@scyld.com>
>   http://www.scyld.com/network/natsemi.html
>   2.4.x kernel port by Jeff Garzik, Tjeerd Mulder
> PCI: Setting latency timer of device 0000:00:0f.0 to 64
> natsemi eth0: NatSemi DP8381[56] at 0x10010000 (0000:00:0f.0), 00:80:64:10:c6:09, IRQ 10, port TP.
> 
> 00:0f.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller
> 	Subsystem: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller
> 	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 (2750ns min, 13000ns max)
> 	Interrupt: pin A routed to IRQ 10
> 	Region 0: I/O ports at f800 [size=256]
> 	Region 1: Memory at 10010000 (32-bit, non-prefetchable) [size=4K]
> 	[virtual] Expansion ROM at 10000000 [disabled] [size=64K]
> 	Capabilities: [40] Power Management version 2
> 		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=320mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
> 		Status: D0 PME-Enable- DSel=0 DScale=0 PME+
> 
> 

It seems to be repeatedly setting the same duplex setting.  The closest
thing I can see in there in recent times is
68c90166e4aaa15ddcdd4778ad30bfb8b32534be, "Add support for using MII port
with no PHY".

Does applying the below backout patch fix things?


diff -puN drivers/net/natsemi.c~a drivers/net/natsemi.c
--- a/drivers/net/natsemi.c~a
+++ a/drivers/net/natsemi.c
@@ -573,8 +573,6 @@ struct netdev_private {
 	u32 intr_status;
 	/* Do not touch the nic registers */
 	int hands_off;
-	/* Don't pay attention to the reported link state. */
-	int ignore_phy;
 	/* external phy that is used: only valid if dev->if_port != PORT_TP */
 	int mii;
 	int phy_addr_external;
@@ -703,10 +701,7 @@ static void __devinit natsemi_init_media
 	struct netdev_private *np = netdev_priv(dev);
 	u32 tmp;
 
-	if (np->ignore_phy)
-		netif_carrier_on(dev);
-	else
-		netif_carrier_off(dev);
+	netif_carrier_off(dev);
 
 	/* get the initial settings from hardware */
 	tmp            = mdio_read(dev, MII_BMCR);
@@ -816,13 +811,8 @@ static int __devinit natsemi_probe1 (str
 	np->hands_off = 0;
 	np->intr_status = 0;
 	np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size;
-	if (natsemi_pci_info[chip_idx].flags & NATSEMI_FLAG_IGNORE_PHY)
-		np->ignore_phy = 1;
-	else
-		np->ignore_phy = 0;
 
 	/* Initial port:
-	 * - If configured to ignore the PHY set up for external.
 	 * - If the nic was configured to use an external phy and if find_mii
 	 *   finds a phy: use external port, first phy that replies.
 	 * - Otherwise: internal port.
@@ -830,7 +820,7 @@ static int __devinit natsemi_probe1 (str
 	 * The address would be used to access a phy over the mii bus, but
 	 * the internal phy is accessed through mapped registers.
 	 */
-	if (np->ignore_phy || readl(ioaddr + ChipConfig) & CfgExtPhy)
+	if (readl(ioaddr + ChipConfig) & CfgExtPhy)
 		dev->if_port = PORT_MII;
 	else
 		dev->if_port = PORT_TP;
@@ -840,9 +830,7 @@ static int __devinit natsemi_probe1 (str
 
 	if (dev->if_port != PORT_TP) {
 		np->phy_addr_external = find_mii(dev);
-		/* If we're ignoring the PHY it doesn't matter if we can't
-		 * find one. */
-		if (!np->ignore_phy && np->phy_addr_external == PHY_ADDR_NONE) {
+		if (np->phy_addr_external == PHY_ADDR_NONE) {
 			dev->if_port = PORT_TP;
 			np->phy_addr_external = PHY_ADDR_INTERNAL;
 		}
@@ -908,8 +896,6 @@ static int __devinit natsemi_probe1 (str
 		printk("%02x, IRQ %d", dev->dev_addr[i], irq);
 		if (dev->if_port == PORT_TP)
 			printk(", port TP.\n");
-		else if (np->ignore_phy)
-			printk(", port MII, ignoring PHY\n");
 		else
 			printk(", port MII, phy ad %d.\n", np->phy_addr_external);
 	}
@@ -1590,13 +1576,9 @@ static void check_link(struct net_device
 {
 	struct netdev_private *np = netdev_priv(dev);
 	void __iomem * ioaddr = ns_ioaddr(dev);
-	int duplex = np->duplex;
+	int duplex;
 	u16 bmsr;
 
-	/* If we are ignoring the PHY then don't try reading it. */
-	if (np->ignore_phy)
-		goto propagate_state;
-
 	/* The link status field is latched: it remains low after a temporary
 	 * link failure until it's read. We need the current link status,
 	 * thus read twice.
@@ -1608,7 +1590,7 @@ static void check_link(struct net_device
 		if (netif_carrier_ok(dev)) {
 			if (netif_msg_link(np))
 				printk(KERN_NOTICE "%s: link down.\n",
-				       dev->name);
+					dev->name);
 			netif_carrier_off(dev);
 			undo_cable_magic(dev);
 		}
@@ -1632,7 +1614,6 @@ static void check_link(struct net_device
 			duplex = 1;
 	}
 
-propagate_state:
 	/* if duplex is set then bit 28 must be set, too */
 	if (duplex ^ !!(np->rx_config & RxAcceptTx)) {
 		if (netif_msg_link(np))
@@ -2861,15 +2842,6 @@ static int netdev_set_ecmd(struct net_de
 	}
 
 	/*
-	 * If we're ignoring the PHY then autoneg and the internal
-	 * transciever are really not going to work so don't let the
-	 * user select them.
-	 */
-	if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE ||
-			       ecmd->port == PORT_TP))
-		return -EINVAL;
-
-	/*
 	 * maxtxpkt, maxrxpkt: ignored for now.
 	 *
 	 * transceiver:
_


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
       [not found]     ` <4636F90A.2070303@interia.pl>
@ 2007-05-01  8:35       ` Andrew Morton
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2007-05-01  8:35 UTC (permalink / raw)
  To: Rafał Bilski; +Cc: linux-kernel, netdev, Mark Brown

On Tue, 01 May 2007 10:23:38 +0200 Rafał Bilski <rafalbilski@interia.pl> wrote:

> Hello again,
> 
> I have downloaded DP83815 datasheet and I see that
> > eth0: Wake-up event 0x200000a
> means "broadcast received" and wakup on broadcast and 
> unicast enabled.
> > eth0: Wake-up event 0x80000a
> Above means "unicast received" and wakup on broadcast 
> and unicast enabled.
> I will try to check if disabling wakeup makes any difference.
> 

Thanks.

You've removed all the cc's I added.  I put them back.  Please always do
reply-to-all.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-01  3:55 ` Natsemi DP83815 driver spaming Andrew Morton
       [not found]   ` <4636E970.3010602@interia.pl>
@ 2007-05-01  8:46   ` Mark Brown
  2007-05-01 10:25     ` Rafał Bilski
  1 sibling, 1 reply; 14+ messages in thread
From: Mark Brown @ 2007-05-01  8:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Rafał Bilski, linux-kernel, netdev

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

On Mon, Apr 30, 2007 at 08:55:22PM -0700, Andrew Morton wrote:
> On Mon, 30 Apr 2007 22:58:47 +0200 Rafał Bilski <rafalbilski@interia.pl> wrote:
> > > ezri user.info kernel: eth0: DSPCFG accepted after 0 usec.
> > > ezri user.notice kernel: eth0: Wake-up event 0x80000a
> > > ezri user.info kernel: eth0: Setting full-duplex based on negotiated link capability.

Could you please run "ethtool -s eth0 msglvl 0xffffffff" to turn logging
from the driver right up and send a log?  This will spam the log if
there is any traffic but should say why the driver is doing this.

> It seems to be repeatedly setting the same duplex setting.  The closest
> thing I can see in there in recent times is
> 68c90166e4aaa15ddcdd4778ad30bfb8b32534be, "Add support for using MII port
> with no PHY".

It's not just setting the same duplex setting, the WoL message indicates
that it's doing that as part of init_registers() which should only be
happening in error handling paths and during resume or open.

-- 
"You grabbed my hand and we fell into it, like a daydream - or a fever."

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-01  8:46   ` Mark Brown
@ 2007-05-01 10:25     ` Rafał Bilski
  2007-05-01 18:08       ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Rafał Bilski @ 2007-05-01 10:25 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel, netdev

> [...] 
> Could you please run "ethtool -s eth0 msglvl 0xffffffff" to turn logging
> from the driver right up and send a log?  This will spam the log if
> there is any traffic but should say why the driver is doing this.
> 
OK. Here it is. It is from 2.6.21.1 with Andrew patch applied. I had to 
disable /var/log/messages because I have root fs on 1GB SD card. It is 
output from dmesg command.
Btw. I've tried kexec, but it isn't working. I will have to flash kernel 
each time.

Thank You
Rafał

eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 6 status was 0x98800076.
eth0: Transmit frame #4 queued in slot 3.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 7 status was 0x98800046.
eth0: tx frame #3 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 8 status was 0x98800076.
eth0: Transmit frame #5 queued in slot 4.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 9 status was 0x98800046.
eth0: tx frame #4 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 10 status was 0x98800076.
eth0: Transmit frame #6 queued in slot 5.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 11 status was 0x98800046.
eth0: tx frame #5 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 12 status was 0x98800076.
eth0: Transmit frame #7 queued in slot 6.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 13 status was 0x98800046.
eth0: tx frame #6 finished, status 0x8000072.
eth0: Transmit frame #8 queued in slot 7.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 14 status was 0x98800046.
eth0: tx frame #7 finished, status 0x8000242.
eth0: Transmit frame #9 queued in slot 8.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 15 status was 0x98800046.
eth0: tx frame #8 finished, status 0x8000072.
eth0: Media selection timer tick.
eth0: possible phy reset: re-initializing
eth0: Tx/Rx process stopped in 0 usec.
  Tx ring at c1189200:
 #0 desc. 0x1189210 0x8000072 0x13c405e.
 #1 desc. 0x1189220 0x8000072 0x134885e.
 #2 desc. 0x1189230 0x8000072 0x13d185e.
 #3 desc. 0x1189240 0x8000072 0x13be05e.
 #4 desc. 0x1189250 0x8000072 0x3bb05e.
 #5 desc. 0x1189260 0x8000072 0x139885e.
 #6 desc. 0x1189270 0x8000072 0x13ac05e.
 #7 desc. 0x1189280 0x8000242 0x139805e.
 #8 desc. 0x1189290 0x8000072 0xc6305e.
 #9 desc. 0x11892a0 0x000000 0x13b305e.
 #10 desc. 0x11892b0 0x000000 0x107965e.
 #11 desc. 0x11892c0 0x000000 0x13ed05e.
 #12 desc. 0x11892d0 0x000000 0x1b0585e.
 #13 desc. 0x11892e0 0x000000 0x13be05e.
 #14 desc. 0x11892f0 0x000000 0xc6785e.
 #15 desc. 0x1189200 0x000000 0x138a05e.
  Rx ring c1189000:
 #0 desc. 0x1189010 0x0005f2 0xc67810.
 #1 desc. 0x1189020 0x0005f2 0x13a0010.
 #2 desc. 0x1189030 0x0005f2 0x11d0010.
 #3 desc. 0x1189040 0x0005f2 0x13c4010.
 #4 desc. 0x1189050 0x0005f2 0x13b3010.
 #5 desc. 0x1189060 0x0005f2 0x13c4810.
 #6 desc. 0x1189070 0x0005f2 0x1377010.
 #7 desc. 0x1189080 0x0005f2 0x13d1810.
 #8 desc. 0x1189090 0x0005f2 0x1371010.
 #9 desc. 0x11890a0 0x0005f2 0x13be010.
 #10 desc. 0x11890b0 0x0005f2 0x1348010.
 #11 desc. 0x11890c0 0x0005f2 0x3bb010.
 #12 desc. 0x11890d0 0x0005f2 0x1b05810.
 #13 desc. 0x11890e0 0x0005f2 0x1398810.
 #14 desc. 0x11890f0 0x0005f2 0x13ac010.
 #15 desc. 0x1189100 0x0005f2 0x1398010.
 #16 desc. 0x1189110 0x0005f2 0x1442810.
 #17 desc. 0x1189120 0x0005f2 0x1371810.
 #18 desc. 0x1189130 0x0005f2 0x1351010.
 #19 desc. 0x1189140 0x0005f2 0x13ed810.
 #20 desc. 0x1189150 0x0005f2 0x1351810.
 #21 desc. 0x1189160 0x0005f2 0x1b05010.
 #22 desc. 0x1189170 0x0005f2 0x11d0810.
 #23 desc. 0x1189180 0x0005f2 0x1377810.
 #24 desc. 0x1189190 0x0005f2 0x13d9810.
 #25 desc. 0x11891a0 0x0005f2 0x13a0810.
 #26 desc. 0x11891b0 0x0005f2 0x1361810.
 #27 desc. 0x11891c0 0x0005f2 0x138a810.
 #28 desc. 0x11891d0 0x0005f2 0x1361010.
 #29 desc. 0x11891e0 0x0005f2 0x13f8810.
 #30 desc. 0x11891f0 0x0005f2 0x13f8010.
 #31 desc. 0x1189000 0x0005f2 0x136b810.
eth0: DSPCFG accepted after 0 usec.
eth0: Wake-up event 0x80000a
eth0: Setting full-duplex based on negotiated link capability.
eth0: Interrupt, status 0x002209, mask 0xf1cd65.
eth0: Poll, status 0x002209, mask 0xf1cd65.
  netdev_rx() entry 0 status was 0x98800076.
eth0: Transmit frame #1 queued in slot 0.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 1 status was 0x98800046.
eth0: tx frame #0 finished, status 0x8000082.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 2 status was 0x98800076.
eth0: Transmit frame #2 queued in slot 1.
eth0: Interrupt, status 0x000240, mask 0xf1cd65.
eth0: Poll, status 0x000240, mask 0xf1cd65.
eth0: tx frame #1 finished, status 0x8000072.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 3 status was 0x98800046.
eth0: Transmit frame #3 queued in slot 2.
eth0: Interrupt, status 0x000248, mask 0xf1cd65.
eth0: Poll, status 0x000248, mask 0xf1cd65.
eth0: tx frame #2 finished, status 0x8000242.
eth0: Poll, status 0x000001, mask 0xf1cd65.
  netdev_rx() entry 4 status was 0x98800046.
eth0: Transmit frame #4 queued in slot 3.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 5 status was 0x98800046.
eth0: tx frame #3 finished, status 0x8000072.
eth0: Media selection timer tick.
eth0: possible phy reset: re-initializing
eth0: Tx/Rx process stopped in 0 usec.
  Tx ring at c1189200:
 #0 desc. 0x1189210 0x8000082 0xc6785e.
 #1 desc. 0x1189220 0x8000072 0x10f905e.
 #2 desc. 0x1189230 0x8000242 0x134885e.
 #3 desc. 0x1189240 0x8000072 0xc7205e.
 #4 desc. 0x1189250 0x000000 0x3bb05e.
 #5 desc. 0x1189260 0x000000 0x139885e.
 #6 desc. 0x1189270 0x000000 0x13ac05e.
 #7 desc. 0x1189280 0x000000 0x139805e.
 #8 desc. 0x1189290 0x000000 0xc6305e.
 #9 desc. 0x11892a0 0x000000 0x13b305e.
 #10 desc. 0x11892b0 0x000000 0x107965e.
 #11 desc. 0x11892c0 0x000000 0x13ed05e.
 #12 desc. 0x11892d0 0x000000 0x1b0585e.
 #13 desc. 0x11892e0 0x000000 0x13be05e.
 #14 desc. 0x11892f0 0x000000 0xc6785e.
 #15 desc. 0x1189200 0x000000 0x138a05e.
  Rx ring c1189000:
 #0 desc. 0x1189010 0x0005f2 0xc63010.
 #1 desc. 0x1189020 0x0005f2 0x13ed010.
 #2 desc. 0x1189030 0x0005f2 0x138a010.
 #3 desc. 0x1189040 0x0005f2 0xc67810.
 #4 desc. 0x1189050 0x0005f2 0x10f9010.
 #5 desc. 0x1189060 0x0005f2 0x1348810.
 #6 desc. 0x1189070 0x0005f2 0x1377010.
 #7 desc. 0x1189080 0x0005f2 0x13d1810.
 #8 desc. 0x1189090 0x0005f2 0x1371010.
 #9 desc. 0x11890a0 0x0005f2 0x13be010.
 #10 desc. 0x11890b0 0x0005f2 0x1348010.
 #11 desc. 0x11890c0 0x0005f2 0x3bb010.
 #12 desc. 0x11890d0 0x0005f2 0x1b05810.
 #13 desc. 0x11890e0 0x0005f2 0x1398810.
 #14 desc. 0x11890f0 0x0005f2 0x13ac010.
 #15 desc. 0x1189100 0x0005f2 0x1398010.
 #16 desc. 0x1189110 0x0005f2 0x1442810.
 #17 desc. 0x1189120 0x0005f2 0x1371810.
 #18 desc. 0x1189130 0x0005f2 0x1351010.
 #19 desc. 0x1189140 0x0005f2 0x13ed810.
 #20 desc. 0x1189150 0x0005f2 0x1351810.
 #21 desc. 0x1189160 0x0005f2 0x1b05010.
 #22 desc. 0x1189170 0x0005f2 0x11d0810.
 #23 desc. 0x1189180 0x0005f2 0x1377810.
 #24 desc. 0x1189190 0x0005f2 0x13d9810.
 #25 desc. 0x11891a0 0x0005f2 0x13a0810.
 #26 desc. 0x11891b0 0x0005f2 0x1361810.
 #27 desc. 0x11891c0 0x0005f2 0x138a810.
 #28 desc. 0x11891d0 0x0005f2 0x1361010.
 #29 desc. 0x11891e0 0x0005f2 0x13f8810.
 #30 desc. 0x11891f0 0x0005f2 0x13f8010.
 #31 desc. 0x1189000 0x0005f2 0x136b810.
eth0: DSPCFG accepted after 0 usec.
eth0: Wake-up event 0x80000a
eth0: Setting full-duplex based on negotiated link capability.
eth0: Interrupt, status 0x002209, mask 0xf1cd65.
eth0: Poll, status 0x002209, mask 0xf1cd65.
  netdev_rx() entry 0 status was 0x98800076.
eth0: Transmit frame #1 queued in slot 0.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 1 status was 0x98800046.
eth0: tx frame #0 finished, status 0x8000082.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 2 status was 0x98800076.
eth0: Transmit frame #2 queued in slot 1.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 3 status was 0x98800046.
eth0: tx frame #1 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 4 status was 0x98800076.
eth0: Transmit frame #3 queued in slot 2.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 5 status was 0x98800046.
eth0: tx frame #2 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 6 status was 0x98800076.
eth0: Transmit frame #4 queued in slot 3.
eth0: Interrupt, status 0x000240, mask 0xf1cd65.
eth0: Poll, status 0x000240, mask 0xf1cd65.
eth0: tx frame #3 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 7 status was 0x98800076.
eth0: Transmit frame #5 queued in slot 4.
eth0: Interrupt, status 0x000240, mask 0xf1cd65.
eth0: Poll, status 0x000240, mask 0xf1cd65.
eth0: tx frame #4 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 8 status was 0x98800076.
eth0: Transmit frame #6 queued in slot 5.
eth0: Interrupt, status 0x000240, mask 0xf1cd65.
eth0: Poll, status 0x000240, mask 0xf1cd65.
eth0: tx frame #5 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 9 status was 0x98800046.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 10 status was 0x98800076.
eth0: Transmit frame #7 queued in slot 6.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 11 status was 0x98800046.
eth0: tx frame #6 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 12 status was 0x98800076.
eth0: Transmit frame #8 queued in slot 7.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 13 status was 0x98800046.
eth0: tx frame #7 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 14 status was 0x98800076.
eth0: Transmit frame #9 queued in slot 8.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 15 status was 0x98800046.
eth0: tx frame #8 finished, status 0x8000072.
eth0: Media selection timer tick.
eth0: possible phy reset: re-initializing
eth0: Tx/Rx process stopped in 0 usec.
  Tx ring at c1189200:
 #0 desc. 0x1189210 0x8000082 0xc6305e.
 #1 desc. 0x1189220 0x8000072 0x138a05e.
 #2 desc. 0x1189230 0x8000072 0x10f905e.
 #3 desc. 0x1189240 0x8000072 0x137705e.
 #4 desc. 0x1189250 0x8000072 0x13ed05e.
 #5 desc. 0x1189260 0x8000072 0x137105e.
 #6 desc. 0x1189270 0x8000072 0x134805e.
 #7 desc. 0x1189280 0x8000072 0x1b0585e.
 #8 desc. 0x1189290 0x8000072 0x13ac05e.
 #9 desc. 0x11892a0 0x000000 0x13b305e.
 #10 desc. 0x11892b0 0x000000 0x107965e.
 #11 desc. 0x11892c0 0x000000 0x13ed05e.
 #12 desc. 0x11892d0 0x000000 0x1b0585e.
 #13 desc. 0x11892e0 0x000000 0x13be05e.
 #14 desc. 0x11892f0 0x000000 0xc6785e.
 #15 desc. 0x1189200 0x000000 0x138a05e.
  Rx ring c1189000:
 #0 desc. 0x1189010 0x0005f2 0x13a0010.
 #1 desc. 0x1189020 0x0005f2 0x11d0010.
 #2 desc. 0x1189030 0x0005f2 0x13c4810.
 #3 desc. 0x1189040 0x0005f2 0xc72010.
 #4 desc. 0x1189050 0x0005f2 0x13b3010.
 #5 desc. 0x1189060 0x0005f2 0x138a010.
 #6 desc. 0x1189070 0x0005f2 0x13c4010.
 #7 desc. 0x1189080 0x0005f2 0x1377010.
 #8 desc. 0x1189090 0x0005f2 0x13ed010.
 #9 desc. 0x11890a0 0x0005f2 0x13be010.
 #10 desc. 0x11890b0 0x0005f2 0x10f9010.
 #11 desc. 0x11890c0 0x0005f2 0x1348810.
 #12 desc. 0x11890d0 0x0005f2 0x3bb010.
 #13 desc. 0x11890e0 0x0005f2 0xc67810.
 #14 desc. 0x11890f0 0x0005f2 0x1398810.
 #15 desc. 0x1189100 0x0005f2 0xc63010.
 #16 desc. 0x1189110 0x0005f2 0x1442810.
 #17 desc. 0x1189120 0x0005f2 0x1371810.
 #18 desc. 0x1189130 0x0005f2 0x1351010.
 #19 desc. 0x1189140 0x0005f2 0x13ed810.
 #20 desc. 0x1189150 0x0005f2 0x1351810.
 #21 desc. 0x1189160 0x0005f2 0x1b05010.
 #22 desc. 0x1189170 0x0005f2 0x11d0810.
 #23 desc. 0x1189180 0x0005f2 0x1377810.
 #24 desc. 0x1189190 0x0005f2 0x13d9810.
 #25 desc. 0x11891a0 0x0005f2 0x13a0810.
 #26 desc. 0x11891b0 0x0005f2 0x1361810.
 #27 desc. 0x11891c0 0x0005f2 0x138a810.
 #28 desc. 0x11891d0 0x0005f2 0x1361010.
 #29 desc. 0x11891e0 0x0005f2 0x13f8810.
 #30 desc. 0x11891f0 0x0005f2 0x13f8010.
 #31 desc. 0x1189000 0x0005f2 0x136b810.
eth0: DSPCFG accepted after 0 usec.
eth0: Wake-up event 0x80000a
eth0: Setting full-duplex based on negotiated link capability.
eth0: Interrupt, status 0x002209, mask 0xf1cd65.
eth0: Poll, status 0x002209, mask 0xf1cd65.
  netdev_rx() entry 0 status was 0x98800076.
eth0: Transmit frame #1 queued in slot 0.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 1 status was 0x98800046.
eth0: tx frame #0 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 2 status was 0x98800076.
eth0: Transmit frame #2 queued in slot 1.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 3 status was 0x98800046.
eth0: tx frame #1 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 4 status was 0x98800076.
eth0: Transmit frame #3 queued in slot 2.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 5 status was 0x98800046.
eth0: tx frame #2 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 6 status was 0x98800076.
eth0: Transmit frame #4 queued in slot 3.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 7 status was 0x98800046.
eth0: tx frame #3 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 8 status was 0x98800076.
eth0: Transmit frame #5 queued in slot 4.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 9 status was 0x98800046.
eth0: tx frame #4 finished, status 0x8000072.
eth0: Interrupt, status 0x000009, mask 0xf1cd65.
eth0: Poll, status 0x000009, mask 0xf1cd65.
  netdev_rx() entry 10 status was 0x98800076.
eth0: Transmit frame #6 queued in slot 5.
eth0: Interrupt, status 0x000249, mask 0xf1cd65.
eth0: Poll, status 0x000249, mask 0xf1cd65.
  netdev_rx() entry 11 status was 0x98800046.
eth0: tx frame #5 finished, status 0x8000072.


----------------------------------------------------------------------
Po meczu.....kurde...:)
>>> http://link.interia.pl/f1a72

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-01 10:25     ` Rafał Bilski
@ 2007-05-01 18:08       ` Mark Brown
  2007-05-01 19:10         ` Rafał Bilski
  2007-05-01 19:52         ` Rafał Bilski
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Brown @ 2007-05-01 18:08 UTC (permalink / raw)
  To: Rafał Bilski; +Cc: Andrew Morton, linux-kernel, netdev

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

On Tue, May 01, 2007 at 12:25:20PM +0200, Rafał Bilski wrote:

> eth0: Media selection timer tick.
> eth0: possible phy reset: re-initializing

This is why the reset is being triggered - it's a workaround for a hardware
bug which checks to make sure the hardware is in the state that the
kernel thinks it is is going off.  The code has this explanatory comment:

 * 2) check for sudden death of the NIC:
 *    It seems that a reference set for this chip went out with incorrect info,
 *    and there exist boards that aren't quite right.  An unexpected voltage
 *    drop can cause the PHY to get itself in a weird state (basically reset).
 *    NOTE: this only seems to affect revC chips.

I'd suggest checking your power supply as a first step.

[BTW, as Andrew said please don't drop people from the CC.]

-- 
"You grabbed my hand and we fell into it, like a daydream - or a fever."

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-01 18:08       ` Mark Brown
@ 2007-05-01 19:10         ` Rafał Bilski
  2007-05-01 19:52         ` Rafał Bilski
  1 sibling, 0 replies; 14+ messages in thread
From: Rafał Bilski @ 2007-05-01 19:10 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel, netdev

>> eth0: Media selection timer tick.
>> eth0: possible phy reset: re-initializing
> 
> This is why the reset is being triggered - it's a workaround for a hardware
> bug which checks to make sure the hardware is in the state that the
> kernel thinks it is is going off.  The code has this explanatory comment:
> 
>  * 2) check for sudden death of the NIC:
>  *    It seems that a reference set for this chip went out with incorrect info,
>  *    and there exist boards that aren't quite right.  An unexpected voltage
>  *    drop can cause the PHY to get itself in a weird state (basically reset).
>  *    NOTE: this only seems to affect revC chips.

Yes. I have revision C chip.
 
> I'd suggest checking your power supply as a first step.

5,25V when not connected. 5,04V when connected to Wyse. I don't have access to 
osciloscope.
I will check if this code is nedded. If it is then I will try to get new power 
supply.
 
> [BTW, as Andrew said please don't drop people from the CC.]
OK. Will not happen again.

Rafał



----------------------------------------------------------------------
Kasia Cichopek eksponuje biust  
>>> http://link.interia.pl/f1a6f


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-01 18:08       ` Mark Brown
  2007-05-01 19:10         ` Rafał Bilski
@ 2007-05-01 19:52         ` Rafał Bilski
  2007-05-01 21:27           ` Mark Brown
  1 sibling, 1 reply; 14+ messages in thread
From: Rafał Bilski @ 2007-05-01 19:52 UTC (permalink / raw)
  To: Mark Brown; +Cc: Andrew Morton, linux-kernel, netdev

>> eth0: Media selection timer tick.
>> eth0: possible phy reset: re-initializing
> 
> This is why the reset is being triggered - it's a workaround for a hardware
> bug which checks to make sure the hardware is in the state that the
> kernel thinks it is is going off.  The code has this explanatory comment:
> 
>  * 2) check for sudden death of the NIC:
>  *    It seems that a reference set for this chip went out with incorrect info,
>  *    and there exist boards that aren't quite right.  An unexpected voltage
>  *    drop can cause the PHY to get itself in a weird state (basically reset).
>  *    NOTE: this only seems to affect revC chips.
> 
Code commented out and NIC is working OK. Strange.
eth0: DSPCFG accepted after 0 usec.
eth0: link up.
eth0: Setting full-duplex based on negotiated link capability.
dspcfg = 0x00000000  np->dspcfg = 0x00005060
dspcfg = 0x00000000  np->dspcfg = 0x00005060
dspcfg = 0x00000000  np->dspcfg = 0x00005060
dspcfg = 0x00000000  np->dspcfg = 0x00005060
dspcfg = 0x00000000  np->dspcfg = 0x00005060
dspcfg = 0x00000000  np->dspcfg = 0x00005060
dspcfg = 0x00000000  np->dspcfg = 0x00005060

One problem solved in mean time :-)
> PCI: CS5530 video turned off.

[BTW, as Andrew said please don't drop people from the CC.]
I didn't. It is Thunderbird. I'm included instead of You. Fixed 
manually this time.

Regards
Rafał


----------------------------------------------------------------------- Linda jako gospodyni domowa - zobacz!!!
>>> http://link.interia.pl/f1a79


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-01 19:52         ` Rafał Bilski
@ 2007-05-01 21:27           ` Mark Brown
       [not found]             ` <b3ece790705011543gdca3a9ei905d3499b6c18dc8@mail.gmail.com>
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2007-05-01 21:27 UTC (permalink / raw)
  To: Rafał Bilski; +Cc: Andrew Morton, linux-kernel, netdev

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

On Tue, May 01, 2007 at 09:52:30PM +0200, Rafał Bilski wrote:

> >  * 2) check for sudden death of the NIC:
> >  *    It seems that a reference set for this chip went out with incorrect info,
> >  *    and there exist boards that aren't quite right.  An unexpected voltage
> >  *    drop can cause the PHY to get itself in a weird state (basically reset).
> >  *    NOTE: this only seems to affect revC chips.

> Code commented out and NIC is working OK. Strange.
> eth0: DSPCFG accepted after 0 usec.
> eth0: link up.
> eth0: Setting full-duplex based on negotiated link capability.
> dspcfg = 0x00000000  np->dspcfg = 0x00005060

Oh, that's entertaining.  I have to confess that I've never seen an that
triggered the workaround before - adding the maintainer, Tim Hockin, who
may be able to shed some light on the expected behaviour here?

-- 
"You grabbed my hand and we fell into it, like a daydream - or a fever."

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
       [not found]             ` <b3ece790705011543gdca3a9ei905d3499b6c18dc8@mail.gmail.com>
@ 2007-05-02  5:54               ` Rafał Bilski
       [not found]                 ` <b3ece790705012303x1e5a2d03xddf6c14aec5a99d8@mail.gmail.com>
  0 siblings, 1 reply; 14+ messages in thread
From: Rafał Bilski @ 2007-05-02  5:54 UTC (permalink / raw)
  To: Tim Hockin; +Cc: Andrew Morton, linux-kernel, netdev

>> > >  * 2) check for sudden death of the NIC:
>> > >  *    It seems that a reference set for this chip went out with
>> incorrect info,
>> > >  *    and there exist boards that aren't quite right.  An
>> unexpected voltage
>> > >  *    drop can cause the PHY to get itself in a weird state
>> (basically reset).
>> > >  *    NOTE: this only seems to affect revC chips.
>>
>> > Code commented out and NIC is working OK. Strange.
>> > eth0: DSPCFG accepted after 0 usec.
>> > eth0: link up.
>> > eth0: Setting full-duplex based on negotiated link capability.
>> > dspcfg = 0x00000000  np->dspcfg = 0x00005060
>>
>> Oh, that's entertaining.  I have to confess that I've never seen an that
>> triggered the workaround before - adding the maintainer, Tim Hockin, who
>> may be able to shed some light on the expected behaviour here?
> 
> It's been quite a while since I dealt with this issue, so I am going
> on faulty memory.  A particular reference design for this chip had bad
> resistor values, or something similar.  That caused the chip to get
> very very confused and need a reset.
Can You send me documentation? I can't find anything in datasheet. 
I will replace bad resitors with correct ones.
> So the driver is finding your chip to be hosed over and over again.
> dspcfg = 0x000000 is bad.  I'd be very surprised if you don't get
> other wierdness - bad performance or noise or who knows what.
No. It is much better. Much less packets need to be retransmitted.  
I was blaming w3cache.tkdami.net earlier.
> You could take out the error message and just let the driver do it's
> thing, or you can try to run with that logic removed.  But I'd measure
> both and see what they do.  Specifically - look  for packet errors.
With code commented out I have 1 error / 30000 transmitted packets from 
DP83815C. I have 1 error / 100000 transmitted packets to DP83815C. Maybe 
it works at all because I have short cable, only 10m long.
I don't remember any errors with plain 2.6.21.1.
> Tim
Rafał


----------------------------------------------------------------------
NIE KUPUJ!!!
...zanim nie porownasz cen >> http://link.interia.pl/f1a5e

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
       [not found]                 ` <b3ece790705012303x1e5a2d03xddf6c14aec5a99d8@mail.gmail.com>
@ 2007-05-02  6:34                   ` Rafał Bilski
  2007-05-02  6:51                     ` Tim Hockin
  0 siblings, 1 reply; 14+ messages in thread
From: Rafał Bilski @ 2007-05-02  6:34 UTC (permalink / raw)
  To: Tim Hockin; +Cc: Andrew Morton, linux-kernel, netdev

[...]
> 
>> With code commented out I have 1 error / 30000 transmitted packets from
>> DP83815C. I have 1 error / 100000 transmitted packets to DP83815C. Maybe
>> it works at all because I have short cable, only 10m long.
>> I don't remember any errors with plain 2.6.21.1.
Sorry. I mean transmition errors, but of course log was full of "wakeup" 
messages. 
> Well, I certainly haven't changed anything in there.  If the behavior
> has changed in recent kernels, check the rest of the diffs.
> 
> Tim

2.6.21.1 is first kernel which I'm using at this device. Earlier it was 
WindowsCE terminal. It is hardware fault. Commenting out the code is my 
way to avoid "wakeup" messages in log, but I don't want to change anything 
in vanilla kernel. I'm lucky that NIC is working at all.

Thank You
Rafał



----------------------------------------------------------------------
NIE KUPUJ!!!
...zanim nie porownasz cen >> http://link.interia.pl/f1a5e




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-02  6:34                   ` Rafał Bilski
@ 2007-05-02  6:51                     ` Tim Hockin
  2007-05-02  8:22                       ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Tim Hockin @ 2007-05-02  6:51 UTC (permalink / raw)
  To: Rafał Bilski; +Cc: Andrew Morton, linux-kernel, netdev

On 5/1/07, Rafal Bilski <rafalbilski@interia.pl> wrote:

> 2.6.21.1 is first kernel which I'm using at this device. Earlier it was
> WindowsCE terminal. It is hardware fault. Commenting out the code is my
> way to avoid "wakeup" messages in log, but I don't want to change anything
> in vanilla kernel. I'm lucky that NIC is working at all.

I'm not sure what the right answer is.  The code was designed to do
the right thing, and yet in your case it's broken.  Does it need to be
a build option to work around broken hardware?  Yuck.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-02  6:51                     ` Tim Hockin
@ 2007-05-02  8:22                       ` Mark Brown
       [not found]                         ` <b3ece790705020744p2e73bb5fo2c0acad947a5de15@mail.gmail.com>
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2007-05-02  8:22 UTC (permalink / raw)
  To: Tim Hockin; +Cc: Rafał Bilski, Andrew Morton, linux-kernel, netdev

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

On Tue, May 01, 2007 at 11:51:41PM -0700, Tim Hockin wrote:

> I'm not sure what the right answer is.  The code was designed to do
> the right thing, and yet in your case it's broken.  Does it need to be
> a build option to work around broken hardware?  Yuck.

Without a system that really needs the original problem that was being
worked around it's going to be hard to see if the workaround still does
the job.  Given the nature of the failure I wouldn't be surprised if it
broke different things on every board that has problems.

How about a sysfs tuneable?  It's not nice but at least it's runtime.

-- 
"You grabbed my hand and we fell into it, like a daydream - or a fever."

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
       [not found]                           ` <4638EF0B.9050701@interia.pl>
@ 2007-05-02 21:41                             ` Mark Brown
  2007-05-03  6:33                               ` Rafał Bilski
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2007-05-02 21:41 UTC (permalink / raw)
  To: Rafał Bilski; +Cc: Tim Hockin, Andrew Morton, linux-kernel, netdev

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

On Wed, May 02, 2007 at 10:05:31PM +0200, Rafał Bilski wrote:

> What about module option?

That would work, though you crossed in the post with me writing a patch
adding a sysfs file; I merged the two for overkill (below).  I also have
a patch which changes the log message for the workaround so that it is
displayed by default in order to make this easier to diagnose.

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 109e802..b9f3ab3 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -81,6 +81,8 @@ static const int multicast_filter_limit = 100;
    Setting to > 1518 effectively disables this feature. */
 static int rx_copybreak;
 
+static int dspcfg_workaround = 1;
+
 /* Used to pass the media type, etc.
    Both 'options[]' and 'full_duplex[]' should exist for driver
    interoperability.
@@ -139,12 +141,14 @@ MODULE_LICENSE("GPL");
 module_param(mtu, int, 0);
 module_param(debug, int, 0);
 module_param(rx_copybreak, int, 0);
+module_param(dspcfg_workaround, int, 1);
 module_param_array(options, int, NULL, 0);
 module_param_array(full_duplex, int, NULL, 0);
 MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
 MODULE_PARM_DESC(debug, "DP8381x default debug level");
 MODULE_PARM_DESC(rx_copybreak,
 	"DP8381x copy breakpoint for copy-only-tiny-frames");
+MODULE_PARM_DESC(dspcfg_workaround, "DP8381x: control DspCfg workaround");
 MODULE_PARM_DESC(options,
 	"DP8381x: Bits 0-3: media type, bit 17: full duplex");
 MODULE_PARM_DESC(full_duplex, "DP8381x full duplex setting(s) (1)");
@@ -590,6 +594,7 @@ struct netdev_private {
 	u32 srr;
 	/* expected DSPCFG value */
 	u16 dspcfg;
+	int dspcfg_workaround;
 	/* parms saved in ethtool format */
 	u16	speed;		/* The forced speed, 10Mb, 100Mb, gigabit */
 	u8	duplex;		/* Duplex, half or full */
@@ -656,6 +661,56 @@ static int netdev_get_regs(struct net_device *dev, u8 *buf);
 static int netdev_get_eeprom(struct net_device *dev, u8 *buf);
 static const struct ethtool_ops ethtool_ops;
 
+#define NATSEMI_ATTR(_name) \
+static ssize_t natsemi_show_##_name(struct device *dev, \
+         struct device_attribute *attr, char *buf); \
+	 static ssize_t natsemi_set_##_name(struct device *dev, \
+		struct device_attribute *attr, \
+	        const char *buf, size_t count); \
+	 static DEVICE_ATTR(_name, 0644, natsemi_show_##_name, natsemi_set_##_name)
+
+#define NATSEMI_CREATE_FILE(_dev, _name) \
+         device_create_file(&_dev->dev, &dev_attr_##_name)
+#define NATSEMI_REMOVE_FILE(_dev, _name) \
+         device_create_file(&_dev->dev, &dev_attr_##_name)
+
+NATSEMI_ATTR(dspcfg_workaround);
+
+static ssize_t natsemi_show_dspcfg_workaround(struct device *dev,
+				  	      struct device_attribute *attr, 
+					      char *buf)
+{
+	struct netdev_private *np = netdev_priv(to_net_dev(dev));
+
+	return sprintf(buf, "%s\n", np->dspcfg_workaround ? "on" : "off");
+}
+
+static ssize_t natsemi_set_dspcfg_workaround(struct device *dev,
+					     struct device_attribute *attr,
+					     const char *buf, size_t count)
+{
+	struct netdev_private *np = netdev_priv(to_net_dev(dev));
+	int new_setting;
+	u32 flags;
+
+        /* Find out the new setting */
+        if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
+                new_setting = 1;
+        else if (!strncmp("off", buf, count - 1)
+                 || !strncmp("0", buf, count - 1))
+		new_setting = 0;
+	else
+                 return count; 
+
+	spin_lock_irqsave(&np->lock, flags);
+
+	np->dspcfg_workaround = new_setting;
+
+	spin_unlock_irqrestore(&np->lock, flags);
+
+	return count;
+}
+
 static inline void __iomem *ns_ioaddr(struct net_device *dev)
 {
 	return (void __iomem *) dev->base_addr;
@@ -820,6 +875,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
 		np->ignore_phy = 1;
 	else
 		np->ignore_phy = 0;
+	np->dspcfg_workaround = dspcfg_workaround;
 
 	/* Initial port:
 	 * - If configured to ignore the PHY set up for external.
@@ -899,6 +955,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
 	if (i)
 		goto err_register_netdev;
 
+	if (!NATSEMI_CREATE_FILE(pdev, dspcfg_workaround))
+		goto err_create_file;
+
 	if (netif_msg_drv(np)) {
 		printk(KERN_INFO "natsemi %s: %s at %#08lx (%s), ",
 			dev->name, natsemi_pci_info[chip_idx].name, iostart,
@@ -915,6 +974,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
 	}
 	return 0;
 
+ err_create_file:
+ 	unregister_netdev(dev);
+
  err_register_netdev:
 	iounmap(ioaddr);
 
@@ -1727,7 +1789,8 @@ static void init_registers(struct net_device *dev)
  *    It seems that a reference set for this chip went out with incorrect info,
  *    and there exist boards that aren't quite right.  An unexpected voltage
  *    drop can cause the PHY to get itself in a weird state (basically reset).
- *    NOTE: this only seems to affect revC chips.
+ *    NOTE: this only seems to affect revC chips.  The user can disable
+ *    this check via dspcfg_workaround sysfs option.
  * 3) check of death of the RX path due to OOM
  */
 static void netdev_timer(unsigned long data)
@@ -1753,7 +1816,7 @@ static void netdev_timer(unsigned long data)
 		writew(1, ioaddr+PGSEL);
 		dspcfg = readw(ioaddr+DSPCFG);
 		writew(0, ioaddr+PGSEL);
-		if (dspcfg != np->dspcfg) {
+		if (np->dspcfg_workaround && dspcfg != np->dspcfg) {
 			if (!netif_queue_stopped(dev)) {
 				spin_unlock_irq(&np->lock);
 				if (netif_msg_hw(np))
@@ -3157,6 +3220,7 @@ static void __devexit natsemi_remove1 (struct pci_dev *pdev)
 	struct net_device *dev = pci_get_drvdata(pdev);
 	void __iomem * ioaddr = ns_ioaddr(dev);
 
+	NATSEMI_REMOVE_FILE(pdev, dspcfg_workaround);
 	unregister_netdev (dev);
 	pci_release_regions (pdev);
 	iounmap(ioaddr);

-- 
"You grabbed my hand and we fell into it, like a daydream - or a fever."

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: Natsemi DP83815 driver spaming
  2007-05-02 21:41                             ` Mark Brown
@ 2007-05-03  6:33                               ` Rafał Bilski
  0 siblings, 0 replies; 14+ messages in thread
From: Rafał Bilski @ 2007-05-03  6:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: Tim Hockin, linux-kernel, netdev

>> What about module option?
> 
> That would work, though you crossed in the post with me writing a patch
> adding a sysfs file; I merged the two for overkill (below).  I also have
> a patch which changes the log message for the workaround so that it is
> displayed by default in order to make this easier to diagnose.

Applied. I set default value to 0. Flashed. However
> +	if (!NATSEMI_CREATE_FILE(pdev, dspcfg_workaround))
> +		goto err_create_file;
is going to err_create_file. Without these lines drivers works fine.

Rafał



----------------------------------------------------------------------
NIE KUPUJ!!!
...zanim nie porownasz cen >> http://link.interia.pl/f1a5e




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-05-03  6:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <46365887.3010705@interia.pl>
2007-05-01  3:55 ` Natsemi DP83815 driver spaming Andrew Morton
     [not found]   ` <4636E970.3010602@interia.pl>
     [not found]     ` <4636F90A.2070303@interia.pl>
2007-05-01  8:35       ` Andrew Morton
2007-05-01  8:46   ` Mark Brown
2007-05-01 10:25     ` Rafał Bilski
2007-05-01 18:08       ` Mark Brown
2007-05-01 19:10         ` Rafał Bilski
2007-05-01 19:52         ` Rafał Bilski
2007-05-01 21:27           ` Mark Brown
     [not found]             ` <b3ece790705011543gdca3a9ei905d3499b6c18dc8@mail.gmail.com>
2007-05-02  5:54               ` Rafał Bilski
     [not found]                 ` <b3ece790705012303x1e5a2d03xddf6c14aec5a99d8@mail.gmail.com>
2007-05-02  6:34                   ` Rafał Bilski
2007-05-02  6:51                     ` Tim Hockin
2007-05-02  8:22                       ` Mark Brown
     [not found]                         ` <b3ece790705020744p2e73bb5fo2c0acad947a5de15@mail.gmail.com>
     [not found]                           ` <4638EF0B.9050701@interia.pl>
2007-05-02 21:41                             ` Mark Brown
2007-05-03  6:33                               ` Rafał Bilski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).