aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2.h')
-rw-r--r--drivers/net/bnx2.h97
1 files changed, 36 insertions, 61 deletions
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 9f691cbd666b..b87925f6a228 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -13,45 +13,6 @@
13#ifndef BNX2_H 13#ifndef BNX2_H
14#define BNX2_H 14#define BNX2_H
15 15
16#include <linux/config.h>
17
18#include <linux/module.h>
19#include <linux/moduleparam.h>
20
21#include <linux/kernel.h>
22#include <linux/timer.h>
23#include <linux/errno.h>
24#include <linux/ioport.h>
25#include <linux/slab.h>
26#include <linux/interrupt.h>
27#include <linux/pci.h>
28#include <linux/init.h>
29#include <linux/netdevice.h>
30#include <linux/etherdevice.h>
31#include <linux/skbuff.h>
32#include <linux/dma-mapping.h>
33#include <asm/bitops.h>
34#include <asm/io.h>
35#include <asm/irq.h>
36#include <linux/delay.h>
37#include <asm/byteorder.h>
38#include <linux/time.h>
39#include <linux/ethtool.h>
40#include <linux/mii.h>
41#ifdef NETIF_F_HW_VLAN_TX
42#include <linux/if_vlan.h>
43#define BCM_VLAN 1
44#endif
45#ifdef NETIF_F_TSO
46#include <net/ip.h>
47#include <net/tcp.h>
48#include <net/checksum.h>
49#define BCM_TSO 1
50#endif
51#include <linux/workqueue.h>
52#include <linux/crc32.h>
53#include <linux/prefetch.h>
54
55/* Hardware data structures and register definitions automatically 16/* Hardware data structures and register definitions automatically
56 * generated from RTL code. Do not modify. 17 * generated from RTL code. Do not modify.
57 */ 18 */
@@ -3792,8 +3753,10 @@ struct l2_fhdr {
3792#define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct tx_bd)) 3753#define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct tx_bd))
3793#define MAX_TX_DESC_CNT (TX_DESC_CNT - 1) 3754#define MAX_TX_DESC_CNT (TX_DESC_CNT - 1)
3794 3755
3756#define MAX_RX_RINGS 4
3795#define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct rx_bd)) 3757#define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct rx_bd))
3796#define MAX_RX_DESC_CNT (RX_DESC_CNT - 1) 3758#define MAX_RX_DESC_CNT (RX_DESC_CNT - 1)
3759#define MAX_TOTAL_RX_DESC_CNT (MAX_RX_DESC_CNT * MAX_RX_RINGS)
3797 3760
3798#define NEXT_TX_BD(x) (((x) & (MAX_TX_DESC_CNT - 1)) == \ 3761#define NEXT_TX_BD(x) (((x) & (MAX_TX_DESC_CNT - 1)) == \
3799 (MAX_TX_DESC_CNT - 1)) ? \ 3762 (MAX_TX_DESC_CNT - 1)) ? \
@@ -3805,8 +3768,10 @@ struct l2_fhdr {
3805 (MAX_RX_DESC_CNT - 1)) ? \ 3768 (MAX_RX_DESC_CNT - 1)) ? \
3806 (x) + 2 : (x) + 1 3769 (x) + 2 : (x) + 1
3807 3770
3808#define RX_RING_IDX(x) ((x) & MAX_RX_DESC_CNT) 3771#define RX_RING_IDX(x) ((x) & bp->rx_max_ring_idx)
3809 3772
3773#define RX_RING(x) (((x) & ~MAX_RX_DESC_CNT) >> 8)
3774#define RX_IDX(x) ((x) & MAX_RX_DESC_CNT)
3810 3775
3811/* Context size. */ 3776/* Context size. */
3812#define CTX_SHIFT 7 3777#define CTX_SHIFT 7
@@ -3903,15 +3868,26 @@ struct bnx2 {
3903 struct status_block *status_blk; 3868 struct status_block *status_blk;
3904 u32 last_status_idx; 3869 u32 last_status_idx;
3905 3870
3906 struct tx_bd *tx_desc_ring; 3871 u32 flags;
3907 struct sw_bd *tx_buf_ring; 3872#define PCIX_FLAG 1
3908 u32 tx_prod_bseq; 3873#define PCI_32BIT_FLAG 2
3909 u16 tx_prod; 3874#define ONE_TDMA_FLAG 4 /* no longer used */
3910 u16 tx_cons; 3875#define NO_WOL_FLAG 8
3911 int tx_ring_size; 3876#define USING_DAC_FLAG 0x10
3877#define USING_MSI_FLAG 0x20
3878#define ASF_ENABLE_FLAG 0x40
3912 3879
3913 u16 hw_tx_cons; 3880 /* Put tx producer and consumer fields in separate cache lines. */
3914 u16 hw_rx_cons; 3881
3882 u32 tx_prod_bseq __attribute__((aligned(L1_CACHE_BYTES)));
3883 u16 tx_prod;
3884
3885 struct tx_bd *tx_desc_ring;
3886 struct sw_bd *tx_buf_ring;
3887 int tx_ring_size;
3888
3889 u16 tx_cons __attribute__((aligned(L1_CACHE_BYTES)));
3890 u16 hw_tx_cons;
3915 3891
3916#ifdef BCM_VLAN 3892#ifdef BCM_VLAN
3917 struct vlan_group *vlgrp; 3893 struct vlan_group *vlgrp;
@@ -3920,19 +3896,23 @@ struct bnx2 {
3920 u32 rx_offset; 3896 u32 rx_offset;
3921 u32 rx_buf_use_size; /* useable size */ 3897 u32 rx_buf_use_size; /* useable size */
3922 u32 rx_buf_size; /* with alignment */ 3898 u32 rx_buf_size; /* with alignment */
3923 struct rx_bd *rx_desc_ring; 3899 u32 rx_max_ring_idx;
3924 struct sw_bd *rx_buf_ring; 3900
3925 u32 rx_prod_bseq; 3901 u32 rx_prod_bseq;
3926 u16 rx_prod; 3902 u16 rx_prod;
3927 u16 rx_cons; 3903 u16 rx_cons;
3904 u16 hw_rx_cons;
3928 3905
3929 u32 rx_csum; 3906 u32 rx_csum;
3930 3907
3908 struct sw_bd *rx_buf_ring;
3909 struct rx_bd *rx_desc_ring[MAX_RX_RINGS];
3910
3931 /* Only used to synchronize netif_stop_queue/wake_queue when tx */ 3911 /* Only used to synchronize netif_stop_queue/wake_queue when tx */
3932 /* ring is full */ 3912 /* ring is full */
3933 spinlock_t tx_lock; 3913 spinlock_t tx_lock;
3934 3914
3935 /* End of fileds used in the performance code paths. */ 3915 /* End of fields used in the performance code paths. */
3936 3916
3937 char *name; 3917 char *name;
3938 3918
@@ -3945,15 +3925,6 @@ struct bnx2 {
3945 /* Used to synchronize phy accesses. */ 3925 /* Used to synchronize phy accesses. */
3946 spinlock_t phy_lock; 3926 spinlock_t phy_lock;
3947 3927
3948 u32 flags;
3949#define PCIX_FLAG 1
3950#define PCI_32BIT_FLAG 2
3951#define ONE_TDMA_FLAG 4 /* no longer used */
3952#define NO_WOL_FLAG 8
3953#define USING_DAC_FLAG 0x10
3954#define USING_MSI_FLAG 0x20
3955#define ASF_ENABLE_FLAG 0x40
3956
3957 u32 phy_flags; 3928 u32 phy_flags;
3958#define PHY_SERDES_FLAG 1 3929#define PHY_SERDES_FLAG 1
3959#define PHY_CRC_FIX_FLAG 2 3930#define PHY_CRC_FIX_FLAG 2
@@ -4004,8 +3975,9 @@ struct bnx2 {
4004 dma_addr_t tx_desc_mapping; 3975 dma_addr_t tx_desc_mapping;
4005 3976
4006 3977
3978 int rx_max_ring;
4007 int rx_ring_size; 3979 int rx_ring_size;
4008 dma_addr_t rx_desc_mapping; 3980 dma_addr_t rx_desc_mapping[MAX_RX_RINGS];
4009 3981
4010 u16 tx_quick_cons_trip; 3982 u16 tx_quick_cons_trip;
4011 u16 tx_quick_cons_trip_int; 3983 u16 tx_quick_cons_trip_int;
@@ -4029,6 +4001,7 @@ struct bnx2 {
4029 struct statistics_block *stats_blk; 4001 struct statistics_block *stats_blk;
4030 dma_addr_t stats_blk_mapping; 4002 dma_addr_t stats_blk_mapping;
4031 4003
4004 u32 hc_cmd;
4032 u32 rx_mode; 4005 u32 rx_mode;
4033 4006
4034 u16 req_line_speed; 4007 u16 req_line_speed;
@@ -4073,6 +4046,8 @@ struct bnx2 {
4073 4046
4074 struct flash_spec *flash_info; 4047 struct flash_spec *flash_info;
4075 u32 flash_size; 4048 u32 flash_size;
4049
4050 int status_stats_size;
4076}; 4051};
4077 4052
4078static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset); 4053static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);