diff options
Diffstat (limited to 'drivers/net/sfc/falcon.c')
-rw-r--r-- | drivers/net/sfc/falcon.c | 91 |
1 files changed, 41 insertions, 50 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index b57cc68058c0..790db89db345 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -116,17 +116,8 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold"); | |||
116 | ************************************************************************** | 116 | ************************************************************************** |
117 | */ | 117 | */ |
118 | 118 | ||
119 | /* DMA address mask (up to 46-bit, avoiding compiler warnings) | 119 | /* DMA address mask */ |
120 | * | 120 | #define FALCON_DMA_MASK DMA_BIT_MASK(46) |
121 | * Note that it is possible to have a platform with 64-bit longs and | ||
122 | * 32-bit DMA addresses, or vice versa. EFX_DMA_MASK takes care of the | ||
123 | * platform DMA mask. | ||
124 | */ | ||
125 | #if BITS_PER_LONG == 64 | ||
126 | #define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffUL) | ||
127 | #else | ||
128 | #define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffULL) | ||
129 | #endif | ||
130 | 121 | ||
131 | /* TX DMA length mask (13-bit) */ | 122 | /* TX DMA length mask (13-bit) */ |
132 | #define FALCON_TX_DMA_MASK (4096 - 1) | 123 | #define FALCON_TX_DMA_MASK (4096 - 1) |
@@ -145,7 +136,7 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold"); | |||
145 | #define PCI_EXP_LNKSTA_LNK_WID_LBN 4 | 136 | #define PCI_EXP_LNKSTA_LNK_WID_LBN 4 |
146 | 137 | ||
147 | #define FALCON_IS_DUAL_FUNC(efx) \ | 138 | #define FALCON_IS_DUAL_FUNC(efx) \ |
148 | (FALCON_REV(efx) < FALCON_REV_B0) | 139 | (falcon_rev(efx) < FALCON_REV_B0) |
149 | 140 | ||
150 | /************************************************************************** | 141 | /************************************************************************** |
151 | * | 142 | * |
@@ -465,7 +456,7 @@ int falcon_init_tx(struct efx_tx_queue *tx_queue) | |||
465 | TX_DESCQ_TYPE, 0, | 456 | TX_DESCQ_TYPE, 0, |
466 | TX_NON_IP_DROP_DIS_B0, 1); | 457 | TX_NON_IP_DROP_DIS_B0, 1); |
467 | 458 | ||
468 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 459 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
469 | int csum = !(efx->net_dev->features & NETIF_F_IP_CSUM); | 460 | int csum = !(efx->net_dev->features & NETIF_F_IP_CSUM); |
470 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_IP_CHKSM_DIS_B0, csum); | 461 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_IP_CHKSM_DIS_B0, csum); |
471 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_TCP_CHKSM_DIS_B0, csum); | 462 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_TCP_CHKSM_DIS_B0, csum); |
@@ -474,7 +465,7 @@ int falcon_init_tx(struct efx_tx_queue *tx_queue) | |||
474 | falcon_write_table(efx, &tx_desc_ptr, efx->type->txd_ptr_tbl_base, | 465 | falcon_write_table(efx, &tx_desc_ptr, efx->type->txd_ptr_tbl_base, |
475 | tx_queue->queue); | 466 | tx_queue->queue); |
476 | 467 | ||
477 | if (FALCON_REV(efx) < FALCON_REV_B0) { | 468 | if (falcon_rev(efx) < FALCON_REV_B0) { |
478 | efx_oword_t reg; | 469 | efx_oword_t reg; |
479 | 470 | ||
480 | BUG_ON(tx_queue->queue >= 128); /* HW limit */ | 471 | BUG_ON(tx_queue->queue >= 128); /* HW limit */ |
@@ -635,7 +626,7 @@ int falcon_init_rx(struct efx_rx_queue *rx_queue) | |||
635 | efx_oword_t rx_desc_ptr; | 626 | efx_oword_t rx_desc_ptr; |
636 | struct efx_nic *efx = rx_queue->efx; | 627 | struct efx_nic *efx = rx_queue->efx; |
637 | int rc; | 628 | int rc; |
638 | int is_b0 = FALCON_REV(efx) >= FALCON_REV_B0; | 629 | int is_b0 = falcon_rev(efx) >= FALCON_REV_B0; |
639 | int iscsi_digest_en = is_b0; | 630 | int iscsi_digest_en = is_b0; |
640 | 631 | ||
641 | EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n", | 632 | EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n", |
@@ -742,8 +733,10 @@ void falcon_fini_rx(struct efx_rx_queue *rx_queue) | |||
742 | continue; | 733 | continue; |
743 | break; | 734 | break; |
744 | } | 735 | } |
745 | if (rc) | 736 | if (rc) { |
746 | EFX_ERR(efx, "failed to flush rx queue %d\n", rx_queue->queue); | 737 | EFX_ERR(efx, "failed to flush rx queue %d\n", rx_queue->queue); |
738 | efx_schedule_reset(efx, RESET_TYPE_INVISIBLE); | ||
739 | } | ||
747 | 740 | ||
748 | /* Remove RX descriptor ring from card */ | 741 | /* Remove RX descriptor ring from card */ |
749 | EFX_ZERO_OWORD(rx_desc_ptr); | 742 | EFX_ZERO_OWORD(rx_desc_ptr); |
@@ -822,10 +815,10 @@ static inline void falcon_handle_tx_event(struct efx_channel *channel, | |||
822 | tx_ev_q_label = EFX_QWORD_FIELD(*event, TX_EV_Q_LABEL); | 815 | tx_ev_q_label = EFX_QWORD_FIELD(*event, TX_EV_Q_LABEL); |
823 | tx_queue = &efx->tx_queue[tx_ev_q_label]; | 816 | tx_queue = &efx->tx_queue[tx_ev_q_label]; |
824 | 817 | ||
825 | if (NET_DEV_REGISTERED(efx)) | 818 | if (efx_dev_registered(efx)) |
826 | netif_tx_lock(efx->net_dev); | 819 | netif_tx_lock(efx->net_dev); |
827 | falcon_notify_tx_desc(tx_queue); | 820 | falcon_notify_tx_desc(tx_queue); |
828 | if (NET_DEV_REGISTERED(efx)) | 821 | if (efx_dev_registered(efx)) |
829 | netif_tx_unlock(efx->net_dev); | 822 | netif_tx_unlock(efx->net_dev); |
830 | } else if (EFX_QWORD_FIELD(*event, TX_EV_PKT_ERR) && | 823 | } else if (EFX_QWORD_FIELD(*event, TX_EV_PKT_ERR) && |
831 | EFX_WORKAROUND_10727(efx)) { | 824 | EFX_WORKAROUND_10727(efx)) { |
@@ -884,7 +877,7 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue, | |||
884 | RX_EV_TCP_UDP_CHKSUM_ERR); | 877 | RX_EV_TCP_UDP_CHKSUM_ERR); |
885 | rx_ev_eth_crc_err = EFX_QWORD_FIELD(*event, RX_EV_ETH_CRC_ERR); | 878 | rx_ev_eth_crc_err = EFX_QWORD_FIELD(*event, RX_EV_ETH_CRC_ERR); |
886 | rx_ev_frm_trunc = EFX_QWORD_FIELD(*event, RX_EV_FRM_TRUNC); | 879 | rx_ev_frm_trunc = EFX_QWORD_FIELD(*event, RX_EV_FRM_TRUNC); |
887 | rx_ev_drib_nib = ((FALCON_REV(efx) >= FALCON_REV_B0) ? | 880 | rx_ev_drib_nib = ((falcon_rev(efx) >= FALCON_REV_B0) ? |
888 | 0 : EFX_QWORD_FIELD(*event, RX_EV_DRIB_NIB)); | 881 | 0 : EFX_QWORD_FIELD(*event, RX_EV_DRIB_NIB)); |
889 | rx_ev_pause_frm = EFX_QWORD_FIELD(*event, RX_EV_PAUSE_FRM_ERR); | 882 | rx_ev_pause_frm = EFX_QWORD_FIELD(*event, RX_EV_PAUSE_FRM_ERR); |
890 | 883 | ||
@@ -1065,7 +1058,7 @@ static void falcon_handle_global_event(struct efx_channel *channel, | |||
1065 | EFX_QWORD_FIELD(*event, XG_PHY_INTR)) | 1058 | EFX_QWORD_FIELD(*event, XG_PHY_INTR)) |
1066 | is_phy_event = 1; | 1059 | is_phy_event = 1; |
1067 | 1060 | ||
1068 | if ((FALCON_REV(efx) >= FALCON_REV_B0) && | 1061 | if ((falcon_rev(efx) >= FALCON_REV_B0) && |
1069 | EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0)) | 1062 | EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0)) |
1070 | is_phy_event = 1; | 1063 | is_phy_event = 1; |
1071 | 1064 | ||
@@ -1405,7 +1398,7 @@ static inline void falcon_irq_ack_a1(struct efx_nic *efx) | |||
1405 | static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx) | 1398 | static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx) |
1406 | { | 1399 | { |
1407 | struct falcon_nic_data *nic_data = efx->nic_data; | 1400 | struct falcon_nic_data *nic_data = efx->nic_data; |
1408 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1401 | efx_oword_t *int_ker = efx->irq_status.addr; |
1409 | efx_oword_t fatal_intr; | 1402 | efx_oword_t fatal_intr; |
1410 | int error, mem_perr; | 1403 | int error, mem_perr; |
1411 | static int n_int_errors; | 1404 | static int n_int_errors; |
@@ -1451,8 +1444,8 @@ out: | |||
1451 | */ | 1444 | */ |
1452 | static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) | 1445 | static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) |
1453 | { | 1446 | { |
1454 | struct efx_nic *efx = (struct efx_nic *)dev_id; | 1447 | struct efx_nic *efx = dev_id; |
1455 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1448 | efx_oword_t *int_ker = efx->irq_status.addr; |
1456 | struct efx_channel *channel; | 1449 | struct efx_channel *channel; |
1457 | efx_dword_t reg; | 1450 | efx_dword_t reg; |
1458 | u32 queues; | 1451 | u32 queues; |
@@ -1489,8 +1482,8 @@ static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) | |||
1489 | 1482 | ||
1490 | static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) | 1483 | static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) |
1491 | { | 1484 | { |
1492 | struct efx_nic *efx = (struct efx_nic *)dev_id; | 1485 | struct efx_nic *efx = dev_id; |
1493 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1486 | efx_oword_t *int_ker = efx->irq_status.addr; |
1494 | struct efx_channel *channel; | 1487 | struct efx_channel *channel; |
1495 | int syserr; | 1488 | int syserr; |
1496 | int queues; | 1489 | int queues; |
@@ -1542,9 +1535,9 @@ static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) | |||
1542 | */ | 1535 | */ |
1543 | static irqreturn_t falcon_msi_interrupt(int irq, void *dev_id) | 1536 | static irqreturn_t falcon_msi_interrupt(int irq, void *dev_id) |
1544 | { | 1537 | { |
1545 | struct efx_channel *channel = (struct efx_channel *)dev_id; | 1538 | struct efx_channel *channel = dev_id; |
1546 | struct efx_nic *efx = channel->efx; | 1539 | struct efx_nic *efx = channel->efx; |
1547 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1540 | efx_oword_t *int_ker = efx->irq_status.addr; |
1548 | int syserr; | 1541 | int syserr; |
1549 | 1542 | ||
1550 | efx->last_irq_cpu = raw_smp_processor_id(); | 1543 | efx->last_irq_cpu = raw_smp_processor_id(); |
@@ -1572,7 +1565,7 @@ static void falcon_setup_rss_indir_table(struct efx_nic *efx) | |||
1572 | unsigned long offset; | 1565 | unsigned long offset; |
1573 | efx_dword_t dword; | 1566 | efx_dword_t dword; |
1574 | 1567 | ||
1575 | if (FALCON_REV(efx) < FALCON_REV_B0) | 1568 | if (falcon_rev(efx) < FALCON_REV_B0) |
1576 | return; | 1569 | return; |
1577 | 1570 | ||
1578 | for (offset = RX_RSS_INDIR_TBL_B0; | 1571 | for (offset = RX_RSS_INDIR_TBL_B0; |
@@ -1595,7 +1588,7 @@ int falcon_init_interrupt(struct efx_nic *efx) | |||
1595 | 1588 | ||
1596 | if (!EFX_INT_MODE_USE_MSI(efx)) { | 1589 | if (!EFX_INT_MODE_USE_MSI(efx)) { |
1597 | irq_handler_t handler; | 1590 | irq_handler_t handler; |
1598 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 1591 | if (falcon_rev(efx) >= FALCON_REV_B0) |
1599 | handler = falcon_legacy_interrupt_b0; | 1592 | handler = falcon_legacy_interrupt_b0; |
1600 | else | 1593 | else |
1601 | handler = falcon_legacy_interrupt_a1; | 1594 | handler = falcon_legacy_interrupt_a1; |
@@ -1636,12 +1629,13 @@ void falcon_fini_interrupt(struct efx_nic *efx) | |||
1636 | efx_oword_t reg; | 1629 | efx_oword_t reg; |
1637 | 1630 | ||
1638 | /* Disable MSI/MSI-X interrupts */ | 1631 | /* Disable MSI/MSI-X interrupts */ |
1639 | efx_for_each_channel_with_interrupt(channel, efx) | 1632 | efx_for_each_channel_with_interrupt(channel, efx) { |
1640 | if (channel->irq) | 1633 | if (channel->irq) |
1641 | free_irq(channel->irq, channel); | 1634 | free_irq(channel->irq, channel); |
1635 | } | ||
1642 | 1636 | ||
1643 | /* ACK legacy interrupt */ | 1637 | /* ACK legacy interrupt */ |
1644 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 1638 | if (falcon_rev(efx) >= FALCON_REV_B0) |
1645 | falcon_read(efx, ®, INT_ISR0_B0); | 1639 | falcon_read(efx, ®, INT_ISR0_B0); |
1646 | else | 1640 | else |
1647 | falcon_irq_ack_a1(efx); | 1641 | falcon_irq_ack_a1(efx); |
@@ -1732,7 +1726,7 @@ void falcon_drain_tx_fifo(struct efx_nic *efx) | |||
1732 | efx_oword_t temp; | 1726 | efx_oword_t temp; |
1733 | int count; | 1727 | int count; |
1734 | 1728 | ||
1735 | if ((FALCON_REV(efx) < FALCON_REV_B0) || | 1729 | if ((falcon_rev(efx) < FALCON_REV_B0) || |
1736 | (efx->loopback_mode != LOOPBACK_NONE)) | 1730 | (efx->loopback_mode != LOOPBACK_NONE)) |
1737 | return; | 1731 | return; |
1738 | 1732 | ||
@@ -1785,7 +1779,7 @@ void falcon_deconfigure_mac_wrapper(struct efx_nic *efx) | |||
1785 | { | 1779 | { |
1786 | efx_oword_t temp; | 1780 | efx_oword_t temp; |
1787 | 1781 | ||
1788 | if (FALCON_REV(efx) < FALCON_REV_B0) | 1782 | if (falcon_rev(efx) < FALCON_REV_B0) |
1789 | return; | 1783 | return; |
1790 | 1784 | ||
1791 | /* Isolate the MAC -> RX */ | 1785 | /* Isolate the MAC -> RX */ |
@@ -1823,7 +1817,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1823 | MAC_SPEED, link_speed); | 1817 | MAC_SPEED, link_speed); |
1824 | /* On B0, MAC backpressure can be disabled and packets get | 1818 | /* On B0, MAC backpressure can be disabled and packets get |
1825 | * discarded. */ | 1819 | * discarded. */ |
1826 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 1820 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
1827 | EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, | 1821 | EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, |
1828 | !efx->link_up); | 1822 | !efx->link_up); |
1829 | } | 1823 | } |
@@ -1841,7 +1835,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1841 | EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc); | 1835 | EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc); |
1842 | 1836 | ||
1843 | /* Unisolate the MAC -> RX */ | 1837 | /* Unisolate the MAC -> RX */ |
1844 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 1838 | if (falcon_rev(efx) >= FALCON_REV_B0) |
1845 | EFX_SET_OWORD_FIELD(reg, RX_INGR_EN_B0, 1); | 1839 | EFX_SET_OWORD_FIELD(reg, RX_INGR_EN_B0, 1); |
1846 | falcon_write(efx, ®, RX_CFG_REG_KER); | 1840 | falcon_write(efx, ®, RX_CFG_REG_KER); |
1847 | } | 1841 | } |
@@ -1856,7 +1850,7 @@ int falcon_dma_stats(struct efx_nic *efx, unsigned int done_offset) | |||
1856 | return 0; | 1850 | return 0; |
1857 | 1851 | ||
1858 | /* Statistics fetch will fail if the MAC is in TX drain */ | 1852 | /* Statistics fetch will fail if the MAC is in TX drain */ |
1859 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 1853 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
1860 | efx_oword_t temp; | 1854 | efx_oword_t temp; |
1861 | falcon_read(efx, &temp, MAC0_CTRL_REG_KER); | 1855 | falcon_read(efx, &temp, MAC0_CTRL_REG_KER); |
1862 | if (EFX_OWORD_FIELD(temp, TXFIFO_DRAIN_EN_B0)) | 1856 | if (EFX_OWORD_FIELD(temp, TXFIFO_DRAIN_EN_B0)) |
@@ -1940,7 +1934,7 @@ static int falcon_gmii_wait(struct efx_nic *efx) | |||
1940 | static void falcon_mdio_write(struct net_device *net_dev, int phy_id, | 1934 | static void falcon_mdio_write(struct net_device *net_dev, int phy_id, |
1941 | int addr, int value) | 1935 | int addr, int value) |
1942 | { | 1936 | { |
1943 | struct efx_nic *efx = (struct efx_nic *)net_dev->priv; | 1937 | struct efx_nic *efx = net_dev->priv; |
1944 | unsigned int phy_id2 = phy_id & FALCON_PHY_ID_ID_MASK; | 1938 | unsigned int phy_id2 = phy_id & FALCON_PHY_ID_ID_MASK; |
1945 | efx_oword_t reg; | 1939 | efx_oword_t reg; |
1946 | 1940 | ||
@@ -2008,7 +2002,7 @@ static void falcon_mdio_write(struct net_device *net_dev, int phy_id, | |||
2008 | * could be read, -1 will be returned. */ | 2002 | * could be read, -1 will be returned. */ |
2009 | static int falcon_mdio_read(struct net_device *net_dev, int phy_id, int addr) | 2003 | static int falcon_mdio_read(struct net_device *net_dev, int phy_id, int addr) |
2010 | { | 2004 | { |
2011 | struct efx_nic *efx = (struct efx_nic *)net_dev->priv; | 2005 | struct efx_nic *efx = net_dev->priv; |
2012 | unsigned int phy_addr = phy_id & FALCON_PHY_ID_ID_MASK; | 2006 | unsigned int phy_addr = phy_id & FALCON_PHY_ID_ID_MASK; |
2013 | efx_oword_t reg; | 2007 | efx_oword_t reg; |
2014 | int value = -1; | 2008 | int value = -1; |
@@ -2113,7 +2107,7 @@ int falcon_probe_port(struct efx_nic *efx) | |||
2113 | falcon_init_mdio(&efx->mii); | 2107 | falcon_init_mdio(&efx->mii); |
2114 | 2108 | ||
2115 | /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */ | 2109 | /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */ |
2116 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 2110 | if (falcon_rev(efx) >= FALCON_REV_B0) |
2117 | efx->flow_control = EFX_FC_RX | EFX_FC_TX; | 2111 | efx->flow_control = EFX_FC_RX | EFX_FC_TX; |
2118 | else | 2112 | else |
2119 | efx->flow_control = EFX_FC_RX; | 2113 | efx->flow_control = EFX_FC_RX; |
@@ -2373,7 +2367,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx) | |||
2373 | return -ENODEV; | 2367 | return -ENODEV; |
2374 | } | 2368 | } |
2375 | 2369 | ||
2376 | switch (FALCON_REV(efx)) { | 2370 | switch (falcon_rev(efx)) { |
2377 | case FALCON_REV_A0: | 2371 | case FALCON_REV_A0: |
2378 | case 0xff: | 2372 | case 0xff: |
2379 | EFX_ERR(efx, "Falcon rev A0 not supported\n"); | 2373 | EFX_ERR(efx, "Falcon rev A0 not supported\n"); |
@@ -2399,7 +2393,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx) | |||
2399 | break; | 2393 | break; |
2400 | 2394 | ||
2401 | default: | 2395 | default: |
2402 | EFX_ERR(efx, "Unknown Falcon rev %d\n", FALCON_REV(efx)); | 2396 | EFX_ERR(efx, "Unknown Falcon rev %d\n", falcon_rev(efx)); |
2403 | return -ENODEV; | 2397 | return -ENODEV; |
2404 | } | 2398 | } |
2405 | 2399 | ||
@@ -2419,7 +2413,7 @@ int falcon_probe_nic(struct efx_nic *efx) | |||
2419 | 2413 | ||
2420 | /* Allocate storage for hardware specific data */ | 2414 | /* Allocate storage for hardware specific data */ |
2421 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); | 2415 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); |
2422 | efx->nic_data = (void *) nic_data; | 2416 | efx->nic_data = nic_data; |
2423 | 2417 | ||
2424 | /* Determine number of ports etc. */ | 2418 | /* Determine number of ports etc. */ |
2425 | rc = falcon_probe_nic_variant(efx); | 2419 | rc = falcon_probe_nic_variant(efx); |
@@ -2489,13 +2483,10 @@ int falcon_probe_nic(struct efx_nic *efx) | |||
2489 | */ | 2483 | */ |
2490 | int falcon_init_nic(struct efx_nic *efx) | 2484 | int falcon_init_nic(struct efx_nic *efx) |
2491 | { | 2485 | { |
2492 | struct falcon_nic_data *data; | ||
2493 | efx_oword_t temp; | 2486 | efx_oword_t temp; |
2494 | unsigned thresh; | 2487 | unsigned thresh; |
2495 | int rc; | 2488 | int rc; |
2496 | 2489 | ||
2497 | data = (struct falcon_nic_data *)efx->nic_data; | ||
2498 | |||
2499 | /* Set up the address region register. This is only needed | 2490 | /* Set up the address region register. This is only needed |
2500 | * for the B0 FPGA, but since we are just pushing in the | 2491 | * for the B0 FPGA, but since we are just pushing in the |
2501 | * reset defaults this may as well be unconditional. */ | 2492 | * reset defaults this may as well be unconditional. */ |
@@ -2562,7 +2553,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2562 | 2553 | ||
2563 | /* Set number of RSS queues for receive path. */ | 2554 | /* Set number of RSS queues for receive path. */ |
2564 | falcon_read(efx, &temp, RX_FILTER_CTL_REG); | 2555 | falcon_read(efx, &temp, RX_FILTER_CTL_REG); |
2565 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 2556 | if (falcon_rev(efx) >= FALCON_REV_B0) |
2566 | EFX_SET_OWORD_FIELD(temp, NUM_KER, 0); | 2557 | EFX_SET_OWORD_FIELD(temp, NUM_KER, 0); |
2567 | else | 2558 | else |
2568 | EFX_SET_OWORD_FIELD(temp, NUM_KER, efx->rss_queues - 1); | 2559 | EFX_SET_OWORD_FIELD(temp, NUM_KER, efx->rss_queues - 1); |
@@ -2600,7 +2591,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2600 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ | 2591 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ |
2601 | EFX_SET_OWORD_FIELD(temp, TX_PREF_THRESHOLD, 2); | 2592 | EFX_SET_OWORD_FIELD(temp, TX_PREF_THRESHOLD, 2); |
2602 | /* Squash TX of packets of 16 bytes or less */ | 2593 | /* Squash TX of packets of 16 bytes or less */ |
2603 | if (FALCON_REV(efx) >= FALCON_REV_B0 && EFX_WORKAROUND_9141(efx)) | 2594 | if (falcon_rev(efx) >= FALCON_REV_B0 && EFX_WORKAROUND_9141(efx)) |
2604 | EFX_SET_OWORD_FIELD(temp, TX_FLUSH_MIN_LEN_EN_B0, 1); | 2595 | EFX_SET_OWORD_FIELD(temp, TX_FLUSH_MIN_LEN_EN_B0, 1); |
2605 | falcon_write(efx, &temp, TX_CFG2_REG_KER); | 2596 | falcon_write(efx, &temp, TX_CFG2_REG_KER); |
2606 | 2597 | ||
@@ -2617,7 +2608,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2617 | if (EFX_WORKAROUND_7575(efx)) | 2608 | if (EFX_WORKAROUND_7575(efx)) |
2618 | EFX_SET_OWORD_FIELD_VER(efx, temp, RX_USR_BUF_SIZE, | 2609 | EFX_SET_OWORD_FIELD_VER(efx, temp, RX_USR_BUF_SIZE, |
2619 | (3 * 4096) / 32); | 2610 | (3 * 4096) / 32); |
2620 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 2611 | if (falcon_rev(efx) >= FALCON_REV_B0) |
2621 | EFX_SET_OWORD_FIELD(temp, RX_INGR_EN_B0, 1); | 2612 | EFX_SET_OWORD_FIELD(temp, RX_INGR_EN_B0, 1); |
2622 | 2613 | ||
2623 | /* RX FIFO flow control thresholds */ | 2614 | /* RX FIFO flow control thresholds */ |
@@ -2633,7 +2624,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2633 | falcon_write(efx, &temp, RX_CFG_REG_KER); | 2624 | falcon_write(efx, &temp, RX_CFG_REG_KER); |
2634 | 2625 | ||
2635 | /* Set destination of both TX and RX Flush events */ | 2626 | /* Set destination of both TX and RX Flush events */ |
2636 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 2627 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
2637 | EFX_POPULATE_OWORD_1(temp, FLS_EVQ_ID, 0); | 2628 | EFX_POPULATE_OWORD_1(temp, FLS_EVQ_ID, 0); |
2638 | falcon_write(efx, &temp, DP_CTRL_REG); | 2629 | falcon_write(efx, &temp, DP_CTRL_REG); |
2639 | } | 2630 | } |
@@ -2647,7 +2638,7 @@ void falcon_remove_nic(struct efx_nic *efx) | |||
2647 | 2638 | ||
2648 | falcon_free_buffer(efx, &efx->irq_status); | 2639 | falcon_free_buffer(efx, &efx->irq_status); |
2649 | 2640 | ||
2650 | (void) falcon_reset_hw(efx, RESET_TYPE_ALL); | 2641 | falcon_reset_hw(efx, RESET_TYPE_ALL); |
2651 | 2642 | ||
2652 | /* Release the second function after the reset */ | 2643 | /* Release the second function after the reset */ |
2653 | if (nic_data->pci_dev2) { | 2644 | if (nic_data->pci_dev2) { |