1dee1ad47SJeff Kirsher /******************************************************************************* 2dee1ad47SJeff Kirsher 3dee1ad47SJeff Kirsher Intel 10 Gigabit PCI Express Linux driver 437689010SMark Rustad Copyright(c) 1999 - 2016 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" 48ee58c114SJavier Martinez Canillas #if IS_ENABLED(CONFIG_FCOE) 49dee1ad47SJeff Kirsher #define IXGBE_FCOE 50dee1ad47SJeff Kirsher #include "ixgbe_fcoe.h" 51ee58c114SJavier Martinez Canillas #endif /* IS_ENABLED(CONFIG_FCOE) */ 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 58dee1ad47SJeff Kirsher /* common prefix used by pr_<> macros */ 59dee1ad47SJeff Kirsher #undef pr_fmt 60dee1ad47SJeff Kirsher #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 61dee1ad47SJeff Kirsher 62dee1ad47SJeff Kirsher /* TX/RX descriptor defines */ 63dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_TXD 512 6459224555SAlexander Duyck #define IXGBE_DEFAULT_TX_WORK 256 65dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD 4096 66dee1ad47SJeff Kirsher #define IXGBE_MIN_TXD 64 67dee1ad47SJeff Kirsher 68fb44519dSAnton Blanchard #if (PAGE_SIZE < 8192) 69dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_RXD 512 70fb44519dSAnton Blanchard #else 71fb44519dSAnton Blanchard #define IXGBE_DEFAULT_RXD 128 72fb44519dSAnton Blanchard #endif 73dee1ad47SJeff Kirsher #define IXGBE_MAX_RXD 4096 74dee1ad47SJeff Kirsher #define IXGBE_MIN_RXD 64 75dee1ad47SJeff Kirsher 765b7f000fSDon Skidmore #define IXGBE_ETH_P_LLDP 0x88CC 775b7f000fSDon Skidmore 78dee1ad47SJeff Kirsher /* flow control */ 79dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTL 0x40 80dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTL 0x7FF80 81dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTH 0x600 82dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTH 0x7FFF0 83dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_FCPAUSE 0xFFFF 84dee1ad47SJeff Kirsher #define IXGBE_MIN_FCPAUSE 0 85dee1ad47SJeff Kirsher #define IXGBE_MAX_FCPAUSE 0xFFFF 86dee1ad47SJeff Kirsher 87dee1ad47SJeff Kirsher /* Supported Rx Buffer Sizes */ 88252562c2SAlexander Duyck #define IXGBE_RXBUFFER_256 256 /* Used for skb receive header */ 89541ea69aSAlexander Duyck #define IXGBE_RXBUFFER_1536 1536 9009816fbeSAlexander Duyck #define IXGBE_RXBUFFER_2K 2048 9109816fbeSAlexander Duyck #define IXGBE_RXBUFFER_3K 3072 9209816fbeSAlexander Duyck #define IXGBE_RXBUFFER_4K 4096 93dee1ad47SJeff Kirsher #define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */ 94dee1ad47SJeff Kirsher 95541ea69aSAlexander Duyck /* Attempt to maximize the headroom available for incoming frames. We 96541ea69aSAlexander Duyck * use a 2K buffer for receives and need 1536/1534 to store the data for 97541ea69aSAlexander Duyck * the frame. This leaves us with 512 bytes of room. From that we need 98541ea69aSAlexander Duyck * to deduct the space needed for the shared info and the padding needed 99541ea69aSAlexander Duyck * to IP align the frame. 100541ea69aSAlexander Duyck * 101541ea69aSAlexander Duyck * Note: For cache line sizes 256 or larger this value is going to end 102541ea69aSAlexander Duyck * up negative. In these cases we should fall back to the 3K 103541ea69aSAlexander Duyck * buffers. 104541ea69aSAlexander Duyck */ 1052de6aa3aSAlexander Duyck #if (PAGE_SIZE < 8192) 106541ea69aSAlexander Duyck #define IXGBE_MAX_2K_FRAME_BUILD_SKB (IXGBE_RXBUFFER_1536 - NET_IP_ALIGN) 107541ea69aSAlexander Duyck #define IXGBE_2K_TOO_SMALL_WITH_PADDING \ 108541ea69aSAlexander Duyck ((NET_SKB_PAD + IXGBE_RXBUFFER_1536) > SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K)) 109541ea69aSAlexander Duyck 110541ea69aSAlexander Duyck static inline int ixgbe_compute_pad(int rx_buf_len) 111541ea69aSAlexander Duyck { 112541ea69aSAlexander Duyck int page_size, pad_size; 113541ea69aSAlexander Duyck 114541ea69aSAlexander Duyck page_size = ALIGN(rx_buf_len, PAGE_SIZE / 2); 115541ea69aSAlexander Duyck pad_size = SKB_WITH_OVERHEAD(page_size) - rx_buf_len; 116541ea69aSAlexander Duyck 117541ea69aSAlexander Duyck return pad_size; 118541ea69aSAlexander Duyck } 119541ea69aSAlexander Duyck 120541ea69aSAlexander Duyck static inline int ixgbe_skb_pad(void) 121541ea69aSAlexander Duyck { 122541ea69aSAlexander Duyck int rx_buf_len; 123541ea69aSAlexander Duyck 124541ea69aSAlexander Duyck /* If a 2K buffer cannot handle a standard Ethernet frame then 125541ea69aSAlexander Duyck * optimize padding for a 3K buffer instead of a 1.5K buffer. 126541ea69aSAlexander Duyck * 127541ea69aSAlexander Duyck * For a 3K buffer we need to add enough padding to allow for 128541ea69aSAlexander Duyck * tailroom due to NET_IP_ALIGN possibly shifting us out of 129541ea69aSAlexander Duyck * cache-line alignment. 130541ea69aSAlexander Duyck */ 131541ea69aSAlexander Duyck if (IXGBE_2K_TOO_SMALL_WITH_PADDING) 132541ea69aSAlexander Duyck rx_buf_len = IXGBE_RXBUFFER_3K + SKB_DATA_ALIGN(NET_IP_ALIGN); 133541ea69aSAlexander Duyck else 134541ea69aSAlexander Duyck rx_buf_len = IXGBE_RXBUFFER_1536; 135541ea69aSAlexander Duyck 136541ea69aSAlexander Duyck /* if needed make room for NET_IP_ALIGN */ 137541ea69aSAlexander Duyck rx_buf_len -= NET_IP_ALIGN; 138541ea69aSAlexander Duyck 139541ea69aSAlexander Duyck return ixgbe_compute_pad(rx_buf_len); 140541ea69aSAlexander Duyck } 141541ea69aSAlexander Duyck 142541ea69aSAlexander Duyck #define IXGBE_SKB_PAD ixgbe_skb_pad() 1432de6aa3aSAlexander Duyck #else 144541ea69aSAlexander Duyck #define IXGBE_SKB_PAD (NET_SKB_PAD + NET_IP_ALIGN) 1452de6aa3aSAlexander Duyck #endif 1462de6aa3aSAlexander Duyck 147dee1ad47SJeff Kirsher /* 148252562c2SAlexander Duyck * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN means we 149252562c2SAlexander Duyck * reserve 64 more, and skb_shared_info adds an additional 320 bytes more, 150252562c2SAlexander Duyck * this adds up to 448 bytes of extra data. 151252562c2SAlexander Duyck * 152252562c2SAlexander Duyck * Since netdev_alloc_skb now allocates a page fragment we can use a value 153252562c2SAlexander Duyck * of 256 and the resultant skb will have a truesize of 960 or less. 154dee1ad47SJeff Kirsher */ 155252562c2SAlexander Duyck #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256 156dee1ad47SJeff Kirsher 157dee1ad47SJeff Kirsher /* How many Rx Buffers do we bundle into one write to the hardware ? */ 158dee1ad47SJeff Kirsher #define IXGBE_RX_BUFFER_WRITE 16 /* Must be power of 2 */ 159dee1ad47SJeff Kirsher 160f3213d93SAlexander Duyck #define IXGBE_RX_DMA_ATTR \ 161f3213d93SAlexander Duyck (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING) 162f3213d93SAlexander Duyck 163472148c3SAlexander Duyck enum ixgbe_tx_flags { 164472148c3SAlexander Duyck /* cmd_type flags */ 165472148c3SAlexander Duyck IXGBE_TX_FLAGS_HW_VLAN = 0x01, 166472148c3SAlexander Duyck IXGBE_TX_FLAGS_TSO = 0x02, 167472148c3SAlexander Duyck IXGBE_TX_FLAGS_TSTAMP = 0x04, 168472148c3SAlexander Duyck 169472148c3SAlexander Duyck /* olinfo flags */ 170472148c3SAlexander Duyck IXGBE_TX_FLAGS_CC = 0x08, 171472148c3SAlexander Duyck IXGBE_TX_FLAGS_IPV4 = 0x10, 172472148c3SAlexander Duyck IXGBE_TX_FLAGS_CSUM = 0x20, 173472148c3SAlexander Duyck 174472148c3SAlexander Duyck /* software defined flags */ 175472148c3SAlexander Duyck IXGBE_TX_FLAGS_SW_VLAN = 0x40, 176472148c3SAlexander Duyck IXGBE_TX_FLAGS_FCOE = 0x80, 177472148c3SAlexander Duyck }; 178472148c3SAlexander Duyck 179472148c3SAlexander Duyck /* VLAN info */ 180dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000 18166f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000 18266f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29 183dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_SHIFT 16 184dee1ad47SJeff Kirsher 185dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_MC_ENTRIES 30 186dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_FUNCTIONS 64 187dee1ad47SJeff Kirsher #define IXGBE_MAX_VFTA_ENTRIES 128 188dee1ad47SJeff Kirsher #define MAX_EMULATION_MAC_ADDRS 16 189dee1ad47SJeff Kirsher #define IXGBE_MAX_PF_MACVLANS 15 1901d9c0bfdSAlexander Duyck #define VMDQ_P(p) ((p) + adapter->ring_feature[RING_F_VMDQ].offset) 19183c61fa9SGreg Rose #define IXGBE_82599_VF_DEVICE_ID 0x10ED 19283c61fa9SGreg Rose #define IXGBE_X540_VF_DEVICE_ID 0x1515 193dee1ad47SJeff Kirsher 194dee1ad47SJeff Kirsher struct vf_data_storage { 195988d1307SMark Rustad struct pci_dev *vfdev; 196dee1ad47SJeff Kirsher unsigned char vf_mac_addresses[ETH_ALEN]; 197dee1ad47SJeff Kirsher u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES]; 198dee1ad47SJeff Kirsher u16 num_vf_mc_hashes; 199dee1ad47SJeff Kirsher bool clear_to_send; 200dee1ad47SJeff Kirsher bool pf_set_mac; 201dee1ad47SJeff Kirsher u16 pf_vlan; /* When set, guest VLAN config not allowed. */ 202dee1ad47SJeff Kirsher u16 pf_qos; 203dee1ad47SJeff Kirsher u16 tx_rate; 204de4c7f65SGreg Rose u8 spoofchk_enabled; 205e65ce0d3SVlad Zolotarov bool rss_query_enabled; 20654011e4dSHiroshi Shimamoto u8 trusted; 2078443c1a4SHiroshi Shimamoto int xcast_mode; 208374c65d6SAlexander Duyck unsigned int vf_api; 209dee1ad47SJeff Kirsher }; 210dee1ad47SJeff Kirsher 2118443c1a4SHiroshi Shimamoto enum ixgbevf_xcast_modes { 2128443c1a4SHiroshi Shimamoto IXGBEVF_XCAST_MODE_NONE = 0, 2138443c1a4SHiroshi Shimamoto IXGBEVF_XCAST_MODE_MULTI, 2148443c1a4SHiroshi Shimamoto IXGBEVF_XCAST_MODE_ALLMULTI, 21507eea570SDon Skidmore IXGBEVF_XCAST_MODE_PROMISC, 2168443c1a4SHiroshi Shimamoto }; 2178443c1a4SHiroshi Shimamoto 218dee1ad47SJeff Kirsher struct vf_macvlans { 219dee1ad47SJeff Kirsher struct list_head l; 220dee1ad47SJeff Kirsher int vf; 221dee1ad47SJeff Kirsher bool free; 222dee1ad47SJeff Kirsher bool is_macvlan; 223dee1ad47SJeff Kirsher u8 vf_macvlan[ETH_ALEN]; 224dee1ad47SJeff Kirsher }; 225dee1ad47SJeff Kirsher 226dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD_PWR 14 227b4f47a48SJacob Keller #define IXGBE_MAX_DATA_PER_TXD (1u << IXGBE_MAX_TXD_PWR) 228dee1ad47SJeff Kirsher 229dee1ad47SJeff Kirsher /* Tx Descriptors needed, worst case */ 230dee1ad47SJeff Kirsher #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD) 231990a3158SAlexander Duyck #define DESC_NEEDED (MAX_SKB_FRAGS + 4) 232dee1ad47SJeff Kirsher 233dee1ad47SJeff Kirsher /* wrapper around a pointer to a socket buffer, 234dee1ad47SJeff Kirsher * so a DMA handle can be stored along with the buffer */ 235dee1ad47SJeff Kirsher struct ixgbe_tx_buffer { 236d3d00239SAlexander Duyck union ixgbe_adv_tx_desc *next_to_watch; 237dee1ad47SJeff Kirsher unsigned long time_stamp; 23833fdc82fSJohn Fastabend union { 239d3d00239SAlexander Duyck struct sk_buff *skb; 24033fdc82fSJohn Fastabend /* XDP uses address ptr on irq_clean */ 24133fdc82fSJohn Fastabend void *data; 24233fdc82fSJohn Fastabend }; 243fd0db0edSAlexander Duyck unsigned int bytecount; 244fd0db0edSAlexander Duyck unsigned short gso_segs; 245244e27adSAlexander Duyck __be16 protocol; 246729739b7SAlexander Duyck DEFINE_DMA_UNMAP_ADDR(dma); 247729739b7SAlexander Duyck DEFINE_DMA_UNMAP_LEN(len); 248fd0db0edSAlexander Duyck u32 tx_flags; 249dee1ad47SJeff Kirsher }; 250dee1ad47SJeff Kirsher 251dee1ad47SJeff Kirsher struct ixgbe_rx_buffer { 252dee1ad47SJeff Kirsher struct sk_buff *skb; 253dee1ad47SJeff Kirsher dma_addr_t dma; 254dee1ad47SJeff Kirsher struct page *page; 2551b56cf49SAlexander Duyck #if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536) 2561b56cf49SAlexander Duyck __u32 page_offset; 2571b56cf49SAlexander Duyck #else 2581b56cf49SAlexander Duyck __u16 page_offset; 2591b56cf49SAlexander Duyck #endif 2601b56cf49SAlexander Duyck __u16 pagecnt_bias; 261dee1ad47SJeff Kirsher }; 262dee1ad47SJeff Kirsher 263dee1ad47SJeff Kirsher struct ixgbe_queue_stats { 264dee1ad47SJeff Kirsher u64 packets; 265dee1ad47SJeff Kirsher u64 bytes; 266dee1ad47SJeff Kirsher }; 267dee1ad47SJeff Kirsher 268dee1ad47SJeff Kirsher struct ixgbe_tx_queue_stats { 269dee1ad47SJeff Kirsher u64 restart_queue; 270dee1ad47SJeff Kirsher u64 tx_busy; 271dee1ad47SJeff Kirsher u64 tx_done_old; 272dee1ad47SJeff Kirsher }; 273dee1ad47SJeff Kirsher 274dee1ad47SJeff Kirsher struct ixgbe_rx_queue_stats { 275dee1ad47SJeff Kirsher u64 rsc_count; 276dee1ad47SJeff Kirsher u64 rsc_flush; 277dee1ad47SJeff Kirsher u64 non_eop_descs; 278dee1ad47SJeff Kirsher u64 alloc_rx_page_failed; 279dee1ad47SJeff Kirsher u64 alloc_rx_buff_failed; 2808a0da21bSAlexander Duyck u64 csum_err; 281dee1ad47SJeff Kirsher }; 282dee1ad47SJeff Kirsher 283a9763f3cSMark Rustad #define IXGBE_TS_HDR_LEN 8 284a9763f3cSMark Rustad 285f800326dSAlexander Duyck enum ixgbe_ring_state_t { 2864f4542bfSAlexander Duyck __IXGBE_RX_3K_BUFFER, 2872de6aa3aSAlexander Duyck __IXGBE_RX_BUILD_SKB_ENABLED, 2884f4542bfSAlexander Duyck __IXGBE_RX_RSC_ENABLED, 2894f4542bfSAlexander Duyck __IXGBE_RX_CSUM_UDP_ZERO_ERR, 2904f4542bfSAlexander Duyck __IXGBE_RX_FCOE, 291dee1ad47SJeff Kirsher __IXGBE_TX_FDIR_INIT_DONE, 292fd786b7bSAlexander Duyck __IXGBE_TX_XPS_INIT_DONE, 293dee1ad47SJeff Kirsher __IXGBE_TX_DETECT_HANG, 294dee1ad47SJeff Kirsher __IXGBE_HANG_CHECK_ARMED, 29533fdc82fSJohn Fastabend __IXGBE_TX_XDP_RING, 296dee1ad47SJeff Kirsher }; 297dee1ad47SJeff Kirsher 2982de6aa3aSAlexander Duyck #define ring_uses_build_skb(ring) \ 2992de6aa3aSAlexander Duyck test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state) 3002de6aa3aSAlexander Duyck 3012a47fa45SJohn Fastabend struct ixgbe_fwd_adapter { 3022a47fa45SJohn Fastabend unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 3032a47fa45SJohn Fastabend struct net_device *netdev; 3042a47fa45SJohn Fastabend struct ixgbe_adapter *real_adapter; 3052a47fa45SJohn Fastabend unsigned int tx_base_queue; 3062a47fa45SJohn Fastabend unsigned int rx_base_queue; 3072a47fa45SJohn Fastabend int pool; 3082a47fa45SJohn Fastabend }; 3092a47fa45SJohn Fastabend 310dee1ad47SJeff Kirsher #define check_for_tx_hang(ring) \ 311dee1ad47SJeff Kirsher test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 312dee1ad47SJeff Kirsher #define set_check_for_tx_hang(ring) \ 313dee1ad47SJeff Kirsher set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 314dee1ad47SJeff Kirsher #define clear_check_for_tx_hang(ring) \ 315dee1ad47SJeff Kirsher clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 316dee1ad47SJeff Kirsher #define ring_is_rsc_enabled(ring) \ 317dee1ad47SJeff Kirsher test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 318dee1ad47SJeff Kirsher #define set_ring_rsc_enabled(ring) \ 319dee1ad47SJeff Kirsher set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 320dee1ad47SJeff Kirsher #define clear_ring_rsc_enabled(ring) \ 321dee1ad47SJeff Kirsher clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 32233fdc82fSJohn Fastabend #define ring_is_xdp(ring) \ 32333fdc82fSJohn Fastabend test_bit(__IXGBE_TX_XDP_RING, &(ring)->state) 32433fdc82fSJohn Fastabend #define set_ring_xdp(ring) \ 32533fdc82fSJohn Fastabend set_bit(__IXGBE_TX_XDP_RING, &(ring)->state) 32633fdc82fSJohn Fastabend #define clear_ring_xdp(ring) \ 32733fdc82fSJohn Fastabend clear_bit(__IXGBE_TX_XDP_RING, &(ring)->state) 328dee1ad47SJeff Kirsher struct ixgbe_ring { 329efe3d3c8SAlexander Duyck struct ixgbe_ring *next; /* pointer to next ring in q_vector */ 330d3ee4294SAlexander Duyck struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */ 331dee1ad47SJeff Kirsher struct net_device *netdev; /* netdev ring belongs to */ 33292470808SJohn Fastabend struct bpf_prog *xdp_prog; 333d3ee4294SAlexander Duyck struct device *dev; /* device for DMA mapping */ 3342a47fa45SJohn Fastabend struct ixgbe_fwd_adapter *l2_accel_priv; 335d3ee4294SAlexander Duyck void *desc; /* descriptor ring memory */ 336dee1ad47SJeff Kirsher union { 337dee1ad47SJeff Kirsher struct ixgbe_tx_buffer *tx_buffer_info; 338dee1ad47SJeff Kirsher struct ixgbe_rx_buffer *rx_buffer_info; 339dee1ad47SJeff Kirsher }; 340dee1ad47SJeff Kirsher unsigned long state; 341dee1ad47SJeff Kirsher u8 __iomem *tail; 342d3ee4294SAlexander Duyck dma_addr_t dma; /* phys. address of descriptor ring */ 343d3ee4294SAlexander Duyck unsigned int size; /* length in bytes */ 344dee1ad47SJeff Kirsher 345dee1ad47SJeff Kirsher u16 count; /* amount of descriptors */ 346dee1ad47SJeff Kirsher 347dee1ad47SJeff Kirsher u8 queue_index; /* needed for multiqueue queue management */ 348dee1ad47SJeff Kirsher u8 reg_idx; /* holds the special value that gets 349dee1ad47SJeff Kirsher * the hardware register offset 350dee1ad47SJeff Kirsher * associated with this ring, which is 351dee1ad47SJeff Kirsher * different for DCB and RSS modes 352dee1ad47SJeff Kirsher */ 353d3ee4294SAlexander Duyck u16 next_to_use; 354d3ee4294SAlexander Duyck u16 next_to_clean; 355d3ee4294SAlexander Duyck 356a9763f3cSMark Rustad unsigned long last_rx_timestamp; 357a9763f3cSMark Rustad 358f800326dSAlexander Duyck union { 359d3ee4294SAlexander Duyck u16 next_to_alloc; 360f800326dSAlexander Duyck struct { 361dee1ad47SJeff Kirsher u8 atr_sample_rate; 362dee1ad47SJeff Kirsher u8 atr_count; 363f800326dSAlexander Duyck }; 364f800326dSAlexander Duyck }; 365dee1ad47SJeff Kirsher 366dee1ad47SJeff Kirsher u8 dcb_tc; 367dee1ad47SJeff Kirsher struct ixgbe_queue_stats stats; 368dee1ad47SJeff Kirsher struct u64_stats_sync syncp; 369dee1ad47SJeff Kirsher union { 370dee1ad47SJeff Kirsher struct ixgbe_tx_queue_stats tx_stats; 371dee1ad47SJeff Kirsher struct ixgbe_rx_queue_stats rx_stats; 372dee1ad47SJeff Kirsher }; 373dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp; 374dee1ad47SJeff Kirsher 375dee1ad47SJeff Kirsher enum ixgbe_ring_f_enum { 376dee1ad47SJeff Kirsher RING_F_NONE = 0, 377dee1ad47SJeff Kirsher RING_F_VMDQ, /* SR-IOV uses the same ring feature */ 378dee1ad47SJeff Kirsher RING_F_RSS, 379dee1ad47SJeff Kirsher RING_F_FDIR, 380dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 381dee1ad47SJeff Kirsher RING_F_FCOE, 382dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 383dee1ad47SJeff Kirsher 384dee1ad47SJeff Kirsher RING_F_ARRAY_SIZE /* must be last in enum set */ 385dee1ad47SJeff Kirsher }; 386dee1ad47SJeff Kirsher 387dee1ad47SJeff Kirsher #define IXGBE_MAX_RSS_INDICES 16 388e9ee3238SEmil Tantilov #define IXGBE_MAX_RSS_INDICES_X550 63 389dee1ad47SJeff Kirsher #define IXGBE_MAX_VMDQ_INDICES 64 390d3cb9869SAlexander Duyck #define IXGBE_MAX_FDIR_INDICES 63 /* based on q_vector limit */ 391dee1ad47SJeff Kirsher #define IXGBE_MAX_FCOE_INDICES 8 392d3cb9869SAlexander Duyck #define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 393d3cb9869SAlexander Duyck #define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 39433fdc82fSJohn Fastabend #define MAX_XDP_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 3952a47fa45SJohn Fastabend #define IXGBE_MAX_L2A_QUEUES 4 3962a47fa45SJohn Fastabend #define IXGBE_BAD_L2A_QUEUE 3 3972a47fa45SJohn Fastabend #define IXGBE_MAX_MACVLANS 31 3982a47fa45SJohn Fastabend #define IXGBE_MAX_DCBMACVLANS 8 3992a47fa45SJohn Fastabend 400dee1ad47SJeff Kirsher struct ixgbe_ring_feature { 401c087663eSAlexander Duyck u16 limit; /* upper limit on feature indices */ 402c087663eSAlexander Duyck u16 indices; /* current value of indices */ 403e4b317e9SAlexander Duyck u16 mask; /* Mask used for feature to ring mapping */ 404e4b317e9SAlexander Duyck u16 offset; /* offset to start of feature */ 405dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp; 406dee1ad47SJeff Kirsher 40773079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_8Q_MASK 0x78 40873079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_4Q_MASK 0x7C 40973079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_2Q_MASK 0x7E 41073079ea0SAlexander Duyck 411f800326dSAlexander Duyck /* 412f800326dSAlexander Duyck * FCoE requires that all Rx buffers be over 2200 bytes in length. Since 413f800326dSAlexander Duyck * this is twice the size of a half page we need to double the page order 414f800326dSAlexander Duyck * for FCoE enabled Rx queues. 415f800326dSAlexander Duyck */ 41609816fbeSAlexander Duyck static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring) 41709816fbeSAlexander Duyck { 4184f4542bfSAlexander Duyck if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state)) 4194f4542bfSAlexander Duyck return IXGBE_RXBUFFER_3K; 4202de6aa3aSAlexander Duyck #if (PAGE_SIZE < 8192) 4212de6aa3aSAlexander Duyck if (ring_uses_build_skb(ring)) 422541ea69aSAlexander Duyck return IXGBE_MAX_2K_FRAME_BUILD_SKB; 4232de6aa3aSAlexander Duyck #endif 42409816fbeSAlexander Duyck return IXGBE_RXBUFFER_2K; 42509816fbeSAlexander Duyck } 42609816fbeSAlexander Duyck 427f800326dSAlexander Duyck static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) 428f800326dSAlexander Duyck { 4294f4542bfSAlexander Duyck #if (PAGE_SIZE < 8192) 4304f4542bfSAlexander Duyck if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state)) 4314f4542bfSAlexander Duyck return 1; 432f800326dSAlexander Duyck #endif 43309816fbeSAlexander Duyck return 0; 43409816fbeSAlexander Duyck } 435f800326dSAlexander Duyck #define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring)) 436f800326dSAlexander Duyck 437dee1ad47SJeff Kirsher struct ixgbe_ring_container { 438efe3d3c8SAlexander Duyck struct ixgbe_ring *ring; /* pointer to linked list of rings */ 439dee1ad47SJeff Kirsher unsigned int total_bytes; /* total bytes processed this int */ 440dee1ad47SJeff Kirsher unsigned int total_packets; /* total packets processed this int */ 441dee1ad47SJeff Kirsher u16 work_limit; /* total work allowed per interrupt */ 442dee1ad47SJeff Kirsher u8 count; /* total number of rings in vector */ 443dee1ad47SJeff Kirsher u8 itr; /* current ITR setting for ring */ 444dee1ad47SJeff Kirsher }; 445dee1ad47SJeff Kirsher 446a557928eSAlexander Duyck /* iterator for handling rings in ring container */ 447a557928eSAlexander Duyck #define ixgbe_for_each_ring(pos, head) \ 448a557928eSAlexander Duyck for (pos = (head).ring; pos != NULL; pos = pos->next) 449a557928eSAlexander Duyck 450dee1ad47SJeff Kirsher #define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \ 451dee1ad47SJeff Kirsher ? 8 : 1) 452dee1ad47SJeff Kirsher #define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS 453dee1ad47SJeff Kirsher 45449c7ffbeSAlexander Duyck /* MAX_Q_VECTORS of these are allocated, 455dee1ad47SJeff Kirsher * but we only use one per queue-specific vector. 456dee1ad47SJeff Kirsher */ 457dee1ad47SJeff Kirsher struct ixgbe_q_vector { 458dee1ad47SJeff Kirsher struct ixgbe_adapter *adapter; 459dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA 460dee1ad47SJeff Kirsher int cpu; /* CPU for DCA */ 461dee1ad47SJeff Kirsher #endif 462d5bf4f67SEmil Tantilov u16 v_idx; /* index of q_vector within array, also used for 463d5bf4f67SEmil Tantilov * finding the bit in EICR and friends that 464d5bf4f67SEmil Tantilov * represents the vector for this ring */ 465d5bf4f67SEmil Tantilov u16 itr; /* Interrupt throttle rate written to EITR */ 466dee1ad47SJeff Kirsher struct ixgbe_ring_container rx, tx; 467d5bf4f67SEmil Tantilov 468d5bf4f67SEmil Tantilov struct napi_struct napi; 469de88eeebSAlexander Duyck cpumask_t affinity_mask; 470de88eeebSAlexander Duyck int numa_node; 471de88eeebSAlexander Duyck struct rcu_head rcu; /* to avoid race with update stats on free */ 472dee1ad47SJeff Kirsher char name[IFNAMSIZ + 9]; 473de88eeebSAlexander Duyck 474de88eeebSAlexander Duyck /* for dynamic allocation of rings associated with this q_vector */ 475de88eeebSAlexander Duyck struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; 476dee1ad47SJeff Kirsher }; 477adc81090SAlexander Duyck 4783ca8bc6dSDon Skidmore #ifdef CONFIG_IXGBE_HWMON 4793ca8bc6dSDon Skidmore 4803ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_LOC 0 4813ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_TEMP 1 4823ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_CAUTION 2 4833ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_MAX 3 4843ca8bc6dSDon Skidmore 4853ca8bc6dSDon Skidmore struct hwmon_attr { 4863ca8bc6dSDon Skidmore struct device_attribute dev_attr; 4873ca8bc6dSDon Skidmore struct ixgbe_hw *hw; 4883ca8bc6dSDon Skidmore struct ixgbe_thermal_diode_data *sensor; 4893ca8bc6dSDon Skidmore char name[12]; 4903ca8bc6dSDon Skidmore }; 4913ca8bc6dSDon Skidmore 4923ca8bc6dSDon Skidmore struct hwmon_buff { 49303b77d81SGuenter Roeck struct attribute_group group; 49403b77d81SGuenter Roeck const struct attribute_group *groups[2]; 49503b77d81SGuenter Roeck struct attribute *attrs[IXGBE_MAX_SENSORS * 4 + 1]; 49603b77d81SGuenter Roeck struct hwmon_attr hwmon_list[IXGBE_MAX_SENSORS * 4]; 4973ca8bc6dSDon Skidmore unsigned int n_hwmon; 4983ca8bc6dSDon Skidmore }; 4993ca8bc6dSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */ 500dee1ad47SJeff Kirsher 501d5bf4f67SEmil Tantilov /* 502d5bf4f67SEmil Tantilov * microsecond values for various ITR rates shifted by 2 to fit itr register 503d5bf4f67SEmil Tantilov * with the first 3 bits reserved 0 504dee1ad47SJeff Kirsher */ 505d5bf4f67SEmil Tantilov #define IXGBE_MIN_RSC_ITR 24 506d5bf4f67SEmil Tantilov #define IXGBE_100K_ITR 40 507d5bf4f67SEmil Tantilov #define IXGBE_20K_ITR 200 5088ac34f10SAlexander Duyck #define IXGBE_12K_ITR 336 509dee1ad47SJeff Kirsher 510f56e0cb1SAlexander Duyck /* ixgbe_test_staterr - tests bits in Rx descriptor status and error fields */ 511f56e0cb1SAlexander Duyck static inline __le32 ixgbe_test_staterr(union ixgbe_adv_rx_desc *rx_desc, 512f56e0cb1SAlexander Duyck const u32 stat_err_bits) 513f56e0cb1SAlexander Duyck { 514f56e0cb1SAlexander Duyck return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); 515f56e0cb1SAlexander Duyck } 516f56e0cb1SAlexander Duyck 517dee1ad47SJeff Kirsher static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring) 518dee1ad47SJeff Kirsher { 519dee1ad47SJeff Kirsher u16 ntc = ring->next_to_clean; 520dee1ad47SJeff Kirsher u16 ntu = ring->next_to_use; 521dee1ad47SJeff Kirsher 522dee1ad47SJeff Kirsher return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; 523dee1ad47SJeff Kirsher } 524dee1ad47SJeff Kirsher 525e4f74028SAlexander Duyck #define IXGBE_RX_DESC(R, i) \ 526dee1ad47SJeff Kirsher (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) 527e4f74028SAlexander Duyck #define IXGBE_TX_DESC(R, i) \ 528dee1ad47SJeff Kirsher (&(((union ixgbe_adv_tx_desc *)((R)->desc))[i])) 529e4f74028SAlexander Duyck #define IXGBE_TX_CTXTDESC(R, i) \ 530dee1ad47SJeff Kirsher (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i])) 531dee1ad47SJeff Kirsher 532c88887e0SAlexander Duyck #define IXGBE_MAX_JUMBO_FRAME_SIZE 9728 /* Maximum Supported Size 9.5KB */ 533dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 534dee1ad47SJeff Kirsher /* Use 3K as the baby jumbo frame size for FCoE */ 535dee1ad47SJeff Kirsher #define IXGBE_FCOE_JUMBO_FRAME_SIZE 3072 536dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 537dee1ad47SJeff Kirsher 538dee1ad47SJeff Kirsher #define OTHER_VECTOR 1 539dee1ad47SJeff Kirsher #define NON_Q_VECTORS (OTHER_VECTOR) 540dee1ad47SJeff Kirsher 541dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82599 64 54249c7ffbeSAlexander Duyck #define MAX_Q_VECTORS_82599 64 543dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82598 18 54449c7ffbeSAlexander Duyck #define MAX_Q_VECTORS_82598 16 545dee1ad47SJeff Kirsher 5465d7daa35SJacob Keller struct ixgbe_mac_addr { 5475d7daa35SJacob Keller u8 addr[ETH_ALEN]; 548c9f53e63SAlexander Duyck u16 pool; 5495d7daa35SJacob Keller u16 state; /* bitmask */ 5505d7daa35SJacob Keller }; 551c9f53e63SAlexander Duyck 5525d7daa35SJacob Keller #define IXGBE_MAC_STATE_DEFAULT 0x1 5535d7daa35SJacob Keller #define IXGBE_MAC_STATE_MODIFIED 0x2 5545d7daa35SJacob Keller #define IXGBE_MAC_STATE_IN_USE 0x4 5555d7daa35SJacob Keller 55649c7ffbeSAlexander Duyck #define MAX_Q_VECTORS MAX_Q_VECTORS_82599 557dee1ad47SJeff Kirsher #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599 558dee1ad47SJeff Kirsher 5598f15486dSAlexander Duyck #define MIN_MSIX_Q_VECTORS 1 560dee1ad47SJeff Kirsher #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS) 561dee1ad47SJeff Kirsher 56246646e61SAlexander Duyck /* default to trying for four seconds */ 56346646e61SAlexander Duyck #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) 56458e7cd24SMark Rustad #define IXGBE_SFP_POLL_JIFFIES (2 * HZ) /* SFP poll every 2 seconds */ 56546646e61SAlexander Duyck 566dee1ad47SJeff Kirsher /* board specific private data structure */ 567dee1ad47SJeff Kirsher struct ixgbe_adapter { 56846646e61SAlexander Duyck unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 56946646e61SAlexander Duyck /* OS defined structs */ 57046646e61SAlexander Duyck struct net_device *netdev; 57192470808SJohn Fastabend struct bpf_prog *xdp_prog; 57246646e61SAlexander Duyck struct pci_dev *pdev; 57346646e61SAlexander Duyck 574dee1ad47SJeff Kirsher unsigned long state; 575dee1ad47SJeff Kirsher 576dee1ad47SJeff Kirsher /* Some features need tri-state capability, 577dee1ad47SJeff Kirsher * thus the additional *_CAPABLE flags. 578dee1ad47SJeff Kirsher */ 579dee1ad47SJeff Kirsher u32 flags; 580b4f47a48SJacob Keller #define IXGBE_FLAG_MSI_ENABLED BIT(1) 581b4f47a48SJacob Keller #define IXGBE_FLAG_MSIX_ENABLED BIT(3) 582b4f47a48SJacob Keller #define IXGBE_FLAG_RX_1BUF_CAPABLE BIT(4) 583b4f47a48SJacob Keller #define IXGBE_FLAG_RX_PS_CAPABLE BIT(5) 584b4f47a48SJacob Keller #define IXGBE_FLAG_RX_PS_ENABLED BIT(6) 585b4f47a48SJacob Keller #define IXGBE_FLAG_DCA_ENABLED BIT(8) 586b4f47a48SJacob Keller #define IXGBE_FLAG_DCA_CAPABLE BIT(9) 587b4f47a48SJacob Keller #define IXGBE_FLAG_IMIR_ENABLED BIT(10) 588b4f47a48SJacob Keller #define IXGBE_FLAG_MQ_CAPABLE BIT(11) 589b4f47a48SJacob Keller #define IXGBE_FLAG_DCB_ENABLED BIT(12) 590b4f47a48SJacob Keller #define IXGBE_FLAG_VMDQ_CAPABLE BIT(13) 591b4f47a48SJacob Keller #define IXGBE_FLAG_VMDQ_ENABLED BIT(14) 592b4f47a48SJacob Keller #define IXGBE_FLAG_FAN_FAIL_CAPABLE BIT(15) 593b4f47a48SJacob Keller #define IXGBE_FLAG_NEED_LINK_UPDATE BIT(16) 594b4f47a48SJacob Keller #define IXGBE_FLAG_NEED_LINK_CONFIG BIT(17) 595b4f47a48SJacob Keller #define IXGBE_FLAG_FDIR_HASH_CAPABLE BIT(18) 596b4f47a48SJacob Keller #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE BIT(19) 597b4f47a48SJacob Keller #define IXGBE_FLAG_FCOE_CAPABLE BIT(20) 598b4f47a48SJacob Keller #define IXGBE_FLAG_FCOE_ENABLED BIT(21) 599b4f47a48SJacob Keller #define IXGBE_FLAG_SRIOV_CAPABLE BIT(22) 600b4f47a48SJacob Keller #define IXGBE_FLAG_SRIOV_ENABLED BIT(23) 60167359c3cSMark Rustad #define IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE BIT(24) 602a9763f3cSMark Rustad #define IXGBE_FLAG_RX_HWTSTAMP_ENABLED BIT(25) 603a9763f3cSMark Rustad #define IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER BIT(26) 6048829009dSUsha Ketineni #define IXGBE_FLAG_DCB_CAPABLE BIT(27) 605a21d0822SEmil Tantilov #define IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE BIT(28) 606dee1ad47SJeff Kirsher 607dee1ad47SJeff Kirsher u32 flags2; 608b4f47a48SJacob Keller #define IXGBE_FLAG2_RSC_CAPABLE BIT(0) 609b4f47a48SJacob Keller #define IXGBE_FLAG2_RSC_ENABLED BIT(1) 610b4f47a48SJacob Keller #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE BIT(2) 611b4f47a48SJacob Keller #define IXGBE_FLAG2_TEMP_SENSOR_EVENT BIT(3) 612b4f47a48SJacob Keller #define IXGBE_FLAG2_SEARCH_FOR_SFP BIT(4) 613b4f47a48SJacob Keller #define IXGBE_FLAG2_SFP_NEEDS_RESET BIT(5) 614b4f47a48SJacob Keller #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT BIT(7) 615b4f47a48SJacob Keller #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP BIT(8) 616b4f47a48SJacob Keller #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP BIT(9) 617b4f47a48SJacob Keller #define IXGBE_FLAG2_PTP_PPS_ENABLED BIT(10) 618b4f47a48SJacob Keller #define IXGBE_FLAG2_PHY_INTERRUPT BIT(11) 619a21d0822SEmil Tantilov #define IXGBE_FLAG2_UDP_TUN_REREG_NEEDED BIT(12) 62016369564SAlexander Duyck #define IXGBE_FLAG2_VLAN_PROMISC BIT(13) 621b3eb4e18SMark Rustad #define IXGBE_FLAG2_EEE_CAPABLE BIT(14) 622b3eb4e18SMark Rustad #define IXGBE_FLAG2_EEE_ENABLED BIT(15) 6232de6aa3aSAlexander Duyck #define IXGBE_FLAG2_RX_LEGACY BIT(16) 62446646e61SAlexander Duyck 62546646e61SAlexander Duyck /* Tx fast path data */ 62646646e61SAlexander Duyck int num_tx_queues; 62746646e61SAlexander Duyck u16 tx_itr_setting; 62846646e61SAlexander Duyck u16 tx_work_limit; 62946646e61SAlexander Duyck 63046646e61SAlexander Duyck /* Rx fast path data */ 63146646e61SAlexander Duyck int num_rx_queues; 63246646e61SAlexander Duyck u16 rx_itr_setting; 63346646e61SAlexander Duyck 6349f12df90SAlexander Duyck /* Port number used to identify VXLAN traffic */ 6359f12df90SAlexander Duyck __be16 vxlan_port; 636a21d0822SEmil Tantilov __be16 geneve_port; 6379f12df90SAlexander Duyck 63833fdc82fSJohn Fastabend /* XDP */ 63933fdc82fSJohn Fastabend int num_xdp_queues; 64033fdc82fSJohn Fastabend struct ixgbe_ring *xdp_ring[MAX_XDP_QUEUES]; 64133fdc82fSJohn Fastabend 64246646e61SAlexander Duyck /* TX */ 64346646e61SAlexander Duyck struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp; 64446646e61SAlexander Duyck 64546646e61SAlexander Duyck u64 restart_queue; 64646646e61SAlexander Duyck u64 lsc_int; 64746646e61SAlexander Duyck u32 tx_timeout_count; 64846646e61SAlexander Duyck 64946646e61SAlexander Duyck /* RX */ 65046646e61SAlexander Duyck struct ixgbe_ring *rx_ring[MAX_RX_QUEUES]; 65146646e61SAlexander Duyck int num_rx_pools; /* == num_rx_queues in 82598 */ 65246646e61SAlexander Duyck int num_rx_queues_per_pool; /* 1 if 82598, can be many if 82599 */ 65346646e61SAlexander Duyck u64 hw_csum_rx_error; 65446646e61SAlexander Duyck u64 hw_rx_no_dma_resources; 65546646e61SAlexander Duyck u64 rsc_total_count; 65646646e61SAlexander Duyck u64 rsc_total_flush; 65746646e61SAlexander Duyck u64 non_eop_descs; 65846646e61SAlexander Duyck u32 alloc_rx_page_failed; 65946646e61SAlexander Duyck u32 alloc_rx_buff_failed; 66046646e61SAlexander Duyck 66149c7ffbeSAlexander Duyck struct ixgbe_q_vector *q_vector[MAX_Q_VECTORS]; 662dee1ad47SJeff Kirsher 663dee1ad47SJeff Kirsher /* DCB parameters */ 664dee1ad47SJeff Kirsher struct ieee_pfc *ixgbe_ieee_pfc; 665dee1ad47SJeff Kirsher struct ieee_ets *ixgbe_ieee_ets; 666dee1ad47SJeff Kirsher struct ixgbe_dcb_config dcb_cfg; 667dee1ad47SJeff Kirsher struct ixgbe_dcb_config temp_dcb_cfg; 668dee1ad47SJeff Kirsher u8 dcb_set_bitmap; 669dee1ad47SJeff Kirsher u8 dcbx_cap; 670dee1ad47SJeff Kirsher enum ixgbe_fc_mode last_lfc_mode; 671dee1ad47SJeff Kirsher 67249c7ffbeSAlexander Duyck int num_q_vectors; /* current number of q_vectors for device */ 67349c7ffbeSAlexander Duyck int max_q_vectors; /* true count of q_vectors for device */ 674dee1ad47SJeff Kirsher struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE]; 675dee1ad47SJeff Kirsher struct msix_entry *msix_entries; 676dee1ad47SJeff Kirsher 677dee1ad47SJeff Kirsher u32 test_icr; 678dee1ad47SJeff Kirsher struct ixgbe_ring test_tx_ring; 679dee1ad47SJeff Kirsher struct ixgbe_ring test_rx_ring; 680dee1ad47SJeff Kirsher 681dee1ad47SJeff Kirsher /* structs defined in ixgbe_hw.h */ 682dee1ad47SJeff Kirsher struct ixgbe_hw hw; 683dee1ad47SJeff Kirsher u16 msg_enable; 684dee1ad47SJeff Kirsher struct ixgbe_hw_stats stats; 685dee1ad47SJeff Kirsher 686dee1ad47SJeff Kirsher u64 tx_busy; 687dee1ad47SJeff Kirsher unsigned int tx_ring_count; 68833fdc82fSJohn Fastabend unsigned int xdp_ring_count; 689dee1ad47SJeff Kirsher unsigned int rx_ring_count; 690dee1ad47SJeff Kirsher 691dee1ad47SJeff Kirsher u32 link_speed; 692dee1ad47SJeff Kirsher bool link_up; 69358e7cd24SMark Rustad unsigned long sfp_poll_time; 694dee1ad47SJeff Kirsher unsigned long link_check_timeout; 695dee1ad47SJeff Kirsher 696dee1ad47SJeff Kirsher struct timer_list service_timer; 69746646e61SAlexander Duyck struct work_struct service_task; 69846646e61SAlexander Duyck 69946646e61SAlexander Duyck struct hlist_head fdir_filter_list; 70046646e61SAlexander Duyck unsigned long fdir_overflow; /* number of times ATR was backed off */ 70146646e61SAlexander Duyck union ixgbe_atr_input fdir_mask; 70246646e61SAlexander Duyck int fdir_filter_count; 703dee1ad47SJeff Kirsher u32 fdir_pballoc; 704dee1ad47SJeff Kirsher u32 atr_sample_rate; 705dee1ad47SJeff Kirsher spinlock_t fdir_perfect_lock; 70646646e61SAlexander Duyck 707dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 708dee1ad47SJeff Kirsher struct ixgbe_fcoe fcoe; 709dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 7102a1a091cSMark Rustad u8 __iomem *io_addr; /* Mainly for iounmap use */ 711dee1ad47SJeff Kirsher u32 wol; 71246646e61SAlexander Duyck 713aa2bacb6SDon Skidmore u16 bridge_mode; 714aa2bacb6SDon Skidmore 71515e5209fSEmil Tantilov u16 eeprom_verh; 71615e5209fSEmil Tantilov u16 eeprom_verl; 717c23f5b6bSEmil Tantilov u16 eeprom_cap; 718dee1ad47SJeff Kirsher 719dee1ad47SJeff Kirsher u32 interrupt_event; 72046646e61SAlexander Duyck u32 led_reg; 721dee1ad47SJeff Kirsher 7223a6a4edaSJacob Keller struct ptp_clock *ptp_clock; 7233a6a4edaSJacob Keller struct ptp_clock_info ptp_caps; 724891dc082SJacob Keller struct work_struct ptp_tx_work; 725891dc082SJacob Keller struct sk_buff *ptp_tx_skb; 72693501d48SJacob Keller struct hwtstamp_config tstamp_config; 727891dc082SJacob Keller unsigned long ptp_tx_start; 7283a6a4edaSJacob Keller unsigned long last_overflow_check; 7296cb562d6SJacob Keller unsigned long last_rx_ptp_check; 730eda183c2SJakub Kicinski unsigned long last_rx_timestamp; 7313a6a4edaSJacob Keller spinlock_t tmreg_lock; 732a9763f3cSMark Rustad struct cyclecounter hw_cc; 733a9763f3cSMark Rustad struct timecounter hw_tc; 7343a6a4edaSJacob Keller u32 base_incval; 735a9763f3cSMark Rustad u32 tx_hwtstamp_timeouts; 7364cc74c01SJacob Keller u32 tx_hwtstamp_skipped; 737a9763f3cSMark Rustad u32 rx_hwtstamp_cleared; 738a9763f3cSMark Rustad void (*ptp_setup_sdp)(struct ixgbe_adapter *); 7393a6a4edaSJacob Keller 740dee1ad47SJeff Kirsher /* SR-IOV */ 741dee1ad47SJeff Kirsher DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); 742dee1ad47SJeff Kirsher unsigned int num_vfs; 743dee1ad47SJeff Kirsher struct vf_data_storage *vfinfo; 744dee1ad47SJeff Kirsher int vf_rate_link_speed; 745dee1ad47SJeff Kirsher struct vf_macvlans vf_mvs; 746dee1ad47SJeff Kirsher struct vf_macvlans *mv_list; 747dee1ad47SJeff Kirsher 74883c61fa9SGreg Rose u32 timer_event_accumulator; 74983c61fa9SGreg Rose u32 vferr_refcount; 7505d7daa35SJacob Keller struct ixgbe_mac_addr *mac_table; 7513ca8bc6dSDon Skidmore struct kobject *info_kobj; 7523ca8bc6dSDon Skidmore #ifdef CONFIG_IXGBE_HWMON 75303b77d81SGuenter Roeck struct hwmon_buff *ixgbe_hwmon_buff; 7543ca8bc6dSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */ 75500949167SCatherine Sullivan #ifdef CONFIG_DEBUG_FS 75600949167SCatherine Sullivan struct dentry *ixgbe_dbg_adapter; 75700949167SCatherine Sullivan #endif /*CONFIG_DEBUG_FS*/ 758107d3018SAlexander Duyck 759107d3018SAlexander Duyck u8 default_up; 7602a47fa45SJohn Fastabend unsigned long fwd_bitmask; /* Bitmask indicating in use pools */ 761dfaf891dSVlad Zolotarov 762b82b17d9SJohn Fastabend #define IXGBE_MAX_LINK_HANDLE 10 7631cdaaf54SAmritha Nambiar struct ixgbe_jump_table *jump_tables[IXGBE_MAX_LINK_HANDLE]; 764db956ae8SJohn Fastabend unsigned long tables; 765b82b17d9SJohn Fastabend 766dfaf891dSVlad Zolotarov /* maximum number of RETA entries among all devices supported by ixgbe 767dfaf891dSVlad Zolotarov * driver: currently it's x550 device in non-SRIOV mode 768dfaf891dSVlad Zolotarov */ 769dfaf891dSVlad Zolotarov #define IXGBE_MAX_RETA_ENTRIES 512 770dfaf891dSVlad Zolotarov u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES]; 771dfaf891dSVlad Zolotarov 772dfaf891dSVlad Zolotarov #define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ 7733dfbfc7eSTony Nguyen u32 *rss_key; 774dee1ad47SJeff Kirsher }; 775dee1ad47SJeff Kirsher 7760f9b232bSDon Skidmore static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter) 7770f9b232bSDon Skidmore { 7780f9b232bSDon Skidmore switch (adapter->hw.mac.type) { 7790f9b232bSDon Skidmore case ixgbe_mac_82598EB: 7800f9b232bSDon Skidmore case ixgbe_mac_82599EB: 7810f9b232bSDon Skidmore case ixgbe_mac_X540: 7820f9b232bSDon Skidmore return IXGBE_MAX_RSS_INDICES; 7830f9b232bSDon Skidmore case ixgbe_mac_X550: 7840f9b232bSDon Skidmore case ixgbe_mac_X550EM_x: 78549425dfcSMark Rustad case ixgbe_mac_x550em_a: 7860f9b232bSDon Skidmore return IXGBE_MAX_RSS_INDICES_X550; 7870f9b232bSDon Skidmore default: 7880f9b232bSDon Skidmore return 0; 7890f9b232bSDon Skidmore } 7900f9b232bSDon Skidmore } 7910f9b232bSDon Skidmore 792dee1ad47SJeff Kirsher struct ixgbe_fdir_filter { 793dee1ad47SJeff Kirsher struct hlist_node fdir_node; 794dee1ad47SJeff Kirsher union ixgbe_atr_input filter; 795dee1ad47SJeff Kirsher u16 sw_idx; 7962a9ed5d1SSridhar Samudrala u64 action; 797dee1ad47SJeff Kirsher }; 798dee1ad47SJeff Kirsher 79970e5576cSDon Skidmore enum ixgbe_state_t { 800dee1ad47SJeff Kirsher __IXGBE_TESTING, 801dee1ad47SJeff Kirsher __IXGBE_RESETTING, 802dee1ad47SJeff Kirsher __IXGBE_DOWN, 80341c62843SMark Rustad __IXGBE_DISABLED, 80409f40aedSMark Rustad __IXGBE_REMOVING, 805dee1ad47SJeff Kirsher __IXGBE_SERVICE_SCHED, 80658cf663fSMark Rustad __IXGBE_SERVICE_INITED, 807dee1ad47SJeff Kirsher __IXGBE_IN_SFP_INIT, 8088fecf67cSJacob Keller __IXGBE_PTP_RUNNING, 809151b260cSJakub Kicinski __IXGBE_PTP_TX_IN_PROGRESS, 81057ca2a4fSEmil Tantilov __IXGBE_RESET_REQUESTED, 811dee1ad47SJeff Kirsher }; 812dee1ad47SJeff Kirsher 8134c1975d7SAlexander Duyck struct ixgbe_cb { 8144c1975d7SAlexander Duyck union { /* Union defining head/tail partner */ 8154c1975d7SAlexander Duyck struct sk_buff *head; 8164c1975d7SAlexander Duyck struct sk_buff *tail; 8174c1975d7SAlexander Duyck }; 818dee1ad47SJeff Kirsher dma_addr_t dma; 8194c1975d7SAlexander Duyck u16 append_cnt; 820f800326dSAlexander Duyck bool page_released; 821dee1ad47SJeff Kirsher }; 8224c1975d7SAlexander Duyck #define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb) 823dee1ad47SJeff Kirsher 824dee1ad47SJeff Kirsher enum ixgbe_boards { 825dee1ad47SJeff Kirsher board_82598, 826dee1ad47SJeff Kirsher board_82599, 827dee1ad47SJeff Kirsher board_X540, 8286a14ee0cSDon Skidmore board_X550, 8296a14ee0cSDon Skidmore board_X550EM_x, 8308dc963e1SPaul Greenwalt board_x550em_x_fw, 83149425dfcSMark Rustad board_x550em_a, 832b3eb4e18SMark Rustad board_x550em_a_fw, 833dee1ad47SJeff Kirsher }; 834dee1ad47SJeff Kirsher 83537689010SMark Rustad extern const struct ixgbe_info ixgbe_82598_info; 83637689010SMark Rustad extern const struct ixgbe_info ixgbe_82599_info; 83737689010SMark Rustad extern const struct ixgbe_info ixgbe_X540_info; 83837689010SMark Rustad extern const struct ixgbe_info ixgbe_X550_info; 83937689010SMark Rustad extern const struct ixgbe_info ixgbe_X550EM_x_info; 8408dc963e1SPaul Greenwalt extern const struct ixgbe_info ixgbe_x550em_x_fw_info; 84149425dfcSMark Rustad extern const struct ixgbe_info ixgbe_x550em_a_info; 842b3eb4e18SMark Rustad extern const struct ixgbe_info ixgbe_x550em_a_fw_info; 843dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB 8443f40c74cSStephen Hemminger extern const struct dcbnl_rtnl_ops ixgbe_dcbnl_ops; 845dee1ad47SJeff Kirsher #endif 846dee1ad47SJeff Kirsher 847dee1ad47SJeff Kirsher extern char ixgbe_driver_name[]; 848dee1ad47SJeff Kirsher extern const char ixgbe_driver_version[]; 8498af3c33fSJeff Kirsher #ifdef IXGBE_FCOE 850ea81875aSNeerav Parikh extern char ixgbe_default_device_descr[]; 8518af3c33fSJeff Kirsher #endif /* IXGBE_FCOE */ 852dee1ad47SJeff Kirsher 8536c211fe1SStefan Assmann int ixgbe_open(struct net_device *netdev); 8546c211fe1SStefan Assmann int ixgbe_close(struct net_device *netdev); 8555ccc921aSJoe Perches void ixgbe_up(struct ixgbe_adapter *adapter); 8565ccc921aSJoe Perches void ixgbe_down(struct ixgbe_adapter *adapter); 8575ccc921aSJoe Perches void ixgbe_reinit_locked(struct ixgbe_adapter *adapter); 8585ccc921aSJoe Perches void ixgbe_reset(struct ixgbe_adapter *adapter); 8595ccc921aSJoe Perches void ixgbe_set_ethtool_ops(struct net_device *netdev); 86092470808SJohn Fastabend int ixgbe_setup_rx_resources(struct ixgbe_adapter *, struct ixgbe_ring *); 8615ccc921aSJoe Perches int ixgbe_setup_tx_resources(struct ixgbe_ring *); 8625ccc921aSJoe Perches void ixgbe_free_rx_resources(struct ixgbe_ring *); 8635ccc921aSJoe Perches void ixgbe_free_tx_resources(struct ixgbe_ring *); 8645ccc921aSJoe Perches void ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); 8655ccc921aSJoe Perches void ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); 8665ccc921aSJoe Perches void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_ring *); 8675ccc921aSJoe Perches void ixgbe_update_stats(struct ixgbe_adapter *adapter); 8685ccc921aSJoe Perches int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); 869740234f0SEmil Tantilov bool ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, 8708e2813f5SJacob Keller u16 subdevice_id); 8715d7daa35SJacob Keller #ifdef CONFIG_PCI_IOV 8725d7daa35SJacob Keller void ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter); 8735d7daa35SJacob Keller #endif 8745d7daa35SJacob Keller int ixgbe_add_mac_filter(struct ixgbe_adapter *adapter, 875c9f53e63SAlexander Duyck const u8 *addr, u16 queue); 8765d7daa35SJacob Keller int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, 877c9f53e63SAlexander Duyck const u8 *addr, u16 queue); 878e1d0a2afSAlexander Duyck void ixgbe_update_pf_promisc_vlvf(struct ixgbe_adapter *adapter, u32 vid); 8795ccc921aSJoe Perches void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); 8805ccc921aSJoe Perches netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, struct ixgbe_adapter *, 881dee1ad47SJeff Kirsher struct ixgbe_ring *); 8825ccc921aSJoe Perches void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *, 883dee1ad47SJeff Kirsher struct ixgbe_tx_buffer *); 8845ccc921aSJoe Perches void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16); 8855ccc921aSJoe Perches void ixgbe_write_eitr(struct ixgbe_q_vector *); 8865ccc921aSJoe Perches int ixgbe_poll(struct napi_struct *napi, int budget); 8875ccc921aSJoe Perches int ethtool_ioctl(struct ifreq *ifr); 8885ccc921aSJoe Perches s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw); 8895ccc921aSJoe Perches s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl); 8905ccc921aSJoe Perches s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl); 8915ccc921aSJoe Perches s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, 892dee1ad47SJeff Kirsher union ixgbe_atr_hash_dword input, 893dee1ad47SJeff Kirsher union ixgbe_atr_hash_dword common, 894dee1ad47SJeff Kirsher u8 queue); 8955ccc921aSJoe Perches s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, 896dee1ad47SJeff Kirsher union ixgbe_atr_input *input_mask); 8975ccc921aSJoe Perches s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, 898dee1ad47SJeff Kirsher union ixgbe_atr_input *input, 899dee1ad47SJeff Kirsher u16 soft_id, u8 queue); 9005ccc921aSJoe Perches s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, 901dee1ad47SJeff Kirsher union ixgbe_atr_input *input, 902dee1ad47SJeff Kirsher u16 soft_id); 9035ccc921aSJoe Perches void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, 904dee1ad47SJeff Kirsher union ixgbe_atr_input *mask); 905b82b17d9SJohn Fastabend int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter, 906b82b17d9SJohn Fastabend struct ixgbe_fdir_filter *input, 907b82b17d9SJohn Fastabend u16 sw_idx); 9085ccc921aSJoe Perches void ixgbe_set_rx_mode(struct net_device *netdev); 9098af3c33fSJeff Kirsher #ifdef CONFIG_IXGBE_DCB 9105ccc921aSJoe Perches void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter); 9118af3c33fSJeff Kirsher #endif 9125ccc921aSJoe Perches int ixgbe_setup_tc(struct net_device *dev, u8 tc); 9135ccc921aSJoe Perches void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); 9145ccc921aSJoe Perches void ixgbe_do_reset(struct net_device *netdev); 9151210982bSDon Skidmore #ifdef CONFIG_IXGBE_HWMON 9165ccc921aSJoe Perches void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); 9175ccc921aSJoe Perches int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); 9181210982bSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */ 919dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE 9205ccc921aSJoe Perches void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); 9215ccc921aSJoe Perches int ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first, 922244e27adSAlexander Duyck u8 *hdr_len); 9235ccc921aSJoe Perches int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, 9245ccc921aSJoe Perches union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb); 9255ccc921aSJoe Perches int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, 926dee1ad47SJeff Kirsher struct scatterlist *sgl, unsigned int sgc); 9275ccc921aSJoe Perches int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid, 928dee1ad47SJeff Kirsher struct scatterlist *sgl, unsigned int sgc); 9295ccc921aSJoe Perches int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); 9305ccc921aSJoe Perches int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter); 9315ccc921aSJoe Perches void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter); 9325ccc921aSJoe Perches int ixgbe_fcoe_enable(struct net_device *netdev); 9335ccc921aSJoe Perches int ixgbe_fcoe_disable(struct net_device *netdev); 934dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB 9355ccc921aSJoe Perches u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter); 9365ccc921aSJoe Perches u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); 937dee1ad47SJeff Kirsher #endif /* CONFIG_IXGBE_DCB */ 9385ccc921aSJoe Perches int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); 9395ccc921aSJoe Perches int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, 940ea81875aSNeerav Parikh struct netdev_fcoe_hbainfo *info); 9415ccc921aSJoe Perches u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter); 942dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */ 94300949167SCatherine Sullivan #ifdef CONFIG_DEBUG_FS 9445ccc921aSJoe Perches void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter); 9455ccc921aSJoe Perches void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter); 9465ccc921aSJoe Perches void ixgbe_dbg_init(void); 9475ccc921aSJoe Perches void ixgbe_dbg_exit(void); 94833243fb0SJoe Perches #else 94933243fb0SJoe Perches static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {} 95033243fb0SJoe Perches static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {} 95133243fb0SJoe Perches static inline void ixgbe_dbg_init(void) {} 95233243fb0SJoe Perches static inline void ixgbe_dbg_exit(void) {} 95300949167SCatherine Sullivan #endif /* CONFIG_DEBUG_FS */ 954b2d96e0aSAlexander Duyck static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) 955b2d96e0aSAlexander Duyck { 956b2d96e0aSAlexander Duyck return netdev_get_tx_queue(ring->netdev, ring->queue_index); 957b2d96e0aSAlexander Duyck } 958b2d96e0aSAlexander Duyck 9595ccc921aSJoe Perches void ixgbe_ptp_init(struct ixgbe_adapter *adapter); 9609966d1eeSJacob Keller void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter); 9615ccc921aSJoe Perches void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); 9625ccc921aSJoe Perches void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); 9635ccc921aSJoe Perches void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); 964*622a2ef5SJacob Keller void ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter); 965a9763f3cSMark Rustad void ixgbe_ptp_rx_pktstamp(struct ixgbe_q_vector *, struct sk_buff *); 966a9763f3cSMark Rustad void ixgbe_ptp_rx_rgtstamp(struct ixgbe_q_vector *, struct sk_buff *skb); 967a9763f3cSMark Rustad static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, 968a9763f3cSMark Rustad union ixgbe_adv_rx_desc *rx_desc, 969a9763f3cSMark Rustad struct sk_buff *skb) 970a9763f3cSMark Rustad { 971a9763f3cSMark Rustad if (unlikely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_TSIP))) { 972a9763f3cSMark Rustad ixgbe_ptp_rx_pktstamp(rx_ring->q_vector, skb); 973a9763f3cSMark Rustad return; 974a9763f3cSMark Rustad } 975a9763f3cSMark Rustad 976a9763f3cSMark Rustad if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS))) 977a9763f3cSMark Rustad return; 978a9763f3cSMark Rustad 979a9763f3cSMark Rustad ixgbe_ptp_rx_rgtstamp(rx_ring->q_vector, skb); 980a9763f3cSMark Rustad 981a9763f3cSMark Rustad /* Update the last_rx_timestamp timer in order to enable watchdog check 982a9763f3cSMark Rustad * for error case of latched timestamp on a dropped packet. 983a9763f3cSMark Rustad */ 984a9763f3cSMark Rustad rx_ring->last_rx_timestamp = jiffies; 985a9763f3cSMark Rustad } 986a9763f3cSMark Rustad 98793501d48SJacob Keller int ixgbe_ptp_set_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr); 98893501d48SJacob Keller int ixgbe_ptp_get_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr); 9895ccc921aSJoe Perches void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); 9905ccc921aSJoe Perches void ixgbe_ptp_reset(struct ixgbe_adapter *adapter); 991a9763f3cSMark Rustad void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter); 992da36b647SGreg Rose #ifdef CONFIG_PCI_IOV 993da36b647SGreg Rose void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter); 994da36b647SGreg Rose #endif 9953a6a4edaSJacob Keller 9962a47fa45SJohn Fastabend netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, 9972a47fa45SJohn Fastabend struct ixgbe_adapter *adapter, 9982a47fa45SJohn Fastabend struct ixgbe_ring *tx_ring); 9997f276efbSVlad Zolotarov u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter); 1000d3aa9c9fSPaolo Abeni void ixgbe_store_key(struct ixgbe_adapter *adapter); 10011c7cf078STom Barbette void ixgbe_store_reta(struct ixgbe_adapter *adapter); 10022916500dSDon Skidmore s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg, 10032916500dSDon Skidmore u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm); 1004dee1ad47SJeff Kirsher #endif /* _IXGBE_H_ */ 1005