0001
0002
0003
0004
0005
0006 #ifndef _IGBVF_H_
0007 #define _IGBVF_H_
0008
0009 #include <linux/types.h>
0010 #include <linux/timer.h>
0011 #include <linux/io.h>
0012 #include <linux/netdevice.h>
0013 #include <linux/if_vlan.h>
0014
0015 #include "vf.h"
0016
0017
0018 struct igbvf_info;
0019 struct igbvf_adapter;
0020
0021
0022 #define IGBVF_START_ITR 488
0023 #define IGBVF_4K_ITR 980
0024 #define IGBVF_20K_ITR 196
0025 #define IGBVF_70K_ITR 56
0026
0027 enum latency_range {
0028 lowest_latency = 0,
0029 low_latency = 1,
0030 bulk_latency = 2,
0031 latency_invalid = 255
0032 };
0033
0034
0035 #define IGBVF_INT_MODE_LEGACY 0
0036 #define IGBVF_INT_MODE_MSI 1
0037 #define IGBVF_INT_MODE_MSIX 2
0038
0039
0040 #define IGBVF_DEFAULT_TXD 256
0041 #define IGBVF_MAX_TXD 4096
0042 #define IGBVF_MIN_TXD 80
0043
0044 #define IGBVF_DEFAULT_RXD 256
0045 #define IGBVF_MAX_RXD 4096
0046 #define IGBVF_MIN_RXD 80
0047
0048 #define IGBVF_MIN_ITR_USECS 10
0049 #define IGBVF_MAX_ITR_USECS 10000
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 #define IGBVF_RX_PTHRESH 16
0063 #define IGBVF_RX_HTHRESH 8
0064 #define IGBVF_RX_WTHRESH 1
0065
0066
0067 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
0068
0069 #define IGBVF_FC_PAUSE_TIME 0x0680
0070
0071
0072 #define IGBVF_TX_QUEUE_WAKE 32
0073
0074 #define IGBVF_RX_BUFFER_WRITE 16
0075
0076 #define AUTO_ALL_MODES 0
0077 #define IGBVF_EEPROM_APME 0x0400
0078
0079 #define IGBVF_MNG_VLAN_NONE (-1)
0080
0081 #define IGBVF_MAX_MAC_FILTERS 3
0082
0083
0084 #define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
0085
0086 enum igbvf_boards {
0087 board_vf,
0088 board_i350_vf,
0089 };
0090
0091 struct igbvf_queue_stats {
0092 u64 packets;
0093 u64 bytes;
0094 };
0095
0096
0097
0098
0099 struct igbvf_buffer {
0100 dma_addr_t dma;
0101 struct sk_buff *skb;
0102 union {
0103
0104 struct {
0105 unsigned long time_stamp;
0106 union e1000_adv_tx_desc *next_to_watch;
0107 u16 length;
0108 u16 mapped_as_page;
0109 };
0110
0111 struct {
0112 struct page *page;
0113 u64 page_dma;
0114 unsigned int page_offset;
0115 };
0116 };
0117 };
0118
0119 union igbvf_desc {
0120 union e1000_adv_rx_desc rx_desc;
0121 union e1000_adv_tx_desc tx_desc;
0122 struct e1000_adv_tx_context_desc tx_context_desc;
0123 };
0124
0125 struct igbvf_ring {
0126 struct igbvf_adapter *adapter;
0127 union igbvf_desc *desc;
0128 dma_addr_t dma;
0129 unsigned int size;
0130 unsigned int count;
0131
0132 u16 next_to_use;
0133 u16 next_to_clean;
0134
0135 u16 head;
0136 u16 tail;
0137
0138
0139 struct igbvf_buffer *buffer_info;
0140 struct napi_struct napi;
0141
0142 char name[IFNAMSIZ + 5];
0143 u32 eims_value;
0144 u32 itr_val;
0145 enum latency_range itr_range;
0146 u16 itr_register;
0147 int set_itr;
0148
0149 struct sk_buff *rx_skb_top;
0150
0151 struct igbvf_queue_stats stats;
0152 };
0153
0154
0155 struct igbvf_adapter {
0156 struct timer_list watchdog_timer;
0157 struct timer_list blink_timer;
0158
0159 struct work_struct reset_task;
0160 struct work_struct watchdog_task;
0161
0162 const struct igbvf_info *ei;
0163
0164 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
0165 u32 bd_number;
0166 u32 rx_buffer_len;
0167 u32 polling_interval;
0168 u16 mng_vlan_id;
0169 u16 link_speed;
0170 u16 link_duplex;
0171
0172 spinlock_t tx_queue_lock;
0173
0174
0175 unsigned long state;
0176
0177
0178 u32 requested_itr;
0179 u32 current_itr;
0180
0181
0182 struct igbvf_ring *tx_ring
0183 ____cacheline_aligned_in_smp;
0184
0185 unsigned int restart_queue;
0186 u32 txd_cmd;
0187
0188 u32 tx_int_delay;
0189 u32 tx_abs_int_delay;
0190
0191 unsigned int total_tx_bytes;
0192 unsigned int total_tx_packets;
0193 unsigned int total_rx_bytes;
0194 unsigned int total_rx_packets;
0195
0196
0197 u32 tx_timeout_count;
0198 u32 tx_fifo_head;
0199 u32 tx_head_addr;
0200 u32 tx_fifo_size;
0201 u32 tx_dma_failed;
0202
0203
0204 struct igbvf_ring *rx_ring;
0205
0206 u32 rx_int_delay;
0207 u32 rx_abs_int_delay;
0208
0209
0210 u64 hw_csum_err;
0211 u64 hw_csum_good;
0212 u64 rx_hdr_split;
0213 u32 alloc_rx_buff_failed;
0214 u32 rx_dma_failed;
0215
0216 unsigned int rx_ps_hdr_size;
0217 u32 max_frame_size;
0218 u32 min_frame_size;
0219
0220
0221 struct net_device *netdev;
0222 struct pci_dev *pdev;
0223 spinlock_t stats_lock;
0224
0225
0226 struct e1000_hw hw;
0227
0228
0229
0230
0231
0232 struct e1000_vf_stats stats;
0233 u64 zero_base;
0234
0235 struct igbvf_ring test_tx_ring;
0236 struct igbvf_ring test_rx_ring;
0237 u32 test_icr;
0238
0239 u32 msg_enable;
0240 struct msix_entry *msix_entries;
0241 int int_mode;
0242 u32 eims_enable_mask;
0243 u32 eims_other;
0244 u32 int_counter0;
0245 u32 int_counter1;
0246
0247 u32 eeprom_wol;
0248 u32 wol;
0249 u32 pba;
0250
0251 bool fc_autoneg;
0252
0253 unsigned long led_status;
0254
0255 unsigned int flags;
0256 unsigned long last_reset;
0257 };
0258
0259 struct igbvf_info {
0260 enum e1000_mac_type mac;
0261 unsigned int flags;
0262 u32 pba;
0263 void (*init_ops)(struct e1000_hw *);
0264 s32 (*get_variants)(struct igbvf_adapter *);
0265 };
0266
0267
0268 #define IGBVF_FLAG_RX_CSUM_DISABLED BIT(0)
0269 #define IGBVF_FLAG_RX_LB_VLAN_BSWAP BIT(1)
0270 #define IGBVF_RX_DESC_ADV(R, i) \
0271 (&((((R).desc))[i].rx_desc))
0272 #define IGBVF_TX_DESC_ADV(R, i) \
0273 (&((((R).desc))[i].tx_desc))
0274 #define IGBVF_TX_CTXTDESC_ADV(R, i) \
0275 (&((((R).desc))[i].tx_context_desc))
0276
0277 enum igbvf_state_t {
0278 __IGBVF_TESTING,
0279 __IGBVF_RESETTING,
0280 __IGBVF_DOWN
0281 };
0282
0283 extern char igbvf_driver_name[];
0284
0285 void igbvf_check_options(struct igbvf_adapter *);
0286 void igbvf_set_ethtool_ops(struct net_device *);
0287
0288 int igbvf_up(struct igbvf_adapter *);
0289 void igbvf_down(struct igbvf_adapter *);
0290 void igbvf_reinit_locked(struct igbvf_adapter *);
0291 int igbvf_setup_rx_resources(struct igbvf_adapter *, struct igbvf_ring *);
0292 int igbvf_setup_tx_resources(struct igbvf_adapter *, struct igbvf_ring *);
0293 void igbvf_free_rx_resources(struct igbvf_ring *);
0294 void igbvf_free_tx_resources(struct igbvf_ring *);
0295 void igbvf_update_stats(struct igbvf_adapter *);
0296
0297 extern unsigned int copybreak;
0298
0299 #endif