vlan: Don't check for vlan group before vlan_tx_tag_present.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / bnx2.c
index b10be27f340a9dcc353937e7a901245d6edb3f05..363ca8bcc974dd75ffcba3cce7b2aa7f08487ec4 100644 (file)
 #include "bnx2_fw.h"
 
 #define DRV_MODULE_NAME                "bnx2"
-#define DRV_MODULE_VERSION     "2.0.17"
-#define DRV_MODULE_RELDATE     "July 18, 2010"
-#define FW_MIPS_FILE_06                "bnx2/bnx2-mips-06-5.0.0.j6.fw"
-#define FW_RV2P_FILE_06                "bnx2/bnx2-rv2p-06-5.0.0.j3.fw"
-#define FW_MIPS_FILE_09                "bnx2/bnx2-mips-09-5.0.0.j15.fw"
-#define FW_RV2P_FILE_09_Ax     "bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw"
-#define FW_RV2P_FILE_09                "bnx2/bnx2-rv2p-09-5.0.0.j10.fw"
+#define DRV_MODULE_VERSION     "2.0.18"
+#define DRV_MODULE_RELDATE     "Oct 7, 2010"
+#define FW_MIPS_FILE_06                "bnx2/bnx2-mips-06-6.0.15.fw"
+#define FW_RV2P_FILE_06                "bnx2/bnx2-rv2p-06-6.0.15.fw"
+#define FW_MIPS_FILE_09                "bnx2/bnx2-mips-09-6.0.17.fw"
+#define FW_RV2P_FILE_09_Ax     "bnx2/bnx2-rv2p-09ax-6.0.17.fw"
+#define FW_RV2P_FILE_09                "bnx2/bnx2-rv2p-09-6.0.17.fw"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -1269,30 +1269,9 @@ bnx2_init_rx_context(struct bnx2 *bp, u32 cid)
        val |= BNX2_L2CTX_CTX_TYPE_SIZE_L2;
        val |= 0x02 << 8;
 
-       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
-               u32 lo_water, hi_water;
-
-               if (bp->flow_ctrl & FLOW_CTRL_TX)
-                       lo_water = BNX2_L2CTX_LO_WATER_MARK_DEFAULT;
-               else
-                       lo_water = BNX2_L2CTX_LO_WATER_MARK_DIS;
-               if (lo_water >= bp->rx_ring_size)
-                       lo_water = 0;
-
-               hi_water = min_t(int, bp->rx_ring_size / 4, lo_water + 16);
-
-               if (hi_water <= lo_water)
-                       lo_water = 0;
-
-               hi_water /= BNX2_L2CTX_HI_WATER_MARK_SCALE;
-               lo_water /= BNX2_L2CTX_LO_WATER_MARK_SCALE;
+       if (bp->flow_ctrl & FLOW_CTRL_TX)
+               val |= BNX2_L2CTX_FLOW_CTRL_ENABLE;
 
-               if (hi_water > 0xf)
-                       hi_water = 0xf;
-               else if (hi_water == 0)
-                       lo_water = 0;
-               val |= lo_water | (hi_water << BNX2_L2CTX_HI_WATER_MARK_SHIFT);
-       }
        bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_CTX_TYPE, val);
 }
 
@@ -1373,8 +1352,7 @@ bnx2_set_mac_link(struct bnx2 *bp)
        /* Acknowledge the interrupt. */
        REG_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE);
 
-       if (CHIP_NUM(bp) == CHIP_NUM_5709)
-               bnx2_init_all_rx_contexts(bp);
+       bnx2_init_all_rx_contexts(bp);
 }
 
 static void
@@ -4974,6 +4952,11 @@ bnx2_init_chip(struct bnx2 *bp)
 
        REG_WR(bp, BNX2_HC_CONFIG, val);
 
+       if (bp->rx_ticks < 25)
+               bnx2_reg_wr_ind(bp, BNX2_FW_RX_LOW_LATENCY, 1);
+       else
+               bnx2_reg_wr_ind(bp, BNX2_FW_RX_LOW_LATENCY, 0);
+
        for (i = 1; i < bp->irq_nvecs; i++) {
                u32 base = ((i - 1) * BNX2_HC_SB_CONFIG_SIZE) +
                           BNX2_HC_SB_CONFIG_1;
@@ -5242,18 +5225,20 @@ bnx2_init_all_rings(struct bnx2 *bp)
                bnx2_init_rx_ring(bp, i);
 
        if (bp->num_rx_rings > 1) {
-               u32 tbl_32;
-               u8 *tbl = (u8 *) &tbl_32;
-
-               bnx2_reg_wr_ind(bp, BNX2_RXP_SCRATCH_RSS_TBL_SZ,
-                               BNX2_RXP_SCRATCH_RSS_TBL_MAX_ENTRIES);
+               u32 tbl_32 = 0;
 
                for (i = 0; i < BNX2_RXP_SCRATCH_RSS_TBL_MAX_ENTRIES; i++) {
-                       tbl[i % 4] = i % (bp->num_rx_rings - 1);
-                       if ((i % 4) == 3)
-                               bnx2_reg_wr_ind(bp,
-                                               BNX2_RXP_SCRATCH_RSS_TBL + i,
-                                               cpu_to_be32(tbl_32));
+                       int shift = (i % 8) << 2;
+
+                       tbl_32 |= (i % (bp->num_rx_rings - 1)) << shift;
+                       if ((i % 8) == 7) {
+                               REG_WR(bp, BNX2_RLUP_RSS_DATA, tbl_32);
+                               REG_WR(bp, BNX2_RLUP_RSS_COMMAND, (i >> 3) |
+                                       BNX2_RLUP_RSS_COMMAND_RSS_WRITE_MASK |
+                                       BNX2_RLUP_RSS_COMMAND_WRITE |
+                                       BNX2_RLUP_RSS_COMMAND_HASH_MASK);
+                               tbl_32 = 0;
+                       }
                }
 
                val = BNX2_RLUP_RSS_CONFIG_IPV4_RSS_TYPE_ALL_XI |
@@ -6444,7 +6429,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
 #ifdef BCM_VLAN
-       if (bp->vlgrp && vlan_tx_tag_present(skb)) {
+       if (vlan_tx_tag_present(skb)) {
                vlan_tag_flags |=
                        (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
        }
@@ -7930,16 +7915,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
                goto err_out_disable;
        }
 
-       /* AER (Advanced Error Reporting) hooks */
-       err = pci_enable_pcie_error_reporting(pdev);
-       if (err) {
-               dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
-                                   "0x%x\n", err);
-               /* non-fatal, continue */
-       }
-
        pci_set_master(pdev);
-       pci_save_state(pdev);
 
        bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
        if (bp->pm_cap == 0) {
@@ -7994,6 +7970,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
                bp->flags |= BNX2_FLAG_PCIE;
                if (CHIP_REV(bp) == CHIP_REV_Ax)
                        bp->flags |= BNX2_FLAG_JUMBO_BROKEN;
+
+               /* AER (Advanced Error Reporting) hooks */
+               err = pci_enable_pcie_error_reporting(pdev);
+               if (err) {
+                       dev_err(&pdev->dev, "pci_enable_pcie_error_reporting "
+                                           "failed 0x%x\n", err);
+                       /* non-fatal, continue */
+               }
+
        } else {
                bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
                if (bp->pcix_cap == 0) {
@@ -8250,16 +8235,20 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        bp->timer.data = (unsigned long) bp;
        bp->timer.function = bnx2_timer;
 
+       pci_save_state(pdev);
+
        return 0;
 
 err_out_unmap:
+       if (bp->flags & BNX2_FLAG_PCIE)
+               pci_disable_pcie_error_reporting(pdev);
+
        if (bp->regview) {
                iounmap(bp->regview);
                bp->regview = NULL;
        }
 
 err_out_release:
-       pci_disable_pcie_error_reporting(pdev);
        pci_release_regions(pdev);
 
 err_out_disable:
@@ -8449,9 +8438,10 @@ bnx2_remove_one(struct pci_dev *pdev)
 
        kfree(bp->temp_stats_blk);
 
-       free_netdev(dev);
+       if (bp->flags & BNX2_FLAG_PCIE)
+               pci_disable_pcie_error_reporting(pdev);
 
-       pci_disable_pcie_error_reporting(pdev);
+       free_netdev(dev);
 
        pci_release_regions(pdev);
        pci_disable_device(pdev);
@@ -8565,6 +8555,9 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
        }
        rtnl_unlock();
 
+       if (!(bp->flags & BNX2_FLAG_PCIE))
+               return result;
+
        err = pci_cleanup_aer_uncorrect_error_status(pdev);
        if (err) {
                dev_err(&pdev->dev,