diff options
author | Sreenivasa Honnur <Sreenivasa.Honnur@neterion.com> | 2008-04-23 13:29:42 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-25 02:07:10 -0400 |
commit | 99993af6981aaf8d212a5efa888a19c9db152d58 (patch) | |
tree | ba0121d049d58684cd96f08b797736671e9e20d0 /drivers/net/s2io.c | |
parent | 10371b5e6ba22173425877ea6a7040619b005fa1 (diff) |
S2io: Removed receive buffer replenishment tasklet
- Removed receive buffer replenishment tasklet s2io_tasklet and instead
allocating the receive buffers in either the interrupt handler (no napi)
or the napi handler (napi enabled).
Signed-off-by: Surjit Reang <surjit.reang@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 93 |
1 files changed, 4 insertions, 89 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 81fd7abc27e4..4344e6ed9041 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -117,20 +117,6 @@ static inline int RXD_IS_UP2DT(struct RxD_t *rxdp) | |||
117 | 117 | ||
118 | #define LINK_IS_UP(val64) (!(val64 & (ADAPTER_STATUS_RMAC_REMOTE_FAULT | \ | 118 | #define LINK_IS_UP(val64) (!(val64 & (ADAPTER_STATUS_RMAC_REMOTE_FAULT | \ |
119 | ADAPTER_STATUS_RMAC_LOCAL_FAULT))) | 119 | ADAPTER_STATUS_RMAC_LOCAL_FAULT))) |
120 | #define TASKLET_IN_USE test_and_set_bit(0, (&sp->tasklet_status)) | ||
121 | #define PANIC 1 | ||
122 | #define LOW 2 | ||
123 | static inline int rx_buffer_level(struct s2io_nic * sp, int rxb_size, int ring) | ||
124 | { | ||
125 | struct mac_info *mac_control; | ||
126 | |||
127 | mac_control = &sp->mac_control; | ||
128 | if (rxb_size <= rxd_count[sp->rxd_mode]) | ||
129 | return PANIC; | ||
130 | else if ((mac_control->rings[ring].pkt_cnt - rxb_size) > 16) | ||
131 | return LOW; | ||
132 | return 0; | ||
133 | } | ||
134 | 120 | ||
135 | static inline int is_s2io_card_up(const struct s2io_nic * sp) | 121 | static inline int is_s2io_card_up(const struct s2io_nic * sp) |
136 | { | 122 | { |
@@ -4105,7 +4091,6 @@ static int s2io_close(struct net_device *dev) | |||
4105 | do_s2io_delete_unicast_mc(sp, tmp64); | 4091 | do_s2io_delete_unicast_mc(sp, tmp64); |
4106 | } | 4092 | } |
4107 | 4093 | ||
4108 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ | ||
4109 | s2io_card_down(sp); | 4094 | s2io_card_down(sp); |
4110 | 4095 | ||
4111 | return 0; | 4096 | return 0; |
@@ -4370,29 +4355,9 @@ s2io_alarm_handle(unsigned long data) | |||
4370 | 4355 | ||
4371 | static int s2io_chk_rx_buffers(struct s2io_nic *sp, int rng_n) | 4356 | static int s2io_chk_rx_buffers(struct s2io_nic *sp, int rng_n) |
4372 | { | 4357 | { |
4373 | int rxb_size, level; | 4358 | if (fill_rx_buffers(sp, rng_n) == -ENOMEM) { |
4374 | 4359 | DBG_PRINT(INFO_DBG, "%s:Out of memory", sp->dev->name); | |
4375 | if (!sp->lro) { | 4360 | DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); |
4376 | rxb_size = atomic_read(&sp->rx_bufs_left[rng_n]); | ||
4377 | level = rx_buffer_level(sp, rxb_size, rng_n); | ||
4378 | |||
4379 | if ((level == PANIC) && (!TASKLET_IN_USE)) { | ||
4380 | int ret; | ||
4381 | DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", __FUNCTION__); | ||
4382 | DBG_PRINT(INTR_DBG, "PANIC levels\n"); | ||
4383 | if ((ret = fill_rx_buffers(sp, rng_n)) == -ENOMEM) { | ||
4384 | DBG_PRINT(INFO_DBG, "Out of memory in %s", | ||
4385 | __FUNCTION__); | ||
4386 | clear_bit(0, (&sp->tasklet_status)); | ||
4387 | return -1; | ||
4388 | } | ||
4389 | clear_bit(0, (&sp->tasklet_status)); | ||
4390 | } else if (level == LOW) | ||
4391 | tasklet_schedule(&sp->task); | ||
4392 | |||
4393 | } else if (fill_rx_buffers(sp, rng_n) == -ENOMEM) { | ||
4394 | DBG_PRINT(INFO_DBG, "%s:Out of memory", sp->dev->name); | ||
4395 | DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); | ||
4396 | } | 4361 | } |
4397 | return 0; | 4362 | return 0; |
4398 | } | 4363 | } |
@@ -6770,49 +6735,6 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6770 | } | 6735 | } |
6771 | 6736 | ||
6772 | /** | 6737 | /** |
6773 | * s2io_tasklet - Bottom half of the ISR. | ||
6774 | * @dev_adr : address of the device structure in dma_addr_t format. | ||
6775 | * Description: | ||
6776 | * This is the tasklet or the bottom half of the ISR. This is | ||
6777 | * an extension of the ISR which is scheduled by the scheduler to be run | ||
6778 | * when the load on the CPU is low. All low priority tasks of the ISR can | ||
6779 | * be pushed into the tasklet. For now the tasklet is used only to | ||
6780 | * replenish the Rx buffers in the Rx buffer descriptors. | ||
6781 | * Return value: | ||
6782 | * void. | ||
6783 | */ | ||
6784 | |||
6785 | static void s2io_tasklet(unsigned long dev_addr) | ||
6786 | { | ||
6787 | struct net_device *dev = (struct net_device *) dev_addr; | ||
6788 | struct s2io_nic *sp = dev->priv; | ||
6789 | int i, ret; | ||
6790 | struct mac_info *mac_control; | ||
6791 | struct config_param *config; | ||
6792 | |||
6793 | mac_control = &sp->mac_control; | ||
6794 | config = &sp->config; | ||
6795 | |||
6796 | if (!TASKLET_IN_USE) { | ||
6797 | for (i = 0; i < config->rx_ring_num; i++) { | ||
6798 | ret = fill_rx_buffers(sp, i); | ||
6799 | if (ret == -ENOMEM) { | ||
6800 | DBG_PRINT(INFO_DBG, "%s: Out of ", | ||
6801 | dev->name); | ||
6802 | DBG_PRINT(INFO_DBG, "memory in tasklet\n"); | ||
6803 | break; | ||
6804 | } else if (ret == -EFILL) { | ||
6805 | DBG_PRINT(INFO_DBG, | ||
6806 | "%s: Rx Ring %d is full\n", | ||
6807 | dev->name, i); | ||
6808 | break; | ||
6809 | } | ||
6810 | } | ||
6811 | clear_bit(0, (&sp->tasklet_status)); | ||
6812 | } | ||
6813 | } | ||
6814 | |||
6815 | /** | ||
6816 | * s2io_set_link - Set the LInk status | 6738 | * s2io_set_link - Set the LInk status |
6817 | * @data: long pointer to device private structue | 6739 | * @data: long pointer to device private structue |
6818 | * Description: Sets the link status for the adapter | 6740 | * Description: Sets the link status for the adapter |
@@ -7186,9 +7108,6 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | |||
7186 | 7108 | ||
7187 | s2io_rem_isr(sp); | 7109 | s2io_rem_isr(sp); |
7188 | 7110 | ||
7189 | /* Kill tasklet. */ | ||
7190 | tasklet_kill(&sp->task); | ||
7191 | |||
7192 | /* Check if the device is Quiescent and then Reset the NIC */ | 7111 | /* Check if the device is Quiescent and then Reset the NIC */ |
7193 | while(do_io) { | 7112 | while(do_io) { |
7194 | /* As per the HW requirement we need to replenish the | 7113 | /* As per the HW requirement we need to replenish the |
@@ -7314,9 +7233,6 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
7314 | 7233 | ||
7315 | S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2)); | 7234 | S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2)); |
7316 | 7235 | ||
7317 | /* Enable tasklet for the device */ | ||
7318 | tasklet_init(&sp->task, s2io_tasklet, (unsigned long) dev); | ||
7319 | |||
7320 | /* Enable select interrupts */ | 7236 | /* Enable select interrupts */ |
7321 | en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS); | 7237 | en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS); |
7322 | if (sp->config.intr_type != INTA) | 7238 | if (sp->config.intr_type != INTA) |
@@ -8119,10 +8035,9 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
8119 | s2io_reset(sp); | 8035 | s2io_reset(sp); |
8120 | 8036 | ||
8121 | /* | 8037 | /* |
8122 | * Initialize the tasklet status and link state flags | 8038 | * Initialize link state flags |
8123 | * and the card state parameter | 8039 | * and the card state parameter |
8124 | */ | 8040 | */ |
8125 | sp->tasklet_status = 0; | ||
8126 | sp->state = 0; | 8041 | sp->state = 0; |
8127 | 8042 | ||
8128 | /* Initialize spinlocks */ | 8043 | /* Initialize spinlocks */ |