aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c90
1 files changed, 53 insertions, 37 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 51a91154125d..517425dcb77c 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -86,7 +86,7 @@
86#include "s2io.h" 86#include "s2io.h"
87#include "s2io-regs.h" 87#include "s2io-regs.h"
88 88
89#define DRV_VERSION "2.0.26.24" 89#define DRV_VERSION "2.0.26.25"
90 90
91/* S2io Driver name & version. */ 91/* S2io Driver name & version. */
92static char s2io_driver_name[] = "Neterion"; 92static char s2io_driver_name[] = "Neterion";
@@ -1891,8 +1891,6 @@ static int init_nic(struct s2io_nic *nic)
1891 1891
1892static int s2io_link_fault_indication(struct s2io_nic *nic) 1892static int s2io_link_fault_indication(struct s2io_nic *nic)
1893{ 1893{
1894 if (nic->config.intr_type != INTA)
1895 return MAC_RMAC_ERR_TIMER;
1896 if (nic->device_type == XFRAME_II_DEVICE) 1894 if (nic->device_type == XFRAME_II_DEVICE)
1897 return LINK_UP_DOWN_INTERRUPT; 1895 return LINK_UP_DOWN_INTERRUPT;
1898 else 1896 else
@@ -1925,7 +1923,9 @@ static void en_dis_err_alarms(struct s2io_nic *nic, u16 mask, int flag)
1925{ 1923{
1926 struct XENA_dev_config __iomem *bar0 = nic->bar0; 1924 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1927 register u64 gen_int_mask = 0; 1925 register u64 gen_int_mask = 0;
1926 u64 interruptible;
1928 1927
1928 writeq(DISABLE_ALL_INTRS, &bar0->general_int_mask);
1929 if (mask & TX_DMA_INTR) { 1929 if (mask & TX_DMA_INTR) {
1930 1930
1931 gen_int_mask |= TXDMA_INT_M; 1931 gen_int_mask |= TXDMA_INT_M;
@@ -2015,10 +2015,12 @@ static void en_dis_err_alarms(struct s2io_nic *nic, u16 mask, int flag)
2015 gen_int_mask |= RXMAC_INT_M; 2015 gen_int_mask |= RXMAC_INT_M;
2016 do_s2io_write_bits(MAC_INT_STATUS_RMAC_INT, flag, 2016 do_s2io_write_bits(MAC_INT_STATUS_RMAC_INT, flag,
2017 &bar0->mac_int_mask); 2017 &bar0->mac_int_mask);
2018 do_s2io_write_bits(RMAC_RX_BUFF_OVRN | RMAC_RX_SM_ERR | 2018 interruptible = RMAC_RX_BUFF_OVRN | RMAC_RX_SM_ERR |
2019 RMAC_UNUSED_INT | RMAC_SINGLE_ECC_ERR | 2019 RMAC_UNUSED_INT | RMAC_SINGLE_ECC_ERR |
2020 RMAC_DOUBLE_ECC_ERR | 2020 RMAC_DOUBLE_ECC_ERR;
2021 RMAC_LINK_STATE_CHANGE_INT, 2021 if (s2io_link_fault_indication(nic) == MAC_RMAC_ERR_TIMER)
2022 interruptible |= RMAC_LINK_STATE_CHANGE_INT;
2023 do_s2io_write_bits(interruptible,
2022 flag, &bar0->mac_rmac_err_mask); 2024 flag, &bar0->mac_rmac_err_mask);
2023 } 2025 }
2024 2026
@@ -2501,6 +2503,9 @@ static void stop_nic(struct s2io_nic *nic)
2501/** 2503/**
2502 * fill_rx_buffers - Allocates the Rx side skbs 2504 * fill_rx_buffers - Allocates the Rx side skbs
2503 * @ring_info: per ring structure 2505 * @ring_info: per ring structure
2506 * @from_card_up: If this is true, we will map the buffer to get
2507 * the dma address for buf0 and buf1 to give it to the card.
2508 * Else we will sync the already mapped buffer to give it to the card.
2504 * Description: 2509 * Description:
2505 * The function allocates Rx side skbs and puts the physical 2510 * The function allocates Rx side skbs and puts the physical
2506 * address of these buffers into the RxD buffer pointers, so that the NIC 2511 * address of these buffers into the RxD buffer pointers, so that the NIC
@@ -2518,7 +2523,7 @@ static void stop_nic(struct s2io_nic *nic)
2518 * SUCCESS on success or an appropriate -ve value on failure. 2523 * SUCCESS on success or an appropriate -ve value on failure.
2519 */ 2524 */
2520 2525
2521static int fill_rx_buffers(struct ring_info *ring) 2526static int fill_rx_buffers(struct ring_info *ring, int from_card_up)
2522{ 2527{
2523 struct sk_buff *skb; 2528 struct sk_buff *skb;
2524 struct RxD_t *rxdp; 2529 struct RxD_t *rxdp;
@@ -2637,17 +2642,16 @@ static int fill_rx_buffers(struct ring_info *ring)
2637 skb->data = (void *) (unsigned long)tmp; 2642 skb->data = (void *) (unsigned long)tmp;
2638 skb_reset_tail_pointer(skb); 2643 skb_reset_tail_pointer(skb);
2639 2644
2640 /* AK: check is wrong. 0 can be valid dma address */ 2645 if (from_card_up) {
2641 if (!(rxdp3->Buffer0_ptr))
2642 rxdp3->Buffer0_ptr = 2646 rxdp3->Buffer0_ptr =
2643 pci_map_single(ring->pdev, ba->ba_0, 2647 pci_map_single(ring->pdev, ba->ba_0,
2644 BUF0_LEN, PCI_DMA_FROMDEVICE); 2648 BUF0_LEN, PCI_DMA_FROMDEVICE);
2645 else 2649 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr))
2650 goto pci_map_failed;
2651 } else
2646 pci_dma_sync_single_for_device(ring->pdev, 2652 pci_dma_sync_single_for_device(ring->pdev,
2647 (dma_addr_t) rxdp3->Buffer0_ptr, 2653 (dma_addr_t) rxdp3->Buffer0_ptr,
2648 BUF0_LEN, PCI_DMA_FROMDEVICE); 2654 BUF0_LEN, PCI_DMA_FROMDEVICE);
2649 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr))
2650 goto pci_map_failed;
2651 2655
2652 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN); 2656 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
2653 if (ring->rxd_mode == RXD_MODE_3B) { 2657 if (ring->rxd_mode == RXD_MODE_3B) {
@@ -2664,21 +2668,22 @@ static int fill_rx_buffers(struct ring_info *ring)
2664 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr)) 2668 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr))
2665 goto pci_map_failed; 2669 goto pci_map_failed;
2666 2670
2667 /* AK: check is wrong */ 2671 if (from_card_up) {
2668 if (!rxdp3->Buffer1_ptr)
2669 rxdp3->Buffer1_ptr = 2672 rxdp3->Buffer1_ptr =
2670 pci_map_single(ring->pdev, 2673 pci_map_single(ring->pdev,
2671 ba->ba_1, BUF1_LEN, 2674 ba->ba_1, BUF1_LEN,
2672 PCI_DMA_FROMDEVICE); 2675 PCI_DMA_FROMDEVICE);
2673 2676
2674 if (pci_dma_mapping_error(rxdp3->Buffer1_ptr)) { 2677 if (pci_dma_mapping_error
2675 pci_unmap_single 2678 (rxdp3->Buffer1_ptr)) {
2676 (ring->pdev, 2679 pci_unmap_single
2677 (dma_addr_t)(unsigned long) 2680 (ring->pdev,
2678 skb->data, 2681 (dma_addr_t)(unsigned long)
2679 ring->mtu + 4, 2682 skb->data,
2680 PCI_DMA_FROMDEVICE); 2683 ring->mtu + 4,
2681 goto pci_map_failed; 2684 PCI_DMA_FROMDEVICE);
2685 goto pci_map_failed;
2686 }
2682 } 2687 }
2683 rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1); 2688 rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1);
2684 rxdp->Control_2 |= SET_BUFFER2_SIZE_3 2689 rxdp->Control_2 |= SET_BUFFER2_SIZE_3
@@ -2813,7 +2818,7 @@ static void free_rx_buffers(struct s2io_nic *sp)
2813 2818
2814static int s2io_chk_rx_buffers(struct ring_info *ring) 2819static int s2io_chk_rx_buffers(struct ring_info *ring)
2815{ 2820{
2816 if (fill_rx_buffers(ring) == -ENOMEM) { 2821 if (fill_rx_buffers(ring, 0) == -ENOMEM) {
2817 DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name); 2822 DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name);
2818 DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); 2823 DBG_PRINT(INFO_DBG, " in Rx Intr!!\n");
2819 } 2824 }
@@ -2944,7 +2949,7 @@ static void s2io_netpoll(struct net_device *dev)
2944 rx_intr_handler(&mac_control->rings[i], 0); 2949 rx_intr_handler(&mac_control->rings[i], 0);
2945 2950
2946 for (i = 0; i < config->rx_ring_num; i++) { 2951 for (i = 0; i < config->rx_ring_num; i++) {
2947 if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { 2952 if (fill_rx_buffers(&mac_control->rings[i], 0) == -ENOMEM) {
2948 DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); 2953 DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name);
2949 DBG_PRINT(INFO_DBG, " in Rx Netpoll!!\n"); 2954 DBG_PRINT(INFO_DBG, " in Rx Netpoll!!\n");
2950 break; 2955 break;
@@ -4373,18 +4378,24 @@ static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id)
4373 /* Nothing much can be done. Get out */ 4378 /* Nothing much can be done. Get out */
4374 return IRQ_HANDLED; 4379 return IRQ_HANDLED;
4375 4380
4376 writeq(S2IO_MINUS_ONE, &bar0->general_int_mask); 4381 if (reason & (GEN_INTR_TXPIC | GEN_INTR_TXTRAFFIC)) {
4382 writeq(S2IO_MINUS_ONE, &bar0->general_int_mask);
4377 4383
4378 if (reason & GEN_INTR_TXTRAFFIC) 4384 if (reason & GEN_INTR_TXPIC)
4379 writeq(S2IO_MINUS_ONE, &bar0->tx_traffic_int); 4385 s2io_txpic_intr_handle(sp);
4380 4386
4381 for (i = 0; i < config->tx_fifo_num; i++) 4387 if (reason & GEN_INTR_TXTRAFFIC)
4382 tx_intr_handler(&fifos[i]); 4388 writeq(S2IO_MINUS_ONE, &bar0->tx_traffic_int);
4383 4389
4384 writeq(sp->general_int_mask, &bar0->general_int_mask); 4390 for (i = 0; i < config->tx_fifo_num; i++)
4385 readl(&bar0->general_int_status); 4391 tx_intr_handler(&fifos[i]);
4386 4392
4387 return IRQ_HANDLED; 4393 writeq(sp->general_int_mask, &bar0->general_int_mask);
4394 readl(&bar0->general_int_status);
4395 return IRQ_HANDLED;
4396 }
4397 /* The interrupt was not raised by us */
4398 return IRQ_NONE;
4388} 4399}
4389 4400
4390static void s2io_txpic_intr_handle(struct s2io_nic *sp) 4401static void s2io_txpic_intr_handle(struct s2io_nic *sp)
@@ -7112,6 +7123,9 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
7112 7123
7113 s2io_rem_isr(sp); 7124 s2io_rem_isr(sp);
7114 7125
7126 /* stop the tx queue, indicate link down */
7127 s2io_link(sp, LINK_DOWN);
7128
7115 /* Check if the device is Quiescent and then Reset the NIC */ 7129 /* Check if the device is Quiescent and then Reset the NIC */
7116 while(do_io) { 7130 while(do_io) {
7117 /* As per the HW requirement we need to replenish the 7131 /* As per the HW requirement we need to replenish the
@@ -7183,7 +7197,7 @@ static int s2io_card_up(struct s2io_nic * sp)
7183 7197
7184 for (i = 0; i < config->rx_ring_num; i++) { 7198 for (i = 0; i < config->rx_ring_num; i++) {
7185 mac_control->rings[i].mtu = dev->mtu; 7199 mac_control->rings[i].mtu = dev->mtu;
7186 ret = fill_rx_buffers(&mac_control->rings[i]); 7200 ret = fill_rx_buffers(&mac_control->rings[i], 1);
7187 if (ret) { 7201 if (ret) {
7188 DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", 7202 DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n",
7189 dev->name); 7203 dev->name);
@@ -7244,17 +7258,19 @@ static int s2io_card_up(struct s2io_nic * sp)
7244 7258
7245 S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2)); 7259 S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2));
7246 7260
7261 set_bit(__S2IO_STATE_CARD_UP, &sp->state);
7262
7247 /* Enable select interrupts */ 7263 /* Enable select interrupts */
7248 en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS); 7264 en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS);
7249 if (sp->config.intr_type != INTA) 7265 if (sp->config.intr_type != INTA) {
7250 en_dis_able_nic_intrs(sp, TX_TRAFFIC_INTR, ENABLE_INTRS); 7266 interruptible = TX_TRAFFIC_INTR | TX_PIC_INTR;
7251 else { 7267 en_dis_able_nic_intrs(sp, interruptible, ENABLE_INTRS);
7268 } else {
7252 interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; 7269 interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR;
7253 interruptible |= TX_PIC_INTR; 7270 interruptible |= TX_PIC_INTR;
7254 en_dis_able_nic_intrs(sp, interruptible, ENABLE_INTRS); 7271 en_dis_able_nic_intrs(sp, interruptible, ENABLE_INTRS);
7255 } 7272 }
7256 7273
7257 set_bit(__S2IO_STATE_CARD_UP, &sp->state);
7258 return 0; 7274 return 0;
7259} 7275}
7260 7276