Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
[safe/jmp/linux-2.6] / drivers / net / bnx2x.h
index e94ce83..3c48a7a 100644 (file)
@@ -1,6 +1,6 @@
 /* bnx2x.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2009 Broadcom Corporation
+ * Copyright (c) 2007-2010 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
 #define BCM_VLAN                       1
 #endif
 
+#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE)
+#define BCM_CNIC 1
+#include "cnic_if.h"
+#endif
 
 #define BNX2X_MULTI_QUEUE
 
@@ -40,7 +44,6 @@
 /* error/debug prints */
 
 #define DRV_MODULE_NAME                "bnx2x"
-#define PFX DRV_MODULE_NAME    ": "
 
 /* for messages that are currently off */
 #define BNX2X_MSG_OFF                  0
 #define DP_LEVEL                       KERN_NOTICE     /* was: KERN_DEBUG */
 
 /* regular debug print */
-#define DP(__mask, __fmt, __args...) do { \
-       if (bp->msglevel & (__mask)) \
-               printk(DP_LEVEL "[%s:%d(%s)]" __fmt, __func__, __LINE__, \
-                       bp->dev ? (bp->dev->name) : "?", ##__args); \
-       } while (0)
+#define DP(__mask, __fmt, __args...)                           \
+do {                                                           \
+       if (bp->msg_enable & (__mask))                          \
+               printk(DP_LEVEL "[%s:%d(%s)]" __fmt,            \
+                      __func__, __LINE__,                      \
+                      bp->dev ? (bp->dev->name) : "?",         \
+                      ##__args);                               \
+} while (0)
 
 /* errors debug print */
-#define BNX2X_DBG_ERR(__fmt, __args...) do { \
-       if (bp->msglevel & NETIF_MSG_PROBE) \
-               printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \
-                       bp->dev ? (bp->dev->name) : "?", ##__args); \
-       } while (0)
+#define BNX2X_DBG_ERR(__fmt, __args...)                                \
+do {                                                           \
+       if (netif_msg_probe(bp))                                \
+               pr_err("[%s:%d(%s)]" __fmt,                     \
+                      __func__, __LINE__,                      \
+                      bp->dev ? (bp->dev->name) : "?",         \
+                      ##__args);                               \
+} while (0)
 
 /* for errors (never masked) */
-#define BNX2X_ERR(__fmt, __args...) do { \
-       printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \
-               bp->dev ? (bp->dev->name) : "?", ##__args); \
-       } while (0)
+#define BNX2X_ERR(__fmt, __args...)                            \
+do {                                                           \
+       pr_err("[%s:%d(%s)]" __fmt,                             \
+              __func__, __LINE__,                              \
+              bp->dev ? (bp->dev->name) : "?",                 \
+              ##__args);                                       \
+} while (0)
 
 /* before we have a dev->name use dev_info() */
-#define BNX2X_DEV_INFO(__fmt, __args...) do { \
-       if (bp->msglevel & NETIF_MSG_PROBE) \
-               dev_info(&bp->pdev->dev, __fmt, ##__args); \
-       } while (0)
+#define BNX2X_DEV_INFO(__fmt, __args...)                        \
+do {                                                            \
+       if (netif_msg_probe(bp))                                 \
+               dev_info(&bp->pdev->dev, __fmt, ##__args);       \
+} while (0)
 
 
 #ifdef BNX2X_STOP_ON_ERROR
                                 offset, len32); \
        } while (0)
 
-#define VIRT_WR_DMAE_LEN(bp, data, addr, len32) \
+#define VIRT_WR_DMAE_LEN(bp, data, addr, len32, le32_swap) \
        do { \
                memcpy(GUNZIP_BUF(bp), data, (len32) * 4); \
                bnx2x_write_big_buf_wb(bp, addr, len32); \
@@ -255,9 +268,6 @@ struct bnx2x_eth_q_stats {
 struct bnx2x_fastpath {
 
        struct napi_struct      napi;
-
-       u8                      is_rx_queue;
-
        struct host_status_block *status_blk;
        dma_addr_t              status_blk_mapping;
 
@@ -881,7 +891,7 @@ struct bnx2x {
        /* End of fields used in the performance code paths */
 
        int                     panic;
-       int                     msglevel;
+       int                     msg_enable;
 
        u32                     flags;
 #define PCIX_FLAG                      1
@@ -896,6 +906,7 @@ struct bnx2x {
 #define BP_NOMCP(bp)                   (bp->flags & NO_MCP_FLAG)
 #define HW_VLAN_TX_FLAG                        0x400
 #define HW_VLAN_RX_FLAG                        0x800
+#define MF_FUNC_DIS                    0x1000
 
        int                     func;
 #define BP_PORT(bp)                    (bp->func % PORT_MAX)
@@ -961,13 +972,11 @@ struct bnx2x {
 #define BNX2X_STATE_CLOSING_WAIT4_HALT 0x4000
 #define BNX2X_STATE_CLOSING_WAIT4_DELETE 0x5000
 #define BNX2X_STATE_CLOSING_WAIT4_UNLOAD 0x6000
-#define BNX2X_STATE_DISABLED           0xd000
 #define BNX2X_STATE_DIAG               0xe000
 #define BNX2X_STATE_ERROR              0xf000
 
        int                     multi_mode;
-       int                     num_rx_queues;
-       int                     num_tx_queues;
+       int                     num_queues;
 
        u32                     rx_mode;
 #define BNX2X_RX_MODE_NONE             0
@@ -1019,6 +1028,9 @@ struct bnx2x {
        /* used to synchronize dmae accesses */
        struct mutex            dmae_mutex;
 
+       /* used to protect the FW mail box */
+       struct mutex            fw_mb_mutex;
+
        /* used to synchronize stats collecting */
        int                     stats_state;
        /* used by dmae command loader */
@@ -1067,20 +1079,15 @@ struct bnx2x {
 };
 
 
-#define BNX2X_MAX_QUEUES(bp)   (IS_E1HMF(bp) ? (MAX_CONTEXT/(2 * E1HVN_MAX)) \
-                                             : (MAX_CONTEXT/2))
-#define BNX2X_NUM_QUEUES(bp)   (bp->num_rx_queues + bp->num_tx_queues)
-#define is_multi(bp)           (BNX2X_NUM_QUEUES(bp) > 2)
+#define BNX2X_MAX_QUEUES(bp)   (IS_E1HMF(bp) ? (MAX_CONTEXT/E1HVN_MAX) \
+                                             : MAX_CONTEXT)
+#define BNX2X_NUM_QUEUES(bp)   (bp->num_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 = bp->num_rx_queues; \
-                            var < BNX2X_NUM_QUEUES(bp); 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_rx_queues; var++)
+                       for (var = 1; var < BNX2X_NUM_QUEUES(bp); var++)
 
 
 void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32);
@@ -1184,7 +1191,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define MAX_SP_DESC_CNT                        (SP_DESC_CNT - 1)
 
 
-#define BNX2X_BTR                      3
+#define BNX2X_BTR                      1
 #define MAX_SPQ_PENDING                        8