bnx2x: Using registers name
[safe/jmp/linux-2.6] / drivers / net / bnx2x.h
index 153cc95..9834a86 100644 (file)
@@ -158,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))
@@ -191,6 +189,43 @@ struct sw_rx_page {
 #define NEXT_SGE_MASK_ELEM(el)         (((el) + 1) & RX_SGE_MASK_LEN_MASK)
 
 
+struct bnx2x_eth_q_stats {
+       u32 total_bytes_received_hi;
+       u32 total_bytes_received_lo;
+       u32 total_bytes_transmitted_hi;
+       u32 total_bytes_transmitted_lo;
+       u32 total_unicast_packets_received_hi;
+       u32 total_unicast_packets_received_lo;
+       u32 total_multicast_packets_received_hi;
+       u32 total_multicast_packets_received_lo;
+       u32 total_broadcast_packets_received_hi;
+       u32 total_broadcast_packets_received_lo;
+       u32 total_unicast_packets_transmitted_hi;
+       u32 total_unicast_packets_transmitted_lo;
+       u32 total_multicast_packets_transmitted_hi;
+       u32 total_multicast_packets_transmitted_lo;
+       u32 total_broadcast_packets_transmitted_hi;
+       u32 total_broadcast_packets_transmitted_lo;
+       u32 valid_bytes_received_hi;
+       u32 valid_bytes_received_lo;
+
+       u32 error_bytes_received_hi;
+       u32 error_bytes_received_lo;
+       u32 etherstatsoverrsizepkts_hi;
+       u32 etherstatsoverrsizepkts_lo;
+       u32 no_buff_discard_hi;
+       u32 no_buff_discard_lo;
+
+       u32 driver_xoff;
+       u32 rx_err_discard_pkt;
+       u32 rx_skb_alloc_failed;
+       u32 hw_csum_err;
+};
+
+#define BNX2X_NUM_Q_STATS              11
+#define Q_STATS_OFFSET32(stat_name) \
+                       (offsetof(struct bnx2x_eth_q_stats, stat_name) / 4)
+
 struct bnx2x_fastpath {
 
        struct napi_struct      napi;
@@ -270,6 +305,11 @@ struct bnx2x_fastpath {
        u64                     tpa_queue_used;
 #endif
 
+       struct tstorm_per_client_stats old_tclient;
+       struct ustorm_per_client_stats old_uclient;
+       struct xstorm_per_client_stats old_xclient;
+       struct bnx2x_eth_q_stats eth_q_stats;
+
        char                    name[IFNAMSIZ];
        struct bnx2x            *bp; /* parent */
 };
@@ -406,10 +446,13 @@ struct bnx2x_fastpath {
 #define BNX2X_RX_CSUM_OK(cqe) \
                        (!(BNX2X_L4_CSUM_ERR(cqe) || BNX2X_IP_CSUM_ERR(cqe)))
 
+#define BNX2X_PRS_FLAG_OVERETH_IPV4(flags) \
+                               (((le16_to_cpu(flags) & \
+                                  PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) >> \
+                                 PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT) \
+                                == PRS_FLAG_OVERETH_IPV4)
 #define BNX2X_RX_SUM_FIX(cqe) \
-                       ((le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & \
-                         PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) == \
-                        (1 << PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT))
+       BNX2X_PRS_FLAG_OVERETH_IPV4(cqe->fast_path_cqe.pars_flags.flags)
 
 
 #define FP_USB_FUNC_OFF                        (2 + 2*HC_USTORM_SB_NUM_INDICES)
@@ -483,11 +526,8 @@ struct bnx2x_common {
        u32                     shmem_base;
 
        u32                     hw_config;
-       u32                     board;
 
        u32                     bc_ver;
-
-       char                    *name;
 };
 
 
@@ -533,6 +573,7 @@ struct bnx2x_port {
 
        /* used to synchronize phy accesses */
        struct mutex            phy_mutex;
+       int                     need_hw_lock;
 
        u32                     port_stx;
 
@@ -578,6 +619,10 @@ struct bnx2x_eth_stats {
 
        u32 error_bytes_received_hi;
        u32 error_bytes_received_lo;
+       u32 etherstatsoverrsizepkts_hi;
+       u32 etherstatsoverrsizepkts_lo;
+       u32 no_buff_discard_hi;
+       u32 no_buff_discard_lo;
 
        u32 rx_stat_ifhcinbadoctets_hi;
        u32 rx_stat_ifhcinbadoctets_lo;
@@ -656,19 +701,20 @@ struct bnx2x_eth_stats {
        u32 tx_stat_bmac_ufl_hi;
        u32 tx_stat_bmac_ufl_lo;
 
-       u32 brb_drop_hi;
-       u32 brb_drop_lo;
-       u32 brb_truncate_hi;
-       u32 brb_truncate_lo;
-
-       u32 jabber_packets_received;
+       u32 pause_frames_received_hi;
+       u32 pause_frames_received_lo;
+       u32 pause_frames_sent_hi;
+       u32 pause_frames_sent_lo;
 
        u32 etherstatspkts1024octetsto1522octets_hi;
        u32 etherstatspkts1024octetsto1522octets_lo;
        u32 etherstatspktsover1522octets_hi;
        u32 etherstatspktsover1522octets_lo;
 
-       u32 no_buff_discard;
+       u32 brb_drop_hi;
+       u32 brb_drop_lo;
+       u32 brb_truncate_hi;
+       u32 brb_truncate_lo;
 
        u32 mac_filter_discard;
        u32 xxoverflow_discard;
@@ -679,8 +725,11 @@ struct bnx2x_eth_stats {
        u32 rx_err_discard_pkt;
        u32 rx_skb_alloc_failed;
        u32 hw_csum_err;
+
+       u32 nig_timer_max;
 };
 
+#define BNX2X_NUM_STATS                        41
 #define STATS_OFFSET32(stat_name) \
                        (offsetof(struct bnx2x_eth_stats, stat_name) / 4)
 
@@ -751,13 +800,17 @@ struct bnx2x {
 #endif
 
        u32                     rx_csum;
-       u32                     rx_offset;
        u32                     rx_buf_size;
 #define ETH_OVREHEAD                   (ETH_HLEN + 8)  /* 8 for CRC + VLAN */
 #define ETH_MIN_PACKET_SIZE            60
 #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;
@@ -767,7 +820,6 @@ struct bnx2x {
        u16                     def_att_idx;
        u32                     attn_state;
        struct attn_route       attn_group[MAX_DYNAMIC_ATTN_GRPS];
-       u32                     nig_mask;
 
        /* slow path ring */
        struct eth_spe          *spq;
@@ -793,7 +845,7 @@ struct bnx2x {
        u32                     flags;
 #define PCIX_FLAG                      1
 #define PCI_32BIT_FLAG                 2
-#define ONE_TDMA_FLAG                  4       /* no longer used */
+#define ONE_PORT_FLAG                  4
 #define NO_WOL_FLAG                    8
 #define USING_DAC_FLAG                 0x10
 #define USING_MSIX_FLAG                        0x20
@@ -817,7 +869,6 @@ struct bnx2x {
        struct work_struct      reset_task;
 
        struct timer_list       timer;
-       int                     timer_interval;
        int                     current_interval;
 
        u16                     fw_seq;
@@ -830,6 +881,9 @@ struct bnx2x {
        struct bnx2x_common     common;
        struct bnx2x_port       port;
 
+       struct cmng_struct_per_port cmng;
+       u32                     vn_weight_sum;
+
        u32                     mf_config;
        u16                     e1hov;
        u8                      e1hmf;
@@ -903,8 +957,6 @@ struct bnx2x {
        int                     executer_idx;
 
        u16                     stats_counter;
-       struct tstorm_per_client_stats old_tclient;
-       struct xstorm_per_client_stats old_xclient;
        struct bnx2x_eth_stats  eth_stats;
 
        struct z_stream_s       *strm;
@@ -934,7 +986,9 @@ struct bnx2x {
 void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32);
 void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
                      u32 len32);
+int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port);
 int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
+int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
 
 static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
                           int wait)
@@ -1005,8 +1059,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define PCICFG_LINK_SPEED_SHIFT                16
 
 
-#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