aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorravinandan.arakali@neterion.com <ravinandan.arakali@neterion.com>2005-09-07 00:36:56 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-06 22:12:57 -0400
commit776bd20fa25fd8fc71fd4a2f213c106d6868db39 (patch)
treedc9745ae9d312b79ce37c9314dade8a4534fd5d1 /drivers
parent4706df3d3c42af802597d82c8b1542c3d52eab23 (diff)
[PATCH] S2io: Hardware and miscellaneous fixes
Hi, This patch contains the following hardware related fixes and other miscellaneous bug fixes. 1. Updated the definition of single and double-bit ECC errors 2. Earlier we were allocating Transmit descriptors equal to MAX_SKB_FRAGS. This was causing a boundary condition failure. Need to allocate MAX_SKB_FRAGS+1 descriptors. 3. On some platforms(like PPC), pci_alloc_consistent() can return a zero DMA address. Since the NIC cannot handle zero-addresses, a workaround has been provided. Basically, we don't use such that page. We reallocate. 4. If list_info allocation failed during driver load, check for it during driver exit and return instead of trying to dereference NULL pointer. 5. Increase the debug level of few non-critical debug messages. 6. Reset the card on critical ECC double errors only in case of XframeI since XframeII can recover from such errors. 7. Print copyright message on driver load. 8. Bumped up the driver version no. to 2.0.8.1 Signed-off-by: Ravinandan Arakali <ravinandan.arakali@neterion.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/s2io-regs.h13
-rw-r--r--drivers/net/s2io.c98
-rw-r--r--drivers/net/s2io.h5
3 files changed, 88 insertions, 28 deletions
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h
index 2234a8f05eb2..7cefe5507b9e 100644
--- a/drivers/net/s2io-regs.h
+++ b/drivers/net/s2io-regs.h
@@ -1,5 +1,5 @@
1/************************************************************************ 1/************************************************************************
2 * regs.h: A Linux PCI-X Ethernet driver for S2IO 10GbE Server NIC 2 * regs.h: 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
@@ -713,13 +713,16 @@ typedef struct _XENA_dev_config {
713 u64 mc_err_reg; 713 u64 mc_err_reg;
714#define MC_ERR_REG_ECC_DB_ERR_L BIT(14) 714#define MC_ERR_REG_ECC_DB_ERR_L BIT(14)
715#define MC_ERR_REG_ECC_DB_ERR_U BIT(15) 715#define MC_ERR_REG_ECC_DB_ERR_U BIT(15)
716#define MC_ERR_REG_MIRI_ECC_DB_ERR_0 BIT(18)
717#define MC_ERR_REG_MIRI_ECC_DB_ERR_1 BIT(20)
716#define MC_ERR_REG_MIRI_CRI_ERR_0 BIT(22) 718#define MC_ERR_REG_MIRI_CRI_ERR_0 BIT(22)
717#define MC_ERR_REG_MIRI_CRI_ERR_1 BIT(23) 719#define MC_ERR_REG_MIRI_CRI_ERR_1 BIT(23)
718#define MC_ERR_REG_SM_ERR BIT(31) 720#define MC_ERR_REG_SM_ERR BIT(31)
719#define MC_ERR_REG_ECC_ALL_SNG (BIT(6) | \ 721#define MC_ERR_REG_ECC_ALL_SNG (BIT(2) | BIT(3) | BIT(4) | BIT(5) |\
720 BIT(7) | BIT(17) | BIT(19)) 722 BIT(6) | BIT(7) | BIT(17) | BIT(19))
721#define MC_ERR_REG_ECC_ALL_DBL (BIT(14) | \ 723#define MC_ERR_REG_ECC_ALL_DBL (BIT(10) | BIT(11) | BIT(12) |\
722 BIT(15) | BIT(18) | BIT(20)) 724 BIT(13) | BIT(14) | BIT(15) |\
725 BIT(18) | BIT(20))
723 u64 mc_err_mask; 726 u64 mc_err_mask;
724 u64 mc_err_alarm; 727 u64 mc_err_alarm;
725 728
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. */
69static char s2io_driver_name[] = "Neterion"; 69static char s2io_driver_name[] = "Neterion";
70static char s2io_driver_version[] = "Version 2.0.3.1"; 70static char s2io_driver_version[] = "Version 2.0.8.1";
71 71
72static inline int RXD_IS_UP2DT(RxD_t *rxdp) 72static 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],
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index bc64d967f080..89151cb52181 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -1,5 +1,5 @@
1/************************************************************************ 1/************************************************************************
2 * s2io.h: A Linux PCI-X Ethernet driver for S2IO 10GbE Server NIC 2 * s2io.h: 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
@@ -622,6 +622,9 @@ typedef struct mac_info {
622 /* Fifo specific structure */ 622 /* Fifo specific structure */
623 fifo_info_t fifos[MAX_TX_FIFOS]; 623 fifo_info_t fifos[MAX_TX_FIFOS];
624 624
625 /* Save virtual address of TxD page with zero DMA addr(if any) */
626 void *zerodma_virt_addr;
627
625/* rx side stuff */ 628/* rx side stuff */
626 /* Ring specific structure */ 629 /* Ring specific structure */
627 ring_info_t rings[MAX_RX_RINGS]; 630 ring_info_t rings[MAX_RX_RINGS];