1dee1ad47SJeff Kirsher /******************************************************************************* 2dee1ad47SJeff Kirsher 3dee1ad47SJeff Kirsher Intel 10 Gigabit PCI Express Linux driver 4434c5e39SDon Skidmore Copyright(c) 1999 - 2013 Intel Corporation. 5dee1ad47SJeff Kirsher 6dee1ad47SJeff Kirsher This program is free software; you can redistribute it and/or modify it 7dee1ad47SJeff Kirsher under the terms and conditions of the GNU General Public License, 8dee1ad47SJeff Kirsher version 2, as published by the Free Software Foundation. 9dee1ad47SJeff Kirsher 10dee1ad47SJeff Kirsher This program is distributed in the hope it will be useful, but WITHOUT 11dee1ad47SJeff Kirsher ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12dee1ad47SJeff Kirsher FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13dee1ad47SJeff Kirsher more details. 14dee1ad47SJeff Kirsher 15dee1ad47SJeff Kirsher You should have received a copy of the GNU General Public License along with 16dee1ad47SJeff Kirsher this program; if not, write to the Free Software Foundation, Inc., 17dee1ad47SJeff Kirsher 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 18dee1ad47SJeff Kirsher 19dee1ad47SJeff Kirsher The full GNU General Public License is included in this distribution in 20dee1ad47SJeff Kirsher the file called "COPYING". 21dee1ad47SJeff Kirsher 22dee1ad47SJeff Kirsher Contact Information: 23b89aae71SJacob Keller Linux NICS <linux.nics@intel.com> 24dee1ad47SJeff Kirsher e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> 25dee1ad47SJeff Kirsher Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26dee1ad47SJeff Kirsher 27dee1ad47SJeff Kirsher *******************************************************************************/ 28dee1ad47SJeff Kirsher 29dee1ad47SJeff Kirsher #ifndef _IXGBE_H_ 30dee1ad47SJeff Kirsher #define _IXGBE_H_ 31dee1ad47SJeff Kirsher 32dee1ad47SJeff Kirsher #include <linux/bitops.h> 33dee1ad47SJeff Kirsher #include <linux/types.h> 34dee1ad47SJeff Kirsher #include <linux/pci.h> 35dee1ad47SJeff Kirsher #include <linux/netdevice.h> 36dee1ad47SJeff Kirsher #include <linux/cpumask.h> 37dee1ad47SJeff Kirsher #include <linux/aer.h> 38dee1ad47SJeff Kirsher #include <linux/if_vlan.h> 396cb562d6SJacob Keller #include <linux/jiffies.h> 40dee1ad47SJeff Kirsher 4174d23cc7SRichard Cochran #include <linux/timecounter.h> 423a6a4edaSJacob Keller #include <linux/net_tstamp.h> 433a6a4edaSJacob Keller #include <linux/ptp_clock_kernel.h> 443a6a4edaSJacob Keller 45dee1ad47SJeff Kirsher #include "ixgbe_type.h" 46dee1ad47SJeff Kirsher #include "ixgbe_common.h" 47dee1ad47SJeff Kirsher #include "ixgbe_dcb.h" 48dee1ad47SJeff Kirsher #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 49dee1ad47SJeff Kirsher #define IXGBE_FCOE 50dee1ad47SJeff Kirsher #include "ixgbe_fcoe.h" 51dee1ad47SJeff Kirsher #endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */ 52dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA 53dee1ad47SJeff Kirsher #include <linux/dca.h> 54dee1ad47SJeff Kirsher #endif 55dee1ad47SJeff Kirsher 56076bb0c8SEliezer Tamir #include <net/busy_poll.h> 575a85e737SEliezer Tamir 58e0d1095aSCong Wang #ifdef CONFIG_NET_RX_BUSY_POLL 59b4640030SJacob Keller #define BP_EXTENDED_STATS 607e15b90fSEliezer Tamir #endif 61dee1ad47SJeff Kirsher /* common prefix used by pr_<> macros */ 62dee1ad47SJeff Kirsher #undef pr_fmt 63dee1ad47SJeff Kirsher #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 64dee1ad47SJeff Kirsher 65dee1ad47SJeff Kirsher /* TX/RX descriptor defines */ 66dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_TXD 512 6759224555SAlexander Duyck #define IXGBE_DEFAULT_TX_WORK 256 68dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD 4096 69dee1ad47SJeff Kirsher #define IXGBE_MIN_TXD 64 70dee1ad47SJeff Kirsher 71fb44519dSAnton Blanchard #if (PAGE_SIZE < 8192) 72dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_RXD 512 73fb44519dSAnton Blanchard #else 74fb44519dSAnton Blanchard #define IXGBE_DEFAULT_RXD 128 75fb44519dSAnton Blanchard #endif 76dee1ad47SJeff Kirsher #define IXGBE_MAX_RXD 4096 77dee1ad47SJeff Kirsher #define IXGBE_MIN_RXD 64 78dee1ad47SJeff Kirsher 795b7f000fSDon Skidmore #define IXGBE_ETH_P_LLDP 0x88CC 805b7f000fSDon Skidmore 81dee1ad47SJeff Kirsher /* flow control */ 82dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTL 0x40 83dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTL 0x7FF80 84dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTH 0x600 85dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTH 0x7FFF0 86dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_FCPAUSE 0xFFFF 87dee1ad47SJeff Kirsher #define IXGBE_MIN_FCPAUSE 0 88dee1ad47SJeff Kirsher #define IXGBE_MAX_FCPAUSE 0xFFFF 89dee1ad47SJeff Kirsher 90dee1ad47SJeff Kirsher /* Supported Rx Buffer Sizes */ 91252562c2SAlexander Duyck #define IXGBE_RXBUFFER_256 256 /* Used for skb receive header */ 9209816fbeSAlexander Duyck #define IXGBE_RXBUFFER_2K 2048 9309816fbeSAlexander Duyck #define IXGBE_RXBUFFER_3K 3072 9409816fbeSAlexander Duyck #define IXGBE_RXBUFFER_4K 4096 95dee1ad47SJeff Kirsher #define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */ 96dee1ad47SJeff Kirsher 97dee1ad47SJeff Kirsher /* 98252562c2SAlexander Duyck * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN means we 99252562c2SAlexander Duyck * reserve 64 more, and skb_shared_info adds an additional 320 bytes more, 100252562c2SAlexander Duyck * this adds up to 448 bytes of extra data. 101252562c2SAlexander Duyck * 102252562c2SAlexander Duyck * Since netdev_alloc_skb now allocates a page fragment we can use a value 103252562c2SAlexander Duyck * of 256 and the resultant skb will have a truesize of 960 or less. 104dee1ad47SJeff Kirsher */ 105252562c2SAlexander Duyck #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256 106dee1ad47SJeff Kirsher 107dee1ad47SJeff Kirsher /* How many Rx Buffers do we bundle into one write to the hardware ? */ 108dee1ad47SJeff Kirsher #define IXGBE_RX_BUFFER_WRITE 16 /* Must be power of 2 */ 109dee1ad47SJeff Kirsher 110472148c3SAlexander Duyck enum ixgbe_tx_flags { 111472148c3SAlexander Duyck /* cmd_type flags */ 112472148c3SAlexander Duyck IXGBE_TX_FLAGS_HW_VLAN = 0x01, 113472148c3SAlexander Duyck IXGBE_TX_FLAGS_TSO = 0x02, 114472148c3SAlexander Duyck IXGBE_TX_FLAGS_TSTAMP = 0x04, 115472148c3SAlexander Duyck 116472148c3SAlexander Duyck /* olinfo flags */ 117472148c3SAlexander Duyck IXGBE_TX_FLAGS_CC = 0x08, 118472148c3SAlexander Duyck IXGBE_TX_FLAGS_IPV4 = 0x10, 119472148c3SAlexander Duyck IXGBE_TX_FLAGS_CSUM = 0x20, 120472148c3SAlexander Duyck 121472148c3SAlexander Duyck /* software defined flags */ 122472148c3SAlexander Duyck IXGBE_TX_FLAGS_SW_VLAN = 0x40, 123472148c3SAlexander Duyck IXGBE_TX_FLAGS_FCOE = 0x80, 124472148c3SAlexander Duyck }; 125472148c3SAlexander Duyck 126472148c3SAlexander Duyck /* VLAN info */ 127dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000 12866f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000 12966f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29 130dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_SHIFT 16 131dee1ad47SJeff Kirsher 132dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_MC_ENTRIES 30 133dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_FUNCTIONS 64 134dee1ad47SJeff Kirsher #define IXGBE_MAX_VFTA_ENTRIES 128 135dee1ad47SJeff Kirsher #define MAX_EMULATION_MAC_ADDRS 16 136dee1ad47SJeff Kirsher #define IXGBE_MAX_PF_MACVLANS 15 1371d9c0bfdSAlexander Duyck #define VMDQ_P(p) ((p) + adapter->ring_feature[RING_F_VMDQ].offset) 13883c61fa9SGreg Rose #define IXGBE_82599_VF_DEVICE_ID 0x10ED 13983c61fa9SGreg Rose #define IXGBE_X540_VF_DEVICE_ID 0x1515 140dee1ad47SJeff Kirsher 141dee1ad47SJeff Kirsher struct vf_data_storage { 142dee1ad47SJeff Kirsher unsigned char vf_mac_addresses[ETH_ALEN]; 143dee1ad47SJeff Kirsher u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES]; 144dee1ad47SJeff Kirsher u16 num_vf_mc_hashes; 145dee1ad47SJeff Kirsher u16 default_vf_vlan_id; 146dee1ad47SJeff Kirsher u16 vlans_enabled; 147dee1ad47SJeff Kirsher bool clear_to_send; 148dee1ad47SJeff Kirsher bool pf_set_mac; 149dee1ad47SJeff Kirsher u16 pf_vlan; /* When set, guest VLAN config not allowed. */ 150dee1ad47SJeff Kirsher u16 pf_qos; 151dee1ad47SJeff Kirsher u16 tx_rate; 152de4c7f65SGreg Rose u16 vlan_count; 153de4c7f65SGreg Rose u8 spoofchk_enabled; 154e65ce0d3SVlad Zolotarov bool rss_query_enabled; 15554011e4dSHiroshi Shimamoto u8 trusted; 1568443c1a4SHiroshi Shimamoto int xcast_mode; 157374c65d6SAlexander Duyck unsigned int vf_api; 158dee1ad47SJeff Kirsher }; 159dee1ad47SJeff Kirsher 1608443c1a4SHiroshi Shimamoto enum ixgbevf_xcast_modes { 1618443c1a4SHiroshi Shimamoto IXGBEVF_XCAST_MODE_NONE = 0, 1628443c1a4SHiroshi Shimamoto IXGBEVF_XCAST_MODE_MULTI, 1638443c1a4SHiroshi Shimamoto IXGBEVF_XCAST_MODE_ALLMULTI, 1648443c1a4SHiroshi Shimamoto }; 1658443c1a4SHiroshi Shimamoto 166dee1ad47SJeff Kirsher struct vf_macvlans { 167dee1ad47SJeff Kirsher struct list_head l; 168dee1ad47SJeff Kirsher int vf; 169dee1ad47SJeff Kirsher bool free; 170dee1ad47SJeff Kirsher bool is_macvlan; 171dee1ad47SJeff Kirsher u8 vf_macvlan[ETH_ALEN]; 172dee1ad47SJeff Kirsher }; 173dee1ad47SJeff Kirsher 174dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD_PWR 14 175dee1ad47SJeff Kirsher #define IXGBE_MAX_DATA_PER_TXD (1 << IXGBE_MAX_TXD_PWR) 176dee1ad47SJeff Kirsher 177dee1ad47SJeff Kirsher /* Tx Descriptors needed, worst case */ 178dee1ad47SJeff Kirsher #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD) 179990a3158SAlexander Duyck #define DESC_NEEDED (MAX_SKB_FRAGS + 4) 180dee1ad47SJeff Kirsher 181dee1ad47SJeff Kirsher /* wrapper around a pointer to a socket buffer, 182dee1ad47SJeff Kirsher * so a DMA handle can be stored along with the buffer */ 183dee1ad47SJeff Kirsher struct ixgbe_tx_buffer { 184d3d00239SAlexander Duyck union ixgbe_adv_tx_desc *next_to_watch; 185dee1ad47SJeff Kirsher unsigned long time_stamp; 186d3d00239SAlexander Duyck struct sk_buff *skb; 187fd0db0edSAlexander Duyck unsigned int bytecount; 188fd0db0edSAlexander Duyck unsigned short gso_segs; 189244e27adSAlexander Duyck __be16 protocol; 190729739b7SAlexander Duyck DEFINE_DMA_UNMAP_ADDR(dma); 191729739b7SAlexander Duyck DEFINE_DMA_UNMAP_LEN(len); 192fd0db0edSAlexander Duyck u32 tx_flags; 193dee1ad47SJeff Kirsher }; 194dee1ad47SJeff Kirsher 195dee1ad47SJeff Kirsher struct ixgbe_rx_buffer { 196dee1ad47SJeff Kirsher struct sk_buff *skb; 197dee1ad47SJeff Kirsher dma_addr_t dma; 198dee1ad47SJeff Kirsher struct page *page; 199dee1ad47SJeff Kirsher unsigned int page_offset; 200dee1ad47SJeff Kirsher }; 201dee1ad47SJeff Kirsher 202dee1ad47SJeff Kirsher struct ixgbe_queue_stats { 203dee1ad47SJeff Kirsher u64 packets; 204dee1ad47SJeff Kirsher u64 bytes; 205b4640030SJacob Keller #ifdef BP_EXTENDED_STATS 2067e15b90fSEliezer Tamir u64 yields; 2077e15b90fSEliezer Tamir u64 misses; 2087e15b90fSEliezer Tamir u64 cleaned; 209b4640030SJacob Keller #endif /* BP_EXTENDED_STATS */ 210dee1ad47SJeff Kirsher }; 211dee1ad47SJeff Kirsher 212dee1ad47SJeff Kirsher struct ixgbe_tx_queue_stats { 213dee1ad47SJeff Kirsher u64 restart_queue; 214dee1ad47SJeff Kirsher u64 tx_busy; 215dee1ad47SJeff Kirsher u64 tx_done_old; 216dee1ad47SJeff Kirsher }; 217dee1ad47SJeff Kirsher 218dee1ad47SJeff Kirsher struct ixgbe_rx_queue_stats { 219dee1ad47SJeff Kirsher u64 rsc_count; 220dee1ad47SJeff Kirsher u64 rsc_flush; 221dee1ad47SJeff Kirsher u64 non_eop_descs; 222dee1ad47SJeff Kirsher u64 alloc_rx_page_failed; 223dee1ad47SJeff Kirsher u64 alloc_rx_buff_failed; 2248a0da21bSAlexander Duyck u64 csum_err; 225dee1ad47SJeff Kirsher }; 226dee1ad47SJeff Kirsher 227f800326dSAlexander Duyck enum ixgbe_ring_state_t { 228dee1ad47SJeff Kirsher __IXGBE_TX_FDIR_INIT_DONE, 229fd786b7bSAlexander Duyck __IXGBE_TX_XPS_INIT_DONE, 230dee1ad47SJeff Kirsher __IXGBE_TX_DETECT_HANG, 231dee1ad47SJeff Kirsher __IXGBE_HANG_CHECK_ARMED, 232dee1ad47SJeff Kirsher __IXGBE_RX_RSC_ENABLED, 2338a0da21bSAlexander Duyck __IXGBE_RX_CSUM_UDP_ZERO_ERR, 23457efd44cSAlexander Duyck __IXGBE_RX_FCOE, 235dee1ad47SJeff Kirsher }; 236dee1ad47SJeff Kirsher 2372a47fa45SJohn Fastabend struct ixgbe_fwd_adapter { 2382a47fa45SJohn Fastabend unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 2392a47fa45SJohn Fastabend struct net_device *netdev; 2402a47fa45SJohn Fastabend struct ixgbe_adapter *real_adapter; 2412a47fa45SJohn Fastabend unsigned int tx_base_queue; 2422a47fa45SJohn Fastabend unsigned int rx_base_queue; 2432a47fa45SJohn Fastabend int pool; 2442a47fa45SJohn Fastabend }; 2452a47fa45SJohn Fastabend 246dee1ad47SJeff Kirsher #define check_for_tx_hang(ring) \ 247dee1ad47SJeff Kirsher test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 248dee1ad47SJeff Kirsher #define set_check_for_tx_hang(ring) \ 249dee1ad47SJeff Kirsher set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 250dee1ad47SJeff Kirsher #define clear_check_for_tx_hang(ring) \ 251dee1ad47SJeff Kirsher clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 252dee1ad47SJeff Kirsher #define ring_is_rsc_enabled(ring) \ 253dee1ad47SJeff Kirsher test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 254dee1ad47SJeff Kirsher #define set_ring_rsc_enabled(ring) \ 255dee1ad47SJeff Kirsher set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 256dee1ad47SJeff Kirsher #define clear_ring_rsc_enabled(ring) \ 257dee1ad47SJeff Kirsher clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 258dee1ad47SJeff Kirsher struct ixgbe_ring { 259efe3d3c8SAlexander Duyck struct ixgbe_ring *next; /* pointer to next ring in q_vector */ 260d3ee4294SAlexander Duyck struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */ 261dee1ad47SJeff Kirsher struct net_device *netdev; /* netdev ring belongs to */ 262d3ee4294SAlexander Duyck struct device *dev; /* device for DMA mapping */ 2632a47fa45SJohn Fastabend struct ixgbe_fwd_adapter *l2_accel_priv; 264d3ee4294SAlexander Duyck void *desc; /* descriptor ring memory */ 265dee1ad47SJeff Kirsher union { 266dee1ad47SJeff Kirsher struct ixgbe_tx_buffer *tx_buffer_info; 267dee1ad47SJeff Kirsher struct ixgbe_rx_buffer *rx_buffer_info; 268dee1ad47SJeff Kirsher }; 269dee1ad47SJeff Kirsher unsigned long state; 270dee1ad47SJeff Kirsher u8 __iomem *tail; 271d3ee4294SAlexander Duyck dma_addr_t dma; /* phys. address of descriptor ring */ 272d3ee4294SAlexander Duyck unsigned int size; /* length in bytes */ 273dee1ad47SJeff Kirsher 274dee1ad47SJeff Kirsher u16 count; /* amount of descriptors */ 275dee1ad47SJeff Kirsher 276dee1ad47SJeff Kirsher u8 queue_index; /* needed for multiqueue queue management */ 277dee1ad47SJeff Kirsher u8 reg_idx; /* holds the special value that gets 278dee1ad47SJeff Kirsher * the hardware register offset 279dee1ad47SJeff Kirsher * associated with this ring, which is 280dee1ad47SJeff Kirsher * different for DCB and RSS modes 281dee1ad47SJeff Kirsher */ 282d3ee4294SAlexander Duyck u16 next_to_use; 283d3ee4294SAlexander Duyck u16 next_to_clean; 284d3ee4294SAlexander Duyck 285f800326dSAlexander Duyck union { 286d3ee4294SAlexander Duyck u16 next_to_alloc; 287f800326dSAlexander Duyck struct { 288dee1ad47SJeff Kirsher u8 atr_sample_rate; 289dee1ad47SJeff Kirsher u8 atr_count; 290f800326dSAlexander Duyck }; 291f800326dSAlexander Duyck }; 292dee1ad47SJeff Kirsher 293dee1ad47SJeff Kirsher u8 dcb_tc; 294dee1ad47SJeff Kirsher struct ixgbe_queue_stats stats; 295dee1ad47SJeff Kirsher struct u64_stats_sync syncp; 296dee1ad47SJeff Kirsher union { 297dee1ad47SJeff Kirsher struct ixgbe_tx_queue_stats tx_stats; 298dee1ad47SJeff Kirsher struct ixgbe_rx_queue_stats rx_stats; 299dee1ad47SJeff Kirsher }; 300dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp; 301dee1ad47SJeff Kirsher 302dee1ad47SJeff Kirsher enum ixgbe_ring_f_enum { 303dee1ad47SJeff Kirsher RING_F_NONE = 0, 304dee1ad47SJeff Kirsher RING_F_VMDQ, /* SR-IOV uses the same ring feature */ 305dee1ad47SJeff Kirsher RING_F_RSS, 306dee1ad47SJeff Kirsher RING_F_FDIR, 307dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 308dee1ad47SJeff Kirsher RING_F_FCOE, 309dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 310dee1ad47SJeff Kirsher 311dee1ad47SJeff Kirsher RING_F_ARRAY_SIZE /* must be last in enum set */ 312dee1ad47SJeff Kirsher }; 313dee1ad47SJeff Kirsher 314dee1ad47SJeff Kirsher #define IXGBE_MAX_RSS_INDICES 16 3150f9b232bSDon Skidmore #define IXGBE_MAX_RSS_INDICES_X550 64 316dee1ad47SJeff Kirsher #define IXGBE_MAX_VMDQ_INDICES 64 317d3cb9869SAlexander Duyck #define IXGBE_MAX_FDIR_INDICES 63 /* based on q_vector limit */ 318dee1ad47SJeff Kirsher #define IXGBE_MAX_FCOE_INDICES 8 319d3cb9869SAlexander Duyck #define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 320d3cb9869SAlexander Duyck #define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 3212a47fa45SJohn Fastabend #define IXGBE_MAX_L2A_QUEUES 4 3222a47fa45SJohn Fastabend #define IXGBE_BAD_L2A_QUEUE 3 3232a47fa45SJohn Fastabend #define IXGBE_MAX_MACVLANS 31 3242a47fa45SJohn Fastabend #define IXGBE_MAX_DCBMACVLANS 8 3252a47fa45SJohn Fastabend 326dee1ad47SJeff Kirsher struct ixgbe_ring_feature { 327c087663eSAlexander Duyck u16 limit; /* upper limit on feature indices */ 328c087663eSAlexander Duyck u16 indices; /* current value of indices */ 329e4b317e9SAlexander Duyck u16 mask; /* Mask used for feature to ring mapping */ 330e4b317e9SAlexander Duyck u16 offset; /* offset to start of feature */ 331dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp; 332dee1ad47SJeff Kirsher 33373079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_8Q_MASK 0x78 33473079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_4Q_MASK 0x7C 33573079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_2Q_MASK 0x7E 33673079ea0SAlexander Duyck 337f800326dSAlexander Duyck /* 338f800326dSAlexander Duyck * FCoE requires that all Rx buffers be over 2200 bytes in length. Since 339f800326dSAlexander Duyck * this is twice the size of a half page we need to double the page order 340f800326dSAlexander Duyck * for FCoE enabled Rx queues. 341f800326dSAlexander Duyck */ 34209816fbeSAlexander Duyck static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring) 34309816fbeSAlexander Duyck { 34409816fbeSAlexander Duyck #ifdef IXGBE_FCOE 34509816fbeSAlexander Duyck if (test_bit(__IXGBE_RX_FCOE, &ring->state)) 34609816fbeSAlexander Duyck return (PAGE_SIZE < 8192) ? IXGBE_RXBUFFER_4K : 34709816fbeSAlexander Duyck IXGBE_RXBUFFER_3K; 34809816fbeSAlexander Duyck #endif 34909816fbeSAlexander Duyck return IXGBE_RXBUFFER_2K; 35009816fbeSAlexander Duyck } 35109816fbeSAlexander Duyck 352f800326dSAlexander Duyck static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) 353f800326dSAlexander Duyck { 35409816fbeSAlexander Duyck #ifdef IXGBE_FCOE 35509816fbeSAlexander Duyck if (test_bit(__IXGBE_RX_FCOE, &ring->state)) 35609816fbeSAlexander Duyck return (PAGE_SIZE < 8192) ? 1 : 0; 357f800326dSAlexander Duyck #endif 35809816fbeSAlexander Duyck return 0; 35909816fbeSAlexander Duyck } 360f800326dSAlexander Duyck #define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring)) 361f800326dSAlexander Duyck 362dee1ad47SJeff Kirsher struct ixgbe_ring_container { 363efe3d3c8SAlexander Duyck struct ixgbe_ring *ring; /* pointer to linked list of rings */ 364dee1ad47SJeff Kirsher unsigned int total_bytes; /* total bytes processed this int */ 365dee1ad47SJeff Kirsher unsigned int total_packets; /* total packets processed this int */ 366dee1ad47SJeff Kirsher u16 work_limit; /* total work allowed per interrupt */ 367dee1ad47SJeff Kirsher u8 count; /* total number of rings in vector */ 368dee1ad47SJeff Kirsher u8 itr; /* current ITR setting for ring */ 369dee1ad47SJeff Kirsher }; 370dee1ad47SJeff Kirsher 371a557928eSAlexander Duyck /* iterator for handling rings in ring container */ 372a557928eSAlexander Duyck #define ixgbe_for_each_ring(pos, head) \ 373a557928eSAlexander Duyck for (pos = (head).ring; pos != NULL; pos = pos->next) 374a557928eSAlexander Duyck 375dee1ad47SJeff Kirsher #define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \ 376dee1ad47SJeff Kirsher ? 8 : 1) 377dee1ad47SJeff Kirsher #define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS 378dee1ad47SJeff Kirsher 37949c7ffbeSAlexander Duyck /* MAX_Q_VECTORS of these are allocated, 380dee1ad47SJeff Kirsher * but we only use one per queue-specific vector. 381dee1ad47SJeff Kirsher */ 382dee1ad47SJeff Kirsher struct ixgbe_q_vector { 383dee1ad47SJeff Kirsher struct ixgbe_adapter *adapter; 384dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA 385dee1ad47SJeff Kirsher int cpu; /* CPU for DCA */ 386dee1ad47SJeff Kirsher #endif 387d5bf4f67SEmil Tantilov u16 v_idx; /* index of q_vector within array, also used for 388d5bf4f67SEmil Tantilov * finding the bit in EICR and friends that 389d5bf4f67SEmil Tantilov * represents the vector for this ring */ 390d5bf4f67SEmil Tantilov u16 itr; /* Interrupt throttle rate written to EITR */ 391dee1ad47SJeff Kirsher struct ixgbe_ring_container rx, tx; 392d5bf4f67SEmil Tantilov 393d5bf4f67SEmil Tantilov struct napi_struct napi; 394de88eeebSAlexander Duyck cpumask_t affinity_mask; 395de88eeebSAlexander Duyck int numa_node; 396de88eeebSAlexander Duyck struct rcu_head rcu; /* to avoid race with update stats on free */ 397dee1ad47SJeff Kirsher char name[IFNAMSIZ + 9]; 398de88eeebSAlexander Duyck 399e0d1095aSCong Wang #ifdef CONFIG_NET_RX_BUSY_POLL 400adc81090SAlexander Duyck atomic_t state; 401e0d1095aSCong Wang #endif /* CONFIG_NET_RX_BUSY_POLL */ 4025a85e737SEliezer Tamir 403de88eeebSAlexander Duyck /* for dynamic allocation of rings associated with this q_vector */ 404de88eeebSAlexander Duyck struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; 405dee1ad47SJeff Kirsher }; 406adc81090SAlexander Duyck 407e0d1095aSCong Wang #ifdef CONFIG_NET_RX_BUSY_POLL 408adc81090SAlexander Duyck enum ixgbe_qv_state_t { 409adc81090SAlexander Duyck IXGBE_QV_STATE_IDLE = 0, 410adc81090SAlexander Duyck IXGBE_QV_STATE_NAPI, 411adc81090SAlexander Duyck IXGBE_QV_STATE_POLL, 412adc81090SAlexander Duyck IXGBE_QV_STATE_DISABLE 413adc81090SAlexander Duyck }; 414adc81090SAlexander Duyck 4155a85e737SEliezer Tamir static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) 4165a85e737SEliezer Tamir { 417adc81090SAlexander Duyck /* reset state to idle */ 418adc81090SAlexander Duyck atomic_set(&q_vector->state, IXGBE_QV_STATE_IDLE); 4195a85e737SEliezer Tamir } 4205a85e737SEliezer Tamir 4215a85e737SEliezer Tamir /* called from the device poll routine to get ownership of a q_vector */ 4225a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector) 4235a85e737SEliezer Tamir { 424adc81090SAlexander Duyck int rc = atomic_cmpxchg(&q_vector->state, IXGBE_QV_STATE_IDLE, 425adc81090SAlexander Duyck IXGBE_QV_STATE_NAPI); 426b4640030SJacob Keller #ifdef BP_EXTENDED_STATS 427adc81090SAlexander Duyck if (rc != IXGBE_QV_STATE_IDLE) 4287e15b90fSEliezer Tamir q_vector->tx.ring->stats.yields++; 4297e15b90fSEliezer Tamir #endif 430adc81090SAlexander Duyck 431adc81090SAlexander Duyck return rc == IXGBE_QV_STATE_IDLE; 4325a85e737SEliezer Tamir } 4335a85e737SEliezer Tamir 4345a85e737SEliezer Tamir /* returns true is someone tried to get the qv while napi had it */ 435adc81090SAlexander Duyck static inline void ixgbe_qv_unlock_napi(struct ixgbe_q_vector *q_vector) 4365a85e737SEliezer Tamir { 437adc81090SAlexander Duyck WARN_ON(atomic_read(&q_vector->state) != IXGBE_QV_STATE_NAPI); 4385a85e737SEliezer Tamir 439adc81090SAlexander Duyck /* flush any outstanding Rx frames */ 440adc81090SAlexander Duyck if (q_vector->napi.gro_list) 441adc81090SAlexander Duyck napi_gro_flush(&q_vector->napi, false); 442adc81090SAlexander Duyck 443adc81090SAlexander Duyck /* reset state to idle */ 444adc81090SAlexander Duyck atomic_set(&q_vector->state, IXGBE_QV_STATE_IDLE); 4455a85e737SEliezer Tamir } 4465a85e737SEliezer Tamir 4475a85e737SEliezer Tamir /* called from ixgbe_low_latency_poll() */ 4485a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector) 4495a85e737SEliezer Tamir { 450adc81090SAlexander Duyck int rc = atomic_cmpxchg(&q_vector->state, IXGBE_QV_STATE_IDLE, 451adc81090SAlexander Duyck IXGBE_QV_STATE_POLL); 452b4640030SJacob Keller #ifdef BP_EXTENDED_STATS 453adc81090SAlexander Duyck if (rc != IXGBE_QV_STATE_IDLE) 454adc81090SAlexander Duyck q_vector->tx.ring->stats.yields++; 4557e15b90fSEliezer Tamir #endif 456adc81090SAlexander Duyck return rc == IXGBE_QV_STATE_IDLE; 4575a85e737SEliezer Tamir } 4585a85e737SEliezer Tamir 4595a85e737SEliezer Tamir /* returns true if someone tried to get the qv while it was locked */ 460adc81090SAlexander Duyck static inline void ixgbe_qv_unlock_poll(struct ixgbe_q_vector *q_vector) 4615a85e737SEliezer Tamir { 462adc81090SAlexander Duyck WARN_ON(atomic_read(&q_vector->state) != IXGBE_QV_STATE_POLL); 4635a85e737SEliezer Tamir 464adc81090SAlexander Duyck /* reset state to idle */ 465adc81090SAlexander Duyck atomic_set(&q_vector->state, IXGBE_QV_STATE_IDLE); 4665a85e737SEliezer Tamir } 4675a85e737SEliezer Tamir 4685a85e737SEliezer Tamir /* true if a socket is polling, even if it did not get the lock */ 469b4640030SJacob Keller static inline bool ixgbe_qv_busy_polling(struct ixgbe_q_vector *q_vector) 4705a85e737SEliezer Tamir { 471adc81090SAlexander Duyck return atomic_read(&q_vector->state) == IXGBE_QV_STATE_POLL; 4725a85e737SEliezer Tamir } 47327d9ce4fSJacob Keller 47427d9ce4fSJacob Keller /* false if QV is currently owned */ 47527d9ce4fSJacob Keller static inline bool ixgbe_qv_disable(struct ixgbe_q_vector *q_vector) 47627d9ce4fSJacob Keller { 477adc81090SAlexander Duyck int rc = atomic_cmpxchg(&q_vector->state, IXGBE_QV_STATE_IDLE, 478adc81090SAlexander Duyck IXGBE_QV_STATE_DISABLE); 47927d9ce4fSJacob Keller 480adc81090SAlexander Duyck return rc == IXGBE_QV_STATE_IDLE; 48127d9ce4fSJacob Keller } 48227d9ce4fSJacob Keller 483e0d1095aSCong Wang #else /* CONFIG_NET_RX_BUSY_POLL */ 4845a85e737SEliezer Tamir static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) 4855a85e737SEliezer Tamir { 4865a85e737SEliezer Tamir } 4875a85e737SEliezer Tamir 4885a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector) 4895a85e737SEliezer Tamir { 4905a85e737SEliezer Tamir return true; 4915a85e737SEliezer Tamir } 4925a85e737SEliezer Tamir 4935a85e737SEliezer Tamir static inline bool ixgbe_qv_unlock_napi(struct ixgbe_q_vector *q_vector) 4945a85e737SEliezer Tamir { 4955a85e737SEliezer Tamir return false; 4965a85e737SEliezer Tamir } 4975a85e737SEliezer Tamir 4985a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector) 4995a85e737SEliezer Tamir { 5005a85e737SEliezer Tamir return false; 5015a85e737SEliezer Tamir } 5025a85e737SEliezer Tamir 5035a85e737SEliezer Tamir static inline bool ixgbe_qv_unlock_poll(struct ixgbe_q_vector *q_vector) 5045a85e737SEliezer Tamir { 5055a85e737SEliezer Tamir return false; 5065a85e737SEliezer Tamir } 5075a85e737SEliezer Tamir 508b4640030SJacob Keller static inline bool ixgbe_qv_busy_polling(struct ixgbe_q_vector *q_vector) 5095a85e737SEliezer Tamir { 5105a85e737SEliezer Tamir return false; 5115a85e737SEliezer Tamir } 51227d9ce4fSJacob Keller 51327d9ce4fSJacob Keller static inline bool ixgbe_qv_disable(struct ixgbe_q_vector *q_vector) 51427d9ce4fSJacob Keller { 51527d9ce4fSJacob Keller return true; 51627d9ce4fSJacob Keller } 51727d9ce4fSJacob Keller 518e0d1095aSCong Wang #endif /* CONFIG_NET_RX_BUSY_POLL */ 5195a85e737SEliezer Tamir 5203ca8bc6dSDon Skidmore #ifdef CONFIG_IXGBE_HWMON 5213ca8bc6dSDon Skidmore 5223ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_LOC 0 5233ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_TEMP 1 5243ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_CAUTION 2 5253ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_MAX 3 5263ca8bc6dSDon Skidmore 5273ca8bc6dSDon Skidmore struct hwmon_attr { 5283ca8bc6dSDon Skidmore struct device_attribute dev_attr; 5293ca8bc6dSDon Skidmore struct ixgbe_hw *hw; 5303ca8bc6dSDon Skidmore struct ixgbe_thermal_diode_data *sensor; 5313ca8bc6dSDon Skidmore char name[12]; 5323ca8bc6dSDon Skidmore }; 5333ca8bc6dSDon Skidmore 5343ca8bc6dSDon Skidmore struct hwmon_buff { 53503b77d81SGuenter Roeck struct attribute_group group; 53603b77d81SGuenter Roeck const struct attribute_group *groups[2]; 53703b77d81SGuenter Roeck struct attribute *attrs[IXGBE_MAX_SENSORS * 4 + 1]; 53803b77d81SGuenter Roeck struct hwmon_attr hwmon_list[IXGBE_MAX_SENSORS * 4]; 5393ca8bc6dSDon Skidmore unsigned int n_hwmon; 5403ca8bc6dSDon Skidmore }; 5413ca8bc6dSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */ 542dee1ad47SJeff Kirsher 543d5bf4f67SEmil Tantilov /* 544d5bf4f67SEmil Tantilov * microsecond values for various ITR rates shifted by 2 to fit itr register 545d5bf4f67SEmil Tantilov * with the first 3 bits reserved 0 546dee1ad47SJeff Kirsher */ 547d5bf4f67SEmil Tantilov #define IXGBE_MIN_RSC_ITR 24 548d5bf4f67SEmil Tantilov #define IXGBE_100K_ITR 40 549d5bf4f67SEmil Tantilov #define IXGBE_20K_ITR 200 5508ac34f10SAlexander Duyck #define IXGBE_12K_ITR 336 551dee1ad47SJeff Kirsher 552f56e0cb1SAlexander Duyck /* ixgbe_test_staterr - tests bits in Rx descriptor status and error fields */ 553f56e0cb1SAlexander Duyck static inline __le32 ixgbe_test_staterr(union ixgbe_adv_rx_desc *rx_desc, 554f56e0cb1SAlexander Duyck const u32 stat_err_bits) 555f56e0cb1SAlexander Duyck { 556f56e0cb1SAlexander Duyck return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); 557f56e0cb1SAlexander Duyck } 558f56e0cb1SAlexander Duyck 559dee1ad47SJeff Kirsher static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring) 560dee1ad47SJeff Kirsher { 561dee1ad47SJeff Kirsher u16 ntc = ring->next_to_clean; 562dee1ad47SJeff Kirsher u16 ntu = ring->next_to_use; 563dee1ad47SJeff Kirsher 564dee1ad47SJeff Kirsher return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; 565dee1ad47SJeff Kirsher } 566dee1ad47SJeff Kirsher 567e4f74028SAlexander Duyck #define IXGBE_RX_DESC(R, i) \ 568dee1ad47SJeff Kirsher (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) 569e4f74028SAlexander Duyck #define IXGBE_TX_DESC(R, i) \ 570dee1ad47SJeff Kirsher (&(((union ixgbe_adv_tx_desc *)((R)->desc))[i])) 571e4f74028SAlexander Duyck #define IXGBE_TX_CTXTDESC(R, i) \ 572dee1ad47SJeff Kirsher (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i])) 573dee1ad47SJeff Kirsher 574c88887e0SAlexander Duyck #define IXGBE_MAX_JUMBO_FRAME_SIZE 9728 /* Maximum Supported Size 9.5KB */ 575dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 576dee1ad47SJeff Kirsher /* Use 3K as the baby jumbo frame size for FCoE */ 577dee1ad47SJeff Kirsher #define IXGBE_FCOE_JUMBO_FRAME_SIZE 3072 578dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 579dee1ad47SJeff Kirsher 580dee1ad47SJeff Kirsher #define OTHER_VECTOR 1 581dee1ad47SJeff Kirsher #define NON_Q_VECTORS (OTHER_VECTOR) 582dee1ad47SJeff Kirsher 583dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82599 64 58449c7ffbeSAlexander Duyck #define MAX_Q_VECTORS_82599 64 585dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82598 18 58649c7ffbeSAlexander Duyck #define MAX_Q_VECTORS_82598 16 587dee1ad47SJeff Kirsher 5885d7daa35SJacob Keller struct ixgbe_mac_addr { 5895d7daa35SJacob Keller u8 addr[ETH_ALEN]; 590*c9f53e63SAlexander Duyck u16 pool; 5915d7daa35SJacob Keller u16 state; /* bitmask */ 5925d7daa35SJacob Keller }; 593*c9f53e63SAlexander Duyck 5945d7daa35SJacob Keller #define IXGBE_MAC_STATE_DEFAULT 0x1 5955d7daa35SJacob Keller #define IXGBE_MAC_STATE_MODIFIED 0x2 5965d7daa35SJacob Keller #define IXGBE_MAC_STATE_IN_USE 0x4 5975d7daa35SJacob Keller 59849c7ffbeSAlexander Duyck #define MAX_Q_VECTORS MAX_Q_VECTORS_82599 599dee1ad47SJeff Kirsher #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599 600dee1ad47SJeff Kirsher 6018f15486dSAlexander Duyck #define MIN_MSIX_Q_VECTORS 1 602dee1ad47SJeff Kirsher #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS) 603dee1ad47SJeff Kirsher 60446646e61SAlexander Duyck /* default to trying for four seconds */ 60546646e61SAlexander Duyck #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) 60658e7cd24SMark Rustad #define IXGBE_SFP_POLL_JIFFIES (2 * HZ) /* SFP poll every 2 seconds */ 60746646e61SAlexander Duyck 608dee1ad47SJeff Kirsher /* board specific private data structure */ 609dee1ad47SJeff Kirsher struct ixgbe_adapter { 61046646e61SAlexander Duyck unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 61146646e61SAlexander Duyck /* OS defined structs */ 61246646e61SAlexander Duyck struct net_device *netdev; 61346646e61SAlexander Duyck struct pci_dev *pdev; 61446646e61SAlexander Duyck 615dee1ad47SJeff Kirsher unsigned long state; 616dee1ad47SJeff Kirsher 617dee1ad47SJeff Kirsher /* Some features need tri-state capability, 618dee1ad47SJeff Kirsher * thus the additional *_CAPABLE flags. 619dee1ad47SJeff Kirsher */ 620dee1ad47SJeff Kirsher u32 flags; 621a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 1) 622a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 3) 623a16a0d2fSAlexander Duyck #define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 4) 624a16a0d2fSAlexander Duyck #define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 5) 625a16a0d2fSAlexander Duyck #define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 6) 626a16a0d2fSAlexander Duyck #define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 8) 627a16a0d2fSAlexander Duyck #define IXGBE_FLAG_DCA_CAPABLE (u32)(1 << 9) 628a16a0d2fSAlexander Duyck #define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 10) 629a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MQ_CAPABLE (u32)(1 << 11) 630a16a0d2fSAlexander Duyck #define IXGBE_FLAG_DCB_ENABLED (u32)(1 << 12) 631a16a0d2fSAlexander Duyck #define IXGBE_FLAG_VMDQ_CAPABLE (u32)(1 << 13) 632a16a0d2fSAlexander Duyck #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 14) 633a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FAN_FAIL_CAPABLE (u32)(1 << 15) 634a16a0d2fSAlexander Duyck #define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 16) 635a16a0d2fSAlexander Duyck #define IXGBE_FLAG_NEED_LINK_CONFIG (u32)(1 << 17) 636a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 18) 637a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 19) 638a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 20) 639a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 21) 640a16a0d2fSAlexander Duyck #define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 22) 641a16a0d2fSAlexander Duyck #define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 23) 64267359c3cSMark Rustad #define IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE BIT(24) 643dee1ad47SJeff Kirsher 644dee1ad47SJeff Kirsher u32 flags2; 645a16a0d2fSAlexander Duyck #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1 << 0) 646dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RSC_ENABLED (u32)(1 << 1) 647dee1ad47SJeff Kirsher #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE (u32)(1 << 2) 648dee1ad47SJeff Kirsher #define IXGBE_FLAG2_TEMP_SENSOR_EVENT (u32)(1 << 3) 649dee1ad47SJeff Kirsher #define IXGBE_FLAG2_SEARCH_FOR_SFP (u32)(1 << 4) 650dee1ad47SJeff Kirsher #define IXGBE_FLAG2_SFP_NEEDS_RESET (u32)(1 << 5) 651dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RESET_REQUESTED (u32)(1 << 6) 652dee1ad47SJeff Kirsher #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT (u32)(1 << 7) 653ef6afc0cSAlexander Duyck #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP (u32)(1 << 8) 654ef6afc0cSAlexander Duyck #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP (u32)(1 << 9) 6558fecf67cSJacob Keller #define IXGBE_FLAG2_PTP_PPS_ENABLED (u32)(1 << 10) 656597f22d6SDon Skidmore #define IXGBE_FLAG2_PHY_INTERRUPT (u32)(1 << 11) 65767359c3cSMark Rustad #ifdef CONFIG_IXGBE_VXLAN 65867359c3cSMark Rustad #define IXGBE_FLAG2_VXLAN_REREG_NEEDED BIT(12) 65967359c3cSMark Rustad #endif 66046646e61SAlexander Duyck 66146646e61SAlexander Duyck /* Tx fast path data */ 66246646e61SAlexander Duyck int num_tx_queues; 66346646e61SAlexander Duyck u16 tx_itr_setting; 66446646e61SAlexander Duyck u16 tx_work_limit; 66546646e61SAlexander Duyck 66646646e61SAlexander Duyck /* Rx fast path data */ 66746646e61SAlexander Duyck int num_rx_queues; 66846646e61SAlexander Duyck u16 rx_itr_setting; 66946646e61SAlexander Duyck 67046646e61SAlexander Duyck /* TX */ 67146646e61SAlexander Duyck struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp; 67246646e61SAlexander Duyck 67346646e61SAlexander Duyck u64 restart_queue; 67446646e61SAlexander Duyck u64 lsc_int; 67546646e61SAlexander Duyck u32 tx_timeout_count; 67646646e61SAlexander Duyck 67746646e61SAlexander Duyck /* RX */ 67846646e61SAlexander Duyck struct ixgbe_ring *rx_ring[MAX_RX_QUEUES]; 67946646e61SAlexander Duyck int num_rx_pools; /* == num_rx_queues in 82598 */ 68046646e61SAlexander Duyck int num_rx_queues_per_pool; /* 1 if 82598, can be many if 82599 */ 68146646e61SAlexander Duyck u64 hw_csum_rx_error; 68246646e61SAlexander Duyck u64 hw_rx_no_dma_resources; 68346646e61SAlexander Duyck u64 rsc_total_count; 68446646e61SAlexander Duyck u64 rsc_total_flush; 68546646e61SAlexander Duyck u64 non_eop_descs; 68646646e61SAlexander Duyck u32 alloc_rx_page_failed; 68746646e61SAlexander Duyck u32 alloc_rx_buff_failed; 68846646e61SAlexander Duyck 68949c7ffbeSAlexander Duyck struct ixgbe_q_vector *q_vector[MAX_Q_VECTORS]; 690dee1ad47SJeff Kirsher 691dee1ad47SJeff Kirsher /* DCB parameters */ 692dee1ad47SJeff Kirsher struct ieee_pfc *ixgbe_ieee_pfc; 693dee1ad47SJeff Kirsher struct ieee_ets *ixgbe_ieee_ets; 694dee1ad47SJeff Kirsher struct ixgbe_dcb_config dcb_cfg; 695dee1ad47SJeff Kirsher struct ixgbe_dcb_config temp_dcb_cfg; 696dee1ad47SJeff Kirsher u8 dcb_set_bitmap; 697dee1ad47SJeff Kirsher u8 dcbx_cap; 698dee1ad47SJeff Kirsher enum ixgbe_fc_mode last_lfc_mode; 699dee1ad47SJeff Kirsher 70049c7ffbeSAlexander Duyck int num_q_vectors; /* current number of q_vectors for device */ 70149c7ffbeSAlexander Duyck int max_q_vectors; /* true count of q_vectors for device */ 702dee1ad47SJeff Kirsher struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE]; 703dee1ad47SJeff Kirsher struct msix_entry *msix_entries; 704dee1ad47SJeff Kirsher 705dee1ad47SJeff Kirsher u32 test_icr; 706dee1ad47SJeff Kirsher struct ixgbe_ring test_tx_ring; 707dee1ad47SJeff Kirsher struct ixgbe_ring test_rx_ring; 708dee1ad47SJeff Kirsher 709dee1ad47SJeff Kirsher /* structs defined in ixgbe_hw.h */ 710dee1ad47SJeff Kirsher struct ixgbe_hw hw; 711dee1ad47SJeff Kirsher u16 msg_enable; 712dee1ad47SJeff Kirsher struct ixgbe_hw_stats stats; 713dee1ad47SJeff Kirsher 714dee1ad47SJeff Kirsher u64 tx_busy; 715dee1ad47SJeff Kirsher unsigned int tx_ring_count; 716dee1ad47SJeff Kirsher unsigned int rx_ring_count; 717dee1ad47SJeff Kirsher 718dee1ad47SJeff Kirsher u32 link_speed; 719dee1ad47SJeff Kirsher bool link_up; 72058e7cd24SMark Rustad unsigned long sfp_poll_time; 721dee1ad47SJeff Kirsher unsigned long link_check_timeout; 722dee1ad47SJeff Kirsher 723dee1ad47SJeff Kirsher struct timer_list service_timer; 72446646e61SAlexander Duyck struct work_struct service_task; 72546646e61SAlexander Duyck 72646646e61SAlexander Duyck struct hlist_head fdir_filter_list; 72746646e61SAlexander Duyck unsigned long fdir_overflow; /* number of times ATR was backed off */ 72846646e61SAlexander Duyck union ixgbe_atr_input fdir_mask; 72946646e61SAlexander Duyck int fdir_filter_count; 730dee1ad47SJeff Kirsher u32 fdir_pballoc; 731dee1ad47SJeff Kirsher u32 atr_sample_rate; 732dee1ad47SJeff Kirsher spinlock_t fdir_perfect_lock; 73346646e61SAlexander Duyck 734dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 735dee1ad47SJeff Kirsher struct ixgbe_fcoe fcoe; 736dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 7372a1a091cSMark Rustad u8 __iomem *io_addr; /* Mainly for iounmap use */ 738dee1ad47SJeff Kirsher u32 wol; 73946646e61SAlexander Duyck 740aa2bacb6SDon Skidmore u16 bridge_mode; 741aa2bacb6SDon Skidmore 74215e5209fSEmil Tantilov u16 eeprom_verh; 74315e5209fSEmil Tantilov u16 eeprom_verl; 744c23f5b6bSEmil Tantilov u16 eeprom_cap; 745dee1ad47SJeff Kirsher 746dee1ad47SJeff Kirsher u32 interrupt_event; 74746646e61SAlexander Duyck u32 led_reg; 748dee1ad47SJeff Kirsher 7493a6a4edaSJacob Keller struct ptp_clock *ptp_clock; 7503a6a4edaSJacob Keller struct ptp_clock_info ptp_caps; 751891dc082SJacob Keller struct work_struct ptp_tx_work; 752891dc082SJacob Keller struct sk_buff *ptp_tx_skb; 75393501d48SJacob Keller struct hwtstamp_config tstamp_config; 754891dc082SJacob Keller unsigned long ptp_tx_start; 7553a6a4edaSJacob Keller unsigned long last_overflow_check; 7566cb562d6SJacob Keller unsigned long last_rx_ptp_check; 757eda183c2SJakub Kicinski unsigned long last_rx_timestamp; 7583a6a4edaSJacob Keller spinlock_t tmreg_lock; 7593a6a4edaSJacob Keller struct cyclecounter cc; 7603a6a4edaSJacob Keller struct timecounter tc; 7613a6a4edaSJacob Keller u32 base_incval; 7623a6a4edaSJacob Keller 763dee1ad47SJeff Kirsher /* SR-IOV */ 764dee1ad47SJeff Kirsher DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); 765dee1ad47SJeff Kirsher unsigned int num_vfs; 766dee1ad47SJeff Kirsher struct vf_data_storage *vfinfo; 767dee1ad47SJeff Kirsher int vf_rate_link_speed; 768dee1ad47SJeff Kirsher struct vf_macvlans vf_mvs; 769dee1ad47SJeff Kirsher struct vf_macvlans *mv_list; 770dee1ad47SJeff Kirsher 77183c61fa9SGreg Rose u32 timer_event_accumulator; 77283c61fa9SGreg Rose u32 vferr_refcount; 7735d7daa35SJacob Keller struct ixgbe_mac_addr *mac_table; 77467359c3cSMark Rustad #ifdef CONFIG_IXGBE_VXLAN 7753f207800SDon Skidmore u16 vxlan_port; 77667359c3cSMark Rustad #endif 7773ca8bc6dSDon Skidmore struct kobject *info_kobj; 7783ca8bc6dSDon Skidmore #ifdef CONFIG_IXGBE_HWMON 77903b77d81SGuenter Roeck struct hwmon_buff *ixgbe_hwmon_buff; 7803ca8bc6dSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */ 78100949167SCatherine Sullivan #ifdef CONFIG_DEBUG_FS 78200949167SCatherine Sullivan struct dentry *ixgbe_dbg_adapter; 78300949167SCatherine Sullivan #endif /*CONFIG_DEBUG_FS*/ 784107d3018SAlexander Duyck 785107d3018SAlexander Duyck u8 default_up; 7862a47fa45SJohn Fastabend unsigned long fwd_bitmask; /* Bitmask indicating in use pools */ 787dfaf891dSVlad Zolotarov 788dfaf891dSVlad Zolotarov /* maximum number of RETA entries among all devices supported by ixgbe 789dfaf891dSVlad Zolotarov * driver: currently it's x550 device in non-SRIOV mode 790dfaf891dSVlad Zolotarov */ 791dfaf891dSVlad Zolotarov #define IXGBE_MAX_RETA_ENTRIES 512 792dfaf891dSVlad Zolotarov u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES]; 793dfaf891dSVlad Zolotarov 794dfaf891dSVlad Zolotarov #define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ 795dfaf891dSVlad Zolotarov u32 rss_key[IXGBE_RSS_KEY_SIZE / sizeof(u32)]; 796dee1ad47SJeff Kirsher }; 797dee1ad47SJeff Kirsher 7980f9b232bSDon Skidmore static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter) 7990f9b232bSDon Skidmore { 8000f9b232bSDon Skidmore switch (adapter->hw.mac.type) { 8010f9b232bSDon Skidmore case ixgbe_mac_82598EB: 8020f9b232bSDon Skidmore case ixgbe_mac_82599EB: 8030f9b232bSDon Skidmore case ixgbe_mac_X540: 8040f9b232bSDon Skidmore return IXGBE_MAX_RSS_INDICES; 8050f9b232bSDon Skidmore case ixgbe_mac_X550: 8060f9b232bSDon Skidmore case ixgbe_mac_X550EM_x: 8070f9b232bSDon Skidmore return IXGBE_MAX_RSS_INDICES_X550; 8080f9b232bSDon Skidmore default: 8090f9b232bSDon Skidmore return 0; 8100f9b232bSDon Skidmore } 8110f9b232bSDon Skidmore } 8120f9b232bSDon Skidmore 813dee1ad47SJeff Kirsher struct ixgbe_fdir_filter { 814dee1ad47SJeff Kirsher struct hlist_node fdir_node; 815dee1ad47SJeff Kirsher union ixgbe_atr_input filter; 816dee1ad47SJeff Kirsher u16 sw_idx; 817dee1ad47SJeff Kirsher u16 action; 818dee1ad47SJeff Kirsher }; 819dee1ad47SJeff Kirsher 82070e5576cSDon Skidmore enum ixgbe_state_t { 821dee1ad47SJeff Kirsher __IXGBE_TESTING, 822dee1ad47SJeff Kirsher __IXGBE_RESETTING, 823dee1ad47SJeff Kirsher __IXGBE_DOWN, 82441c62843SMark Rustad __IXGBE_DISABLED, 82509f40aedSMark Rustad __IXGBE_REMOVING, 826dee1ad47SJeff Kirsher __IXGBE_SERVICE_SCHED, 82758cf663fSMark Rustad __IXGBE_SERVICE_INITED, 828dee1ad47SJeff Kirsher __IXGBE_IN_SFP_INIT, 8298fecf67cSJacob Keller __IXGBE_PTP_RUNNING, 830151b260cSJakub Kicinski __IXGBE_PTP_TX_IN_PROGRESS, 831dee1ad47SJeff Kirsher }; 832dee1ad47SJeff Kirsher 8334c1975d7SAlexander Duyck struct ixgbe_cb { 8344c1975d7SAlexander Duyck union { /* Union defining head/tail partner */ 8354c1975d7SAlexander Duyck struct sk_buff *head; 8364c1975d7SAlexander Duyck struct sk_buff *tail; 8374c1975d7SAlexander Duyck }; 838dee1ad47SJeff Kirsher dma_addr_t dma; 8394c1975d7SAlexander Duyck u16 append_cnt; 840f800326dSAlexander Duyck bool page_released; 841dee1ad47SJeff Kirsher }; 8424c1975d7SAlexander Duyck #define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb) 843dee1ad47SJeff Kirsher 844dee1ad47SJeff Kirsher enum ixgbe_boards { 845dee1ad47SJeff Kirsher board_82598, 846dee1ad47SJeff Kirsher board_82599, 847dee1ad47SJeff Kirsher board_X540, 8486a14ee0cSDon Skidmore board_X550, 8496a14ee0cSDon Skidmore board_X550EM_x, 850dee1ad47SJeff Kirsher }; 851dee1ad47SJeff Kirsher 852dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_82598_info; 853dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_82599_info; 854dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_X540_info; 8556a14ee0cSDon Skidmore extern struct ixgbe_info ixgbe_X550_info; 8566a14ee0cSDon Skidmore extern struct ixgbe_info ixgbe_X550EM_x_info; 857dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB 858dee1ad47SJeff Kirsher extern const struct dcbnl_rtnl_ops dcbnl_ops; 859dee1ad47SJeff Kirsher #endif 860dee1ad47SJeff Kirsher 861dee1ad47SJeff Kirsher extern char ixgbe_driver_name[]; 862dee1ad47SJeff Kirsher extern const char ixgbe_driver_version[]; 8638af3c33fSJeff Kirsher #ifdef IXGBE_FCOE 864ea81875aSNeerav Parikh extern char ixgbe_default_device_descr[]; 8658af3c33fSJeff Kirsher #endif /* IXGBE_FCOE */ 866dee1ad47SJeff Kirsher 8675ccc921aSJoe Perches void ixgbe_up(struct ixgbe_adapter *adapter); 8685ccc921aSJoe Perches void ixgbe_down(struct ixgbe_adapter *adapter); 8695ccc921aSJoe Perches void ixgbe_reinit_locked(struct ixgbe_adapter *adapter); 8705ccc921aSJoe Perches void ixgbe_reset(struct ixgbe_adapter *adapter); 8715ccc921aSJoe Perches void ixgbe_set_ethtool_ops(struct net_device *netdev); 8725ccc921aSJoe Perches int ixgbe_setup_rx_resources(struct ixgbe_ring *); 8735ccc921aSJoe Perches int ixgbe_setup_tx_resources(struct ixgbe_ring *); 8745ccc921aSJoe Perches void ixgbe_free_rx_resources(struct ixgbe_ring *); 8755ccc921aSJoe Perches void ixgbe_free_tx_resources(struct ixgbe_ring *); 8765ccc921aSJoe Perches void ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); 8775ccc921aSJoe Perches void ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); 8785ccc921aSJoe Perches void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_ring *); 8795ccc921aSJoe Perches void ixgbe_update_stats(struct ixgbe_adapter *adapter); 8805ccc921aSJoe Perches int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); 8815ccc921aSJoe Perches int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, 8828e2813f5SJacob Keller u16 subdevice_id); 8835d7daa35SJacob Keller #ifdef CONFIG_PCI_IOV 8845d7daa35SJacob Keller void ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter); 8855d7daa35SJacob Keller #endif 8865d7daa35SJacob Keller int ixgbe_add_mac_filter(struct ixgbe_adapter *adapter, 887*c9f53e63SAlexander Duyck const u8 *addr, u16 queue); 8885d7daa35SJacob Keller int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, 889*c9f53e63SAlexander Duyck const u8 *addr, u16 queue); 8905ccc921aSJoe Perches void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); 8915ccc921aSJoe Perches netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, struct ixgbe_adapter *, 892dee1ad47SJeff Kirsher struct ixgbe_ring *); 8935ccc921aSJoe Perches void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *, 894dee1ad47SJeff Kirsher struct ixgbe_tx_buffer *); 8955ccc921aSJoe Perches void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16); 8965ccc921aSJoe Perches void ixgbe_write_eitr(struct ixgbe_q_vector *); 8975ccc921aSJoe Perches int ixgbe_poll(struct napi_struct *napi, int budget); 8985ccc921aSJoe Perches int ethtool_ioctl(struct ifreq *ifr); 8995ccc921aSJoe Perches s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw); 9005ccc921aSJoe Perches s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl); 9015ccc921aSJoe Perches s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl); 9025ccc921aSJoe Perches s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, 903dee1ad47SJeff Kirsher union ixgbe_atr_hash_dword input, 904dee1ad47SJeff Kirsher union ixgbe_atr_hash_dword common, 905dee1ad47SJeff Kirsher u8 queue); 9065ccc921aSJoe Perches s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, 907dee1ad47SJeff Kirsher union ixgbe_atr_input *input_mask); 9085ccc921aSJoe Perches s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, 909dee1ad47SJeff Kirsher union ixgbe_atr_input *input, 910dee1ad47SJeff Kirsher u16 soft_id, u8 queue); 9115ccc921aSJoe Perches s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, 912dee1ad47SJeff Kirsher union ixgbe_atr_input *input, 913dee1ad47SJeff Kirsher u16 soft_id); 9145ccc921aSJoe Perches void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, 915dee1ad47SJeff Kirsher union ixgbe_atr_input *mask); 9165ccc921aSJoe Perches void ixgbe_set_rx_mode(struct net_device *netdev); 9178af3c33fSJeff Kirsher #ifdef CONFIG_IXGBE_DCB 9185ccc921aSJoe Perches void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter); 9198af3c33fSJeff Kirsher #endif 9205ccc921aSJoe Perches int ixgbe_setup_tc(struct net_device *dev, u8 tc); 9215ccc921aSJoe Perches void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); 9225ccc921aSJoe Perches void ixgbe_do_reset(struct net_device *netdev); 9231210982bSDon Skidmore #ifdef CONFIG_IXGBE_HWMON 9245ccc921aSJoe Perches void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); 9255ccc921aSJoe Perches int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); 9261210982bSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */ 927dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 9285ccc921aSJoe Perches void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); 9295ccc921aSJoe Perches int ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first, 930244e27adSAlexander Duyck u8 *hdr_len); 9315ccc921aSJoe Perches int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, 9325ccc921aSJoe Perches union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb); 9335ccc921aSJoe Perches int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, 934dee1ad47SJeff Kirsher struct scatterlist *sgl, unsigned int sgc); 9355ccc921aSJoe Perches int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid, 936dee1ad47SJeff Kirsher struct scatterlist *sgl, unsigned int sgc); 9375ccc921aSJoe Perches int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); 9385ccc921aSJoe Perches int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter); 9395ccc921aSJoe Perches void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter); 9405ccc921aSJoe Perches int ixgbe_fcoe_enable(struct net_device *netdev); 9415ccc921aSJoe Perches int ixgbe_fcoe_disable(struct net_device *netdev); 942dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB 9435ccc921aSJoe Perches u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter); 9445ccc921aSJoe Perches u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); 945dee1ad47SJeff Kirsher #endif /* CONFIG_IXGBE_DCB */ 9465ccc921aSJoe Perches int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); 9475ccc921aSJoe Perches int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, 948ea81875aSNeerav Parikh struct netdev_fcoe_hbainfo *info); 9495ccc921aSJoe Perches u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter); 950dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 95100949167SCatherine Sullivan #ifdef CONFIG_DEBUG_FS 9525ccc921aSJoe Perches void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter); 9535ccc921aSJoe Perches void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter); 9545ccc921aSJoe Perches void ixgbe_dbg_init(void); 9555ccc921aSJoe Perches void ixgbe_dbg_exit(void); 95633243fb0SJoe Perches #else 95733243fb0SJoe Perches static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {} 95833243fb0SJoe Perches static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {} 95933243fb0SJoe Perches static inline void ixgbe_dbg_init(void) {} 96033243fb0SJoe Perches static inline void ixgbe_dbg_exit(void) {} 96100949167SCatherine Sullivan #endif /* CONFIG_DEBUG_FS */ 962b2d96e0aSAlexander Duyck static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) 963b2d96e0aSAlexander Duyck { 964b2d96e0aSAlexander Duyck return netdev_get_tx_queue(ring->netdev, ring->queue_index); 965b2d96e0aSAlexander Duyck } 966b2d96e0aSAlexander Duyck 9675ccc921aSJoe Perches void ixgbe_ptp_init(struct ixgbe_adapter *adapter); 9689966d1eeSJacob Keller void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter); 9695ccc921aSJoe Perches void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); 9705ccc921aSJoe Perches void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); 9715ccc921aSJoe Perches void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); 972eda183c2SJakub Kicinski void ixgbe_ptp_rx_hwtstamp(struct ixgbe_adapter *adapter, struct sk_buff *skb); 97393501d48SJacob Keller int ixgbe_ptp_set_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr); 97493501d48SJacob Keller int ixgbe_ptp_get_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr); 9755ccc921aSJoe Perches void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); 9765ccc921aSJoe Perches void ixgbe_ptp_reset(struct ixgbe_adapter *adapter); 9775ccc921aSJoe Perches void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr); 978da36b647SGreg Rose #ifdef CONFIG_PCI_IOV 979da36b647SGreg Rose void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter); 980da36b647SGreg Rose #endif 9813a6a4edaSJacob Keller 9822a47fa45SJohn Fastabend netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, 9832a47fa45SJohn Fastabend struct ixgbe_adapter *adapter, 9842a47fa45SJohn Fastabend struct ixgbe_ring *tx_ring); 9857f276efbSVlad Zolotarov u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter); 9861c7cf078STom Barbette void ixgbe_store_reta(struct ixgbe_adapter *adapter); 987dee1ad47SJeff Kirsher #endif /* _IXGBE_H_ */ 988