aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSivakumar Subramani <Sivakumar.Subramani@neterion.com>2007-01-31 13:32:57 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-05 16:58:51 -0500
commit372cc5972de0eb5b15403d37fa63dcb4f9134ee0 (patch)
tree20b759f03c3d8f4d41f61f1166487664e084f796
parent19a605220cf83a5ec5f8d9f9943e862ebf18f93f (diff)
s2io: Fixes in updating skb->truesize and code cleanup.
1. Fix for updating skb->truesize properly. 2. Disable NAPI only if more than one ring configured in case of MSI/MSI-X interrupts. Previously we were disabling NAPI irrespective of number of rings when MSI/MSI-X interrupts were used. 3. Code cleanup. Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/s2io.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 350723bd5eb8..9b9b28e85a7d 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_nic *nic)
459 void *tmp_v_addr, *tmp_v_addr_next; 459 void *tmp_v_addr, *tmp_v_addr_next;
460 dma_addr_t tmp_p_addr, tmp_p_addr_next; 460 dma_addr_t tmp_p_addr, tmp_p_addr_next;
461 RxD_block_t *pre_rxd_blk = NULL; 461 RxD_block_t *pre_rxd_blk = NULL;
462 int i, j, blk_cnt, rx_sz, tx_sz; 462 int i, j, blk_cnt;
463 int lst_size, lst_per_page; 463 int lst_size, lst_per_page;
464 struct net_device *dev = nic->dev; 464 struct net_device *dev = nic->dev;
465 unsigned long tmp; 465 unsigned long tmp;
@@ -484,7 +484,6 @@ static int init_shared_mem(struct s2io_nic *nic)
484 } 484 }
485 485
486 lst_size = (sizeof(TxD_t) * config->max_txds); 486 lst_size = (sizeof(TxD_t) * config->max_txds);
487 tx_sz = lst_size * size;
488 lst_per_page = PAGE_SIZE / lst_size; 487 lst_per_page = PAGE_SIZE / lst_size;
489 488
490 for (i = 0; i < config->tx_fifo_num; i++) { 489 for (i = 0; i < config->tx_fifo_num; i++) {
@@ -583,7 +582,6 @@ static int init_shared_mem(struct s2io_nic *nic)
583 size = (size * (sizeof(RxD1_t))); 582 size = (size * (sizeof(RxD1_t)));
584 else 583 else
585 size = (size * (sizeof(RxD3_t))); 584 size = (size * (sizeof(RxD3_t)));
586 rx_sz = size;
587 585
588 for (i = 0; i < config->rx_ring_num; i++) { 586 for (i = 0; i < config->rx_ring_num; i++) {
589 mac_control->rings[i].rx_curr_get_info.block_index = 0; 587 mac_control->rings[i].rx_curr_get_info.block_index = 0;
@@ -624,6 +622,8 @@ static int init_shared_mem(struct s2io_nic *nic)
624 rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)* 622 rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
625 rxd_count[nic->rxd_mode], 623 rxd_count[nic->rxd_mode],
626 GFP_KERNEL); 624 GFP_KERNEL);
625 if (!rx_blocks->rxds)
626 return -ENOMEM;
627 for (l=0; l<rxd_count[nic->rxd_mode];l++) { 627 for (l=0; l<rxd_count[nic->rxd_mode];l++) {
628 rx_blocks->rxds[l].virt_addr = 628 rx_blocks->rxds[l].virt_addr =
629 rx_blocks->block_virt_addr + 629 rx_blocks->block_virt_addr +
@@ -2259,6 +2259,7 @@ static int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb)
2259 return -ENOMEM ; 2259 return -ENOMEM ;
2260 } 2260 }
2261 frag_list = skb_shinfo(skb)->frag_list; 2261 frag_list = skb_shinfo(skb)->frag_list;
2262 skb->truesize += frag_list->truesize;
2262 frag_list->next = NULL; 2263 frag_list->next = NULL;
2263 tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); 2264 tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
2264 frag_list->data = tmp; 2265 frag_list->data = tmp;
@@ -3185,6 +3186,8 @@ static void alarm_intr_handler(struct s2io_nic *nic)
3185 register u64 val64 = 0, err_reg = 0; 3186 register u64 val64 = 0, err_reg = 0;
3186 u64 cnt; 3187 u64 cnt;
3187 int i; 3188 int i;
3189 if (atomic_read(&nic->card_state) == CARD_DOWN)
3190 return;
3188 nic->mac_control.stats_info->sw_stat.ring_full_cnt = 0; 3191 nic->mac_control.stats_info->sw_stat.ring_full_cnt = 0;
3189 /* Handling the XPAK counters update */ 3192 /* Handling the XPAK counters update */
3190 if(nic->mac_control.stats_info->xpak_stat.xpak_timer_count < 72000) { 3193 if(nic->mac_control.stats_info->xpak_stat.xpak_timer_count < 72000) {
@@ -6576,7 +6579,6 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp)
6576 skb_put(skb, buf1_len); 6579 skb_put(skb, buf1_len);
6577 skb->len += buf2_len; 6580 skb->len += buf2_len;
6578 skb->data_len += buf2_len; 6581 skb->data_len += buf2_len;
6579 skb->truesize += buf2_len;
6580 skb_put(skb_shinfo(skb)->frag_list, buf2_len); 6582 skb_put(skb_shinfo(skb)->frag_list, buf2_len);
6581 sp->stats.rx_bytes += buf1_len; 6583 sp->stats.rx_bytes += buf1_len;
6582 6584
@@ -6797,6 +6799,8 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
6797 "Defaulting to INTA\n"); 6799 "Defaulting to INTA\n");
6798 *dev_intr_type = INTA; 6800 *dev_intr_type = INTA;
6799 } 6801 }
6802 if ( (rx_ring_num > 1) && (*dev_intr_type != INTA) )
6803 napi = 0;
6800 if (rx_ring_mode > 3) { 6804 if (rx_ring_mode > 3) {
6801 DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n"); 6805 DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n");
6802 DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\n"); 6806 DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\n");
@@ -7312,7 +7316,7 @@ int __init s2io_starter(void)
7312 * Description: This function is the cleanup routine for the driver. It unregist * ers the driver. 7316 * Description: This function is the cleanup routine for the driver. It unregist * ers the driver.
7313 */ 7317 */
7314 7318
7315static void s2io_closer(void) 7319static __exit void s2io_closer(void)
7316{ 7320{
7317 pci_unregister_driver(&s2io_driver); 7321 pci_unregister_driver(&s2io_driver);
7318 DBG_PRINT(INIT_DBG, "cleanup done\n"); 7322 DBG_PRINT(INIT_DBG, "cleanup done\n");
@@ -7633,6 +7637,7 @@ static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb,
7633 lro->last_frag->next = skb; 7637 lro->last_frag->next = skb;
7634 else 7638 else
7635 skb_shinfo(first)->frag_list = skb; 7639 skb_shinfo(first)->frag_list = skb;
7640 first->truesize += skb->truesize;
7636 lro->last_frag = skb; 7641 lro->last_frag = skb;
7637 sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++; 7642 sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
7638 return; 7643 return;