igb.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003   Intel(R) Gigabit Ethernet Linux driver
00004   Copyright(c) 2007-2009 Intel Corporation.
00005 
00006   This program is free software; you can redistribute it and/or modify it
00007   under the terms and conditions of the GNU General Public License,
00008   version 2, as published by the Free Software Foundation.
00009 
00010   This program is distributed in the hope it will be useful, but WITHOUT
00011   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00013   more details.
00014 
00015   You should have received a copy of the GNU General Public License along with
00016   this program; if not, write to the Free Software Foundation, Inc.,
00017   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019   The full GNU General Public License is included in this distribution in
00020   the file called "COPYING".
00021 
00022   Contact Information:
00023   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
00024   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
00025 
00026 *******************************************************************************/
00027 
00028 FILE_LICENCE ( GPL2_ONLY );
00029 
00030 /* Linux PRO/1000 Ethernet Driver main header file */
00031 
00032 #ifndef _IGB_H_
00033 #define _IGB_H_
00034 
00035 #include "igb_api.h"
00036 
00037 extern int igb_probe ( struct pci_device *pdev, const struct pci_device_id *ent);
00038 extern void igb_remove ( struct pci_device *pdev );
00039 
00040 struct igb_adapter;
00041 
00042 /* Interrupt defines */
00043 #define IGB_START_ITR                    648 /* ~6000 ints/sec */
00044 
00045 /* Interrupt modes, as used by the IntMode paramter */
00046 #define IGB_INT_MODE_LEGACY                0
00047 #define IGB_INT_MODE_MSI                   1
00048 #define IGB_INT_MODE_MSIX                  2
00049 
00050 #define HW_PERF
00051 /* TX/RX descriptor defines */
00052 #define IGB_DEFAULT_TXD                  256
00053 #define IGB_MIN_TXD                       80
00054 #define IGB_MAX_TXD                     4096
00055 
00056 #define IGB_DEFAULT_RXD                  256
00057 #define IGB_MIN_RXD                       80
00058 #define IGB_MAX_RXD                     4096
00059 
00060 #define IGB_MIN_ITR_USECS                 10 /* 100k irq/sec */
00061 #define IGB_MAX_ITR_USECS               8191 /* 120  irq/sec */
00062 
00063 #define NON_Q_VECTORS                      1
00064 #define MAX_Q_VECTORS                      8
00065 
00066 /* Transmit and receive queues */
00067 #define IGB_MAX_RX_QUEUES                  (adapter->vfs_allocated_count ? 2 : \
00068                                            (hw->mac.type > e1000_82575 ? 8 : 4))
00069 #define IGB_ABS_MAX_TX_QUEUES              8
00070 #define IGB_MAX_TX_QUEUES                  IGB_MAX_RX_QUEUES
00071 
00072 #define IGB_MAX_VF_MC_ENTRIES              30
00073 #define IGB_MAX_VF_FUNCTIONS               8
00074 #define IGB_MAX_VFTA_ENTRIES               128
00075 #define IGB_MAX_UTA_ENTRIES                128
00076 #define MAX_EMULATION_MAC_ADDRS            16
00077 #define OUI_LEN                            3
00078 
00079 struct vf_data_storage {
00080         unsigned char vf_mac_addresses[ETH_ALEN];
00081         u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
00082         u16 num_vf_mc_hashes;
00083         u16 default_vf_vlan_id;
00084         u16 vlans_enabled;
00085         unsigned char em_mac_addresses[MAX_EMULATION_MAC_ADDRS * ETH_ALEN];
00086         u32 uta_table_copy[IGB_MAX_UTA_ENTRIES];
00087         u32 flags;
00088         unsigned long last_nack;
00089 };
00090 
00091 #define IGB_VF_FLAG_CTS            0x00000001 /* VF is clear to send data */
00092 #define IGB_VF_FLAG_UNI_PROMISC    0x00000002 /* VF has unicast promisc */
00093 #define IGB_VF_FLAG_MULTI_PROMISC  0x00000004 /* VF has multicast promisc */
00094 
00095 /* RX descriptor control thresholds.
00096  * PTHRESH - MAC will consider prefetch if it has fewer than this number of
00097  *           descriptors available in its onboard memory.
00098  *           Setting this to 0 disables RX descriptor prefetch.
00099  * HTHRESH - MAC will only prefetch if there are at least this many descriptors
00100  *           available in host memory.
00101  *           If PTHRESH is 0, this should also be 0.
00102  * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
00103  *           descriptors until either it has this many to write back, or the
00104  *           ITR timer expires.
00105  */
00106 #define IGB_RX_PTHRESH                    (hw->mac.type <= e1000_82576 ? 16 : 8)
00107 #define IGB_RX_HTHRESH                     8
00108 #define IGB_RX_WTHRESH                     1
00109 #define IGB_TX_PTHRESH                     8
00110 #define IGB_TX_HTHRESH                     1
00111 #define IGB_TX_WTHRESH                     ((hw->mac.type == e1000_82576 && \
00112                                              adapter->msix_entries) ? 0 : 16)
00113 
00114 /* this is the size past which hardware will drop packets when setting LPE=0 */
00115 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
00116 
00117 /* Supported Rx Buffer Sizes */
00118 #define IGB_RXBUFFER_128   128    /* Used for packet split */
00119 #define IGB_RXBUFFER_256   256    /* Used for packet split */
00120 #define IGB_RXBUFFER_512   512
00121 #define IGB_RXBUFFER_1024  1024
00122 #define IGB_RXBUFFER_2048  2048
00123 #define IGB_RXBUFFER_4096  4096
00124 #define IGB_RXBUFFER_8192  8192
00125 #define IGB_RXBUFFER_16384 16384
00126 
00127 /* Packet Buffer allocations */
00128 #define IGB_PBA_BYTES_SHIFT 0xA
00129 #define IGB_TX_HEAD_ADDR_SHIFT 7
00130 #define IGB_PBA_TX_MASK 0xFFFF0000
00131 
00132 #define IGB_FC_PAUSE_TIME 0x0680 /* 858 usec */
00133 
00134 /* How many Tx Descriptors do we need to call netif_wake_queue ? */
00135 #define IGB_TX_QUEUE_WAKE       32
00136 /* How many Rx Buffers do we bundle into one write to the hardware ? */
00137 #define IGB_RX_BUFFER_WRITE     16      /* Must be power of 2 */
00138 
00139 #define AUTO_ALL_MODES            0
00140 #define IGB_EEPROM_APME         0x0400
00141 
00142 #ifndef IGB_MASTER_SLAVE
00143 /* Switch to override PHY master/slave setting */
00144 #define IGB_MASTER_SLAVE        e1000_ms_hw_default
00145 #endif
00146 
00147 #define IGB_MNG_VLAN_NONE -1
00148 
00149 /* wrapper around a pointer to a socket buffer,
00150  * so a DMA handle can be stored along with the buffer */
00151 struct igb_buffer {
00152         struct sk_buff *skb;
00153         dma_addr_t dma;
00154         dma_addr_t page_dma;
00155         union {
00156                 /* TX */
00157                 struct {
00158                         unsigned long time_stamp;
00159                         u16 length;
00160                         u16 next_to_watch;
00161                 };
00162 
00163 #ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
00164                 /* RX */
00165                 struct {
00166                         unsigned long page_offset;
00167                         struct page *page;
00168                 };
00169 #endif
00170         };
00171 };
00172 
00173 struct igb_queue_stats {
00174         u64 packets;
00175         u64 bytes;
00176 };
00177 
00178 struct igb_q_vector {
00179         struct igb_adapter *adapter; /* backlink */
00180         struct igb_ring *rx_ring;
00181         struct igb_ring *tx_ring;
00182 #if 0
00183         struct napi_struct napi;
00184 #endif
00185         u32 eims_value;
00186         u16 cpu;
00187 
00188         u16 itr_val;
00189         u8 set_itr;
00190         u8 itr_shift;
00191         void __iomem *itr_register;
00192 
00193 #if 0
00194         char name[IFNAMSIZ + 9];
00195 #endif
00196 #ifndef HAVE_NETDEV_NAPI_LIST
00197         struct net_device poll_dev;
00198 #endif
00199 };
00200 
00201 struct igb_ring {
00202         struct igb_q_vector *q_vector; /* backlink to q_vector */
00203         struct pci_dev *pdev;          /* pci device for dma mapping */
00204         dma_addr_t dma;                /* phys address of the ring */
00205         void *desc;                    /* descriptor ring memory */
00206         unsigned int size;             /* length of desc. ring in bytes */
00207         u16 count;                     /* number of desc. in the ring */
00208         u16 next_to_use;
00209         u16 next_to_clean;
00210         u8 queue_index;
00211         u8 reg_idx;
00212         void __iomem *head;
00213         void __iomem *tail;
00214         struct igb_buffer *buffer_info; /* array of buffer info structs */
00215 
00216         unsigned int total_bytes;
00217         unsigned int total_packets;
00218 
00219         struct igb_queue_stats stats;
00220 
00221         union {
00222                 /* TX */
00223                 struct {
00224                         unsigned int restart_queue;
00225                         u32 ctx_idx;
00226                         bool detect_tx_hung;
00227                 };
00228                 /* RX */
00229                 struct {
00230                         u64 hw_csum_err;
00231                         u64 hw_csum_good;
00232                         u32 rx_buffer_len;
00233                         u16 rx_ps_hdr_size;
00234                         bool rx_csum;
00235 #ifdef IGB_LRO
00236                         struct net_lro_mgr lro_mgr;
00237                         bool lro_used;
00238 #endif
00239                 };
00240         };
00241 };
00242 
00243 
00244 #define IGB_ADVTXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
00245 
00246 #define IGB_DESC_UNUSED(R) \
00247         ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
00248         (R)->next_to_clean - (R)->next_to_use - 1)
00249 
00250 #define E1000_RX_DESC_ADV(R, i)     \
00251         (&(((union e1000_adv_rx_desc *)((R).desc))[i]))
00252 #define E1000_TX_DESC_ADV(R, i)     \
00253         (&(((union e1000_adv_tx_desc *)((R).desc))[i]))
00254 #define E1000_TX_CTXTDESC_ADV(R, i)         \
00255         (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i]))
00256 #define E1000_GET_DESC(R, i, type)      (&(((struct type *)((R).desc))[i]))
00257 #define E1000_TX_DESC(R, i)             E1000_GET_DESC(R, i, e1000_tx_desc)
00258 #define E1000_RX_DESC(R, i)             E1000_GET_DESC(R, i, e1000_rx_desc)
00259 
00260 #define MAX_MSIX_COUNT 10
00261 /* board specific private data structure */
00262 
00263 /* board specific private data structure */
00264 struct igb_adapter {
00265 
00266         /* OS defined structs */
00267         struct net_device *netdev;
00268         struct pci_device *pdev;
00269         struct net_device_stats net_stats;
00270 
00271         /* structs defined in e1000_hw.h */
00272         struct e1000_hw hw;
00273 
00274         struct e1000_phy_info phy_info;
00275 
00276         u32 min_frame_size;
00277         u32 max_frame_size;
00278 
00279         u32 wol;
00280         u32 pba;
00281         u32 max_hw_frame_size;
00282 
00283         bool fc_autoneg;
00284 
00285         unsigned int flags;
00286         unsigned int flags2;
00287 
00288 #define NUM_TX_DESC     8
00289 #define NUM_RX_DESC     8
00290 
00291         struct io_buffer *tx_iobuf[NUM_TX_DESC];
00292         struct io_buffer *rx_iobuf[NUM_RX_DESC];
00293 
00294         struct e1000_tx_desc *tx_base;
00295         struct e1000_rx_desc *rx_base;
00296 
00297         uint32_t tx_ring_size;
00298         uint32_t rx_ring_size;
00299 
00300         uint32_t tx_head;
00301         uint32_t tx_tail;
00302         uint32_t tx_fill_ctr;
00303 
00304         uint32_t rx_curr;
00305 
00306         uint32_t ioaddr;
00307         uint32_t irqno;
00308 
00309         uint32_t tx_int_delay;
00310         uint32_t tx_abs_int_delay;
00311         uint32_t txd_cmd;
00312 };
00313 
00314 #define IGB_FLAG_HAS_MSI           (1 << 0)
00315 #define IGB_FLAG_MSI_ENABLE        (1 << 1)
00316 #define IGB_FLAG_DCA_ENABLED       (1 << 3)
00317 #define IGB_FLAG_LLI_PUSH          (1 << 4)
00318 #define IGB_FLAG_IN_NETPOLL        (1 << 5)
00319 #define IGB_FLAG_QUAD_PORT_A       (1 << 6)
00320 #define IGB_FLAG_QUEUE_PAIRS       (1 << 7)
00321 
00322 #define IGB_82576_TSYNC_SHIFT 19
00323 
00324 #endif /* _IGB_H_ */

Generated on Tue Apr 6 20:01:00 2010 for gPXE by  doxygen 1.5.7.1