netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] sky2: patches for 2.6.22.y
@ 2007-09-28 16:48 Stephen Hemminger
  2007-09-28 16:48 ` [PATCH 1/3] sky2: reduce impact of watchdog timer Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stephen Hemminger @ 2007-09-28 16:48 UTC (permalink / raw)
  To: Krzysztof Oledzki, Greg KH; +Cc: stable, netdev

Fixes for power regression, VLAN and resume problems.
These are all in 2.6.23.

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


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

* [PATCH 1/3] sky2: reduce impact of watchdog timer
  2007-09-28 16:48 [PATCH 0/3] sky2: patches for 2.6.22.y Stephen Hemminger
@ 2007-09-28 16:48 ` Stephen Hemminger
  2007-09-28 16:48 ` [PATCH 2/3] sky2: fix VLAN receive processing Stephen Hemminger
  2007-09-28 16:48 ` [PATCH 3/3] sky2: fix transmit state on resume Stephen Hemminger
  2 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2007-09-28 16:48 UTC (permalink / raw)
  To: Krzysztof Oledzki, Greg KH; +Cc: stable, netdev

[-- Attachment #1: sky2-hw-watchdog.patch --]
[-- Type: text/plain, Size: 4147 bytes --]

This is the 2.6.22 version of a regression fix that is already
in 2.6.23.  Change the watchdog timer form 10 per second all the time,
to 1 per second and only if interface is up.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-09-17 10:39:47.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-28 09:13:38.000000000 -0700
@@ -96,10 +96,6 @@ static int disable_msi = 0;
 module_param(disable_msi, int, 0);
 MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
 
-static int idle_timeout = 100;
-module_param(idle_timeout, int, 0);
-MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)");
-
 static const struct pci_device_id sky2_id_table[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */
 	{ PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
@@ -1693,6 +1689,8 @@ static void sky2_link_up(struct sky2_por
 
 	netif_carrier_on(sky2->netdev);
 
+	mod_timer(&hw->watchdog_timer, jiffies + 1);
+
 	/* Turn on link LED */
 	sky2_write8(hw, SK_REG(port, LNK_LED_REG),
 		    LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
@@ -2384,25 +2382,25 @@ static void sky2_le_error(struct sky2_hw
 	sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK);
 }
 
-/* If idle then force a fake soft NAPI poll once a second
- * to work around cases where sharing an edge triggered interrupt.
- */
-static inline void sky2_idle_start(struct sky2_hw *hw)
-{
-	if (idle_timeout > 0)
-		mod_timer(&hw->idle_timer,
-			  jiffies + msecs_to_jiffies(idle_timeout));
-}
-
-static void sky2_idle(unsigned long arg)
+/* Force a fake soft NAPI poll to handle lost IRQ's */
+static void sky2_watchdog(unsigned long arg)
 {
 	struct sky2_hw *hw = (struct sky2_hw *) arg;
 	struct net_device *dev = hw->dev[0];
+	int i, active = 0;
 
 	if (__netif_rx_schedule_prep(dev))
 		__netif_rx_schedule(dev);
 
-	mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout));
+	for (i = 0; i < hw->ports; i++) {
+		dev = hw->dev[i];
+		if (!netif_running(dev))
+			continue;
+		++active;
+	}
+
+	if (active)
+		mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ));
 }
 
 /* Hardware/software error handling */
@@ -2692,8 +2690,6 @@ static void sky2_restart(struct work_str
 
 	dev_dbg(&hw->pdev->dev, "restarting\n");
 
-	del_timer_sync(&hw->idle_timer);
-
 	rtnl_lock();
 	sky2_write32(hw, B0_IMSK, 0);
 	sky2_read32(hw, B0_IMSK);
@@ -2722,8 +2718,6 @@ static void sky2_restart(struct work_str
 		}
 	}
 
-	sky2_idle_start(hw);
-
 	rtnl_unlock();
 }
 
@@ -3713,11 +3707,9 @@ static int __devinit sky2_probe(struct p
 			sky2_show_addr(dev1);
 	}
 
-	setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw);
+	setup_timer(&hw->watchdog_timer, sky2_watchdog, (unsigned long) hw);
 	INIT_WORK(&hw->restart_work, sky2_restart);
 
-	sky2_idle_start(hw);
-
 	pci_set_drvdata(pdev, hw);
 
 	return 0;
@@ -3752,7 +3744,7 @@ static void __devexit sky2_remove(struct
 	if (!hw)
 		return;
 
-	del_timer_sync(&hw->idle_timer);
+	del_timer_sync(&hw->watchdog_timer);
 
 	flush_scheduled_work();
 
@@ -3796,7 +3788,7 @@ static int sky2_suspend(struct pci_dev *
 	if (!hw)
 		return 0;
 
-	del_timer_sync(&hw->idle_timer);
+	del_timer_sync(&hw->watchdog_timer);
 	netif_poll_disable(hw->dev[0]);
 
 	for (i = 0; i < hw->ports; i++) {
@@ -3862,7 +3854,7 @@ static int sky2_resume(struct pci_dev *p
 	}
 
 	netif_poll_enable(hw->dev[0]);
-	sky2_idle_start(hw);
+
 	return 0;
 out:
 	dev_err(&pdev->dev, "resume failed (%d)\n", err);
@@ -3879,7 +3871,6 @@ static void sky2_shutdown(struct pci_dev
 	if (!hw)
 		return;
 
-	del_timer_sync(&hw->idle_timer);
 	netif_poll_disable(hw->dev[0]);
 
 	for (i = 0; i < hw->ports; i++) {
--- a/drivers/net/sky2.h	2007-08-21 10:59:11.000000000 -0700
+++ b/drivers/net/sky2.h	2007-09-28 09:13:15.000000000 -0700
@@ -1921,7 +1921,7 @@ struct sky2_hw {
 	u32		     st_idx;
 	dma_addr_t   	     st_dma;
 
-	struct timer_list    idle_timer;
+	struct timer_list    watchdog_timer;
 	struct work_struct   restart_work;
 	int		     msi;
 	wait_queue_head_t    msi_wait;

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


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

* [PATCH 2/3] sky2: fix VLAN receive processing
  2007-09-28 16:48 [PATCH 0/3] sky2: patches for 2.6.22.y Stephen Hemminger
  2007-09-28 16:48 ` [PATCH 1/3] sky2: reduce impact of watchdog timer Stephen Hemminger
@ 2007-09-28 16:48 ` Stephen Hemminger
  2007-09-28 18:40   ` Krzysztof Oledzki
  2007-09-28 19:20   ` [stable] " Chris Wright
  2007-09-28 16:48 ` [PATCH 3/3] sky2: fix transmit state on resume Stephen Hemminger
  2 siblings, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2007-09-28 16:48 UTC (permalink / raw)
  To: Krzysztof Oledzki, Greg KH; +Cc: stable, netdev, Pierre-Yves Ritschard

[-- Attachment #1: sky2-vlan-len.patch --]
[-- Type: text/plain, Size: 1221 bytes --]

The length check for truncated frames was not correctly handling
the case where VLAN acceleration had already read the tag.
Also, the Yukon EX has some features that use high bit of status
as security tag.

Signed-off-by: Pierre-Yves Ritschard <pyr@spootnik.org>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-09-28 09:13:38.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-28 09:21:26.000000000 -0700
@@ -2049,6 +2049,7 @@ static struct sk_buff *sky2_receive(stru
  	struct sky2_port *sky2 = netdev_priv(dev);
 	struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
 	struct sk_buff *skb = NULL;
+	u16 count;
 
 	if (unlikely(netif_msg_rx_status(sky2)))
 		printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
@@ -2063,7 +2064,13 @@ static struct sk_buff *sky2_receive(stru
 	if (!(status & GMR_FS_RX_OK))
 		goto resubmit;
 
-	if (status >> 16 != length)
+	count = (status & GMR_FS_LEN) >> 16;
+#ifdef SKY2_VLAN_TAG_USED
+	/* Account for vlan tag */
+	if (sky2->vlgrp && (status & GMR_FS_VLAN))
+		count -= VLAN_HLEN;
+#endif
+	if (count != length)
 		goto len_mismatch;
 
 	if (length < copybreak)

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


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

* [PATCH 3/3] sky2: fix transmit state on resume
  2007-09-28 16:48 [PATCH 0/3] sky2: patches for 2.6.22.y Stephen Hemminger
  2007-09-28 16:48 ` [PATCH 1/3] sky2: reduce impact of watchdog timer Stephen Hemminger
  2007-09-28 16:48 ` [PATCH 2/3] sky2: fix VLAN receive processing Stephen Hemminger
@ 2007-09-28 16:48 ` Stephen Hemminger
  2 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2007-09-28 16:48 UTC (permalink / raw)
  To: Krzysztof Oledzki, Greg KH; +Cc: stable, netdev

[-- Attachment #1: sky2-tx-sum-resume.patch --]
[-- Type: text/plain, Size: 1190 bytes --]

After resume, driver has reset the chip so the current state
of transmit checksum offload state machine and DMA state machine
will be undefined.

The fix is to set the state so that first Tx will set MSS and offset
values.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-09-28 09:21:26.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-28 09:21:37.000000000 -0700
@@ -831,6 +831,20 @@ static inline struct sky2_tx_le *get_tx_
 	return le;
 }
 
+static void tx_init(struct sky2_port *sky2)
+{
+	struct sky2_tx_le *le;
+
+	sky2->tx_prod = sky2->tx_cons = 0;
+	sky2->tx_tcpsum = 0;
+	sky2->tx_last_mss = 0;
+
+	le = get_tx_le(sky2);
+	le->addr = 0;
+	le->opcode = OP_ADDR64 | HW_OWNER;
+	sky2->tx_addr64 = 0;
+}
+
 static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
 					    struct sky2_tx_le *le)
 {
@@ -1244,7 +1258,8 @@ static int sky2_up(struct net_device *de
 				GFP_KERNEL);
 	if (!sky2->tx_ring)
 		goto err_out;
-	sky2->tx_prod = sky2->tx_cons = 0;
+
+	tx_init(sky2);
 
 	sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES,
 					   &sky2->rx_le_map);

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


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

* Re: [PATCH 2/3] sky2: fix VLAN receive processing
  2007-09-28 16:48 ` [PATCH 2/3] sky2: fix VLAN receive processing Stephen Hemminger
@ 2007-09-28 18:40   ` Krzysztof Oledzki
  2007-09-28 19:20   ` [stable] " Chris Wright
  1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Oledzki @ 2007-09-28 18:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Greg KH, stable, netdev, Pierre-Yves Ritschard



On Fri, 28 Sep 2007, Stephen Hemminger wrote:

> The length check for truncated frames was not correctly handling
> the case where VLAN acceleration had already read the tag.
> Also, the Yukon EX has some features that use high bit of status
> as security tag.
>

Thank you.



Best regards

 					Krzysztof Oledzki

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

* Re: [stable] [PATCH 2/3] sky2: fix VLAN receive processing
  2007-09-28 16:48 ` [PATCH 2/3] sky2: fix VLAN receive processing Stephen Hemminger
  2007-09-28 18:40   ` Krzysztof Oledzki
@ 2007-09-28 19:20   ` Chris Wright
  2007-09-28 19:36     ` Stephen Hemminger
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Wright @ 2007-09-28 19:20 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Krzysztof Oledzki, Greg KH, netdev, stable, Pierre-Yves Ritschard

* Stephen Hemminger (shemminger@linux-foundation.org) wrote:
> The length check for truncated frames was not correctly handling
> the case where VLAN acceleration had already read the tag.
> Also, the Yukon EX has some features that use high bit of status
> as security tag.

Did you leave out the GMR_FS_LEN change on purpose?  AFAICT, w/out
that you miss the Yukon EX high bit usage.  The upstream patch applies,
can we simply use that one (below rediffed for stable)?

thanks,
-chris
--

>From d6532232cd3de79c852685823a9c52f723816d0a Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 19 Sep 2007 15:36:42 -0700
Subject: sky2: fix VLAN receive processing (resend)

The length check for truncated frames was not correctly handling
the case where VLAN acceleration had already read the tag.
Also, the Yukon EX has some features that use high bit of status
as security tag.

Signed-off-by: Pierre-Yves Ritschard <pyr@spootnik.org>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
 drivers/net/sky2.c |   14 +++++++++++++-
 drivers/net/sky2.h |    2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

--- linux-2.6.22.9.orig/drivers/net/sky2.c
+++ linux-2.6.22.9/drivers/net/sky2.c
@@ -2049,6 +2049,13 @@ static struct sk_buff *sky2_receive(stru
  	struct sky2_port *sky2 = netdev_priv(dev);
 	struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
 	struct sk_buff *skb = NULL;
+	u16 count = (status & GMR_FS_LEN) >> 16;
+
+#ifdef SKY2_VLAN_TAG_USED
+	/* Account for vlan tag */
+	if (sky2->vlgrp && (status & GMR_FS_VLAN))
+		count -= VLAN_HLEN;
+#endif
 
 	if (unlikely(netif_msg_rx_status(sky2)))
 		printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
@@ -2063,7 +2070,8 @@ static struct sk_buff *sky2_receive(stru
 	if (!(status & GMR_FS_RX_OK))
 		goto resubmit;
 
-	if (status >> 16 != length)
+	/* if length reported by DMA does not match PHY, packet was truncated */
+	if (length != count)
 		goto len_mismatch;
 
 	if (length < copybreak)
@@ -2079,6 +2087,10 @@ len_mismatch:
 	/* Truncation of overlength packets
 	   causes PHY length to not match MAC length */
 	++sky2->net_stats.rx_length_errors;
+	if (netif_msg_rx_err(sky2) && net_ratelimit())
+		pr_info(PFX "%s: rx length mismatch: length %d status %#x\n",
+			dev->name, length, status);
+	goto resubmit;
 
 error:
 	++sky2->net_stats.rx_errors;
--- linux-2.6.22.9.orig/drivers/net/sky2.h
+++ linux-2.6.22.9/drivers/net/sky2.h
@@ -1579,7 +1579,7 @@ enum {
 
 /* Receive Frame Status Encoding */
 enum {
-	GMR_FS_LEN	= 0xffff<<16, /* Bit 31..16:	Rx Frame Length */
+	GMR_FS_LEN	= 0x7fff<<16, /* Bit 30..16:	Rx Frame Length */
 	GMR_FS_VLAN	= 1<<13, /* VLAN Packet */
 	GMR_FS_JABBER	= 1<<12, /* Jabber Packet */
 	GMR_FS_UN_SIZE	= 1<<11, /* Undersize Packet */

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

* Re: [stable] [PATCH 2/3] sky2: fix VLAN receive processing
  2007-09-28 19:20   ` [stable] " Chris Wright
@ 2007-09-28 19:36     ` Stephen Hemminger
  2007-09-28 19:41       ` Chris Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2007-09-28 19:36 UTC (permalink / raw)
  To: Chris Wright
  Cc: Krzysztof Oledzki, Greg KH, netdev, stable, Pierre-Yves Ritschard

On Fri, 28 Sep 2007 12:20:44 -0700
Chris Wright <chrisw@sous-sol.org> wrote:

> * Stephen Hemminger (shemminger@linux-foundation.org) wrote:
> > The length check for truncated frames was not correctly handling
> > the case where VLAN acceleration had already read the tag.
> > Also, the Yukon EX has some features that use high bit of status
> > as security tag.
> 
> Did you leave out the GMR_FS_LEN change on purpose?  AFAICT, w/out
> that you miss the Yukon EX high bit usage.  The upstream patch applies,
> can we simply use that one (below rediffed for stable)?
> 
> thanks,
> -chris
>

I left it out on purpose because 2.6.22 doesn't support Yukon EX.

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

* Re: [stable] [PATCH 2/3] sky2: fix VLAN receive processing
  2007-09-28 19:36     ` Stephen Hemminger
@ 2007-09-28 19:41       ` Chris Wright
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wright @ 2007-09-28 19:41 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Chris Wright, Greg KH, netdev, stable, Pierre-Yves Ritschard,
	Krzysztof Oledzki

* Stephen Hemminger (shemminger@linux-foundation.org) wrote:
> I left it out on purpose because 2.6.22 doesn't support Yukon EX.

OK, thanks.

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

end of thread, other threads:[~2007-09-28 19:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-28 16:48 [PATCH 0/3] sky2: patches for 2.6.22.y Stephen Hemminger
2007-09-28 16:48 ` [PATCH 1/3] sky2: reduce impact of watchdog timer Stephen Hemminger
2007-09-28 16:48 ` [PATCH 2/3] sky2: fix VLAN receive processing Stephen Hemminger
2007-09-28 18:40   ` Krzysztof Oledzki
2007-09-28 19:20   ` [stable] " Chris Wright
2007-09-28 19:36     ` Stephen Hemminger
2007-09-28 19:41       ` Chris Wright
2007-09-28 16:48 ` [PATCH 3/3] sky2: fix transmit state on resume Stephen Hemminger

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).