diff options
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 98 |
1 files changed, 76 insertions, 22 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 5dda043bd9d7..7cfe1669ae9d 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | * s2io.c: A Linux PCI-X Ethernet driver for S2IO 10GbE Server NIC | 2 | * s2io.c: A Linux PCI-X Ethernet driver for Neterion 10GbE Server NIC |
3 | * Copyright(c) 2002-2005 Neterion Inc. | 3 | * Copyright(c) 2002-2005 Neterion Inc. |
4 | 4 | ||
5 | * This software may be used and distributed according to the terms of | 5 | * This software may be used and distributed according to the terms of |
@@ -28,7 +28,7 @@ | |||
28 | * explaination of all the variables. | 28 | * explaination of all the variables. |
29 | * rx_ring_num : This can be used to program the number of receive rings used | 29 | * rx_ring_num : This can be used to program the number of receive rings used |
30 | * in the driver. | 30 | * in the driver. |
31 | * rx_ring_len: This defines the number of descriptors each ring can have. This | 31 | * rx_ring_sz: This defines the number of descriptors each ring can have. This |
32 | * is also an array of size 8. | 32 | * is also an array of size 8. |
33 | * tx_fifo_num: This defines the number of Tx FIFOs thats used int the driver. | 33 | * tx_fifo_num: This defines the number of Tx FIFOs thats used int the driver. |
34 | * tx_fifo_len: This too is an array of 8. Each element defines the number of | 34 | * tx_fifo_len: This too is an array of 8. Each element defines the number of |
@@ -67,7 +67,7 @@ | |||
67 | 67 | ||
68 | /* S2io Driver name & version. */ | 68 | /* S2io Driver name & version. */ |
69 | static char s2io_driver_name[] = "Neterion"; | 69 | static char s2io_driver_name[] = "Neterion"; |
70 | static char s2io_driver_version[] = "Version 2.0.3.1"; | 70 | static char s2io_driver_version[] = "Version 2.0.8.1"; |
71 | 71 | ||
72 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) | 72 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) |
73 | { | 73 | { |
@@ -404,7 +404,7 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
404 | config->tx_cfg[i].fifo_len - 1; | 404 | config->tx_cfg[i].fifo_len - 1; |
405 | mac_control->fifos[i].fifo_no = i; | 405 | mac_control->fifos[i].fifo_no = i; |
406 | mac_control->fifos[i].nic = nic; | 406 | mac_control->fifos[i].nic = nic; |
407 | mac_control->fifos[i].max_txds = MAX_SKB_FRAGS; | 407 | mac_control->fifos[i].max_txds = MAX_SKB_FRAGS + 1; |
408 | 408 | ||
409 | for (j = 0; j < page_num; j++) { | 409 | for (j = 0; j < page_num; j++) { |
410 | int k = 0; | 410 | int k = 0; |
@@ -418,6 +418,26 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
418 | DBG_PRINT(ERR_DBG, "failed for TxDL\n"); | 418 | DBG_PRINT(ERR_DBG, "failed for TxDL\n"); |
419 | return -ENOMEM; | 419 | return -ENOMEM; |
420 | } | 420 | } |
421 | /* If we got a zero DMA address(can happen on | ||
422 | * certain platforms like PPC), reallocate. | ||
423 | * Store virtual address of page we don't want, | ||
424 | * to be freed later. | ||
425 | */ | ||
426 | if (!tmp_p) { | ||
427 | mac_control->zerodma_virt_addr = tmp_v; | ||
428 | DBG_PRINT(INIT_DBG, | ||
429 | "%s: Zero DMA address for TxDL. ", dev->name); | ||
430 | DBG_PRINT(INIT_DBG, | ||
431 | "Virtual address %llx\n", (u64)tmp_v); | ||
432 | tmp_v = pci_alloc_consistent(nic->pdev, | ||
433 | PAGE_SIZE, &tmp_p); | ||
434 | if (!tmp_v) { | ||
435 | DBG_PRINT(ERR_DBG, | ||
436 | "pci_alloc_consistent "); | ||
437 | DBG_PRINT(ERR_DBG, "failed for TxDL\n"); | ||
438 | return -ENOMEM; | ||
439 | } | ||
440 | } | ||
421 | while (k < lst_per_page) { | 441 | while (k < lst_per_page) { |
422 | int l = (j * lst_per_page) + k; | 442 | int l = (j * lst_per_page) + k; |
423 | if (l == config->tx_cfg[i].fifo_len) | 443 | if (l == config->tx_cfg[i].fifo_len) |
@@ -600,7 +620,7 @@ static void free_shared_mem(struct s2io_nic *nic) | |||
600 | mac_info_t *mac_control; | 620 | mac_info_t *mac_control; |
601 | struct config_param *config; | 621 | struct config_param *config; |
602 | int lst_size, lst_per_page; | 622 | int lst_size, lst_per_page; |
603 | 623 | struct net_device *dev = nic->dev; | |
604 | 624 | ||
605 | if (!nic) | 625 | if (!nic) |
606 | return; | 626 | return; |
@@ -616,9 +636,10 @@ static void free_shared_mem(struct s2io_nic *nic) | |||
616 | lst_per_page); | 636 | lst_per_page); |
617 | for (j = 0; j < page_num; j++) { | 637 | for (j = 0; j < page_num; j++) { |
618 | int mem_blks = (j * lst_per_page); | 638 | int mem_blks = (j * lst_per_page); |
619 | if ((!mac_control->fifos[i].list_info) || | 639 | if (!mac_control->fifos[i].list_info) |
620 | (!mac_control->fifos[i].list_info[mem_blks]. | 640 | return; |
621 | list_virt_addr)) | 641 | if (!mac_control->fifos[i].list_info[mem_blks]. |
642 | list_virt_addr) | ||
622 | break; | 643 | break; |
623 | pci_free_consistent(nic->pdev, PAGE_SIZE, | 644 | pci_free_consistent(nic->pdev, PAGE_SIZE, |
624 | mac_control->fifos[i]. | 645 | mac_control->fifos[i]. |
@@ -628,6 +649,18 @@ static void free_shared_mem(struct s2io_nic *nic) | |||
628 | list_info[mem_blks]. | 649 | list_info[mem_blks]. |
629 | list_phy_addr); | 650 | list_phy_addr); |
630 | } | 651 | } |
652 | /* If we got a zero DMA address during allocation, | ||
653 | * free the page now | ||
654 | */ | ||
655 | if (mac_control->zerodma_virt_addr) { | ||
656 | pci_free_consistent(nic->pdev, PAGE_SIZE, | ||
657 | mac_control->zerodma_virt_addr, | ||
658 | (dma_addr_t)0); | ||
659 | DBG_PRINT(INIT_DBG, | ||
660 | "%s: Freeing TxDL with zero DMA addr. ", dev->name); | ||
661 | DBG_PRINT(INIT_DBG, "Virtual address %llx\n", | ||
662 | (u64)(mac_control->zerodma_virt_addr)); | ||
663 | } | ||
631 | kfree(mac_control->fifos[i].list_info); | 664 | kfree(mac_control->fifos[i].list_info); |
632 | } | 665 | } |
633 | 666 | ||
@@ -2479,9 +2512,10 @@ static void rx_intr_handler(ring_info_t *ring_data) | |||
2479 | #endif | 2512 | #endif |
2480 | spin_lock(&nic->rx_lock); | 2513 | spin_lock(&nic->rx_lock); |
2481 | if (atomic_read(&nic->card_state) == CARD_DOWN) { | 2514 | if (atomic_read(&nic->card_state) == CARD_DOWN) { |
2482 | DBG_PRINT(ERR_DBG, "%s: %s going down for reset\n", | 2515 | DBG_PRINT(INTR_DBG, "%s: %s going down for reset\n", |
2483 | __FUNCTION__, dev->name); | 2516 | __FUNCTION__, dev->name); |
2484 | spin_unlock(&nic->rx_lock); | 2517 | spin_unlock(&nic->rx_lock); |
2518 | return; | ||
2485 | } | 2519 | } |
2486 | 2520 | ||
2487 | get_info = ring_data->rx_curr_get_info; | 2521 | get_info = ring_data->rx_curr_get_info; |
@@ -2596,8 +2630,14 @@ static void tx_intr_handler(fifo_info_t *fifo_data) | |||
2596 | if (txdlp->Control_1 & TXD_T_CODE) { | 2630 | if (txdlp->Control_1 & TXD_T_CODE) { |
2597 | unsigned long long err; | 2631 | unsigned long long err; |
2598 | err = txdlp->Control_1 & TXD_T_CODE; | 2632 | err = txdlp->Control_1 & TXD_T_CODE; |
2599 | DBG_PRINT(ERR_DBG, "***TxD error %llx\n", | 2633 | if ((err >> 48) == 0xA) { |
2600 | err); | 2634 | DBG_PRINT(TX_DBG, "TxD returned due \ |
2635 | to loss of link\n"); | ||
2636 | } | ||
2637 | else { | ||
2638 | DBG_PRINT(ERR_DBG, "***TxD error \ | ||
2639 | %llx\n", err); | ||
2640 | } | ||
2601 | } | 2641 | } |
2602 | 2642 | ||
2603 | skb = (struct sk_buff *) ((unsigned long) | 2643 | skb = (struct sk_buff *) ((unsigned long) |
@@ -2689,12 +2729,16 @@ static void alarm_intr_handler(struct s2io_nic *nic) | |||
2689 | if (val64 & MC_ERR_REG_ECC_ALL_DBL) { | 2729 | if (val64 & MC_ERR_REG_ECC_ALL_DBL) { |
2690 | nic->mac_control.stats_info->sw_stat. | 2730 | nic->mac_control.stats_info->sw_stat. |
2691 | double_ecc_errs++; | 2731 | double_ecc_errs++; |
2692 | DBG_PRINT(ERR_DBG, "%s: Device indicates ", | 2732 | DBG_PRINT(INIT_DBG, "%s: Device indicates ", |
2693 | dev->name); | 2733 | dev->name); |
2694 | DBG_PRINT(ERR_DBG, "double ECC error!!\n"); | 2734 | DBG_PRINT(INIT_DBG, "double ECC error!!\n"); |
2695 | if (nic->device_type != XFRAME_II_DEVICE) { | 2735 | if (nic->device_type != XFRAME_II_DEVICE) { |
2696 | netif_stop_queue(dev); | 2736 | /* Reset XframeI only if critical error */ |
2697 | schedule_work(&nic->rst_timer_task); | 2737 | if (val64 & (MC_ERR_REG_MIRI_ECC_DB_ERR_0 | |
2738 | MC_ERR_REG_MIRI_ECC_DB_ERR_1)) { | ||
2739 | netif_stop_queue(dev); | ||
2740 | schedule_work(&nic->rst_timer_task); | ||
2741 | } | ||
2698 | } | 2742 | } |
2699 | } else { | 2743 | } else { |
2700 | nic->mac_control.stats_info->sw_stat. | 2744 | nic->mac_control.stats_info->sw_stat. |
@@ -2706,7 +2750,8 @@ static void alarm_intr_handler(struct s2io_nic *nic) | |||
2706 | val64 = readq(&bar0->serr_source); | 2750 | val64 = readq(&bar0->serr_source); |
2707 | if (val64 & SERR_SOURCE_ANY) { | 2751 | if (val64 & SERR_SOURCE_ANY) { |
2708 | DBG_PRINT(ERR_DBG, "%s: Device indicates ", dev->name); | 2752 | DBG_PRINT(ERR_DBG, "%s: Device indicates ", dev->name); |
2709 | DBG_PRINT(ERR_DBG, "serious error!!\n"); | 2753 | DBG_PRINT(ERR_DBG, "serious error %llx!!\n", |
2754 | (unsigned long long)val64); | ||
2710 | netif_stop_queue(dev); | 2755 | netif_stop_queue(dev); |
2711 | schedule_work(&nic->rst_timer_task); | 2756 | schedule_work(&nic->rst_timer_task); |
2712 | } | 2757 | } |
@@ -3130,7 +3175,7 @@ int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3130 | queue_len = mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1; | 3175 | queue_len = mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1; |
3131 | /* Avoid "put" pointer going beyond "get" pointer */ | 3176 | /* Avoid "put" pointer going beyond "get" pointer */ |
3132 | if (txdp->Host_Control || (((put_off + 1) % queue_len) == get_off)) { | 3177 | if (txdp->Host_Control || (((put_off + 1) % queue_len) == get_off)) { |
3133 | DBG_PRINT(ERR_DBG, "Error in xmit, No free TXDs.\n"); | 3178 | DBG_PRINT(TX_DBG, "Error in xmit, No free TXDs.\n"); |
3134 | netif_stop_queue(dev); | 3179 | netif_stop_queue(dev); |
3135 | dev_kfree_skb(skb); | 3180 | dev_kfree_skb(skb); |
3136 | spin_unlock_irqrestore(&sp->tx_lock, flags); | 3181 | spin_unlock_irqrestore(&sp->tx_lock, flags); |
@@ -3528,7 +3573,7 @@ static void s2io_set_multicast(struct net_device *dev) | |||
3528 | 3573 | ||
3529 | val64 = readq(&bar0->mac_cfg); | 3574 | val64 = readq(&bar0->mac_cfg); |
3530 | sp->promisc_flg = 1; | 3575 | sp->promisc_flg = 1; |
3531 | DBG_PRINT(ERR_DBG, "%s: entered promiscuous mode\n", | 3576 | DBG_PRINT(INFO_DBG, "%s: entered promiscuous mode\n", |
3532 | dev->name); | 3577 | dev->name); |
3533 | } else if (!(dev->flags & IFF_PROMISC) && (sp->promisc_flg)) { | 3578 | } else if (!(dev->flags & IFF_PROMISC) && (sp->promisc_flg)) { |
3534 | /* Remove the NIC from promiscuous mode */ | 3579 | /* Remove the NIC from promiscuous mode */ |
@@ -3543,7 +3588,7 @@ static void s2io_set_multicast(struct net_device *dev) | |||
3543 | 3588 | ||
3544 | val64 = readq(&bar0->mac_cfg); | 3589 | val64 = readq(&bar0->mac_cfg); |
3545 | sp->promisc_flg = 0; | 3590 | sp->promisc_flg = 0; |
3546 | DBG_PRINT(ERR_DBG, "%s: left promiscuous mode\n", | 3591 | DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n", |
3547 | dev->name); | 3592 | dev->name); |
3548 | } | 3593 | } |
3549 | 3594 | ||
@@ -5325,7 +5370,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5325 | break; | 5370 | break; |
5326 | } | 5371 | } |
5327 | } | 5372 | } |
5328 | config->max_txds = MAX_SKB_FRAGS; | 5373 | config->max_txds = MAX_SKB_FRAGS + 1; |
5329 | 5374 | ||
5330 | /* Rx side parameters. */ | 5375 | /* Rx side parameters. */ |
5331 | if (rx_ring_sz[0] == 0) | 5376 | if (rx_ring_sz[0] == 0) |
@@ -5525,9 +5570,14 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5525 | if (sp->device_type & XFRAME_II_DEVICE) { | 5570 | if (sp->device_type & XFRAME_II_DEVICE) { |
5526 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe II 10GbE adapter ", | 5571 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe II 10GbE adapter ", |
5527 | dev->name); | 5572 | dev->name); |
5528 | DBG_PRINT(ERR_DBG, "(rev %d), Driver %s\n", | 5573 | DBG_PRINT(ERR_DBG, "(rev %d), %s", |
5529 | get_xena_rev_id(sp->pdev), | 5574 | get_xena_rev_id(sp->pdev), |
5530 | s2io_driver_version); | 5575 | s2io_driver_version); |
5576 | #ifdef CONFIG_2BUFF_MODE | ||
5577 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); | ||
5578 | #endif | ||
5579 | |||
5580 | DBG_PRINT(ERR_DBG, "\nCopyright(c) 2002-2005 Neterion Inc.\n"); | ||
5531 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", | 5581 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", |
5532 | sp->def_mac_addr[0].mac_addr[0], | 5582 | sp->def_mac_addr[0].mac_addr[0], |
5533 | sp->def_mac_addr[0].mac_addr[1], | 5583 | sp->def_mac_addr[0].mac_addr[1], |
@@ -5544,9 +5594,13 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5544 | } else { | 5594 | } else { |
5545 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe I 10GbE adapter ", | 5595 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe I 10GbE adapter ", |
5546 | dev->name); | 5596 | dev->name); |
5547 | DBG_PRINT(ERR_DBG, "(rev %d), Driver %s\n", | 5597 | DBG_PRINT(ERR_DBG, "(rev %d), %s", |
5548 | get_xena_rev_id(sp->pdev), | 5598 | get_xena_rev_id(sp->pdev), |
5549 | s2io_driver_version); | 5599 | s2io_driver_version); |
5600 | #ifdef CONFIG_2BUFF_MODE | ||
5601 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); | ||
5602 | #endif | ||
5603 | DBG_PRINT(ERR_DBG, "\nCopyright(c) 2002-2005 Neterion Inc.\n"); | ||
5550 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", | 5604 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", |
5551 | sp->def_mac_addr[0].mac_addr[0], | 5605 | sp->def_mac_addr[0].mac_addr[0], |
5552 | sp->def_mac_addr[0].mac_addr[1], | 5606 | sp->def_mac_addr[0].mac_addr[1], |