* [PATCH] natsemi: Use round_jiffies() for slow timers
@ 2007-10-09 21:57 Mark Brown
2007-10-09 21:57 ` [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently Mark Brown
2007-10-10 0:47 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2007-10-09 21:57 UTC (permalink / raw)
To: jgarzik, thockin; +Cc: netdev, linux-kernel, Mark Brown
Unless we have failed to fill the RX ring the timer used by the natsemi
driver is not particularly urgent and can use round_jiffies() to allow
grouping with other timers.
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
---
drivers/net/natsemi.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index b47a12d..0b33a58 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1575,7 +1575,7 @@ static int netdev_open(struct net_device *dev)
/* Set the timer to check for link beat. */
init_timer(&np->timer);
- np->timer.expires = jiffies + NATSEMI_TIMER_FREQ;
+ np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ);
np->timer.data = (unsigned long)dev;
np->timer.function = &netdev_timer; /* timer handler */
add_timer(&np->timer);
@@ -1855,7 +1855,11 @@ static void netdev_timer(unsigned long data)
next_tick = 1;
}
}
- mod_timer(&np->timer, jiffies + next_tick);
+
+ if (next_tick > 1)
+ mod_timer(&np->timer, round_jiffies(jiffies + next_tick));
+ else
+ mod_timer(&np->timer, jiffies + next_tick);
}
static void dump_ring(struct net_device *dev)
@@ -3330,7 +3334,7 @@ static int natsemi_resume (struct pci_dev *pdev)
spin_unlock_irq(&np->lock);
enable_irq(dev->irq);
- mod_timer(&np->timer, jiffies + 1*HZ);
+ mod_timer(&np->timer, round_jiffies(jiffies + 1*HZ));
}
netif_device_attach(dev);
netif_poll_enable(dev);
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently
2007-10-09 21:57 [PATCH] natsemi: Use round_jiffies() for slow timers Mark Brown
@ 2007-10-09 21:57 ` Mark Brown
2007-10-10 0:47 ` Jeff Garzik
2007-10-10 0:47 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2007-10-09 21:57 UTC (permalink / raw)
To: jgarzik, thockin; +Cc: netdev, linux-kernel, Mark Brown
The natsemi driver has a define NATSEMI_TIMER_FREQ which looks like it
controls the normal frequency of the chip poll timer but in fact only
takes effect for the first run of the timer. Adjust the value of the
define to match that used by the timer and use the define consistently.
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
---
drivers/net/natsemi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 0b33a58..1f88604 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -108,7 +108,7 @@ static int full_duplex[MAX_UNITS];
#define TX_TIMEOUT (2*HZ)
#define NATSEMI_HW_TIMEOUT 400
-#define NATSEMI_TIMER_FREQ 3*HZ
+#define NATSEMI_TIMER_FREQ 5*HZ
#define NATSEMI_PG0_NREGS 64
#define NATSEMI_RFDR_NREGS 8
#define NATSEMI_PG1_NREGS 4
@@ -1797,7 +1797,7 @@ static void netdev_timer(unsigned long data)
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = netdev_priv(dev);
void __iomem * ioaddr = ns_ioaddr(dev);
- int next_tick = 5*HZ;
+ int next_tick = NATSEMI_TIMER_FREQ;
if (netif_msg_timer(np)) {
/* DO NOT read the IntrStatus register,
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] natsemi: Use round_jiffies() for slow timers
2007-10-09 21:57 [PATCH] natsemi: Use round_jiffies() for slow timers Mark Brown
2007-10-09 21:57 ` [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently Mark Brown
@ 2007-10-10 0:47 ` Jeff Garzik
2007-10-10 10:05 ` Mark Brown
1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2007-10-10 0:47 UTC (permalink / raw)
To: Mark Brown; +Cc: thockin, netdev, linux-kernel
Mark Brown wrote:
> Unless we have failed to fill the RX ring the timer used by the natsemi
> driver is not particularly urgent and can use round_jiffies() to allow
> grouping with other timers.
>
> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
> ---
> drivers/net/natsemi.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
ACK but does not apply to netdev-2.6.git#upstream or davem/net-2.6.24.git
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently
2007-10-09 21:57 ` [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently Mark Brown
@ 2007-10-10 0:47 ` Jeff Garzik
0 siblings, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-10-10 0:47 UTC (permalink / raw)
To: Mark Brown; +Cc: thockin, netdev, linux-kernel
Mark Brown wrote:
> The natsemi driver has a define NATSEMI_TIMER_FREQ which looks like it
> controls the normal frequency of the chip poll timer but in fact only
> takes effect for the first run of the timer. Adjust the value of the
> define to match that used by the timer and use the define consistently.
>
> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
> ---
> drivers/net/natsemi.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
applied
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] natsemi: Use round_jiffies() for slow timers
2007-10-10 0:47 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
@ 2007-10-10 10:05 ` Mark Brown
2007-10-10 16:11 ` [PATCH] natsemi: Check return value for pci_enable_device() Mark Brown
2007-10-15 18:21 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2007-10-10 10:05 UTC (permalink / raw)
To: Jeff Garzik, thockin; +Cc: netdev, linux-kernel, Mark Brown
Unless we have failed to fill the RX ring the timer used by the natsemi
driver is not particularly urgent and can use round_jiffies() to allow
grouping with other timers.
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
---
Rediffed against current netdev-2.6.git#upstream
drivers/net/natsemi.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 527f9dc..b881786 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1576,7 +1576,7 @@ static int netdev_open(struct net_device *dev)
/* Set the timer to check for link beat. */
init_timer(&np->timer);
- np->timer.expires = jiffies + NATSEMI_TIMER_FREQ;
+ np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ);
np->timer.data = (unsigned long)dev;
np->timer.function = &netdev_timer; /* timer handler */
add_timer(&np->timer);
@@ -1856,7 +1856,11 @@ static void netdev_timer(unsigned long data)
next_tick = 1;
}
}
- mod_timer(&np->timer, jiffies + next_tick);
+
+ if (next_tick > 1)
+ mod_timer(&np->timer, round_jiffies(jiffies + next_tick));
+ else
+ mod_timer(&np->timer, jiffies + next_tick);
}
static void dump_ring(struct net_device *dev)
@@ -3331,7 +3335,7 @@ static int natsemi_resume (struct pci_dev *pdev)
spin_unlock_irq(&np->lock);
enable_irq(dev->irq);
- mod_timer(&np->timer, jiffies + 1*HZ);
+ mod_timer(&np->timer, round_jiffies(jiffies + 1*HZ));
}
netif_device_attach(dev);
out:
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] natsemi: Check return value for pci_enable_device()
2007-10-10 10:05 ` Mark Brown
@ 2007-10-10 16:11 ` Mark Brown
2007-10-15 18:21 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
1 sibling, 0 replies; 7+ messages in thread
From: Mark Brown @ 2007-10-10 16:11 UTC (permalink / raw)
To: Jeff Garzik, thockin; +Cc: netdev, linux-kernel, Mark Brown
pci_enable_device() is __must_check so do that in natsemi_resume().
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
---
drivers/net/natsemi.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index b881786..50e1ec6 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -3314,13 +3314,19 @@ static int natsemi_resume (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata (pdev);
struct netdev_private *np = netdev_priv(dev);
+ int ret = 0;
rtnl_lock();
if (netif_device_present(dev))
goto out;
if (netif_running(dev)) {
BUG_ON(!np->hands_off);
- pci_enable_device(pdev);
+ ret = pci_enable_device(pdev);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "pci_enable_device() failed: %d\n", ret);
+ goto out;
+ }
/* pci_power_on(pdev); */
napi_enable(&np->napi);
@@ -3340,7 +3346,7 @@ static int natsemi_resume (struct pci_dev *pdev)
netif_device_attach(dev);
out:
rtnl_unlock();
- return 0;
+ return ret;
}
#endif /* CONFIG_PM */
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] natsemi: Use round_jiffies() for slow timers
2007-10-10 10:05 ` Mark Brown
2007-10-10 16:11 ` [PATCH] natsemi: Check return value for pci_enable_device() Mark Brown
@ 2007-10-15 18:21 ` Jeff Garzik
1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-10-15 18:21 UTC (permalink / raw)
To: Mark Brown; +Cc: thockin, netdev, linux-kernel
Mark Brown wrote:
> Unless we have failed to fill the RX ring the timer used by the natsemi
> driver is not particularly urgent and can use round_jiffies() to allow
> grouping with other timers.
>
> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
> ---
> Rediffed against current netdev-2.6.git#upstream
>
> drivers/net/natsemi.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
applied and the pci_enabie_device() return value patch
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-10-15 18:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-09 21:57 [PATCH] natsemi: Use round_jiffies() for slow timers Mark Brown
2007-10-09 21:57 ` [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently Mark Brown
2007-10-10 0:47 ` Jeff Garzik
2007-10-10 0:47 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
2007-10-10 10:05 ` Mark Brown
2007-10-10 16:11 ` [PATCH] natsemi: Check return value for pci_enable_device() Mark Brown
2007-10-15 18:21 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
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).