bnx2x: Removing microcode assertion check
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / bnx2x.h
index 6fcccef4cf3d02bbc0449eaabbf7f081ce9f2cc5..cfbeabb8e5eaedfb0916d1fd205bfe3c7ea7bc6f 100644 (file)
@@ -1,6 +1,6 @@
 /* bnx2x.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2008 Broadcom Corporation
+ * Copyright (c) 2007-2009 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #endif
 
 
+#define BNX2X_MULTI_QUEUE
+
+#define BNX2X_NEW_NAPI
+
 /* error/debug prints */
 
 #define DRV_MODULE_NAME                "bnx2x"
@@ -154,8 +158,6 @@ struct sw_rx_page {
 #define SGE_PAGE_SHIFT                 PAGE_SHIFT
 #define SGE_PAGE_ALIGN(addr)           PAGE_ALIGN(addr)
 
-#define BCM_RX_ETH_PAYLOAD_ALIGN       64
-
 /* SGE ring related macros */
 #define NUM_RX_SGE_PAGES               2
 #define RX_SGE_CNT             (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge))
@@ -266,19 +268,13 @@ struct bnx2x_fastpath {
        u64                     tpa_queue_used;
 #endif
 
+       char                    name[IFNAMSIZ];
        struct bnx2x            *bp; /* parent */
 };
 
 #define bnx2x_fp(bp, nr, var)          (bp->fp[nr].var)
 
-#define BNX2X_HAS_TX_WORK(fp) \
-                       ((fp->tx_pkt_prod != le16_to_cpu(*fp->tx_cons_sb)) || \
-                        (fp->tx_pkt_prod != fp->tx_pkt_cons))
-
-#define BNX2X_HAS_RX_WORK(fp) \
-                       (fp->rx_comp_cons != rx_cons_sb)
-
-#define BNX2X_HAS_WORK(fp)     (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp))
+#define BNX2X_HAS_WORK(fp)     (bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))
 
 
 /* MC hsi */
@@ -687,11 +683,7 @@ struct bnx2x_eth_stats {
                        (offsetof(struct bnx2x_eth_stats, stat_name) / 4)
 
 
-#ifdef BNX2X_MULTI
 #define MAX_CONTEXT                    16
-#else
-#define MAX_CONTEXT                    1
-#endif
 
 union cdu_context {
        struct eth_context eth;
@@ -746,6 +738,9 @@ struct bnx2x {
 
        atomic_t                intr_sem;
        struct msix_entry       msix_table[MAX_CONTEXT+1];
+#define INT_MODE_INTx                  1
+#define INT_MODE_MSI                   2
+#define INT_MODE_MSIX                  3
 
        int                     tx_ring_size;
 
@@ -761,6 +756,11 @@ struct bnx2x {
 #define ETH_MAX_PACKET_SIZE            1500
 #define ETH_MAX_JUMBO_PACKET_SIZE      9600
 
+       /* Max supported alignment is 256 (8 shift) */
+#define BNX2X_RX_ALIGN_SHIFT           ((L1_CACHE_SHIFT < 8) ? \
+                                        L1_CACHE_SHIFT : 8)
+#define BNX2X_RX_ALIGN                 (1 << BNX2X_RX_ALIGN_SHIFT)
+
        struct host_def_status_block *def_status_blk;
 #define DEF_SB_ID                      16
        u16                     def_c_idx;
@@ -800,7 +800,7 @@ struct bnx2x {
 #define NO_WOL_FLAG                    8
 #define USING_DAC_FLAG                 0x10
 #define USING_MSIX_FLAG                        0x20
-#define ASF_ENABLE_FLAG                        0x40
+#define USING_MSI_FLAG                 0x40
 #define TPA_ENABLE_FLAG                        0x80
 #define NO_MCP_FLAG                    0x100
 #define BP_NOMCP(bp)                   (bp->flags & NO_MCP_FLAG)
@@ -866,8 +866,9 @@ struct bnx2x {
 #define BNX2X_STATE_DIAG               0xe000
 #define BNX2X_STATE_ERROR              0xf000
 
-       int                     num_queues;
-#define BP_MAX_QUEUES(bp)              (IS_E1HMF(bp) ? 4 : 16)
+       int                     multi_mode;
+       int                     num_rx_queues;
+       int                     num_tx_queues;
 
        u32                     rx_mode;
 #define BNX2X_RX_MODE_NONE             0
@@ -918,11 +919,19 @@ struct bnx2x {
 };
 
 
-#define for_each_queue(bp, var)        for (var = 0; var < bp->num_queues; var++)
+#define BNX2X_MAX_QUEUES(bp)   (IS_E1HMF(bp) ? (MAX_CONTEXT / E1HVN_MAX) : \
+                                                MAX_CONTEXT)
+#define BNX2X_NUM_QUEUES(bp)   max(bp->num_rx_queues, bp->num_tx_queues)
+#define is_multi(bp)           (BNX2X_NUM_QUEUES(bp) > 1)
 
+#define for_each_rx_queue(bp, var) \
+                       for (var = 0; var < bp->num_rx_queues; var++)
+#define for_each_tx_queue(bp, var) \
+                       for (var = 0; var < bp->num_tx_queues; var++)
+#define for_each_queue(bp, var) \
+                       for (var = 0; var < BNX2X_NUM_QUEUES(bp); var++)
 #define for_each_nondefault_queue(bp, var) \
-                               for (var = 1; var < bp->num_queues; var++)
-#define is_multi(bp)           (bp->num_queues > 1)
+                       for (var = 1; var < BNX2X_NUM_QUEUES(bp); var++)
 
 
 void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32);
@@ -1000,7 +1009,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 
 
 #define BNX2X_NUM_STATS                        42
-#define BNX2X_NUM_TESTS                        8
+#define BNX2X_NUM_TESTS                        7
 
 #define BNX2X_MAC_LOOPBACK             0
 #define BNX2X_PHY_LOOPBACK             1
@@ -1127,12 +1136,13 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
                                 AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR)
 
 
-#define MULTI_FLAGS \
+#define MULTI_FLAGS(bp) \
                (TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY | \
                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY | \
                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY | \
                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY | \
-                TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_ENABLE)
+                (bp->multi_mode << \
+                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT))
 
 #define MULTI_MASK                     0x7f