]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/ixgbe/ixgbe_main.c
ixgbe: Fix usage of netif_*_all_queues() with netif_carrier_{off|on}()
[karo-tx-linux.git] / drivers / net / ixgbe / ixgbe_main.c
index 028bfb20412cb5c9e3a575e3e88b8cc2a60bb12b..d1f80dd88bc9ff572812f52e190d249fd1949b4f 100644 (file)
@@ -68,6 +68,8 @@ static struct pci_device_id ixgbe_pci_tbl[] = {
         board_82598 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598AF_SINGLE_PORT),
         board_82598 },
+       {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598AT),
+        board_82598 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_CX4),
         board_82598 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598_CX4_DUAL_PORT),
@@ -666,7 +668,6 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter,
 
                skb->protocol = eth_type_trans(skb, adapter->netdev);
                ixgbe_receive_skb(adapter, skb, staterr, rx_ring, rx_desc);
-               adapter->netdev->last_rx = jiffies;
 
 next_desc:
                rx_desc->wb.upper.status_error = 0;
@@ -904,6 +905,17 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector)
        return;
 }
 
+static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+
+       if ((adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) &&
+           (eicr & IXGBE_EICR_GPI_SDP1)) {
+               DPRINTK(PROBE, CRIT, "Fan has stopped, replace the adapter\n");
+               /* write to clear the interrupt */
+               IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1);
+       }
+}
 
 static void ixgbe_check_lsc(struct ixgbe_adapter *adapter)
 {
@@ -928,6 +940,8 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data)
        if (eicr & IXGBE_EICR_LSC)
                ixgbe_check_lsc(adapter);
 
+       ixgbe_check_fan_failure(adapter, eicr);
+
        if (!test_bit(__IXGBE_DOWN, &adapter->state))
                IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER);
 
@@ -1316,6 +1330,8 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
        if (eicr & IXGBE_EICR_LSC)
                ixgbe_check_lsc(adapter);
 
+       ixgbe_check_fan_failure(adapter, eicr);
+
        if (netif_rx_schedule_prep(netdev, &adapter->q_vector[0].napi)) {
                adapter->tx_ring[0].total_packets = 0;
                adapter->tx_ring[0].total_bytes = 0;
@@ -1418,6 +1434,8 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter)
 {
        u32 mask;
        mask = IXGBE_EIMS_ENABLE_MASK;
+       if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE)
+               mask |= IXGBE_EIMS_GPI_SDP1;
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask);
        IXGBE_WRITE_FLUSH(&adapter->hw);
 }
@@ -1927,6 +1945,13 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
        }
 
+       /* Enable fan failure interrupt if media type is copper */
+       if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) {
+               gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
+               gpie |= IXGBE_SDP1_GPIEN;
+               IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
+       }
+
        mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
        if (max_frame != (mhadd >> IXGBE_MHADD_MFS_SHIFT)) {
                mhadd &= ~IXGBE_MHADD_MFS_MASK;
@@ -1972,6 +1997,9 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
 
        ixgbe_irq_enable(adapter);
 
+       /* enable transmits */
+       netif_tx_start_all_queues(netdev);
+
        /* bring the link up in the watchdog, this could race with our first
         * link up interrupt but shouldn't be a problem */
        adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
@@ -2564,6 +2592,9 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
        rss = min(IXGBE_MAX_RSS_INDICES, (int)num_online_cpus());
        adapter->ring_feature[RING_F_RSS].indices = rss;
        adapter->flags |= IXGBE_FLAG_RSS_ENABLED;
+       if (hw->mac.ops.get_media_type &&
+           (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper))
+               adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE;
 
        /* default flow control settings */
        hw->fc.original_type = ixgbe_fc_none;
@@ -3219,7 +3250,6 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                                 (FLOW_TX ? "TX" : "None"))));
 
                        netif_carrier_on(netdev);
-                       netif_tx_wake_all_queues(netdev);
                } else {
                        /* Force detection of hung controller */
                        adapter->detect_tx_hung = true;
@@ -3230,7 +3260,6 @@ static void ixgbe_watchdog_task(struct work_struct *work)
                if (netif_carrier_ok(netdev)) {
                        DPRINTK(LINK, INFO, "NIC Link is Down\n");
                        netif_carrier_off(netdev);
-                       netif_tx_stop_all_queues(netdev);
                }
        }
 
@@ -3691,6 +3720,10 @@ static int ixgbe_link_config(struct ixgbe_hw *hw)
        /* must always autoneg for both 1G and 10G link */
        hw->mac.autoneg = true;
 
+       if ((hw->mac.type == ixgbe_mac_82598EB) &&
+           (hw->phy.media_type == ixgbe_media_type_copper))
+               autoneg = IXGBE_LINK_SPEED_82598_AUTONEG;
+
        return hw->mac.ops.setup_link_speed(hw, autoneg, true, true);
 }
 
@@ -3911,7 +3944,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        }
 
        netif_carrier_off(netdev);
-       netif_tx_stop_all_queues(netdev);
 
        ixgbe_napi_add_all(adapter);
 
@@ -4009,7 +4041,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
                                                 pci_channel_state_t state)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
-       struct ixgbe_adapter *adapter = netdev->priv;
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
 
        netif_device_detach(netdev);
 
@@ -4030,7 +4062,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev,
 static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
-       struct ixgbe_adapter *adapter = netdev->priv;
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
 
        if (pci_enable_device(pdev)) {
                DPRINTK(PROBE, ERR,
@@ -4058,7 +4090,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
 static void ixgbe_io_resume(struct pci_dev *pdev)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
-       struct ixgbe_adapter *adapter = netdev->priv;
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
 
        if (netif_running(netdev)) {
                if (ixgbe_up(adapter)) {