1 /*******************************************************************************
3 Intel(R) Gigabit Ethernet Linux driver
4 Copyright(c) 2007-2013 Intel Corporation.
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.
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
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.
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
23 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 *******************************************************************************/
28 /* Linux PRO/1000 Ethernet Driver main header file */
33 #include <linux/kobject.h>
39 #undef HAVE_HW_TIME_STAMP
40 #ifdef HAVE_HW_TIME_STAMP
41 #include <linux/pci.h>
42 #include <linux/netdevice.h>
43 #include <linux/vmalloc.h>
47 #include <linux/ethtool.h>
52 #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
56 #include <linux/dca.h>
62 #include <linux/sctp.h>
65 #include "e1000_api.h"
66 #include "e1000_82575.h"
67 #include "e1000_manage.h"
68 #include "e1000_mbx.h"
70 #define IGB_ERR(args...) printk(KERN_ERR "igb: " args)
73 #define DPRINTK(nlevel, klevel, fmt, args...) \
74 (void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
75 printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
76 __FUNCTION__ , ## args))
78 #ifdef HAVE_PTP_1588_CLOCK
79 #include <linux/clocksource.h>
80 #include <linux/net_tstamp.h>
81 #include <linux/ptp_clock_kernel.h>
82 #endif /* HAVE_PTP_1588_CLOCK */
84 #ifdef HAVE_I2C_SUPPORT
85 #include <linux/i2c.h>
86 #include <linux/i2c-algo-bit.h>
87 #endif /* HAVE_I2C_SUPPORT */
89 /* Interrupt defines */
90 #define IGB_START_ITR 648 /* ~6000 ints/sec */
91 #define IGB_4K_ITR 980
92 #define IGB_20K_ITR 196
93 #define IGB_70K_ITR 56
95 /* Interrupt modes, as used by the IntMode paramter */
96 #define IGB_INT_MODE_LEGACY 0
97 #define IGB_INT_MODE_MSI 1
98 #define IGB_INT_MODE_MSIX 2
100 /* TX/RX descriptor defines */
101 #define IGB_DEFAULT_TXD 256
102 #define IGB_DEFAULT_TX_WORK 128
103 #define IGB_MIN_TXD 80
104 #define IGB_MAX_TXD 4096
106 #define IGB_DEFAULT_RXD 256
107 #define IGB_MIN_RXD 80
108 #define IGB_MAX_RXD 4096
110 #define IGB_MIN_ITR_USECS 10 /* 100k irq/sec */
111 #define IGB_MAX_ITR_USECS 8191 /* 120 irq/sec */
113 #define NON_Q_VECTORS 1
114 #define MAX_Q_VECTORS 10
116 /* Transmit and receive queues */
117 #define IGB_MAX_RX_QUEUES 16
118 #define IGB_MAX_TX_QUEUES 16
120 #define IGB_MAX_VF_MC_ENTRIES 30
121 #define IGB_MAX_VF_FUNCTIONS 8
122 #define IGB_82576_VF_DEV_ID 0x10CA
123 #define IGB_I350_VF_DEV_ID 0x1520
124 #define IGB_MAX_UTA_ENTRIES 128
125 #define MAX_EMULATION_MAC_ADDRS 16
127 #define IGB_MAX_VMDQ_QUEUES 8
130 struct vf_data_storage {
131 unsigned char vf_mac_addresses[ETH_ALEN];
132 u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
133 u16 num_vf_mc_hashes;
134 u16 default_vf_vlan_id;
136 unsigned char em_mac_addresses[MAX_EMULATION_MAC_ADDRS * ETH_ALEN];
137 u32 uta_table_copy[IGB_MAX_UTA_ENTRIES];
139 unsigned long last_nack;
141 u16 pf_vlan; /* When set, guest VLAN config not allowed. */
144 #ifdef HAVE_VF_SPOOFCHK_CONFIGURE
145 bool spoofchk_enabled;
150 #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */
151 #define IGB_VF_FLAG_UNI_PROMISC 0x00000002 /* VF has unicast promisc */
152 #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004 /* VF has multicast promisc */
153 #define IGB_VF_FLAG_PF_SET_MAC 0x00000008 /* PF has set MAC address */
155 /* RX descriptor control thresholds.
156 * PTHRESH - MAC will consider prefetch if it has fewer than this number of
157 * descriptors available in its onboard memory.
158 * Setting this to 0 disables RX descriptor prefetch.
159 * HTHRESH - MAC will only prefetch if there are at least this many descriptors
160 * available in host memory.
161 * If PTHRESH is 0, this should also be 0.
162 * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
163 * descriptors until either it has this many to write back, or the
166 #define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : 8)
167 #define IGB_RX_HTHRESH 8
168 #define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8)
169 #define IGB_TX_HTHRESH 1
170 #define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \
171 adapter->msix_entries) ? 1 : 4)
173 /* this is the size past which hardware will drop packets when setting LPE=0 */
174 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
176 /* NOTE: netdev_alloc_skb reserves 16 bytes, NET_IP_ALIGN means we
177 * reserve 2 more, and skb_shared_info adds an additional 384 more,
178 * this adds roughly 448 bytes of extra data meaning the smallest
179 * allocation we could have is 1K.
180 * i.e. RXBUFFER_512 --> size-1024 slab
182 /* Supported Rx Buffer Sizes */
183 #define IGB_RXBUFFER_256 256
184 #define IGB_RXBUFFER_2048 2048
185 #define IGB_RXBUFFER_16384 16384
186 #define IGB_RX_HDR_LEN IGB_RXBUFFER_256
187 #if MAX_SKB_FRAGS < 8
188 #define IGB_RX_BUFSZ ALIGN(MAX_JUMBO_FRAME_SIZE / MAX_SKB_FRAGS, 1024)
190 #define IGB_RX_BUFSZ IGB_RXBUFFER_2048
194 /* Packet Buffer allocations */
195 #define IGB_PBA_BYTES_SHIFT 0xA
196 #define IGB_TX_HEAD_ADDR_SHIFT 7
197 #define IGB_PBA_TX_MASK 0xFFFF0000
199 #define IGB_FC_PAUSE_TIME 0x0680 /* 858 usec */
201 /* How many Rx Buffers do we bundle into one write to the hardware ? */
202 #define IGB_RX_BUFFER_WRITE 16 /* Must be power of 2 */
204 #define IGB_EEPROM_APME 0x0400
205 #define AUTO_ALL_MODES 0
207 #ifndef IGB_MASTER_SLAVE
208 /* Switch to override PHY master/slave setting */
209 #define IGB_MASTER_SLAVE e1000_ms_hw_default
212 #define IGB_MNG_VLAN_NONE -1
215 #define IGB_LRO_MAX 32 /*Maximum number of LRO descriptors*/
216 struct igb_lro_stats {
222 * igb_lro_header - header format to be aggregated by LRO
223 * @iph: IP header without options
225 * @ts: Optional TCP timestamp data in TCP options
227 * This structure relies on the check above that verifies that the header
228 * is IPv4 and does not contain any options.
236 struct igb_lro_list {
237 struct sk_buff_head active;
238 struct igb_lro_stats stats;
241 #endif /* IGB_NO_LRO */
244 #ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT
245 union { /* Union defining head/tail partner */
246 struct sk_buff *head;
247 struct sk_buff *tail;
250 __be32 tsecr; /* timestamp echo response */
251 u32 tsval; /* timestamp value in host order */
252 u32 next_seq; /* next expected sequence number */
253 u16 free; /* 65521 minus total size */
254 u16 mss; /* size of data portion of packet */
255 u16 append_cnt; /* number of skb's appended */
256 #endif /* IGB_NO_LRO */
257 #ifdef HAVE_VLAN_RX_REGISTER
258 u16 vid; /* VLAN tag */
261 #define IGB_CB(skb) ((struct igb_cb *)(skb)->cb)
265 IGB_TX_FLAGS_VLAN = 0x01,
266 IGB_TX_FLAGS_TSO = 0x02,
267 IGB_TX_FLAGS_TSTAMP = 0x04,
270 IGB_TX_FLAGS_IPV4 = 0x10,
271 IGB_TX_FLAGS_CSUM = 0x20,
275 #define IGB_TX_FLAGS_VLAN_MASK 0xffff0000
276 #define IGB_TX_FLAGS_VLAN_SHIFT 16
279 * The largest size we can write to the descriptor is 65535. In order to
280 * maintain a power of two alignment we have to limit ourselves to 32K.
282 #define IGB_MAX_TXD_PWR 15
283 #define IGB_MAX_DATA_PER_TXD (1 << IGB_MAX_TXD_PWR)
285 /* Tx Descriptors needed, worst case */
286 #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IGB_MAX_DATA_PER_TXD)
287 #ifndef MAX_SKB_FRAGS
288 #define DESC_NEEDED 4
289 #elif (MAX_SKB_FRAGS < 16)
290 #define DESC_NEEDED ((MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE)) + 4)
292 #define DESC_NEEDED (MAX_SKB_FRAGS + 4)
295 /* wrapper around a pointer to a socket buffer,
296 * so a DMA handle can be stored along with the buffer */
297 struct igb_tx_buffer {
298 union e1000_adv_tx_desc *next_to_watch;
299 unsigned long time_stamp;
301 unsigned int bytecount;
304 DEFINE_DMA_UNMAP_ADDR(dma);
305 DEFINE_DMA_UNMAP_LEN(len);
309 struct igb_rx_buffer {
311 #ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT
319 struct igb_tx_queue_stats {
325 struct igb_rx_queue_stats {
331 u64 ipv4_packets; /* IPv4 headers processed */
332 u64 ipv4e_packets; /* IPv4E headers with extensions processed */
333 u64 ipv6_packets; /* IPv6 headers processed */
334 u64 ipv6e_packets; /* IPv6E headers with extensions processed */
335 u64 tcp_packets; /* TCP headers processed */
336 u64 udp_packets; /* UDP headers processed */
337 u64 sctp_packets; /* SCTP headers processed */
338 u64 nfs_packets; /* NFS headers processe */
341 struct igb_ring_container {
342 struct igb_ring *ring; /* pointer to linked list of rings */
343 unsigned int total_bytes; /* total bytes processed this int */
344 unsigned int total_packets; /* total packets processed this int */
345 u16 work_limit; /* total work allowed per interrupt */
346 u8 count; /* total number of rings in vector */
347 u8 itr; /* current ITR setting for ring */
351 struct igb_q_vector *q_vector; /* backlink to q_vector */
352 struct net_device *netdev; /* back pointer to net_device */
353 struct device *dev; /* device for dma mapping */
354 union { /* array of buffer info structs */
355 struct igb_tx_buffer *tx_buffer_info;
356 struct igb_rx_buffer *rx_buffer_info;
358 #ifdef HAVE_PTP_1588_CLOCK
359 unsigned long last_rx_timestamp;
360 #endif /* HAVE_PTP_1588_CLOCK */
361 void *desc; /* descriptor ring memory */
362 unsigned long flags; /* ring specific flags */
363 void __iomem *tail; /* pointer to ring tail register */
364 dma_addr_t dma; /* phys address of the ring */
365 unsigned int size; /* length of desc. ring in bytes */
367 u16 count; /* number of desc. in the ring */
368 u8 queue_index; /* logical index of the ring*/
369 u8 reg_idx; /* physical index of the ring */
371 /* everything past this point are written often */
379 struct igb_tx_queue_stats tx_stats;
383 struct igb_rx_queue_stats rx_stats;
384 #ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT
391 #ifdef CONFIG_IGB_VMDQ_NETDEV
392 struct net_device *vmdq_netdev;
393 int vqueue_index; /* queue index for virtual netdev */
395 } ____cacheline_internodealigned_in_smp;
397 struct igb_q_vector {
398 struct igb_adapter *adapter; /* backlink */
399 int cpu; /* CPU for DCA */
400 u32 eims_value; /* EIMS mask value */
404 void __iomem *itr_register;
406 struct igb_ring_container rx, tx;
408 struct napi_struct napi;
410 struct igb_lro_list lrolist; /* LRO list for queue vector*/
412 char name[IFNAMSIZ + 9];
413 #ifndef HAVE_NETDEV_NAPI_LIST
414 struct net_device poll_dev;
417 /* for dynamic allocation of rings associated with this q_vector */
418 struct igb_ring ring[0] ____cacheline_internodealigned_in_smp;
421 enum e1000_ring_flags_t {
422 #ifndef HAVE_NDO_SET_FEATURES
423 IGB_RING_FLAG_RX_CSUM,
425 IGB_RING_FLAG_RX_SCTP_CSUM,
426 IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
427 IGB_RING_FLAG_TX_CTX_IDX,
428 IGB_RING_FLAG_TX_DETECT_HANG,
431 struct igb_mac_addr {
434 u16 state; /* bitmask */
436 #define IGB_MAC_STATE_DEFAULT 0x1
437 #define IGB_MAC_STATE_MODIFIED 0x2
438 #define IGB_MAC_STATE_IN_USE 0x4
440 #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
442 #define IGB_RX_DESC(R, i) \
443 (&(((union e1000_adv_rx_desc *)((R)->desc))[i]))
444 #define IGB_TX_DESC(R, i) \
445 (&(((union e1000_adv_tx_desc *)((R)->desc))[i]))
446 #define IGB_TX_CTXTDESC(R, i) \
447 (&(((struct e1000_adv_tx_context_desc *)((R)->desc))[i]))
449 #ifdef CONFIG_IGB_VMDQ_NETDEV
450 #define netdev_ring(ring) \
451 ((ring->vmdq_netdev ? ring->vmdq_netdev : ring->netdev))
452 #define ring_queue_index(ring) \
453 ((ring->vmdq_netdev ? ring->vqueue_index : ring->queue_index))
455 #define netdev_ring(ring) (ring->netdev)
456 #define ring_queue_index(ring) (ring->queue_index)
457 #endif /* CONFIG_IGB_VMDQ_NETDEV */
459 /* igb_test_staterr - tests bits within Rx descriptor status and error fields */
460 static inline __le32 igb_test_staterr(union e1000_adv_rx_desc *rx_desc,
461 const u32 stat_err_bits)
463 return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
466 /* igb_desc_unused - calculate if we have unused descriptors */
467 static inline u16 igb_desc_unused(const struct igb_ring *ring)
469 u16 ntc = ring->next_to_clean;
470 u16 ntu = ring->next_to_use;
472 return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
476 static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring)
478 return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
480 #endif /* CONFIG_BQL */
482 // #ifdef EXT_THERMAL_SENSOR_SUPPORT
484 struct igb_therm_proc_data
487 struct e1000_thermal_diode_data *sensor_data;
490 // #endif /* IGB_PROCFS */
491 // #endif /* EXT_THERMAL_SENSOR_SUPPORT */
494 #define IGB_HWMON_TYPE_LOC 0
495 #define IGB_HWMON_TYPE_TEMP 1
496 #define IGB_HWMON_TYPE_CAUTION 2
497 #define IGB_HWMON_TYPE_MAX 3
500 struct device_attribute dev_attr;
502 struct e1000_thermal_diode_data *sensor;
507 struct device *device;
508 struct hwmon_attr *hwmon_list;
509 unsigned int n_hwmon;
511 #endif /* IGB_HWMON */
513 /* board specific private data structure */
515 #ifdef HAVE_VLAN_RX_REGISTER
516 /* vlgrp must be first member of structure */
517 struct vlan_group *vlgrp;
519 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
521 struct net_device *netdev;
526 unsigned int num_q_vectors;
527 struct msix_entry *msix_entries;
532 u32 tx_timeout_count;
534 struct igb_ring *tx_ring[IGB_MAX_TX_QUEUES];
538 struct igb_ring *rx_ring[IGB_MAX_RX_QUEUES];
540 struct timer_list watchdog_timer;
541 struct timer_list dma_err_timer;
542 struct timer_list phy_info_timer;
551 /* Interrupt Throttle Rate */
555 struct work_struct reset_task;
556 struct work_struct watchdog_task;
557 struct work_struct dma_err_task;
559 u8 tx_timeout_factor;
562 bool tx_hang_detected;
563 bool disable_hw_reset;
567 /* OS defined structs */
568 struct pci_dev *pdev;
569 #ifndef HAVE_NETDEV_STATS_IN_NETDEV
570 struct net_device_stats net_stats;
573 struct igb_lro_stats lro_stats;
576 /* structs defined in e1000_hw.h */
578 struct e1000_hw_stats stats;
579 struct e1000_phy_info phy_info;
580 struct e1000_phy_stats phy_stats;
584 struct igb_ring test_tx_ring;
585 struct igb_ring test_rx_ring;
590 struct igb_q_vector *q_vector[MAX_Q_VECTORS];
591 u32 eims_enable_mask;
594 /* to not mess up cache alignment, always add to the bottom */
598 struct vf_data_storage *vf_data;
600 int vf_rate_link_speed;
604 unsigned int vfs_allocated_count;
605 /* Malicious Driver Detection flag. Valid only when SR-IOV is enabled */
612 struct igb_mac_addr *mac_table;
613 #ifdef CONFIG_IGB_VMDQ_NETDEV
614 struct net_device *vmdq_netdev[IGB_MAX_VMDQ_QUEUES];
620 /* External Thermal Sensor support flag */
623 struct hwmon_buff igb_hwmon_buff;
624 #else /* IGB_HWMON */
626 struct proc_dir_entry *eth_dir;
627 struct proc_dir_entry *info_dir;
628 struct proc_dir_entry *therm_dir[E1000_MAX_SENSORS];
629 struct igb_therm_proc_data therm_data[E1000_MAX_SENSORS];
631 #endif /* IGB_PROCFS */
632 #endif /* IGB_HWMON */
635 #ifdef HAVE_PTP_1588_CLOCK
636 struct ptp_clock *ptp_clock;
637 struct ptp_clock_info ptp_caps;
638 struct delayed_work ptp_overflow_work;
639 struct work_struct ptp_tx_work;
640 struct sk_buff *ptp_tx_skb;
641 unsigned long ptp_tx_start;
642 unsigned long last_rx_ptp_check;
643 spinlock_t tmreg_lock;
644 struct cyclecounter cc;
645 struct timecounter tc;
646 u32 tx_hwtstamp_timeouts;
647 u32 rx_hwtstamp_cleared;
648 #endif /* HAVE_PTP_1588_CLOCK */
650 #ifdef HAVE_I2C_SUPPORT
651 struct i2c_algo_bit_data i2c_algo;
652 struct i2c_adapter i2c_adap;
653 struct i2c_client *i2c_client;
654 #endif /* HAVE_I2C_SUPPORT */
655 unsigned long link_check_timeout;
664 #ifdef CONFIG_IGB_VMDQ_NETDEV
665 struct igb_vmdq_adapter {
666 #ifdef HAVE_VLAN_RX_REGISTER
667 /* vlgrp must be first member of structure */
668 struct vlan_group *vlgrp;
670 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
672 struct igb_adapter *real_adapter;
673 struct net_device *vnetdev;
674 struct net_device_stats net_stats;
675 struct igb_ring *tx_ring;
676 struct igb_ring *rx_ring;
680 #define IGB_FLAG_HAS_MSI (1 << 0)
681 #define IGB_FLAG_DCA_ENABLED (1 << 1)
682 #define IGB_FLAG_LLI_PUSH (1 << 2)
683 #define IGB_FLAG_QUAD_PORT_A (1 << 3)
684 #define IGB_FLAG_QUEUE_PAIRS (1 << 4)
685 #define IGB_FLAG_EEE (1 << 5)
686 #define IGB_FLAG_DMAC (1 << 6)
687 #define IGB_FLAG_DETECT_BAD_DMA (1 << 7)
688 #define IGB_FLAG_PTP (1 << 8)
689 #define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 9)
690 #define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 10)
691 #define IGB_FLAG_WOL_SUPPORTED (1 << 11)
692 #define IGB_FLAG_NEED_LINK_UPDATE (1 << 12)
693 #define IGB_FLAG_LOOPBACK_ENABLE (1 << 13)
694 #define IGB_FLAG_MEDIA_RESET (1 << 14)
695 #define IGB_FLAG_MAS_ENABLE (1 << 15)
697 /* Media Auto Sense */
698 #define IGB_MAS_ENABLE_0 0X0001
699 #define IGB_MAS_ENABLE_1 0X0002
700 #define IGB_MAS_ENABLE_2 0X0004
701 #define IGB_MAS_ENABLE_3 0X0008
703 #define IGB_MIN_TXPBSIZE 20408
704 #define IGB_TX_BUF_4096 4096
706 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coal Flush */
708 /* DMA Coalescing defines */
709 #define IGB_DMAC_DISABLE 0
710 #define IGB_DMAC_MIN 250
711 #define IGB_DMAC_500 500
712 #define IGB_DMAC_EN_DEFAULT 1000
713 #define IGB_DMAC_2000 2000
714 #define IGB_DMAC_3000 3000
715 #define IGB_DMAC_4000 4000
716 #define IGB_DMAC_5000 5000
717 #define IGB_DMAC_6000 6000
718 #define IGB_DMAC_7000 7000
719 #define IGB_DMAC_8000 8000
720 #define IGB_DMAC_9000 9000
721 #define IGB_DMAC_MAX 10000
723 #define IGB_82576_TSYNC_SHIFT 19
724 #define IGB_82580_TSYNC_SHIFT 24
725 #define IGB_TS_HDR_LEN 16
728 #define FW_HDR_LEN 0x4
729 #define FW_CMD_DRV_INFO 0xDD
730 #define FW_CMD_DRV_INFO_LEN 0x5
731 #define FW_CMD_RESERVED 0X0
732 #define FW_RESP_SUCCESS 0x1
733 #define FW_UNUSED_VER 0x0
734 #define FW_MAX_RETRIES 3
735 #define FW_STATUS_SUCCESS 0x1
736 #define FW_FAMILY_DRV_VER 0Xffffffff
738 #define IGB_MAX_LINK_TRIES 20
740 struct e1000_fw_hdr {
752 struct e1000_fw_drv_info {
753 struct e1000_fw_hdr hdr;
756 u16 pad; /* end spacing to ensure length is mult. of dword */
757 u8 pad2; /* end spacing to ensure length is mult. of dword2 */
767 extern char igb_driver_name[];
768 extern char igb_driver_version[];
770 extern int igb_up(struct igb_adapter *);
771 extern void igb_down(struct igb_adapter *);
772 extern void igb_reinit_locked(struct igb_adapter *);
773 extern void igb_reset(struct igb_adapter *);
774 extern int igb_set_spd_dplx(struct igb_adapter *, u16);
775 extern int igb_setup_tx_resources(struct igb_ring *);
776 extern int igb_setup_rx_resources(struct igb_ring *);
777 extern void igb_free_tx_resources(struct igb_ring *);
778 extern void igb_free_rx_resources(struct igb_ring *);
779 extern void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
780 extern void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
781 extern void igb_setup_tctl(struct igb_adapter *);
782 extern void igb_setup_rctl(struct igb_adapter *);
783 extern netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
784 extern void igb_unmap_and_free_tx_resource(struct igb_ring *,
785 struct igb_tx_buffer *);
786 extern void igb_alloc_rx_buffers(struct igb_ring *, u16);
787 extern void igb_clean_rx_ring(struct igb_ring *);
788 extern void igb_update_stats(struct igb_adapter *);
789 extern bool igb_has_link(struct igb_adapter *adapter);
790 extern void igb_set_ethtool_ops(struct net_device *);
791 extern void igb_check_options(struct igb_adapter *);
792 extern void igb_power_up_link(struct igb_adapter *);
793 #ifdef HAVE_PTP_1588_CLOCK
794 extern void igb_ptp_init(struct igb_adapter *adapter);
795 extern void igb_ptp_stop(struct igb_adapter *adapter);
796 extern void igb_ptp_reset(struct igb_adapter *adapter);
797 extern void igb_ptp_tx_work(struct work_struct *work);
798 extern void igb_ptp_rx_hang(struct igb_adapter *adapter);
799 extern void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
800 extern void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
801 struct sk_buff *skb);
802 extern void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector,
804 struct sk_buff *skb);
805 static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring,
806 union e1000_adv_rx_desc *rx_desc,
809 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
810 #ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT
811 igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb);
812 skb_pull(skb, IGB_TS_HDR_LEN);
817 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TS))
818 igb_ptp_rx_rgtstamp(rx_ring->q_vector, skb);
820 /* Update the last_rx_timestamp timer in order to enable watchdog check
821 * for error case of latched timestamp on a dropped packet.
823 rx_ring->last_rx_timestamp = jiffies;
826 extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
827 struct ifreq *ifr, int cmd);
828 #endif /* HAVE_PTP_1588_CLOCK */
829 #ifdef ETHTOOL_OPS_COMPAT
830 extern int ethtool_ioctl(struct ifreq *);
832 extern int igb_write_mc_addr_list(struct net_device *netdev);
833 extern int igb_add_mac_filter(struct igb_adapter *adapter, u8 *addr, u16 queue);
834 extern int igb_del_mac_filter(struct igb_adapter *adapter, u8* addr, u16 queue);
835 extern int igb_available_rars(struct igb_adapter *adapter);
836 extern s32 igb_vlvf_set(struct igb_adapter *, u32, bool, u32);
837 extern void igb_configure_vt_default_pool(struct igb_adapter *adapter);
838 extern void igb_enable_vlan_tags(struct igb_adapter *adapter);
839 #ifndef HAVE_VLAN_RX_REGISTER
840 extern void igb_vlan_mode(struct net_device *, u32);
843 #define E1000_PCS_CFG_IGN_SD 1
846 void igb_sysfs_exit(struct igb_adapter *adapter);
847 int igb_sysfs_init(struct igb_adapter *adapter);
850 int igb_procfs_init(struct igb_adapter* adapter);
851 void igb_procfs_exit(struct igb_adapter* adapter);
852 int igb_procfs_topdir_init(void);
853 void igb_procfs_topdir_exit(void);
854 #endif /* IGB_PROCFS */
855 #endif /* IGB_HWMON */