kni: fix build with kernel 3.8
[dpdk.git] / lib / librte_eal / linuxapp / kni / ethtool / igb / igb.h
1 /*******************************************************************************
2
3   Intel(R) Gigabit Ethernet Linux driver
4   Copyright(c) 2007-2012 Intel Corporation.
5
6   This program is free software; you can redistribute it and/or modify it
7   under the terms and conditions of the GNU General Public License,
8   version 2, as published by the Free Software Foundation.
9
10   This program is distributed in the hope it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13   more details.
14
15   You should have received a copy of the GNU General Public License along with
16   this program; if not, write to the Free Software Foundation, Inc.,
17   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19   The full GNU General Public License is included in this distribution in
20   the file called "COPYING".
21
22   Contact Information:
23   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25
26 *******************************************************************************/
27
28 /* Linux PRO/1000 Ethernet Driver main header file */
29
30 #ifndef _IGB_H_
31 #define _IGB_H_
32
33 #include <linux/kobject.h>
34
35 #ifndef IGB_NO_LRO
36 #include <net/tcp.h>
37 #endif
38
39 #include <linux/pci.h>
40 #include <linux/netdevice.h>
41 #include <linux/vmalloc.h>
42
43 #ifdef SIOCETHTOOL
44 #include <linux/ethtool.h>
45 #endif
46
47 #undef HAVE_HW_TIME_STAMP
48 #ifdef HAVE_HW_TIME_STAMP
49 #include <linux/clocksource.h>
50 #include <linux/timecompare.h>
51 #include <linux/net_tstamp.h>
52
53 #endif
54 struct igb_adapter;
55
56 #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
57 //#define IGB_DCA
58 #endif
59 #ifdef IGB_DCA
60 #include <linux/dca.h>
61 #endif
62
63 #ifndef HAVE_HW_TIME_STAMP
64 #undef IGB_PER_PKT_TIMESTAMP
65 #endif
66
67
68 #include "kcompat.h"
69
70 #ifdef HAVE_SCTP
71 #include <linux/sctp.h>
72 #endif
73
74 #include "e1000_api.h"
75 #include "e1000_82575.h"
76 #include "e1000_manage.h"
77 #include "e1000_mbx.h"
78
79 #define IGB_ERR(args...) printk(KERN_ERR "igb: " args)
80
81 #define PFX "igb: "
82 #define DPRINTK(nlevel, klevel, fmt, args...) \
83         (void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
84         printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
85                 __FUNCTION__ , ## args))
86
87 /* Interrupt defines */
88 #define IGB_START_ITR                    648 /* ~6000 ints/sec */
89 #define IGB_4K_ITR                       980
90 #define IGB_20K_ITR                      196
91 #define IGB_70K_ITR                       56
92
93 /* Interrupt modes, as used by the IntMode paramter */
94 #define IGB_INT_MODE_LEGACY                0
95 #define IGB_INT_MODE_MSI                   1
96 #define IGB_INT_MODE_MSIX                  2
97
98 /* TX/RX descriptor defines */
99 #define IGB_DEFAULT_TXD                  256
100 #define IGB_DEFAULT_TX_WORK              128
101 #define IGB_MIN_TXD                       80
102 #define IGB_MAX_TXD                     4096
103
104 #define IGB_DEFAULT_RXD                  256
105 #define IGB_MIN_RXD                       80
106 #define IGB_MAX_RXD                     4096
107
108 #define IGB_MIN_ITR_USECS                 10 /* 100k irq/sec */
109 #define IGB_MAX_ITR_USECS               8191 /* 120  irq/sec */
110
111 #define NON_Q_VECTORS                      1
112 #define MAX_Q_VECTORS                     10
113
114 /* Transmit and receive queues */
115 #define IGB_MAX_RX_QUEUES                 16
116 #define IGB_MAX_TX_QUEUES                 16
117
118 #define IGB_MAX_VF_MC_ENTRIES             30
119 #define IGB_MAX_VF_FUNCTIONS               8
120 #define IGB_82576_VF_DEV_ID           0x10CA
121 #define IGB_I350_VF_DEV_ID            0x1520
122 #define IGB_MAX_UTA_ENTRIES              128
123 #define MAX_EMULATION_MAC_ADDRS           16
124 #define OUI_LEN                            3
125 #define IGB_MAX_VMDQ_QUEUES                8
126
127
128 struct vf_data_storage {
129         unsigned char vf_mac_addresses[ETH_ALEN];
130         u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
131         u16 num_vf_mc_hashes;
132         u16 default_vf_vlan_id;
133         u16 vlans_enabled;
134         unsigned char em_mac_addresses[MAX_EMULATION_MAC_ADDRS * ETH_ALEN];
135         u32 uta_table_copy[IGB_MAX_UTA_ENTRIES];
136         u32 flags;
137         unsigned long last_nack;
138 #ifdef IFLA_VF_MAX
139         u16 pf_vlan; /* When set, guest VLAN config not allowed. */
140         u16 pf_qos;
141         u16 tx_rate;
142 #endif
143         struct pci_dev *vfdev;
144 };
145
146 #define IGB_VF_FLAG_CTS            0x00000001 /* VF is clear to send data */
147 #define IGB_VF_FLAG_UNI_PROMISC    0x00000002 /* VF has unicast promisc */
148 #define IGB_VF_FLAG_MULTI_PROMISC  0x00000004 /* VF has multicast promisc */
149 #define IGB_VF_FLAG_PF_SET_MAC     0x00000008 /* PF has set MAC address */
150
151 /* RX descriptor control thresholds.
152  * PTHRESH - MAC will consider prefetch if it has fewer than this number of
153  *           descriptors available in its onboard memory.
154  *           Setting this to 0 disables RX descriptor prefetch.
155  * HTHRESH - MAC will only prefetch if there are at least this many descriptors
156  *           available in host memory.
157  *           If PTHRESH is 0, this should also be 0.
158  * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
159  *           descriptors until either it has this many to write back, or the
160  *           ITR timer expires.
161  */
162 #define IGB_RX_PTHRESH                     8
163 #define IGB_RX_HTHRESH                     8
164 #define IGB_TX_PTHRESH                     8
165 #define IGB_TX_HTHRESH                     1
166 #define IGB_RX_WTHRESH                     ((hw->mac.type == e1000_82576 && \
167                                              adapter->msix_entries) ? 1 : 4)
168 #define IGB_TX_WTHRESH                     ((hw->mac.type == e1000_82576 && \
169                                              adapter->msix_entries) ? 1 : 16)
170
171 /* this is the size past which hardware will drop packets when setting LPE=0 */
172 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
173
174 /* NOTE: netdev_alloc_skb reserves 16 bytes, NET_IP_ALIGN means we
175  * reserve 2 more, and skb_shared_info adds an additional 384 more,
176  * this adds roughly 448 bytes of extra data meaning the smallest
177  * allocation we could have is 1K.
178  * i.e. RXBUFFER_512 --> size-1024 slab
179  */
180 /* Supported Rx Buffer Sizes */
181 #define IGB_RXBUFFER_512   512
182 #define IGB_RXBUFFER_16384 16384
183 #define IGB_RX_HDR_LEN     IGB_RXBUFFER_512
184
185
186 /* Packet Buffer allocations */
187 #define IGB_PBA_BYTES_SHIFT 0xA
188 #define IGB_TX_HEAD_ADDR_SHIFT 7
189 #define IGB_PBA_TX_MASK 0xFFFF0000
190
191 #define IGB_FC_PAUSE_TIME 0x0680 /* 858 usec */
192
193 /* How many Tx Descriptors do we need to call netif_wake_queue ? */
194 #define IGB_TX_QUEUE_WAKE       32
195 /* How many Rx Buffers do we bundle into one write to the hardware ? */
196 #define IGB_RX_BUFFER_WRITE     16      /* Must be power of 2 */
197
198 #define IGB_EEPROM_APME         0x0400
199 #ifndef ETH_TP_MDI_X
200 #define AUTO_ALL_MODES          0
201 #endif
202
203 #ifndef IGB_MASTER_SLAVE
204 /* Switch to override PHY master/slave setting */
205 #define IGB_MASTER_SLAVE        e1000_ms_hw_default
206 #endif
207
208 #define IGB_MNG_VLAN_NONE -1
209
210 #ifndef IGB_NO_LRO
211 #define IGB_LRO_MAX 32 /*Maximum number of LRO descriptors*/
212 struct igb_lro_stats {
213         u32 flushed;
214         u32 coal;
215         u32 recycled;
216 };
217
218 /*
219  * igb_lro_header - header format to be aggregated by LRO
220  * @iph: IP header without options
221  * @tcp: TCP header
222  * @ts:  Optional TCP timestamp data in TCP options
223  *
224  * This structure relies on the check above that verifies that the header
225  * is IPv4 and does not contain any options.
226  */
227 struct igb_lrohdr {
228         struct iphdr iph;
229         struct tcphdr th; 
230         __be32 ts[0];
231 };
232
233 struct igb_lro_list {
234         struct sk_buff_head active;
235         struct igb_lro_stats stats;
236 };
237
238 #endif /* IGB_NO_LRO */
239 struct igb_cb {
240 #ifndef IGB_NO_LRO
241         union {                         /* Union defining head/tail partner */
242                 struct sk_buff *head;
243                 struct sk_buff *tail;
244         };
245         __be32  tsecr;                  /* timestamp echo response */
246         u32     tsval;                  /* timestamp value in host order */
247         u32     next_seq;               /* next expected sequence number */
248         u16     free;                   /* 65521 minus total size */
249         u16     mss;                    /* size of data portion of packet */
250         u16     append_cnt;             /* number of skb's appended */
251 #endif /* IGB_NO_LRO */
252 #ifdef HAVE_VLAN_RX_REGISTER
253         u16     vid;                    /* VLAN tag */
254 #endif
255 };
256 #define IGB_CB(skb) ((struct igb_cb *)(skb)->cb)
257
258 #define IGB_TX_FLAGS_CSUM               0x00000001
259 #define IGB_TX_FLAGS_VLAN               0x00000002
260 #define IGB_TX_FLAGS_TSO                0x00000004
261 #define IGB_TX_FLAGS_IPV4               0x00000008
262 #define IGB_TX_FLAGS_TSTAMP             0x00000010
263 #define IGB_TX_FLAGS_VLAN_MASK          0xffff0000
264 #define IGB_TX_FLAGS_VLAN_SHIFT                 16
265
266 /* wrapper around a pointer to a socket buffer,
267  * so a DMA handle can be stored along with the buffer */
268 struct igb_tx_buffer {
269         union e1000_adv_tx_desc *next_to_watch;
270         unsigned long time_stamp;
271         struct sk_buff *skb;
272         unsigned int bytecount;
273         u16 gso_segs;
274         __be16 protocol;
275         DEFINE_DMA_UNMAP_ADDR(dma);
276         DEFINE_DMA_UNMAP_LEN(len);
277         u32 tx_flags;
278 };
279
280 struct igb_rx_buffer {
281         struct sk_buff *skb;
282         dma_addr_t dma;
283 #ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
284         struct page *page;
285         dma_addr_t page_dma;
286         u32 page_offset;
287 #endif
288 };
289
290 struct igb_tx_queue_stats {
291         u64 packets;
292         u64 bytes;
293         u64 restart_queue;
294 };
295
296 struct igb_rx_queue_stats {
297         u64 packets;
298         u64 bytes;
299         u64 drops;
300         u64 csum_err;
301         u64 alloc_failed;
302 };
303
304 struct igb_ring_container {
305         struct igb_ring *ring;          /* pointer to linked list of rings */
306         unsigned int total_bytes;       /* total bytes processed this int */
307         unsigned int total_packets;     /* total packets processed this int */
308         u16 work_limit;                 /* total work allowed per interrupt */
309         u8 count;                       /* total number of rings in vector */
310         u8 itr;                         /* current ITR setting for ring */
311 };
312
313 struct igb_q_vector {
314         struct igb_adapter *adapter;    /* backlink */
315         int cpu;                        /* CPU for DCA */
316         u32 eims_value;                 /* EIMS mask value */
317
318         struct igb_ring_container rx, tx;
319
320         struct napi_struct napi;
321         int numa_node;
322
323         u16 itr_val;
324         u8 set_itr;
325         void __iomem *itr_register;
326
327 #ifndef IGB_NO_LRO
328         struct igb_lro_list *lrolist;   /* LRO list for queue vector*/
329 #endif
330         char name[IFNAMSIZ + 9];
331 #ifndef HAVE_NETDEV_NAPI_LIST
332         struct net_device poll_dev;
333 #endif
334 } ____cacheline_internodealigned_in_smp;
335
336 struct igb_ring {
337         struct igb_q_vector *q_vector;  /* backlink to q_vector */
338         struct net_device *netdev;      /* back pointer to net_device */
339         struct device *dev;             /* device for dma mapping */
340         union {                         /* array of buffer info structs */
341                 struct igb_tx_buffer *tx_buffer_info;
342                 struct igb_rx_buffer *rx_buffer_info;
343         };
344         void *desc;                     /* descriptor ring memory */
345         unsigned long flags;            /* ring specific flags */
346         void __iomem *tail;             /* pointer to ring tail register */
347
348         u16 count;                      /* number of desc. in the ring */
349         u8 queue_index;                 /* logical index of the ring*/
350         u8 reg_idx;                     /* physical index of the ring */
351         u32 size;                       /* length of desc. ring in bytes */
352
353         /* everything past this point are written often */
354         u16 next_to_clean ____cacheline_aligned_in_smp;
355         u16 next_to_use;
356
357         union {
358                 /* TX */
359                 struct {
360                         struct igb_tx_queue_stats tx_stats;
361                 };
362                 /* RX */
363                 struct {
364                         struct igb_rx_queue_stats rx_stats;
365 #ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT
366                         u16 rx_buffer_len;
367 #endif
368                 };
369         };
370 #ifdef CONFIG_IGB_VMDQ_NETDEV
371         struct net_device *vmdq_netdev;
372         int vqueue_index;               /* queue index for virtual netdev */
373 #endif
374         /* Items past this point are only used during ring alloc / free */
375         dma_addr_t dma;                 /* phys address of the ring */
376         int numa_node;                  /* node to alloc ring memory on */
377
378 } ____cacheline_internodealigned_in_smp;
379
380 enum e1000_ring_flags_t {
381 #ifndef HAVE_NDO_SET_FEATURES
382         IGB_RING_FLAG_RX_CSUM,
383 #endif
384         IGB_RING_FLAG_RX_SCTP_CSUM,
385         IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
386         IGB_RING_FLAG_TX_CTX_IDX,
387         IGB_RING_FLAG_TX_DETECT_HANG,
388 };
389 struct igb_mac_addr {
390         u8 addr[ETH_ALEN];
391         u16 queue;
392         u16 state; /* bitmask */
393 };
394 #define IGB_MAC_STATE_DEFAULT   0x1
395 #define IGB_MAC_STATE_MODIFIED  0x2
396 #define IGB_MAC_STATE_IN_USE    0x4
397
398 #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
399
400 #define IGB_RX_DESC(R, i)           \
401         (&(((union e1000_adv_rx_desc *)((R)->desc))[i]))
402 #define IGB_TX_DESC(R, i)           \
403         (&(((union e1000_adv_tx_desc *)((R)->desc))[i]))
404 #define IGB_TX_CTXTDESC(R, i)       \
405         (&(((struct e1000_adv_tx_context_desc *)((R)->desc))[i]))
406
407 #ifdef CONFIG_IGB_VMDQ_NETDEV
408 #define netdev_ring(ring) \
409         ((ring->vmdq_netdev ? ring->vmdq_netdev : ring->netdev))
410 #define ring_queue_index(ring) \
411         ((ring->vmdq_netdev ? ring->vqueue_index : ring->queue_index))
412 #else
413 #define netdev_ring(ring) (ring->netdev)
414 #define ring_queue_index(ring) (ring->queue_index)
415 #endif /* CONFIG_IGB_VMDQ_NETDEV */
416
417 /* igb_test_staterr - tests bits within Rx descriptor status and error fields */
418 static inline __le32 igb_test_staterr(union e1000_adv_rx_desc *rx_desc,
419                                       const u32 stat_err_bits)
420 {
421         return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
422 }
423
424 /* igb_desc_unused - calculate if we have unused descriptors */
425 static inline u16 igb_desc_unused(const struct igb_ring *ring)
426 {
427         u16 ntc = ring->next_to_clean;
428         u16 ntu = ring->next_to_use;
429
430         return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
431 }
432
433 #ifdef CONFIG_BQL
434 static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring)
435 {
436         return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
437 }
438 #endif /* CONFIG_BQL */
439
440 // #ifdef EXT_THERMAL_SENSOR_SUPPORT
441 // #ifdef IGB_PROCFS
442 struct igb_therm_proc_data
443 {
444         struct e1000_hw *hw;
445         struct e1000_thermal_diode_data *sensor_data;
446 };
447
448 //  #endif /* IGB_PROCFS */
449 // #endif /* EXT_THERMAL_SENSOR_SUPPORT */
450
451 /* board specific private data structure */
452 struct igb_adapter {
453 #ifdef HAVE_VLAN_RX_REGISTER
454         /* vlgrp must be first member of structure */
455         struct vlan_group *vlgrp;
456 #else
457         unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
458 #endif
459         struct net_device *netdev;
460
461         unsigned long state;
462         unsigned int flags;
463
464         unsigned int num_q_vectors;
465         struct msix_entry *msix_entries;
466
467
468         /* TX */
469         u16 tx_work_limit;
470         u32 tx_timeout_count;
471         int num_tx_queues;
472         struct igb_ring *tx_ring[IGB_MAX_TX_QUEUES];
473
474         /* RX */
475         int num_rx_queues;
476         struct igb_ring *rx_ring[IGB_MAX_RX_QUEUES];
477
478         struct timer_list watchdog_timer;
479         struct timer_list dma_err_timer;
480         struct timer_list phy_info_timer;
481         u16 mng_vlan_id;
482         u32 bd_number;
483         u32 wol;
484         u32 en_mng_pt;
485         u16 link_speed;
486         u16 link_duplex;
487         u8 port_num;
488
489         /* Interrupt Throttle Rate */
490         u32 rx_itr_setting;
491         u32 tx_itr_setting;
492
493         struct work_struct reset_task;
494         struct work_struct watchdog_task;
495         struct work_struct dma_err_task;
496         bool fc_autoneg;
497         u8  tx_timeout_factor;
498
499         u32 max_frame_size;
500
501         /* OS defined structs */
502         struct pci_dev *pdev;
503 #ifndef HAVE_NETDEV_STATS_IN_NETDEV
504         struct net_device_stats net_stats;
505 #endif
506 #ifndef IGB_NO_LRO
507         struct igb_lro_stats lro_stats;
508 #endif
509 #ifdef HAVE_HW_TIME_STAMP
510         struct cyclecounter cycles;
511         struct timecounter clock;
512         struct timecompare compare;
513         struct hwtstamp_config hwtstamp_config;
514 #endif
515
516         /* structs defined in e1000_hw.h */
517         struct e1000_hw hw;
518         struct e1000_hw_stats stats;
519         struct e1000_phy_info phy_info;
520         struct e1000_phy_stats phy_stats;
521
522 #ifdef ETHTOOL_TEST
523         u32 test_icr;
524         struct igb_ring test_tx_ring;
525         struct igb_ring test_rx_ring;
526 #endif
527
528         int msg_enable;
529
530         struct igb_q_vector *q_vector[MAX_Q_VECTORS];
531         u32 eims_enable_mask;
532         u32 eims_other;
533
534         /* to not mess up cache alignment, always add to the bottom */
535         u32 eeprom_wol;
536
537         u32 *config_space;
538         u16 tx_ring_count;
539         u16 rx_ring_count;
540         struct vf_data_storage *vf_data;
541 #ifdef IFLA_VF_MAX
542         int vf_rate_link_speed;
543 #endif
544         u32 lli_port;
545         u32 lli_size;
546         unsigned int vfs_allocated_count;
547         /* Malicious Driver Detection flag. Valid only when SR-IOV is enabled */
548         bool mdd;
549         int int_mode;
550         u32 rss_queues;
551         u32 vmdq_pools;
552         u16 fw_version;
553         int node;
554         u32 wvbr;
555         struct igb_mac_addr *mac_table;
556 #ifdef CONFIG_IGB_VMDQ_NETDEV
557         struct net_device *vmdq_netdev[IGB_MAX_VMDQ_QUEUES];
558 #endif
559         int vferr_refcount;
560         int dmac;
561         u32 *shadow_vfta;
562
563         /* External Thermal Sensor support flag */
564         bool ets;
565 #ifdef IGB_SYSFS
566         struct kobject *info_kobj;
567         struct kobject *therm_kobj[E1000_MAX_SENSORS];
568 #else /* IGB_SYSFS */
569 #ifdef IGB_PROCFS
570         struct proc_dir_entry *eth_dir;
571         struct proc_dir_entry *info_dir;
572         struct proc_dir_entry *therm_dir[E1000_MAX_SENSORS];
573         struct igb_therm_proc_data therm_data[E1000_MAX_SENSORS];
574 #endif /* IGB_PROCFS */
575 #endif /* IGB_SYSFS */
576 };
577
578 #ifdef CONFIG_IGB_VMDQ_NETDEV
579 struct igb_vmdq_adapter {
580 #ifdef HAVE_VLAN_RX_REGISTER
581         /* vlgrp must be first member of structure */
582         struct vlan_group *vlgrp;
583 #else
584         unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
585 #endif
586         struct igb_adapter *real_adapter;
587         struct net_device *vnetdev;
588         struct net_device_stats net_stats;
589         struct igb_ring *tx_ring;
590         struct igb_ring *rx_ring;
591 };
592 #endif
593
594
595 #define IGB_FLAG_HAS_MSI           (1 << 0)
596 #define IGB_FLAG_MSI_ENABLE        (1 << 1)
597 #define IGB_FLAG_DCA_ENABLED       (1 << 2)
598 #define IGB_FLAG_LLI_PUSH          (1 << 3)
599 #define IGB_FLAG_QUAD_PORT_A       (1 << 4)
600 #define IGB_FLAG_QUEUE_PAIRS       (1 << 5)
601 #define IGB_FLAG_EEE               (1 << 6)
602 #define IGB_FLAG_DMAC              (1 << 7)
603 #define IGB_FLAG_DETECT_BAD_DMA    (1 << 8)
604
605 #define IGB_MIN_TXPBSIZE           20408
606 #define IGB_TX_BUF_4096            4096
607
608 #define IGB_DMCTLX_DCFLUSH_DIS     0x80000000  /* Disable DMA Coal Flush */
609
610 /* DMA Coalescing defines */
611 #define IGB_DMAC_DISABLE          0
612 #define IGB_DMAC_MIN            250
613 #define IGB_DMAC_500            500
614 #define IGB_DMAC_EN_DEFAULT    1000
615 #define IGB_DMAC_2000          2000
616 #define IGB_DMAC_3000          3000
617 #define IGB_DMAC_4000          4000
618 #define IGB_DMAC_5000          5000
619 #define IGB_DMAC_6000          6000
620 #define IGB_DMAC_7000          7000
621 #define IGB_DMAC_8000          8000
622 #define IGB_DMAC_9000          9000
623 #define IGB_DMAC_MAX          10000
624
625
626 #define IGB_82576_TSYNC_SHIFT 19
627 #define IGB_82580_TSYNC_SHIFT 24
628 #define IGB_TS_HDR_LEN        16
629
630 /* CEM Support */
631 #define FW_HDR_LEN           0x4
632 #define FW_CMD_DRV_INFO      0xDD
633 #define FW_CMD_DRV_INFO_LEN  0x5
634 #define FW_CMD_RESERVED      0X0
635 #define FW_RESP_SUCCESS      0x1
636 #define FW_UNUSED_VER        0x0
637 #define FW_MAX_RETRIES       3
638 #define FW_STATUS_SUCCESS    0x1
639 #define FW_FAMILY_DRV_VER    0Xffffffff
640
641 #define IGB_MAX_LINK_TRIES   20
642
643 struct e1000_fw_hdr {
644         u8 cmd;
645         u8 buf_len;
646         union
647         {
648                 u8 cmd_resv;
649                 u8 ret_status;
650         } cmd_or_resp;
651         u8 checksum;
652 };
653 struct e1000_fw_drv_info {
654         struct e1000_fw_hdr hdr;
655         u8 port_num;
656         u32 drv_version;
657         u16 pad; /* end spacing to ensure length is mult. of dword */
658         u8  pad2; /* end spacing to ensure length is mult. of dword2 */
659 };
660 enum e1000_state_t {
661         __IGB_TESTING,
662         __IGB_RESETTING,
663         __IGB_DOWN
664 };
665
666 extern char igb_driver_name[];
667 extern char igb_driver_version[];
668
669 extern int igb_up(struct igb_adapter *);
670 extern void igb_down(struct igb_adapter *);
671 extern void igb_reinit_locked(struct igb_adapter *);
672 extern void igb_reset(struct igb_adapter *);
673 extern int igb_set_spd_dplx(struct igb_adapter *, u16);
674 extern int igb_setup_tx_resources(struct igb_ring *);
675 extern int igb_setup_rx_resources(struct igb_ring *);
676 extern void igb_free_tx_resources(struct igb_ring *);
677 extern void igb_free_rx_resources(struct igb_ring *);
678 extern void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
679 extern void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
680 extern void igb_setup_tctl(struct igb_adapter *);
681 extern void igb_setup_rctl(struct igb_adapter *);
682 extern netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
683 extern void igb_unmap_and_free_tx_resource(struct igb_ring *,
684                                            struct igb_tx_buffer *);
685 extern void igb_alloc_rx_buffers(struct igb_ring *, u16);
686 extern void igb_clean_rx_ring(struct igb_ring *);
687 extern void igb_update_stats(struct igb_adapter *);
688 extern bool igb_has_link(struct igb_adapter *adapter);
689 extern void igb_set_ethtool_ops(struct net_device *);
690 extern void igb_check_options(struct igb_adapter *);
691 extern void igb_power_up_link(struct igb_adapter *);
692 #ifdef ETHTOOL_OPS_COMPAT
693 extern int ethtool_ioctl(struct ifreq *);
694 #endif
695 extern int igb_write_mc_addr_list(struct net_device *netdev);
696 extern int igb_add_mac_filter(struct igb_adapter *adapter, u8 *addr, u16 queue);
697 extern int igb_del_mac_filter(struct igb_adapter *adapter, u8* addr, u16 queue);
698 extern int igb_available_rars(struct igb_adapter *adapter);
699 extern s32 igb_vlvf_set(struct igb_adapter *, u32, bool, u32);
700 extern void igb_configure_vt_default_pool(struct igb_adapter *adapter);
701 extern void igb_enable_vlan_tags(struct igb_adapter *adapter);
702 #ifndef HAVE_VLAN_RX_REGISTER
703 extern void igb_vlan_mode(struct net_device *, u32);
704 #endif
705
706
707 #ifdef IGB_SYSFS
708 void igb_sysfs_exit(struct igb_adapter *adapter);
709 int igb_sysfs_init(struct igb_adapter *adapter);
710 #else
711 #ifdef IGB_PROCFS
712 int igb_procfs_init(struct igb_adapter* adapter);
713 void igb_procfs_exit(struct igb_adapter* adapter);
714 int igb_procfs_topdir_init(void);
715 void igb_procfs_topdir_exit(void);
716 #endif /* IGB_PROCFS */
717 #endif /* IGB_SYSFS */
718 #endif /* _IGB_H_ */