| /******************************************************************************* |
| |
| Intel(R) Gigabit Ethernet Linux driver |
| Copyright(c) 2007-2012 Intel Corporation. |
| |
| This program is free software; you can redistribute it and/or modify it |
| under the terms and conditions of the GNU General Public License, |
| version 2, as published by the Free Software Foundation. |
| |
| This program is distributed in the hope it will be useful, but WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| more details. |
| |
| You should have received a copy of the GNU General Public License along with |
| this program; if not, write to the Free Software Foundation, Inc., |
| 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| |
| The full GNU General Public License is included in this distribution in |
| the file called "COPYING". |
| |
| Contact Information: |
| e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
| Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| |
| *******************************************************************************/ |
| |
| /* Linux PRO/1000 Ethernet Driver main header file */ |
| |
| #ifndef _IGB_H_ |
| #define _IGB_H_ |
| |
| #include <linux/kobject.h> |
| |
| #ifndef IGB_NO_LRO |
| #include <net/tcp.h> |
| #endif |
| |
| #include <linux/pci.h> |
| #include <linux/netdevice.h> |
| #include <linux/vmalloc.h> |
| |
| #ifdef SIOCETHTOOL |
| #include <linux/ethtool.h> |
| #endif |
| |
| #ifdef HAVE_HW_TIME_STAMP |
| #include <linux/clocksource.h> |
| #include <linux/timecompare.h> |
| #include <linux/net_tstamp.h> |
| |
| #endif |
| struct igb_adapter; |
| |
| #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE) |
| #define IGB_DCA |
| #endif |
| #ifdef IGB_DCA |
| #include <linux/dca.h> |
| #endif |
| |
| #ifndef HAVE_HW_TIME_STAMP |
| #undef IGB_PER_PKT_TIMESTAMP |
| #endif |
| |
| |
| #include "kcompat.h" |
| |
| #ifdef HAVE_SCTP |
| #include <linux/sctp.h> |
| #endif |
| |
| #include "e1000_api.h" |
| #include "e1000_82575.h" |
| #include "e1000_manage.h" |
| #include "e1000_mbx.h" |
| |
| #ifdef ENABLE_DNA |
| #include "../../../../kernel/linux/pf_ring.h" |
| #endif |
| |
| #define IGB_ERR(args...) printk(KERN_ERR "igb: " args) |
| |
| #define PFX "igb: " |
| #define DPRINTK(nlevel, klevel, fmt, args...) \ |
| (void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \ |
| printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \ |
| __FUNCTION__ , ## args)) |
| |
| /* Interrupt defines */ |
| #define IGB_START_ITR 648 /* ~6000 ints/sec */ |
| #define IGB_4K_ITR 980 |
| #define IGB_20K_ITR 196 |
| #define IGB_70K_ITR 56 |
| |
| /* Interrupt modes, as used by the IntMode paramter */ |
| #define IGB_INT_MODE_LEGACY 0 |
| #define IGB_INT_MODE_MSI 1 |
| #define IGB_INT_MODE_MSIX 2 |
| |
| /* TX/RX descriptor defines */ |
| #define IGB_DEFAULT_TXD 256 |
| #define IGB_DEFAULT_TX_WORK 128 |
| #define IGB_MIN_TXD 80 |
| #define IGB_MAX_TXD 4096 |
| |
| #define IGB_DEFAULT_RXD 256 |
| #define IGB_MIN_RXD 80 |
| #define IGB_MAX_RXD 4096 |
| |
| #ifdef ENABLE_DNA |
| #define DNA_IGB_DEFAULT_RXD 2048 |
| #define DNA_IGB_DEFAULT_TXD 2048 |
| #endif |
| |
| #define IGB_MIN_ITR_USECS 10 /* 100k irq/sec */ |
| #define IGB_MAX_ITR_USECS 8191 /* 120 irq/sec */ |
| |
| #define NON_Q_VECTORS 1 |
| #define MAX_Q_VECTORS 10 |
| |
| /* Transmit and receive queues */ |
| #define IGB_MAX_RX_QUEUES 16 |
| #define IGB_MAX_TX_QUEUES 16 |
| |
| #define IGB_MAX_VF_MC_ENTRIES 30 |
| #define IGB_MAX_VF_FUNCTIONS 8 |
| #define IGB_82576_VF_DEV_ID 0x10CA |
| #define IGB_I350_VF_DEV_ID 0x1520 |
| #define IGB_MAX_UTA_ENTRIES 128 |
| #define MAX_EMULATION_MAC_ADDRS 16 |
| #define OUI_LEN 3 |
| #define IGB_MAX_VMDQ_QUEUES 8 |
| |
| #define E1000_DMACDC 0x3F1C |
| |
| struct vf_data_storage { |
| unsigned char vf_mac_addresses[ETH_ALEN]; |
| u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES]; |
| u16 num_vf_mc_hashes; |
| u16 default_vf_vlan_id; |
| u16 vlans_enabled; |
| unsigned char em_mac_addresses[MAX_EMULATION_MAC_ADDRS * ETH_ALEN]; |
| u32 uta_table_copy[IGB_MAX_UTA_ENTRIES]; |
| u32 flags; |
| unsigned long last_nack; |
| #ifdef IFLA_VF_MAX |
| u16 pf_vlan; /* When set, guest VLAN config not allowed. */ |
| u16 pf_qos; |
| u16 tx_rate; |
| #endif |
| struct pci_dev *vfdev; |
| }; |
| |
| #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */ |
| #define IGB_VF_FLAG_UNI_PROMISC 0x00000002 /* VF has unicast promisc */ |
| #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004 /* VF has multicast promisc */ |
| #define IGB_VF_FLAG_PF_SET_MAC 0x00000008 /* PF has set MAC address */ |
| |
| /* RX descriptor control thresholds. |
| * PTHRESH - MAC will consider prefetch if it has fewer than this number of |
| * descriptors available in its onboard memory. |
| * Setting this to 0 disables RX descriptor prefetch. |
| * HTHRESH - MAC will only prefetch if there are at least this many descriptors |
| * available in host memory. |
| * If PTHRESH is 0, this should also be 0. |
| * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back |
| * descriptors until either it has this many to write back, or the |
| * ITR timer expires. |
| */ |
| #define IGB_RX_PTHRESH 8 |
| #define IGB_RX_HTHRESH 8 |
| #define IGB_TX_PTHRESH 8 |
| #define IGB_TX_HTHRESH 1 |
| #define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ |
| adapter->msix_entries) ? 1 : 4) |
| #define IGB_TX_WTHRESH ((hw->mac.type == e1000_82576 && \ |
| adapter->msix_entries) ? 1 : 16) |
| |
| /* this is the size past which hardware will drop packets when setting LPE=0 */ |
| #define MAXIMUM_ETHERNET_VLAN_SIZE 1522 |
| |
| /* NOTE: netdev_alloc_skb reserves 16 bytes, NET_IP_ALIGN means we |
| * reserve 2 more, and skb_shared_info adds an additional 384 more, |
| * this adds roughly 448 bytes of extra data meaning the smallest |
| * allocation we could have is 1K. |
| * i.e. RXBUFFER_512 --> size-1024 slab |
| */ |
| /* Supported Rx Buffer Sizes */ |
| #define IGB_RXBUFFER_512 512 |
| #define IGB_RXBUFFER_2048 2048 |
| #define IGB_RXBUFFER_256 256 |
| #define IGB_RXBUFFER_16384 16384 |
| #define IGB_RX_HDR_LEN IGB_RXBUFFER_512 |
| |
| |
| /* Packet Buffer allocations */ |
| #define IGB_PBA_BYTES_SHIFT 0xA |
| #define IGB_TX_HEAD_ADDR_SHIFT 7 |
| #define IGB_PBA_TX_MASK 0xFFFF0000 |
| |
| #define IGB_FC_PAUSE_TIME 0x0680 /* 858 usec */ |
| |
| /* How many Tx Descriptors do we need to call netif_wake_queue ? */ |
| #define IGB_TX_QUEUE_WAKE 32 |
| /* How many Rx Buffers do we bundle into one write to the hardware ? */ |
| #define IGB_RX_BUFFER_WRITE 16 /* Must be power of 2 */ |
| |
| #define IGB_EEPROM_APME 0x0400 |
| #ifndef ETH_TP_MDI_X |
| #define AUTO_ALL_MODES 0 |
| #endif |
| |
| #ifndef IGB_MASTER_SLAVE |
| /* Switch to override PHY master/slave setting */ |
| #define IGB_MASTER_SLAVE e1000_ms_hw_default |
| #endif |
| |
| #define IGB_MNG_VLAN_NONE -1 |
| |
| #ifndef IGB_NO_LRO |
| #define IGB_LRO_MAX 32 /*Maximum number of LRO descriptors*/ |
| struct igb_lro_stats { |
| u32 flushed; |
| u32 coal; |
| u32 recycled; |
| }; |
| |
| /* |
| * igb_lro_header - header format to be aggregated by LRO |
| * @iph: IP header without options |
| * @tcp: TCP header |
| * @ts: Optional TCP timestamp data in TCP options |
| * |
| * This structure relies on the check above that verifies that the header |
| * is IPv4 and does not contain any options. |
| */ |
| struct igb_lrohdr { |
| struct iphdr iph; |
| struct tcphdr th; |
| __be32 ts[0]; |
| }; |
| |
| struct igb_lro_list { |
| struct sk_buff_head active; |
| struct igb_lro_stats stats; |
| }; |
| |
| #endif /* IGB_NO_LRO */ |
| struct igb_cb { |
| #ifndef IGB_NO_LRO |
| union { /* Union defining head/tail partner */ |
| struct sk_buff *head; |
| struct sk_buff *tail; |
| }; |
| __be32 tsecr; /* timestamp echo response */ |
| u32 tsval; /* timestamp value in host order */ |
| u32 next_seq; /* next expected sequence number */ |
| u16 free; /* 65521 minus total size */ |
| u16 mss; /* size of data portion of packet */ |
| u16 append_cnt; /* number of skb's appended */ |
| #endif /* IGB_NO_LRO */ |
| #ifdef HAVE_VLAN_RX_REGISTER |
| u16 vid; /* VLAN tag */ |
| #endif |
| }; |
| #define IGB_CB(skb) ((struct igb_cb *)(skb)->cb) |
| |
| #define IGB_TX_FLAGS_CSUM 0x00000001 |
| #define IGB_TX_FLAGS_VLAN 0x00000002 |
| #define IGB_TX_FLAGS_TSO 0x00000004 |
| #define IGB_TX_FLAGS_IPV4 0x00000008 |
| #define IGB_TX_FLAGS_TSTAMP 0x00000010 |
| #define IGB_TX_FLAGS_VLAN_MASK 0xffff0000 |
| #define IGB_TX_FLAGS_VLAN_SHIFT 16 |
| |
| /* wrapper around a pointer to a socket buffer, |
| * so a DMA handle can be stored along with the buffer */ |
| struct igb_tx_buffer { |
| union e1000_adv_tx_desc *next_to_watch; |
| unsigned long time_stamp; |
| struct sk_buff *skb; |
| unsigned int bytecount; |
| u16 gso_segs; |
| __be16 protocol; |
| dma_addr_t dma; //DEFINE_DMA_UNMAP_ADDR(dma); /* ENABLE_DNA patch */ |
| DEFINE_DMA_UNMAP_LEN(len); |
| u32 tx_flags; |
| }; |
| |
| struct igb_rx_buffer { |
| struct sk_buff *skb; |
| dma_addr_t dma; |
| #ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT |
| struct page *page; |
| dma_addr_t page_dma; |
| u32 page_offset; |
| #endif |
| }; |
| |
| struct igb_tx_queue_stats { |
| u64 packets; |
| u64 bytes; |
| u64 restart_queue; |
| }; |
| |
| struct igb_rx_queue_stats { |
| u64 packets; |
| u64 bytes; |
| u64 drops; |
| u64 csum_err; |
| u64 alloc_failed; |
| u64 csum_good; |
| u64 rx_hdr_split; |
| u64 lli_int; |
| u64 pif_count; |
| }; |
| |
| struct igb_ring_container { |
| struct igb_ring *ring; /* pointer to linked list of rings */ |
| unsigned int total_bytes; /* total bytes processed this int */ |
| unsigned int total_packets; /* total packets processed this int */ |
| u16 work_limit; /* total work allowed per interrupt */ |
| u8 count; /* total number of rings in vector */ |
| u8 itr; /* current ITR setting for ring */ |
| }; |
| |
| struct igb_q_vector { |
| struct igb_adapter *adapter; /* backlink */ |
| int cpu; /* CPU for DCA */ |
| u32 eims_value; /* EIMS mask value */ |
| |
| struct igb_ring_container rx, tx; |
| |
| struct napi_struct napi; |
| int numa_node; |
| |
| u16 itr_val; |
| u8 set_itr; |
| void __iomem *itr_register; |
| |
| #ifndef IGB_NO_LRO |
| struct igb_lro_list *lrolist; /* LRO list for queue vector*/ |
| #endif |
| char name[IFNAMSIZ + 9]; |
| #ifndef HAVE_NETDEV_NAPI_LIST |
| struct net_device poll_dev; |
| #endif |
| } ____cacheline_internodealigned_in_smp; |
| |
| struct igb_ring { |
| struct igb_q_vector *q_vector; /* backlink to q_vector */ |
| struct net_device *netdev; /* back pointer to net_device */ |
| struct device *dev; /* device for dma mapping */ |
| union { /* array of buffer info structs */ |
| struct igb_tx_buffer *tx_buffer_info; |
| struct igb_rx_buffer *rx_buffer_info; |
| }; |
| void *desc; /* descriptor ring memory */ |
| unsigned long flags; /* ring specific flags */ |
| void __iomem *tail; /* pointer to ring tail register */ |
| |
| u16 count; /* number of desc. in the ring */ |
| u8 queue_index; /* logical index of the ring*/ |
| u8 reg_idx; /* physical index of the ring */ |
| u32 size; /* length of desc. ring in bytes */ |
| |
| /* everything past this point are written often */ |
| u16 next_to_clean ____cacheline_aligned_in_smp; |
| u16 next_to_use; |
| |
| union { |
| /* TX */ |
| struct { |
| struct igb_tx_queue_stats tx_stats; |
| }; |
| /* RX */ |
| struct { |
| struct igb_rx_queue_stats rx_stats; |
| #ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT |
| u16 rx_buffer_len; |
| #endif |
| }; |
| }; |
| #ifdef CONFIG_IGB_VMDQ_NETDEV |
| struct net_device *vmdq_netdev; |
| int vqueue_index; /* queue index for virtual netdev */ |
| #endif |
| /* Items past this point are only used during ring alloc / free */ |
| dma_addr_t dma; /* phys address of the ring */ |
| int numa_node; /* node to alloc ring memory on */ |
| |
| #ifdef ENABLE_DNA |
| struct { |
| u_int8_t queue_in_use, memory_allocated; |
| u_int tot_packet_memory, packet_slot_len, num_memory_pages, packet_num_slots, mem_order; |
| |
| union { |
| struct { |
| wait_queue_head_t packet_waitqueue; |
| u_int8_t interrupt_received; |
| u_int8_t interrupt_enabled; |
| |
| /* Pointer to the slots where packets will be hosted */ |
| unsigned long packet_memory[DNA_MAX_NUM_CHUNKS]; |
| } rx; |
| |
| struct { |
| /* Pointer to the slots where packets will be hosted */ |
| unsigned long packet_memory[DNA_MAX_NUM_CHUNKS]; |
| } tx; |
| } rx_tx; |
| } dna; |
| #endif |
| } ____cacheline_internodealigned_in_smp; |
| |
| enum e1000_ring_flags_t { |
| #ifndef HAVE_NDO_SET_FEATURES |
| IGB_RING_FLAG_RX_CSUM, |
| #endif |
| IGB_RING_FLAG_RX_SCTP_CSUM, |
| IGB_RING_FLAG_RX_LB_VLAN_BSWAP, |
| IGB_RING_FLAG_TX_CTX_IDX, |
| IGB_RING_FLAG_TX_DETECT_HANG, |
| }; |
| struct igb_mac_addr { |
| u8 addr[ETH_ALEN]; |
| u16 queue; |
| u16 state; /* bitmask */ |
| }; |
| #define IGB_MAC_STATE_DEFAULT 0x1 |
| #define IGB_MAC_STATE_MODIFIED 0x2 |
| #define IGB_MAC_STATE_IN_USE 0x4 |
| |
| #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) |
| |
| #define IGB_RX_DESC(R, i) \ |
| (&(((union e1000_adv_rx_desc *)((R)->desc))[i])) |
| #define IGB_TX_DESC(R, i) \ |
| (&(((union e1000_adv_tx_desc *)((R)->desc))[i])) |
| #define IGB_TX_CTXTDESC(R, i) \ |
| (&(((struct e1000_adv_tx_context_desc *)((R)->desc))[i])) |
| |
| #ifdef CONFIG_IGB_VMDQ_NETDEV |
| #define netdev_ring(ring) \ |
| ((ring->vmdq_netdev ? ring->vmdq_netdev : ring->netdev)) |
| #define ring_queue_index(ring) \ |
| ((ring->vmdq_netdev ? ring->vqueue_index : ring->queue_index)) |
| #else |
| #define netdev_ring(ring) (ring->netdev) |
| #define ring_queue_index(ring) (ring->queue_index) |
| #endif /* CONFIG_IGB_VMDQ_NETDEV */ |
| |
| /* igb_test_staterr - tests bits within Rx descriptor status and error fields */ |
| static inline __le32 igb_test_staterr(union e1000_adv_rx_desc *rx_desc, |
| const u32 stat_err_bits) |
| { |
| return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); |
| } |
| |
| /* igb_desc_unused - calculate if we have unused descriptors */ |
| static inline u16 igb_desc_unused(const struct igb_ring *ring) |
| { |
| u16 ntc = ring->next_to_clean; |
| u16 ntu = ring->next_to_use; |
| |
| return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; |
| } |
| |
| #ifdef CONFIG_BQL |
| static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring) |
| { |
| return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index); |
| } |
| #endif /* CONFIG_BQL */ |
| |
| // #ifdef EXT_THERMAL_SENSOR_SUPPORT |
| // #ifdef IGB_PROCFS |
| struct igb_therm_proc_data |
| { |
| struct e1000_hw *hw; |
| struct e1000_thermal_diode_data *sensor_data; |
| }; |
| |
| // #endif /* IGB_PROCFS */ |
| // #endif /* EXT_THERMAL_SENSOR_SUPPORT */ |
| |
| /* board specific private data structure */ |
| struct igb_adapter { |
| #ifdef HAVE_VLAN_RX_REGISTER |
| /* vlgrp must be first member of structure */ |
| struct vlan_group *vlgrp; |
| #else |
| unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
| #endif |
| struct net_device *netdev; |
| |
| unsigned long state; |
| unsigned int flags; |
| |
| unsigned int num_q_vectors; |
| struct msix_entry *msix_entries; |
| |
| |
| /* TX */ |
| u16 tx_work_limit; |
| u32 tx_timeout_count; |
| int num_tx_queues; |
| struct igb_ring *tx_ring[IGB_MAX_TX_QUEUES]; |
| |
| /* RX */ |
| int num_rx_queues; |
| struct igb_ring *rx_ring[IGB_MAX_RX_QUEUES]; |
| |
| struct timer_list watchdog_timer; |
| struct timer_list dma_err_timer; |
| struct timer_list phy_info_timer; |
| u16 mng_vlan_id; |
| u32 bd_number; |
| u32 wol; |
| u32 en_mng_pt; |
| u16 link_speed; |
| u16 link_duplex; |
| u8 port_num; |
| |
| /* Interrupt Throttle Rate */ |
| u32 rx_itr_setting; |
| u32 tx_itr_setting; |
| |
| struct work_struct reset_task; |
| struct work_struct watchdog_task; |
| struct work_struct dma_err_task; |
| bool fc_autoneg; |
| u8 tx_timeout_factor; |
| |
| u32 max_frame_size; |
| |
| /* OS defined structs */ |
| struct pci_dev *pdev; |
| #ifndef HAVE_NETDEV_STATS_IN_NETDEV |
| struct net_device_stats net_stats; |
| #endif |
| #ifndef IGB_NO_LRO |
| struct igb_lro_stats lro_stats; |
| #endif |
| #ifdef HAVE_HW_TIME_STAMP |
| struct cyclecounter cycles; |
| struct timecounter clock; |
| struct timecompare compare; |
| struct hwtstamp_config hwtstamp_config; |
| #endif |
| |
| /* structs defined in e1000_hw.h */ |
| struct e1000_hw hw; |
| struct e1000_hw_stats stats; |
| struct e1000_phy_info phy_info; |
| struct e1000_phy_stats phy_stats; |
| |
| #ifdef ETHTOOL_TEST |
| u32 test_icr; |
| struct igb_ring test_tx_ring; |
| struct igb_ring test_rx_ring; |
| #endif |
| |
| int msg_enable; |
| |
| struct igb_q_vector *q_vector[MAX_Q_VECTORS]; |
| u32 eims_enable_mask; |
| u32 eims_other; |
| |
| /* to not mess up cache alignment, always add to the bottom */ |
| u32 eeprom_wol; |
| |
| u32 *config_space; |
| u16 tx_ring_count; |
| u16 rx_ring_count; |
| struct vf_data_storage *vf_data; |
| #ifdef IFLA_VF_MAX |
| int vf_rate_link_speed; |
| #endif |
| u32 lli_port; |
| u32 lli_size; |
| unsigned int vfs_allocated_count; |
| /* Malicious Driver Detection flag. Valid only when SR-IOV is enabled */ |
| bool mdd; |
| int int_mode; |
| u32 rss_queues; |
| u32 vmdq_pools; |
| u16 fw_version; |
| int node; |
| u32 wvbr; |
| struct igb_mac_addr *mac_table; |
| #ifdef CONFIG_IGB_VMDQ_NETDEV |
| struct net_device *vmdq_netdev[IGB_MAX_VMDQ_QUEUES]; |
| #endif |
| int vferr_refcount; |
| int dmac; |
| u64 dmac_entries; |
| int count; |
| u32 *shadow_vfta; |
| |
| /* External Thermal Sensor support flag */ |
| bool ets; |
| #ifdef IGB_SYSFS |
| struct kobject *info_kobj; |
| struct kobject *therm_kobj[E1000_MAX_SENSORS]; |
| #else /* IGB_SYSFS */ |
| #ifdef IGB_PROCFS |
| struct proc_dir_entry *eth_dir; |
| struct proc_dir_entry *info_dir; |
| struct proc_dir_entry *therm_dir[E1000_MAX_SENSORS]; |
| struct igb_therm_proc_data therm_data[E1000_MAX_SENSORS]; |
| #endif /* IGB_PROCFS */ |
| #endif /* IGB_SYSFS */ |
| |
| #ifdef ENABLE_DNA |
| struct { |
| u_int8_t dna_enabled; |
| } dna; |
| #endif |
| }; |
| |
| #ifdef CONFIG_IGB_VMDQ_NETDEV |
| struct igb_vmdq_adapter { |
| #ifdef HAVE_VLAN_RX_REGISTER |
| /* vlgrp must be first member of structure */ |
| struct vlan_group *vlgrp; |
| #else |
| unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
| #endif |
| struct igb_adapter *real_adapter; |
| struct net_device *vnetdev; |
| struct net_device_stats net_stats; |
| struct igb_ring *tx_ring; |
| struct igb_ring *rx_ring; |
| }; |
| #endif |
| |
| |
| #define IGB_FLAG_HAS_MSI (1 << 0) |
| #define IGB_FLAG_MSI_ENABLE (1 << 1) |
| #define IGB_FLAG_DCA_ENABLED (1 << 2) |
| #define IGB_FLAG_LLI_PUSH (1 << 3) |
| #define IGB_FLAG_QUAD_PORT_A (1 << 4) |
| #define IGB_FLAG_QUEUE_PAIRS (1 << 5) |
| #define IGB_FLAG_EEE (1 << 6) |
| #define IGB_FLAG_DMAC (1 << 7) |
| #define IGB_FLAG_DETECT_BAD_DMA (1 << 8) |
| |
| #define IGB_MIN_TXPBSIZE 20408 |
| #define IGB_TX_BUF_4096 4096 |
| |
| #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coal Flush */ |
| |
| /* DMA Coalescing defines */ |
| #define IGB_DMAC_DISABLE 0 |
| #define IGB_DMAC_MIN 250 |
| #define IGB_DMAC_500 500 |
| #define IGB_DMAC_EN_DEFAULT 1000 |
| #define IGB_DMAC_2000 2000 |
| #define IGB_DMAC_3000 3000 |
| #define IGB_DMAC_4000 4000 |
| #define IGB_DMAC_5000 5000 |
| #define IGB_DMAC_6000 6000 |
| #define IGB_DMAC_7000 7000 |
| #define IGB_DMAC_8000 8000 |
| #define IGB_DMAC_9000 9000 |
| #define IGB_DMAC_MAX 10000 |
| |
| |
| #define IGB_82576_TSYNC_SHIFT 19 |
| #define IGB_82580_TSYNC_SHIFT 24 |
| #define IGB_TS_HDR_LEN 16 |
| |
| /* CEM Support */ |
| #define FW_HDR_LEN 0x4 |
| #define FW_CMD_DRV_INFO 0xDD |
| #define FW_CMD_DRV_INFO_LEN 0x5 |
| #define FW_CMD_RESERVED 0X0 |
| #define FW_RESP_SUCCESS 0x1 |
| #define FW_UNUSED_VER 0x0 |
| #define FW_MAX_RETRIES 3 |
| #define FW_STATUS_SUCCESS 0x1 |
| #define FW_FAMILY_DRV_VER 0Xffffffff |
| |
| #define IGB_MAX_LINK_TRIES 20 |
| |
| struct e1000_fw_hdr { |
| u8 cmd; |
| u8 buf_len; |
| union |
| { |
| u8 cmd_resv; |
| u8 ret_status; |
| } cmd_or_resp; |
| u8 checksum; |
| }; |
| struct e1000_fw_drv_info { |
| struct e1000_fw_hdr hdr; |
| u8 port_num; |
| u32 drv_version; |
| u16 pad; /* end spacing to ensure length is mult. of dword */ |
| u8 pad2; /* end spacing to ensure length is mult. of dword2 */ |
| }; |
| enum e1000_state_t { |
| __IGB_TESTING, |
| __IGB_RESETTING, |
| __IGB_DOWN |
| }; |
| |
| extern char igb_driver_name[]; |
| extern char igb_driver_version[]; |
| |
| extern int igb_up(struct igb_adapter *); |
| extern void igb_down(struct igb_adapter *); |
| extern void igb_reinit_locked(struct igb_adapter *); |
| extern void igb_reset(struct igb_adapter *); |
| extern int igb_set_spd_dplx(struct igb_adapter *, u16); |
| extern int igb_setup_tx_resources(struct igb_ring *); |
| extern int igb_setup_rx_resources(struct igb_ring *); |
| extern void igb_free_tx_resources(struct igb_ring *); |
| extern void igb_free_rx_resources(struct igb_ring *); |
| extern void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *); |
| extern void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *); |
| extern void igb_setup_tctl(struct igb_adapter *); |
| extern void igb_setup_rctl(struct igb_adapter *); |
| extern netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *); |
| extern void igb_unmap_and_free_tx_resource(struct igb_ring *, |
| struct igb_tx_buffer *); |
| extern void igb_alloc_rx_buffers(struct igb_ring *, u16); |
| extern void igb_clean_rx_ring(struct igb_ring *); |
| extern void igb_update_stats(struct igb_adapter *); |
| extern bool igb_has_link(struct igb_adapter *adapter); |
| extern void igb_set_ethtool_ops(struct net_device *); |
| extern void igb_check_options(struct igb_adapter *); |
| extern void igb_power_up_link(struct igb_adapter *); |
| #ifdef ETHTOOL_OPS_COMPAT |
| extern int ethtool_ioctl(struct ifreq *); |
| #endif |
| extern int igb_write_mc_addr_list(struct net_device *netdev); |
| extern int igb_add_mac_filter(struct igb_adapter *adapter, u8 *addr, u16 queue); |
| extern int igb_del_mac_filter(struct igb_adapter *adapter, u8* addr, u16 queue); |
| extern int igb_available_rars(struct igb_adapter *adapter); |
| extern s32 igb_vlvf_set(struct igb_adapter *, u32, bool, u32); |
| extern void igb_configure_vt_default_pool(struct igb_adapter *adapter); |
| extern void igb_enable_vlan_tags(struct igb_adapter *adapter); |
| #ifndef HAVE_VLAN_RX_REGISTER |
| extern void igb_vlan_mode(struct net_device *, u32); |
| #endif |
| |
| |
| #ifdef IGB_SYSFS |
| void igb_sysfs_exit(struct igb_adapter *adapter); |
| int igb_sysfs_init(struct igb_adapter *adapter); |
| #else |
| #ifdef IGB_PROCFS |
| int igb_procfs_init(struct igb_adapter* adapter); |
| void igb_procfs_exit(struct igb_adapter* adapter); |
| int igb_procfs_topdir_init(void); |
| void igb_procfs_topdir_exit(void); |
| #endif /* IGB_PROCFS */ |
| #endif /* IGB_SYSFS */ |
| #endif /* _IGB_H_ */ |