igb.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 FILE_LICENCE ( GPL2_ONLY );
00029
00030
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
00043 #define IGB_START_ITR 648
00044
00045
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
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
00061 #define IGB_MAX_ITR_USECS 8191
00062
00063 #define NON_Q_VECTORS 1
00064 #define MAX_Q_VECTORS 8
00065
00066
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
00092 #define IGB_VF_FLAG_UNI_PROMISC 0x00000002
00093 #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
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
00115 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
00116
00117
00118 #define IGB_RXBUFFER_128 128
00119 #define IGB_RXBUFFER_256 256
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
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
00133
00134
00135 #define IGB_TX_QUEUE_WAKE 32
00136
00137 #define IGB_RX_BUFFER_WRITE 16
00138
00139 #define AUTO_ALL_MODES 0
00140 #define IGB_EEPROM_APME 0x0400
00141
00142 #ifndef IGB_MASTER_SLAVE
00143
00144 #define IGB_MASTER_SLAVE e1000_ms_hw_default
00145 #endif
00146
00147 #define IGB_MNG_VLAN_NONE -1
00148
00149
00150
00151 struct igb_buffer {
00152 struct sk_buff *skb;
00153 dma_addr_t dma;
00154 dma_addr_t page_dma;
00155 union {
00156
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
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;
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;
00203 struct pci_dev *pdev;
00204 dma_addr_t dma;
00205 void *desc;
00206 unsigned int size;
00207 u16 count;
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;
00215
00216 unsigned int total_bytes;
00217 unsigned int total_packets;
00218
00219 struct igb_queue_stats stats;
00220
00221 union {
00222
00223 struct {
00224 unsigned int restart_queue;
00225 u32 ctx_idx;
00226 bool detect_tx_hung;
00227 };
00228
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
00262
00263
00264 struct igb_adapter {
00265
00266
00267 struct net_device *netdev;
00268 struct pci_device *pdev;
00269 struct net_device_stats net_stats;
00270
00271
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