Merge branch 'linus' into cont_syslog
[safe/jmp/linux-2.6] / drivers / net / bnx2x_main.c
index 23528de..57ff5b3 100644 (file)
@@ -57,8 +57,8 @@
 #include "bnx2x_init_ops.h"
 #include "bnx2x_dump.h"
 
-#define DRV_MODULE_VERSION     "1.52.1-8"
-#define DRV_MODULE_RELDATE     "2010/04/01"
+#define DRV_MODULE_VERSION     "1.52.53-1"
+#define DRV_MODULE_RELDATE     "2010/18/04"
 #define BNX2X_BC_VER           0x040200
 
 #include <linux/firmware.h>
@@ -1582,7 +1582,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                struct sw_rx_bd *rx_buf = NULL;
                struct sk_buff *skb;
                union eth_rx_cqe *cqe;
-               u8 cqe_fp_flags;
+               u8 cqe_fp_flags, cqe_fp_status_flags;
                u16 len, pad;
 
                comp_ring_cons = RCQ_BD(sw_comp_cons);
@@ -1598,6 +1598,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
 
                cqe = &fp->rx_comp_ring[comp_ring_cons];
                cqe_fp_flags = cqe->fast_path_cqe.type_error_flags;
+               cqe_fp_status_flags = cqe->fast_path_cqe.status_flags;
 
                DP(NETIF_MSG_RX_STATUS, "CQE type %x  err %x  status %x"
                   "  queue %x  vlan %x  len %u\n", CQE_TYPE(cqe_fp_flags),
@@ -1616,7 +1617,6 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                        rx_buf = &fp->rx_buf_ring[bd_cons];
                        skb = rx_buf->skb;
                        prefetch(skb);
-                       prefetch((u8 *)skb + 256);
                        len = le16_to_cpu(cqe->fast_path_cqe.pkt_len);
                        pad = cqe->fast_path_cqe.placement_offset;
 
@@ -1667,7 +1667,6 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                                        dma_unmap_addr(rx_buf, mapping),
                                                   pad + RX_COPY_THRESH,
                                                   DMA_FROM_DEVICE);
-                       prefetch(skb);
                        prefetch(((char *)(skb)) + 128);
 
                        /* is this an error packet? */
@@ -1727,6 +1726,12 @@ reuse_rx:
 
                        skb->protocol = eth_type_trans(skb, bp->dev);
 
+                       if ((bp->dev->features & NETIF_F_RXHASH) &&
+                           (cqe_fp_status_flags &
+                            ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG))
+                               skb->rxhash = le32_to_cpu(
+                                   cqe->fast_path_cqe.rss_hash_result);
+
                        skb->ip_summed = CHECKSUM_NONE;
                        if (bp->rx_csum) {
                                if (likely(BNX2X_RX_CSUM_OK(cqe)))
@@ -2458,6 +2463,7 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func)
 /* This function is called upon link interrupt */
 static void bnx2x_link_attn(struct bnx2x *bp)
 {
+       u32 prev_link_status = bp->link_vars.link_status;
        /* Make sure that we are synced with the current statistics */
        bnx2x_stats_handle(bp, STATS_EVENT_STOP);
 
@@ -2490,8 +2496,9 @@ static void bnx2x_link_attn(struct bnx2x *bp)
                        bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
        }
 
-       /* indicate link status */
-       bnx2x_link_report(bp);
+       /* indicate link status only if link status actually changed */
+       if (prev_link_status != bp->link_vars.link_status)
+               bnx2x_link_report(bp);
 
        if (IS_E1HMF(bp)) {
                int port = BP_PORT(bp);
@@ -5748,10 +5755,10 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
        u32 offset;
        u16 max_agg_size;
 
-       if (is_multi(bp)) {
-               tstorm_config.config_flags = MULTI_FLAGS(bp);
+       tstorm_config.config_flags = RSS_FLAGS(bp);
+
+       if (is_multi(bp))
                tstorm_config.rss_result_mask = MULTI_MASK;
-       }
 
        /* Enable TPA if needed */
        if (bp->flags & TPA_ENABLE_FLAG)
@@ -6627,10 +6634,8 @@ static int bnx2x_init_common(struct bnx2x *bp)
        bnx2x_init_block(bp, PBF_BLOCK, COMMON_STAGE);
 
        REG_WR(bp, SRC_REG_SOFT_RST, 1);
-       for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4) {
-               REG_WR(bp, i, 0xc0cac01a);
-               /* TODO: replace with something meaningful */
-       }
+       for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4)
+               REG_WR(bp, i, random32());
        bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE);
 #ifdef BCM_CNIC
        REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672);
@@ -8494,6 +8499,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
 
        /* Disable HW interrupts, NAPI and Tx */
        bnx2x_netif_stop(bp, 1);
+       netif_carrier_off(bp->dev);
 
        del_timer_sync(&bp->timer);
        SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb,
@@ -8519,8 +8525,6 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
 
        bp->state = BNX2X_STATE_CLOSED;
 
-       netif_carrier_off(bp->dev);
-
        /* The last driver must disable a "close the gate" if there is no
         * parity attention or "process kill" pending.
         */
@@ -10999,6 +11003,11 @@ static int bnx2x_set_flags(struct net_device *dev, u32 data)
                changed = 1;
        }
 
+       if (data & ETH_FLAG_RXHASH)
+               dev->features |= NETIF_F_RXHASH;
+       else
+               dev->features &= ~NETIF_F_RXHASH;
+
        if (changed && netif_running(dev)) {
                bnx2x_nic_unload(bp, UNLOAD_NORMAL);
                rc = bnx2x_nic_load(bp, LOAD_NORMAL);
@@ -11137,7 +11146,7 @@ static int bnx2x_test_registers(struct bnx2x *bp)
 
                        save_val = REG_RD(bp, offset);
 
-                       REG_WR(bp, offset, wr_val);
+                       REG_WR(bp, offset, (wr_val & mask));
                        val = REG_RD(bp, offset);
 
                        /* Restore the original register's value */
@@ -11935,6 +11944,14 @@ static int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
                break;
 
        case PCI_D3hot:
+               /* If there are other clients above don't
+                  shut down the power */
+               if (atomic_read(&bp->pdev->enable_cnt) != 1)
+                       return 0;
+               /* Don't shut down the power for emulation and FPGA */
+               if (CHIP_REV_IS_SLOW(bp))
+                       return 0;
+
                pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
                pmcsr |= 3;
 
@@ -12551,9 +12568,7 @@ static int bnx2x_close(struct net_device *dev)
 
        /* Unload the driver, release IRQs */
        bnx2x_nic_unload(bp, UNLOAD_CLOSE);
-       if (atomic_read(&bp->pdev->enable_cnt) == 1)
-               if (!CHIP_REV_IS_SLOW(bp))
-                       bnx2x_set_power_state(bp, PCI_D3hot);
+       bnx2x_set_power_state(bp, PCI_D3hot);
 
        return 0;
 }
@@ -13415,6 +13430,7 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
        bp->rx_mode = BNX2X_RX_MODE_NONE;
 
        bnx2x_netif_stop(bp, 0);
+       netif_carrier_off(bp->dev);
 
        del_timer_sync(&bp->timer);
        bp->stats_state = STATS_STATE_DISABLED;
@@ -13441,8 +13457,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
 
        bp->state = BNX2X_STATE_CLOSED;
 
-       netif_carrier_off(bp->dev);
-
        return 0;
 }