aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorraghavendra.koushik@neterion.com <raghavendra.koushik@neterion.com>2005-08-03 15:34:11 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-11 00:10:45 -0400
commit25fff88eb7dbc63e03f1766e130515900d440dbb (patch)
tree8ca0644a07520e4b2beec8caf7d9ba091ef50299 /drivers
parentd8892c6ee39614bc6d282dbef0ff9fa461a6467c (diff)
[PATCH] S2io: Timer based slowpath handling
Hi, This patch implements the slow-path handling functions(link state change, hardware errors) as a timer. It is not handled in interrupt handler as was done previously. Signed-off-by: Ravinandan Arakali <ravinandan.arakali@neterion.com> Signed-off-by: Raghavendra Koushik <raghavendra.koushik@neterion.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/s2io.c22
-rw-r--r--drivers/net/s2io.h4
2 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index aff1fb74e14b..ee498d248d38 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -168,6 +168,12 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
168#define S2IO_TEST_LEN sizeof(s2io_gstrings) / ETH_GSTRING_LEN 168#define S2IO_TEST_LEN sizeof(s2io_gstrings) / ETH_GSTRING_LEN
169#define S2IO_STRINGS_LEN S2IO_TEST_LEN * ETH_GSTRING_LEN 169#define S2IO_STRINGS_LEN S2IO_TEST_LEN * ETH_GSTRING_LEN
170 170
171#define S2IO_TIMER_CONF(timer, handle, arg, exp) \
172 init_timer(&timer); \
173 timer.function = handle; \
174 timer.data = (unsigned long) arg; \
175 mod_timer(&timer, (jiffies + exp)) \
176
171/* 177/*
172 * Constants to be programmed into the Xena's registers, to configure 178 * Constants to be programmed into the Xena's registers, to configure
173 * the XAUI. 179 * the XAUI.
@@ -2741,6 +2747,7 @@ int s2io_open(struct net_device *dev)
2741setting_mac_address_failed: 2747setting_mac_address_failed:
2742 free_irq(sp->pdev->irq, dev); 2748 free_irq(sp->pdev->irq, dev);
2743isr_registration_failed: 2749isr_registration_failed:
2750 del_timer_sync(&sp->alarm_timer);
2744 s2io_reset(sp); 2751 s2io_reset(sp);
2745hw_init_failed: 2752hw_init_failed:
2746 return err; 2753 return err;
@@ -2898,6 +2905,15 @@ int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
2898 return 0; 2905 return 0;
2899} 2906}
2900 2907
2908static void
2909s2io_alarm_handle(unsigned long data)
2910{
2911 nic_t *sp = (nic_t *)data;
2912
2913 alarm_intr_handler(sp);
2914 mod_timer(&sp->alarm_timer, jiffies + HZ / 2);
2915}
2916
2901/** 2917/**
2902 * s2io_isr - ISR handler of the device . 2918 * s2io_isr - ISR handler of the device .
2903 * @irq: the irq of the device. 2919 * @irq: the irq of the device.
@@ -2942,9 +2958,6 @@ static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs)
2942 return IRQ_NONE; 2958 return IRQ_NONE;
2943 } 2959 }
2944 2960
2945 if (reason & (GEN_ERROR_INTR))
2946 alarm_intr_handler(sp);
2947
2948#ifdef CONFIG_S2IO_NAPI 2961#ifdef CONFIG_S2IO_NAPI
2949 if (reason & GEN_INTR_RXTRAFFIC) { 2962 if (reason & GEN_INTR_RXTRAFFIC) {
2950 if (netif_rx_schedule_prep(dev)) { 2963 if (netif_rx_schedule_prep(dev)) {
@@ -4394,6 +4407,7 @@ static void s2io_card_down(nic_t * sp)
4394 unsigned long flags; 4407 unsigned long flags;
4395 register u64 val64 = 0; 4408 register u64 val64 = 0;
4396 4409
4410 del_timer_sync(&sp->alarm_timer);
4397 /* If s2io_set_link task is executing, wait till it completes. */ 4411 /* If s2io_set_link task is executing, wait till it completes. */
4398 while (test_and_set_bit(0, &(sp->link_state))) { 4412 while (test_and_set_bit(0, &(sp->link_state))) {
4399 msleep(50); 4413 msleep(50);
@@ -4496,6 +4510,8 @@ static int s2io_card_up(nic_t * sp)
4496 return -ENODEV; 4510 return -ENODEV;
4497 } 4511 }
4498 4512
4513 S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2));
4514
4499 atomic_set(&sp->card_state, CARD_UP); 4515 atomic_set(&sp->card_state, CARD_UP);
4500 return 0; 4516 return 0;
4501} 4517}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index ce9bf6d5ee00..263fe7a1b903 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -624,6 +624,9 @@ struct s2io_nic {
624 struct tasklet_struct task; 624 struct tasklet_struct task;
625 volatile unsigned long tasklet_status; 625 volatile unsigned long tasklet_status;
626 626
627 /* Timer that handles I/O errors/exceptions */
628 struct timer_list alarm_timer;
629
627 /* Space to back up the PCI config space */ 630 /* Space to back up the PCI config space */
628 u32 config_space[256 / sizeof(u32)]; 631 u32 config_space[256 / sizeof(u32)];
629 632
@@ -819,6 +822,7 @@ static int s2io_poll(struct net_device *dev, int *budget);
819#endif 822#endif
820static void s2io_init_pci(nic_t * sp); 823static void s2io_init_pci(nic_t * sp);
821int s2io_set_mac_addr(struct net_device *dev, u8 * addr); 824int s2io_set_mac_addr(struct net_device *dev, u8 * addr);
825static void s2io_alarm_handle(unsigned long data);
822static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs); 826static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs);
823static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag); 827static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag);
824static struct ethtool_ops netdev_ethtool_ops; 828static struct ethtool_ops netdev_ethtool_ops;