18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef _IXGBE_H_ 58c2ecf20Sopenharmony_ci#define _IXGBE_H_ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/bitops.h> 88c2ecf20Sopenharmony_ci#include <linux/types.h> 98c2ecf20Sopenharmony_ci#include <linux/pci.h> 108c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 118c2ecf20Sopenharmony_ci#include <linux/cpumask.h> 128c2ecf20Sopenharmony_ci#include <linux/aer.h> 138c2ecf20Sopenharmony_ci#include <linux/if_vlan.h> 148c2ecf20Sopenharmony_ci#include <linux/jiffies.h> 158c2ecf20Sopenharmony_ci#include <linux/phy.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <linux/timecounter.h> 188c2ecf20Sopenharmony_ci#include <linux/net_tstamp.h> 198c2ecf20Sopenharmony_ci#include <linux/ptp_clock_kernel.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "ixgbe_type.h" 228c2ecf20Sopenharmony_ci#include "ixgbe_common.h" 238c2ecf20Sopenharmony_ci#include "ixgbe_dcb.h" 248c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_FCOE) 258c2ecf20Sopenharmony_ci#define IXGBE_FCOE 268c2ecf20Sopenharmony_ci#include "ixgbe_fcoe.h" 278c2ecf20Sopenharmony_ci#endif /* IS_ENABLED(CONFIG_FCOE) */ 288c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_DCA 298c2ecf20Sopenharmony_ci#include <linux/dca.h> 308c2ecf20Sopenharmony_ci#endif 318c2ecf20Sopenharmony_ci#include "ixgbe_ipsec.h" 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#include <net/xdp.h> 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* common prefix used by pr_<> macros */ 368c2ecf20Sopenharmony_ci#undef pr_fmt 378c2ecf20Sopenharmony_ci#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* TX/RX descriptor defines */ 408c2ecf20Sopenharmony_ci#define IXGBE_DEFAULT_TXD 512 418c2ecf20Sopenharmony_ci#define IXGBE_DEFAULT_TX_WORK 256 428c2ecf20Sopenharmony_ci#define IXGBE_MAX_TXD 4096 438c2ecf20Sopenharmony_ci#define IXGBE_MIN_TXD 64 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#if (PAGE_SIZE < 8192) 468c2ecf20Sopenharmony_ci#define IXGBE_DEFAULT_RXD 512 478c2ecf20Sopenharmony_ci#else 488c2ecf20Sopenharmony_ci#define IXGBE_DEFAULT_RXD 128 498c2ecf20Sopenharmony_ci#endif 508c2ecf20Sopenharmony_ci#define IXGBE_MAX_RXD 4096 518c2ecf20Sopenharmony_ci#define IXGBE_MIN_RXD 64 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci/* flow control */ 548c2ecf20Sopenharmony_ci#define IXGBE_MIN_FCRTL 0x40 558c2ecf20Sopenharmony_ci#define IXGBE_MAX_FCRTL 0x7FF80 568c2ecf20Sopenharmony_ci#define IXGBE_MIN_FCRTH 0x600 578c2ecf20Sopenharmony_ci#define IXGBE_MAX_FCRTH 0x7FFF0 588c2ecf20Sopenharmony_ci#define IXGBE_DEFAULT_FCPAUSE 0xFFFF 598c2ecf20Sopenharmony_ci#define IXGBE_MIN_FCPAUSE 0 608c2ecf20Sopenharmony_ci#define IXGBE_MAX_FCPAUSE 0xFFFF 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* Supported Rx Buffer Sizes */ 638c2ecf20Sopenharmony_ci#define IXGBE_RXBUFFER_256 256 /* Used for skb receive header */ 648c2ecf20Sopenharmony_ci#define IXGBE_RXBUFFER_1536 1536 658c2ecf20Sopenharmony_ci#define IXGBE_RXBUFFER_2K 2048 668c2ecf20Sopenharmony_ci#define IXGBE_RXBUFFER_3K 3072 678c2ecf20Sopenharmony_ci#define IXGBE_RXBUFFER_4K 4096 688c2ecf20Sopenharmony_ci#define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */ 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define IXGBE_PKT_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2)) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* Attempt to maximize the headroom available for incoming frames. We 738c2ecf20Sopenharmony_ci * use a 2K buffer for receives and need 1536/1534 to store the data for 748c2ecf20Sopenharmony_ci * the frame. This leaves us with 512 bytes of room. From that we need 758c2ecf20Sopenharmony_ci * to deduct the space needed for the shared info and the padding needed 768c2ecf20Sopenharmony_ci * to IP align the frame. 778c2ecf20Sopenharmony_ci * 788c2ecf20Sopenharmony_ci * Note: For cache line sizes 256 or larger this value is going to end 798c2ecf20Sopenharmony_ci * up negative. In these cases we should fall back to the 3K 808c2ecf20Sopenharmony_ci * buffers. 818c2ecf20Sopenharmony_ci */ 828c2ecf20Sopenharmony_ci#if (PAGE_SIZE < 8192) 838c2ecf20Sopenharmony_ci#define IXGBE_MAX_2K_FRAME_BUILD_SKB (IXGBE_RXBUFFER_1536 - NET_IP_ALIGN) 848c2ecf20Sopenharmony_ci#define IXGBE_2K_TOO_SMALL_WITH_PADDING \ 858c2ecf20Sopenharmony_ci((NET_SKB_PAD + IXGBE_RXBUFFER_1536) > SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K)) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic inline int ixgbe_compute_pad(int rx_buf_len) 888c2ecf20Sopenharmony_ci{ 898c2ecf20Sopenharmony_ci int page_size, pad_size; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci page_size = ALIGN(rx_buf_len, PAGE_SIZE / 2); 928c2ecf20Sopenharmony_ci pad_size = SKB_WITH_OVERHEAD(page_size) - rx_buf_len; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci return pad_size; 958c2ecf20Sopenharmony_ci} 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic inline int ixgbe_skb_pad(void) 988c2ecf20Sopenharmony_ci{ 998c2ecf20Sopenharmony_ci int rx_buf_len; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci /* If a 2K buffer cannot handle a standard Ethernet frame then 1028c2ecf20Sopenharmony_ci * optimize padding for a 3K buffer instead of a 1.5K buffer. 1038c2ecf20Sopenharmony_ci * 1048c2ecf20Sopenharmony_ci * For a 3K buffer we need to add enough padding to allow for 1058c2ecf20Sopenharmony_ci * tailroom due to NET_IP_ALIGN possibly shifting us out of 1068c2ecf20Sopenharmony_ci * cache-line alignment. 1078c2ecf20Sopenharmony_ci */ 1088c2ecf20Sopenharmony_ci if (IXGBE_2K_TOO_SMALL_WITH_PADDING) 1098c2ecf20Sopenharmony_ci rx_buf_len = IXGBE_RXBUFFER_3K + SKB_DATA_ALIGN(NET_IP_ALIGN); 1108c2ecf20Sopenharmony_ci else 1118c2ecf20Sopenharmony_ci rx_buf_len = IXGBE_RXBUFFER_1536; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci /* if needed make room for NET_IP_ALIGN */ 1148c2ecf20Sopenharmony_ci rx_buf_len -= NET_IP_ALIGN; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci return ixgbe_compute_pad(rx_buf_len); 1178c2ecf20Sopenharmony_ci} 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define IXGBE_SKB_PAD ixgbe_skb_pad() 1208c2ecf20Sopenharmony_ci#else 1218c2ecf20Sopenharmony_ci#define IXGBE_SKB_PAD (NET_SKB_PAD + NET_IP_ALIGN) 1228c2ecf20Sopenharmony_ci#endif 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* 1258c2ecf20Sopenharmony_ci * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN means we 1268c2ecf20Sopenharmony_ci * reserve 64 more, and skb_shared_info adds an additional 320 bytes more, 1278c2ecf20Sopenharmony_ci * this adds up to 448 bytes of extra data. 1288c2ecf20Sopenharmony_ci * 1298c2ecf20Sopenharmony_ci * Since netdev_alloc_skb now allocates a page fragment we can use a value 1308c2ecf20Sopenharmony_ci * of 256 and the resultant skb will have a truesize of 960 or less. 1318c2ecf20Sopenharmony_ci */ 1328c2ecf20Sopenharmony_ci#define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci/* How many Rx Buffers do we bundle into one write to the hardware ? */ 1358c2ecf20Sopenharmony_ci#define IXGBE_RX_BUFFER_WRITE 16 /* Must be power of 2 */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define IXGBE_RX_DMA_ATTR \ 1388c2ecf20Sopenharmony_ci (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cienum ixgbe_tx_flags { 1418c2ecf20Sopenharmony_ci /* cmd_type flags */ 1428c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_HW_VLAN = 0x01, 1438c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_TSO = 0x02, 1448c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_TSTAMP = 0x04, 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* olinfo flags */ 1478c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_CC = 0x08, 1488c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_IPV4 = 0x10, 1498c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_CSUM = 0x20, 1508c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_IPSEC = 0x40, 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci /* software defined flags */ 1538c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_SW_VLAN = 0x80, 1548c2ecf20Sopenharmony_ci IXGBE_TX_FLAGS_FCOE = 0x100, 1558c2ecf20Sopenharmony_ci}; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/* VLAN info */ 1588c2ecf20Sopenharmony_ci#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000 1598c2ecf20Sopenharmony_ci#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000 1608c2ecf20Sopenharmony_ci#define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29 1618c2ecf20Sopenharmony_ci#define IXGBE_TX_FLAGS_VLAN_SHIFT 16 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#define IXGBE_MAX_VF_MC_ENTRIES 30 1648c2ecf20Sopenharmony_ci#define IXGBE_MAX_VF_FUNCTIONS 64 1658c2ecf20Sopenharmony_ci#define IXGBE_MAX_VFTA_ENTRIES 128 1668c2ecf20Sopenharmony_ci#define MAX_EMULATION_MAC_ADDRS 16 1678c2ecf20Sopenharmony_ci#define IXGBE_MAX_PF_MACVLANS 15 1688c2ecf20Sopenharmony_ci#define VMDQ_P(p) ((p) + adapter->ring_feature[RING_F_VMDQ].offset) 1698c2ecf20Sopenharmony_ci#define IXGBE_82599_VF_DEVICE_ID 0x10ED 1708c2ecf20Sopenharmony_ci#define IXGBE_X540_VF_DEVICE_ID 0x1515 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_cistruct vf_data_storage { 1738c2ecf20Sopenharmony_ci struct pci_dev *vfdev; 1748c2ecf20Sopenharmony_ci unsigned char vf_mac_addresses[ETH_ALEN]; 1758c2ecf20Sopenharmony_ci u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES]; 1768c2ecf20Sopenharmony_ci u16 num_vf_mc_hashes; 1778c2ecf20Sopenharmony_ci bool clear_to_send; 1788c2ecf20Sopenharmony_ci bool pf_set_mac; 1798c2ecf20Sopenharmony_ci u16 pf_vlan; /* When set, guest VLAN config not allowed. */ 1808c2ecf20Sopenharmony_ci u16 pf_qos; 1818c2ecf20Sopenharmony_ci u16 tx_rate; 1828c2ecf20Sopenharmony_ci int link_enable; 1838c2ecf20Sopenharmony_ci int link_state; 1848c2ecf20Sopenharmony_ci u8 spoofchk_enabled; 1858c2ecf20Sopenharmony_ci bool rss_query_enabled; 1868c2ecf20Sopenharmony_ci u8 trusted; 1878c2ecf20Sopenharmony_ci int xcast_mode; 1888c2ecf20Sopenharmony_ci unsigned int vf_api; 1898c2ecf20Sopenharmony_ci u8 primary_abort_count; 1908c2ecf20Sopenharmony_ci}; 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_cienum ixgbevf_xcast_modes { 1938c2ecf20Sopenharmony_ci IXGBEVF_XCAST_MODE_NONE = 0, 1948c2ecf20Sopenharmony_ci IXGBEVF_XCAST_MODE_MULTI, 1958c2ecf20Sopenharmony_ci IXGBEVF_XCAST_MODE_ALLMULTI, 1968c2ecf20Sopenharmony_ci IXGBEVF_XCAST_MODE_PROMISC, 1978c2ecf20Sopenharmony_ci}; 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_cistruct vf_macvlans { 2008c2ecf20Sopenharmony_ci struct list_head l; 2018c2ecf20Sopenharmony_ci int vf; 2028c2ecf20Sopenharmony_ci bool free; 2038c2ecf20Sopenharmony_ci bool is_macvlan; 2048c2ecf20Sopenharmony_ci u8 vf_macvlan[ETH_ALEN]; 2058c2ecf20Sopenharmony_ci}; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci#define IXGBE_MAX_TXD_PWR 14 2088c2ecf20Sopenharmony_ci#define IXGBE_MAX_DATA_PER_TXD (1u << IXGBE_MAX_TXD_PWR) 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci/* Tx Descriptors needed, worst case */ 2118c2ecf20Sopenharmony_ci#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD) 2128c2ecf20Sopenharmony_ci#define DESC_NEEDED (MAX_SKB_FRAGS + 4) 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* wrapper around a pointer to a socket buffer, 2158c2ecf20Sopenharmony_ci * so a DMA handle can be stored along with the buffer */ 2168c2ecf20Sopenharmony_cistruct ixgbe_tx_buffer { 2178c2ecf20Sopenharmony_ci union ixgbe_adv_tx_desc *next_to_watch; 2188c2ecf20Sopenharmony_ci unsigned long time_stamp; 2198c2ecf20Sopenharmony_ci union { 2208c2ecf20Sopenharmony_ci struct sk_buff *skb; 2218c2ecf20Sopenharmony_ci struct xdp_frame *xdpf; 2228c2ecf20Sopenharmony_ci }; 2238c2ecf20Sopenharmony_ci unsigned int bytecount; 2248c2ecf20Sopenharmony_ci unsigned short gso_segs; 2258c2ecf20Sopenharmony_ci __be16 protocol; 2268c2ecf20Sopenharmony_ci DEFINE_DMA_UNMAP_ADDR(dma); 2278c2ecf20Sopenharmony_ci DEFINE_DMA_UNMAP_LEN(len); 2288c2ecf20Sopenharmony_ci u32 tx_flags; 2298c2ecf20Sopenharmony_ci}; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_cistruct ixgbe_rx_buffer { 2328c2ecf20Sopenharmony_ci union { 2338c2ecf20Sopenharmony_ci struct { 2348c2ecf20Sopenharmony_ci struct sk_buff *skb; 2358c2ecf20Sopenharmony_ci dma_addr_t dma; 2368c2ecf20Sopenharmony_ci struct page *page; 2378c2ecf20Sopenharmony_ci __u32 page_offset; 2388c2ecf20Sopenharmony_ci __u16 pagecnt_bias; 2398c2ecf20Sopenharmony_ci }; 2408c2ecf20Sopenharmony_ci struct { 2418c2ecf20Sopenharmony_ci bool discard; 2428c2ecf20Sopenharmony_ci struct xdp_buff *xdp; 2438c2ecf20Sopenharmony_ci }; 2448c2ecf20Sopenharmony_ci }; 2458c2ecf20Sopenharmony_ci}; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistruct ixgbe_queue_stats { 2488c2ecf20Sopenharmony_ci u64 packets; 2498c2ecf20Sopenharmony_ci u64 bytes; 2508c2ecf20Sopenharmony_ci}; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_cistruct ixgbe_tx_queue_stats { 2538c2ecf20Sopenharmony_ci u64 restart_queue; 2548c2ecf20Sopenharmony_ci u64 tx_busy; 2558c2ecf20Sopenharmony_ci u64 tx_done_old; 2568c2ecf20Sopenharmony_ci}; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistruct ixgbe_rx_queue_stats { 2598c2ecf20Sopenharmony_ci u64 rsc_count; 2608c2ecf20Sopenharmony_ci u64 rsc_flush; 2618c2ecf20Sopenharmony_ci u64 non_eop_descs; 2628c2ecf20Sopenharmony_ci u64 alloc_rx_page; 2638c2ecf20Sopenharmony_ci u64 alloc_rx_page_failed; 2648c2ecf20Sopenharmony_ci u64 alloc_rx_buff_failed; 2658c2ecf20Sopenharmony_ci u64 csum_err; 2668c2ecf20Sopenharmony_ci}; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci#define IXGBE_TS_HDR_LEN 8 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_cienum ixgbe_ring_state_t { 2718c2ecf20Sopenharmony_ci __IXGBE_RX_3K_BUFFER, 2728c2ecf20Sopenharmony_ci __IXGBE_RX_BUILD_SKB_ENABLED, 2738c2ecf20Sopenharmony_ci __IXGBE_RX_RSC_ENABLED, 2748c2ecf20Sopenharmony_ci __IXGBE_RX_CSUM_UDP_ZERO_ERR, 2758c2ecf20Sopenharmony_ci __IXGBE_RX_FCOE, 2768c2ecf20Sopenharmony_ci __IXGBE_TX_FDIR_INIT_DONE, 2778c2ecf20Sopenharmony_ci __IXGBE_TX_XPS_INIT_DONE, 2788c2ecf20Sopenharmony_ci __IXGBE_TX_DETECT_HANG, 2798c2ecf20Sopenharmony_ci __IXGBE_HANG_CHECK_ARMED, 2808c2ecf20Sopenharmony_ci __IXGBE_TX_XDP_RING, 2818c2ecf20Sopenharmony_ci __IXGBE_TX_DISABLED, 2828c2ecf20Sopenharmony_ci}; 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci#define ring_uses_build_skb(ring) \ 2858c2ecf20Sopenharmony_ci test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state) 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistruct ixgbe_fwd_adapter { 2888c2ecf20Sopenharmony_ci unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 2898c2ecf20Sopenharmony_ci struct net_device *netdev; 2908c2ecf20Sopenharmony_ci unsigned int tx_base_queue; 2918c2ecf20Sopenharmony_ci unsigned int rx_base_queue; 2928c2ecf20Sopenharmony_ci int pool; 2938c2ecf20Sopenharmony_ci}; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#define check_for_tx_hang(ring) \ 2968c2ecf20Sopenharmony_ci test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 2978c2ecf20Sopenharmony_ci#define set_check_for_tx_hang(ring) \ 2988c2ecf20Sopenharmony_ci set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 2998c2ecf20Sopenharmony_ci#define clear_check_for_tx_hang(ring) \ 3008c2ecf20Sopenharmony_ci clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) 3018c2ecf20Sopenharmony_ci#define ring_is_rsc_enabled(ring) \ 3028c2ecf20Sopenharmony_ci test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 3038c2ecf20Sopenharmony_ci#define set_ring_rsc_enabled(ring) \ 3048c2ecf20Sopenharmony_ci set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 3058c2ecf20Sopenharmony_ci#define clear_ring_rsc_enabled(ring) \ 3068c2ecf20Sopenharmony_ci clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) 3078c2ecf20Sopenharmony_ci#define ring_is_xdp(ring) \ 3088c2ecf20Sopenharmony_ci test_bit(__IXGBE_TX_XDP_RING, &(ring)->state) 3098c2ecf20Sopenharmony_ci#define set_ring_xdp(ring) \ 3108c2ecf20Sopenharmony_ci set_bit(__IXGBE_TX_XDP_RING, &(ring)->state) 3118c2ecf20Sopenharmony_ci#define clear_ring_xdp(ring) \ 3128c2ecf20Sopenharmony_ci clear_bit(__IXGBE_TX_XDP_RING, &(ring)->state) 3138c2ecf20Sopenharmony_cistruct ixgbe_ring { 3148c2ecf20Sopenharmony_ci struct ixgbe_ring *next; /* pointer to next ring in q_vector */ 3158c2ecf20Sopenharmony_ci struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */ 3168c2ecf20Sopenharmony_ci struct net_device *netdev; /* netdev ring belongs to */ 3178c2ecf20Sopenharmony_ci struct bpf_prog *xdp_prog; 3188c2ecf20Sopenharmony_ci struct device *dev; /* device for DMA mapping */ 3198c2ecf20Sopenharmony_ci void *desc; /* descriptor ring memory */ 3208c2ecf20Sopenharmony_ci union { 3218c2ecf20Sopenharmony_ci struct ixgbe_tx_buffer *tx_buffer_info; 3228c2ecf20Sopenharmony_ci struct ixgbe_rx_buffer *rx_buffer_info; 3238c2ecf20Sopenharmony_ci }; 3248c2ecf20Sopenharmony_ci unsigned long state; 3258c2ecf20Sopenharmony_ci u8 __iomem *tail; 3268c2ecf20Sopenharmony_ci dma_addr_t dma; /* phys. address of descriptor ring */ 3278c2ecf20Sopenharmony_ci unsigned int size; /* length in bytes */ 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci u16 count; /* amount of descriptors */ 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci u8 queue_index; /* needed for multiqueue queue management */ 3328c2ecf20Sopenharmony_ci u8 reg_idx; /* holds the special value that gets 3338c2ecf20Sopenharmony_ci * the hardware register offset 3348c2ecf20Sopenharmony_ci * associated with this ring, which is 3358c2ecf20Sopenharmony_ci * different for DCB and RSS modes 3368c2ecf20Sopenharmony_ci */ 3378c2ecf20Sopenharmony_ci u16 next_to_use; 3388c2ecf20Sopenharmony_ci u16 next_to_clean; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci unsigned long last_rx_timestamp; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci union { 3438c2ecf20Sopenharmony_ci u16 next_to_alloc; 3448c2ecf20Sopenharmony_ci struct { 3458c2ecf20Sopenharmony_ci u8 atr_sample_rate; 3468c2ecf20Sopenharmony_ci u8 atr_count; 3478c2ecf20Sopenharmony_ci }; 3488c2ecf20Sopenharmony_ci }; 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci u8 dcb_tc; 3518c2ecf20Sopenharmony_ci struct ixgbe_queue_stats stats; 3528c2ecf20Sopenharmony_ci struct u64_stats_sync syncp; 3538c2ecf20Sopenharmony_ci union { 3548c2ecf20Sopenharmony_ci struct ixgbe_tx_queue_stats tx_stats; 3558c2ecf20Sopenharmony_ci struct ixgbe_rx_queue_stats rx_stats; 3568c2ecf20Sopenharmony_ci }; 3578c2ecf20Sopenharmony_ci struct xdp_rxq_info xdp_rxq; 3588c2ecf20Sopenharmony_ci struct xsk_buff_pool *xsk_pool; 3598c2ecf20Sopenharmony_ci u16 ring_idx; /* {rx,tx,xdp}_ring back reference idx */ 3608c2ecf20Sopenharmony_ci u16 rx_buf_len; 3618c2ecf20Sopenharmony_ci} ____cacheline_internodealigned_in_smp; 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_cienum ixgbe_ring_f_enum { 3648c2ecf20Sopenharmony_ci RING_F_NONE = 0, 3658c2ecf20Sopenharmony_ci RING_F_VMDQ, /* SR-IOV uses the same ring feature */ 3668c2ecf20Sopenharmony_ci RING_F_RSS, 3678c2ecf20Sopenharmony_ci RING_F_FDIR, 3688c2ecf20Sopenharmony_ci#ifdef IXGBE_FCOE 3698c2ecf20Sopenharmony_ci RING_F_FCOE, 3708c2ecf20Sopenharmony_ci#endif /* IXGBE_FCOE */ 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci RING_F_ARRAY_SIZE /* must be last in enum set */ 3738c2ecf20Sopenharmony_ci}; 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ci#define IXGBE_MAX_RSS_INDICES 16 3768c2ecf20Sopenharmony_ci#define IXGBE_MAX_RSS_INDICES_X550 63 3778c2ecf20Sopenharmony_ci#define IXGBE_MAX_VMDQ_INDICES 64 3788c2ecf20Sopenharmony_ci#define IXGBE_MAX_FDIR_INDICES 63 /* based on q_vector limit */ 3798c2ecf20Sopenharmony_ci#define IXGBE_MAX_FCOE_INDICES 8 3808c2ecf20Sopenharmony_ci#define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 3818c2ecf20Sopenharmony_ci#define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 3828c2ecf20Sopenharmony_ci#define MAX_XDP_QUEUES (IXGBE_MAX_FDIR_INDICES + 1) 3838c2ecf20Sopenharmony_ci#define IXGBE_MAX_L2A_QUEUES 4 3848c2ecf20Sopenharmony_ci#define IXGBE_BAD_L2A_QUEUE 3 3858c2ecf20Sopenharmony_ci#define IXGBE_MAX_MACVLANS 63 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_cistruct ixgbe_ring_feature { 3888c2ecf20Sopenharmony_ci u16 limit; /* upper limit on feature indices */ 3898c2ecf20Sopenharmony_ci u16 indices; /* current value of indices */ 3908c2ecf20Sopenharmony_ci u16 mask; /* Mask used for feature to ring mapping */ 3918c2ecf20Sopenharmony_ci u16 offset; /* offset to start of feature */ 3928c2ecf20Sopenharmony_ci} ____cacheline_internodealigned_in_smp; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci#define IXGBE_82599_VMDQ_8Q_MASK 0x78 3958c2ecf20Sopenharmony_ci#define IXGBE_82599_VMDQ_4Q_MASK 0x7C 3968c2ecf20Sopenharmony_ci#define IXGBE_82599_VMDQ_2Q_MASK 0x7E 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci/* 3998c2ecf20Sopenharmony_ci * FCoE requires that all Rx buffers be over 2200 bytes in length. Since 4008c2ecf20Sopenharmony_ci * this is twice the size of a half page we need to double the page order 4018c2ecf20Sopenharmony_ci * for FCoE enabled Rx queues. 4028c2ecf20Sopenharmony_ci */ 4038c2ecf20Sopenharmony_cistatic inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring) 4048c2ecf20Sopenharmony_ci{ 4058c2ecf20Sopenharmony_ci if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state)) 4068c2ecf20Sopenharmony_ci return IXGBE_RXBUFFER_3K; 4078c2ecf20Sopenharmony_ci#if (PAGE_SIZE < 8192) 4088c2ecf20Sopenharmony_ci if (ring_uses_build_skb(ring)) 4098c2ecf20Sopenharmony_ci return IXGBE_MAX_2K_FRAME_BUILD_SKB; 4108c2ecf20Sopenharmony_ci#endif 4118c2ecf20Sopenharmony_ci return IXGBE_RXBUFFER_2K; 4128c2ecf20Sopenharmony_ci} 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_cistatic inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) 4158c2ecf20Sopenharmony_ci{ 4168c2ecf20Sopenharmony_ci#if (PAGE_SIZE < 8192) 4178c2ecf20Sopenharmony_ci if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state)) 4188c2ecf20Sopenharmony_ci return 1; 4198c2ecf20Sopenharmony_ci#endif 4208c2ecf20Sopenharmony_ci return 0; 4218c2ecf20Sopenharmony_ci} 4228c2ecf20Sopenharmony_ci#define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring)) 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci#define IXGBE_ITR_ADAPTIVE_MIN_INC 2 4258c2ecf20Sopenharmony_ci#define IXGBE_ITR_ADAPTIVE_MIN_USECS 10 4268c2ecf20Sopenharmony_ci#define IXGBE_ITR_ADAPTIVE_MAX_USECS 126 4278c2ecf20Sopenharmony_ci#define IXGBE_ITR_ADAPTIVE_LATENCY 0x80 4288c2ecf20Sopenharmony_ci#define IXGBE_ITR_ADAPTIVE_BULK 0x00 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_cistruct ixgbe_ring_container { 4318c2ecf20Sopenharmony_ci struct ixgbe_ring *ring; /* pointer to linked list of rings */ 4328c2ecf20Sopenharmony_ci unsigned long next_update; /* jiffies value of last update */ 4338c2ecf20Sopenharmony_ci unsigned int total_bytes; /* total bytes processed this int */ 4348c2ecf20Sopenharmony_ci unsigned int total_packets; /* total packets processed this int */ 4358c2ecf20Sopenharmony_ci u16 work_limit; /* total work allowed per interrupt */ 4368c2ecf20Sopenharmony_ci u8 count; /* total number of rings in vector */ 4378c2ecf20Sopenharmony_ci u8 itr; /* current ITR setting for ring */ 4388c2ecf20Sopenharmony_ci}; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci/* iterator for handling rings in ring container */ 4418c2ecf20Sopenharmony_ci#define ixgbe_for_each_ring(pos, head) \ 4428c2ecf20Sopenharmony_ci for (pos = (head).ring; pos != NULL; pos = pos->next) 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci#define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \ 4458c2ecf20Sopenharmony_ci ? 8 : 1) 4468c2ecf20Sopenharmony_ci#define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ci/* MAX_Q_VECTORS of these are allocated, 4498c2ecf20Sopenharmony_ci * but we only use one per queue-specific vector. 4508c2ecf20Sopenharmony_ci */ 4518c2ecf20Sopenharmony_cistruct ixgbe_q_vector { 4528c2ecf20Sopenharmony_ci struct ixgbe_adapter *adapter; 4538c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_DCA 4548c2ecf20Sopenharmony_ci int cpu; /* CPU for DCA */ 4558c2ecf20Sopenharmony_ci#endif 4568c2ecf20Sopenharmony_ci u16 v_idx; /* index of q_vector within array, also used for 4578c2ecf20Sopenharmony_ci * finding the bit in EICR and friends that 4588c2ecf20Sopenharmony_ci * represents the vector for this ring */ 4598c2ecf20Sopenharmony_ci u16 itr; /* Interrupt throttle rate written to EITR */ 4608c2ecf20Sopenharmony_ci struct ixgbe_ring_container rx, tx; 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_ci struct napi_struct napi; 4638c2ecf20Sopenharmony_ci cpumask_t affinity_mask; 4648c2ecf20Sopenharmony_ci int numa_node; 4658c2ecf20Sopenharmony_ci struct rcu_head rcu; /* to avoid race with update stats on free */ 4668c2ecf20Sopenharmony_ci char name[IFNAMSIZ + 9]; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci /* for dynamic allocation of rings associated with this q_vector */ 4698c2ecf20Sopenharmony_ci struct ixgbe_ring ring[] ____cacheline_internodealigned_in_smp; 4708c2ecf20Sopenharmony_ci}; 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_HWMON 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ci#define IXGBE_HWMON_TYPE_LOC 0 4758c2ecf20Sopenharmony_ci#define IXGBE_HWMON_TYPE_TEMP 1 4768c2ecf20Sopenharmony_ci#define IXGBE_HWMON_TYPE_CAUTION 2 4778c2ecf20Sopenharmony_ci#define IXGBE_HWMON_TYPE_MAX 3 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_cistruct hwmon_attr { 4808c2ecf20Sopenharmony_ci struct device_attribute dev_attr; 4818c2ecf20Sopenharmony_ci struct ixgbe_hw *hw; 4828c2ecf20Sopenharmony_ci struct ixgbe_thermal_diode_data *sensor; 4838c2ecf20Sopenharmony_ci char name[12]; 4848c2ecf20Sopenharmony_ci}; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_cistruct hwmon_buff { 4878c2ecf20Sopenharmony_ci struct attribute_group group; 4888c2ecf20Sopenharmony_ci const struct attribute_group *groups[2]; 4898c2ecf20Sopenharmony_ci struct attribute *attrs[IXGBE_MAX_SENSORS * 4 + 1]; 4908c2ecf20Sopenharmony_ci struct hwmon_attr hwmon_list[IXGBE_MAX_SENSORS * 4]; 4918c2ecf20Sopenharmony_ci unsigned int n_hwmon; 4928c2ecf20Sopenharmony_ci}; 4938c2ecf20Sopenharmony_ci#endif /* CONFIG_IXGBE_HWMON */ 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ci/* 4968c2ecf20Sopenharmony_ci * microsecond values for various ITR rates shifted by 2 to fit itr register 4978c2ecf20Sopenharmony_ci * with the first 3 bits reserved 0 4988c2ecf20Sopenharmony_ci */ 4998c2ecf20Sopenharmony_ci#define IXGBE_MIN_RSC_ITR 24 5008c2ecf20Sopenharmony_ci#define IXGBE_100K_ITR 40 5018c2ecf20Sopenharmony_ci#define IXGBE_20K_ITR 200 5028c2ecf20Sopenharmony_ci#define IXGBE_12K_ITR 336 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci/* ixgbe_test_staterr - tests bits in Rx descriptor status and error fields */ 5058c2ecf20Sopenharmony_cistatic inline __le32 ixgbe_test_staterr(union ixgbe_adv_rx_desc *rx_desc, 5068c2ecf20Sopenharmony_ci const u32 stat_err_bits) 5078c2ecf20Sopenharmony_ci{ 5088c2ecf20Sopenharmony_ci return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); 5098c2ecf20Sopenharmony_ci} 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_cistatic inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring) 5128c2ecf20Sopenharmony_ci{ 5138c2ecf20Sopenharmony_ci u16 ntc = ring->next_to_clean; 5148c2ecf20Sopenharmony_ci u16 ntu = ring->next_to_use; 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_ci return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; 5178c2ecf20Sopenharmony_ci} 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci#define IXGBE_RX_DESC(R, i) \ 5208c2ecf20Sopenharmony_ci (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) 5218c2ecf20Sopenharmony_ci#define IXGBE_TX_DESC(R, i) \ 5228c2ecf20Sopenharmony_ci (&(((union ixgbe_adv_tx_desc *)((R)->desc))[i])) 5238c2ecf20Sopenharmony_ci#define IXGBE_TX_CTXTDESC(R, i) \ 5248c2ecf20Sopenharmony_ci (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i])) 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci#define IXGBE_MAX_JUMBO_FRAME_SIZE 9728 /* Maximum Supported Size 9.5KB */ 5278c2ecf20Sopenharmony_ci#ifdef IXGBE_FCOE 5288c2ecf20Sopenharmony_ci/* Use 3K as the baby jumbo frame size for FCoE */ 5298c2ecf20Sopenharmony_ci#define IXGBE_FCOE_JUMBO_FRAME_SIZE 3072 5308c2ecf20Sopenharmony_ci#endif /* IXGBE_FCOE */ 5318c2ecf20Sopenharmony_ci 5328c2ecf20Sopenharmony_ci#define OTHER_VECTOR 1 5338c2ecf20Sopenharmony_ci#define NON_Q_VECTORS (OTHER_VECTOR) 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_ci#define MAX_MSIX_VECTORS_82599 64 5368c2ecf20Sopenharmony_ci#define MAX_Q_VECTORS_82599 64 5378c2ecf20Sopenharmony_ci#define MAX_MSIX_VECTORS_82598 18 5388c2ecf20Sopenharmony_ci#define MAX_Q_VECTORS_82598 16 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_cistruct ixgbe_mac_addr { 5418c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; 5428c2ecf20Sopenharmony_ci u16 pool; 5438c2ecf20Sopenharmony_ci u16 state; /* bitmask */ 5448c2ecf20Sopenharmony_ci}; 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_ci#define IXGBE_MAC_STATE_DEFAULT 0x1 5478c2ecf20Sopenharmony_ci#define IXGBE_MAC_STATE_MODIFIED 0x2 5488c2ecf20Sopenharmony_ci#define IXGBE_MAC_STATE_IN_USE 0x4 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci#define MAX_Q_VECTORS MAX_Q_VECTORS_82599 5518c2ecf20Sopenharmony_ci#define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_ci#define MIN_MSIX_Q_VECTORS 1 5548c2ecf20Sopenharmony_ci#define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS) 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci/* default to trying for four seconds */ 5578c2ecf20Sopenharmony_ci#define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) 5588c2ecf20Sopenharmony_ci#define IXGBE_SFP_POLL_JIFFIES (2 * HZ) /* SFP poll every 2 seconds */ 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci#define IXGBE_PRIMARY_ABORT_LIMIT 5 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci/* board specific private data structure */ 5638c2ecf20Sopenharmony_cistruct ixgbe_adapter { 5648c2ecf20Sopenharmony_ci unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 5658c2ecf20Sopenharmony_ci /* OS defined structs */ 5668c2ecf20Sopenharmony_ci struct net_device *netdev; 5678c2ecf20Sopenharmony_ci struct bpf_prog *xdp_prog; 5688c2ecf20Sopenharmony_ci struct pci_dev *pdev; 5698c2ecf20Sopenharmony_ci struct mii_bus *mii_bus; 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci unsigned long state; 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci /* Some features need tri-state capability, 5748c2ecf20Sopenharmony_ci * thus the additional *_CAPABLE flags. 5758c2ecf20Sopenharmony_ci */ 5768c2ecf20Sopenharmony_ci u32 flags; 5778c2ecf20Sopenharmony_ci#define IXGBE_FLAG_MSI_ENABLED BIT(1) 5788c2ecf20Sopenharmony_ci#define IXGBE_FLAG_MSIX_ENABLED BIT(3) 5798c2ecf20Sopenharmony_ci#define IXGBE_FLAG_RX_1BUF_CAPABLE BIT(4) 5808c2ecf20Sopenharmony_ci#define IXGBE_FLAG_RX_PS_CAPABLE BIT(5) 5818c2ecf20Sopenharmony_ci#define IXGBE_FLAG_RX_PS_ENABLED BIT(6) 5828c2ecf20Sopenharmony_ci#define IXGBE_FLAG_DCA_ENABLED BIT(8) 5838c2ecf20Sopenharmony_ci#define IXGBE_FLAG_DCA_CAPABLE BIT(9) 5848c2ecf20Sopenharmony_ci#define IXGBE_FLAG_IMIR_ENABLED BIT(10) 5858c2ecf20Sopenharmony_ci#define IXGBE_FLAG_MQ_CAPABLE BIT(11) 5868c2ecf20Sopenharmony_ci#define IXGBE_FLAG_DCB_ENABLED BIT(12) 5878c2ecf20Sopenharmony_ci#define IXGBE_FLAG_VMDQ_CAPABLE BIT(13) 5888c2ecf20Sopenharmony_ci#define IXGBE_FLAG_VMDQ_ENABLED BIT(14) 5898c2ecf20Sopenharmony_ci#define IXGBE_FLAG_FAN_FAIL_CAPABLE BIT(15) 5908c2ecf20Sopenharmony_ci#define IXGBE_FLAG_NEED_LINK_UPDATE BIT(16) 5918c2ecf20Sopenharmony_ci#define IXGBE_FLAG_NEED_LINK_CONFIG BIT(17) 5928c2ecf20Sopenharmony_ci#define IXGBE_FLAG_FDIR_HASH_CAPABLE BIT(18) 5938c2ecf20Sopenharmony_ci#define IXGBE_FLAG_FDIR_PERFECT_CAPABLE BIT(19) 5948c2ecf20Sopenharmony_ci#define IXGBE_FLAG_FCOE_CAPABLE BIT(20) 5958c2ecf20Sopenharmony_ci#define IXGBE_FLAG_FCOE_ENABLED BIT(21) 5968c2ecf20Sopenharmony_ci#define IXGBE_FLAG_SRIOV_CAPABLE BIT(22) 5978c2ecf20Sopenharmony_ci#define IXGBE_FLAG_SRIOV_ENABLED BIT(23) 5988c2ecf20Sopenharmony_ci#define IXGBE_FLAG_RX_HWTSTAMP_ENABLED BIT(25) 5998c2ecf20Sopenharmony_ci#define IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER BIT(26) 6008c2ecf20Sopenharmony_ci#define IXGBE_FLAG_DCB_CAPABLE BIT(27) 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci u32 flags2; 6038c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_RSC_CAPABLE BIT(0) 6048c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_RSC_ENABLED BIT(1) 6058c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE BIT(2) 6068c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_TEMP_SENSOR_EVENT BIT(3) 6078c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_SEARCH_FOR_SFP BIT(4) 6088c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_SFP_NEEDS_RESET BIT(5) 6098c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_FDIR_REQUIRES_REINIT BIT(7) 6108c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP BIT(8) 6118c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP BIT(9) 6128c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_PTP_PPS_ENABLED BIT(10) 6138c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_PHY_INTERRUPT BIT(11) 6148c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_VLAN_PROMISC BIT(13) 6158c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_EEE_CAPABLE BIT(14) 6168c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_EEE_ENABLED BIT(15) 6178c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_RX_LEGACY BIT(16) 6188c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_IPSEC_ENABLED BIT(17) 6198c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_VF_IPSEC_ENABLED BIT(18) 6208c2ecf20Sopenharmony_ci#define IXGBE_FLAG2_AUTO_DISABLE_VF BIT(19) 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci /* Tx fast path data */ 6238c2ecf20Sopenharmony_ci int num_tx_queues; 6248c2ecf20Sopenharmony_ci u16 tx_itr_setting; 6258c2ecf20Sopenharmony_ci u16 tx_work_limit; 6268c2ecf20Sopenharmony_ci u64 tx_ipsec; 6278c2ecf20Sopenharmony_ci 6288c2ecf20Sopenharmony_ci /* Rx fast path data */ 6298c2ecf20Sopenharmony_ci int num_rx_queues; 6308c2ecf20Sopenharmony_ci u16 rx_itr_setting; 6318c2ecf20Sopenharmony_ci u64 rx_ipsec; 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci /* Port number used to identify VXLAN traffic */ 6348c2ecf20Sopenharmony_ci __be16 vxlan_port; 6358c2ecf20Sopenharmony_ci __be16 geneve_port; 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_ci /* XDP */ 6388c2ecf20Sopenharmony_ci int num_xdp_queues; 6398c2ecf20Sopenharmony_ci struct ixgbe_ring *xdp_ring[MAX_XDP_QUEUES]; 6408c2ecf20Sopenharmony_ci unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled rings */ 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_ci /* TX */ 6438c2ecf20Sopenharmony_ci struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp; 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci u64 restart_queue; 6468c2ecf20Sopenharmony_ci u64 lsc_int; 6478c2ecf20Sopenharmony_ci u32 tx_timeout_count; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci /* RX */ 6508c2ecf20Sopenharmony_ci struct ixgbe_ring *rx_ring[MAX_RX_QUEUES]; 6518c2ecf20Sopenharmony_ci int num_rx_pools; /* == num_rx_queues in 82598 */ 6528c2ecf20Sopenharmony_ci int num_rx_queues_per_pool; /* 1 if 82598, can be many if 82599 */ 6538c2ecf20Sopenharmony_ci u64 hw_csum_rx_error; 6548c2ecf20Sopenharmony_ci u64 hw_rx_no_dma_resources; 6558c2ecf20Sopenharmony_ci u64 rsc_total_count; 6568c2ecf20Sopenharmony_ci u64 rsc_total_flush; 6578c2ecf20Sopenharmony_ci u64 non_eop_descs; 6588c2ecf20Sopenharmony_ci u32 alloc_rx_page; 6598c2ecf20Sopenharmony_ci u32 alloc_rx_page_failed; 6608c2ecf20Sopenharmony_ci u32 alloc_rx_buff_failed; 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_ci struct ixgbe_q_vector *q_vector[MAX_Q_VECTORS]; 6638c2ecf20Sopenharmony_ci 6648c2ecf20Sopenharmony_ci /* DCB parameters */ 6658c2ecf20Sopenharmony_ci struct ieee_pfc *ixgbe_ieee_pfc; 6668c2ecf20Sopenharmony_ci struct ieee_ets *ixgbe_ieee_ets; 6678c2ecf20Sopenharmony_ci struct ixgbe_dcb_config dcb_cfg; 6688c2ecf20Sopenharmony_ci struct ixgbe_dcb_config temp_dcb_cfg; 6698c2ecf20Sopenharmony_ci u8 hw_tcs; 6708c2ecf20Sopenharmony_ci u8 dcb_set_bitmap; 6718c2ecf20Sopenharmony_ci u8 dcbx_cap; 6728c2ecf20Sopenharmony_ci enum ixgbe_fc_mode last_lfc_mode; 6738c2ecf20Sopenharmony_ci 6748c2ecf20Sopenharmony_ci int num_q_vectors; /* current number of q_vectors for device */ 6758c2ecf20Sopenharmony_ci int max_q_vectors; /* true count of q_vectors for device */ 6768c2ecf20Sopenharmony_ci struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE]; 6778c2ecf20Sopenharmony_ci struct msix_entry *msix_entries; 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci u32 test_icr; 6808c2ecf20Sopenharmony_ci struct ixgbe_ring test_tx_ring; 6818c2ecf20Sopenharmony_ci struct ixgbe_ring test_rx_ring; 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci /* structs defined in ixgbe_hw.h */ 6848c2ecf20Sopenharmony_ci struct ixgbe_hw hw; 6858c2ecf20Sopenharmony_ci u16 msg_enable; 6868c2ecf20Sopenharmony_ci struct ixgbe_hw_stats stats; 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci u64 tx_busy; 6898c2ecf20Sopenharmony_ci unsigned int tx_ring_count; 6908c2ecf20Sopenharmony_ci unsigned int xdp_ring_count; 6918c2ecf20Sopenharmony_ci unsigned int rx_ring_count; 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci u32 link_speed; 6948c2ecf20Sopenharmony_ci bool link_up; 6958c2ecf20Sopenharmony_ci unsigned long sfp_poll_time; 6968c2ecf20Sopenharmony_ci unsigned long link_check_timeout; 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_ci struct timer_list service_timer; 6998c2ecf20Sopenharmony_ci struct work_struct service_task; 7008c2ecf20Sopenharmony_ci 7018c2ecf20Sopenharmony_ci struct hlist_head fdir_filter_list; 7028c2ecf20Sopenharmony_ci unsigned long fdir_overflow; /* number of times ATR was backed off */ 7038c2ecf20Sopenharmony_ci union ixgbe_atr_input fdir_mask; 7048c2ecf20Sopenharmony_ci int fdir_filter_count; 7058c2ecf20Sopenharmony_ci u32 fdir_pballoc; 7068c2ecf20Sopenharmony_ci u32 atr_sample_rate; 7078c2ecf20Sopenharmony_ci spinlock_t fdir_perfect_lock; 7088c2ecf20Sopenharmony_ci 7098c2ecf20Sopenharmony_ci#ifdef IXGBE_FCOE 7108c2ecf20Sopenharmony_ci struct ixgbe_fcoe fcoe; 7118c2ecf20Sopenharmony_ci#endif /* IXGBE_FCOE */ 7128c2ecf20Sopenharmony_ci u8 __iomem *io_addr; /* Mainly for iounmap use */ 7138c2ecf20Sopenharmony_ci u32 wol; 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci u16 bridge_mode; 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_ci char eeprom_id[NVM_VER_SIZE]; 7188c2ecf20Sopenharmony_ci u16 eeprom_cap; 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci u32 interrupt_event; 7218c2ecf20Sopenharmony_ci u32 led_reg; 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci struct ptp_clock *ptp_clock; 7248c2ecf20Sopenharmony_ci struct ptp_clock_info ptp_caps; 7258c2ecf20Sopenharmony_ci struct work_struct ptp_tx_work; 7268c2ecf20Sopenharmony_ci struct sk_buff *ptp_tx_skb; 7278c2ecf20Sopenharmony_ci struct hwtstamp_config tstamp_config; 7288c2ecf20Sopenharmony_ci unsigned long ptp_tx_start; 7298c2ecf20Sopenharmony_ci unsigned long last_overflow_check; 7308c2ecf20Sopenharmony_ci unsigned long last_rx_ptp_check; 7318c2ecf20Sopenharmony_ci unsigned long last_rx_timestamp; 7328c2ecf20Sopenharmony_ci spinlock_t tmreg_lock; 7338c2ecf20Sopenharmony_ci struct cyclecounter hw_cc; 7348c2ecf20Sopenharmony_ci struct timecounter hw_tc; 7358c2ecf20Sopenharmony_ci u32 base_incval; 7368c2ecf20Sopenharmony_ci u32 tx_hwtstamp_timeouts; 7378c2ecf20Sopenharmony_ci u32 tx_hwtstamp_skipped; 7388c2ecf20Sopenharmony_ci u32 rx_hwtstamp_cleared; 7398c2ecf20Sopenharmony_ci void (*ptp_setup_sdp)(struct ixgbe_adapter *); 7408c2ecf20Sopenharmony_ci 7418c2ecf20Sopenharmony_ci /* SR-IOV */ 7428c2ecf20Sopenharmony_ci DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); 7438c2ecf20Sopenharmony_ci unsigned int num_vfs; 7448c2ecf20Sopenharmony_ci struct vf_data_storage *vfinfo; 7458c2ecf20Sopenharmony_ci int vf_rate_link_speed; 7468c2ecf20Sopenharmony_ci struct vf_macvlans vf_mvs; 7478c2ecf20Sopenharmony_ci struct vf_macvlans *mv_list; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_ci u32 timer_event_accumulator; 7508c2ecf20Sopenharmony_ci u32 vferr_refcount; 7518c2ecf20Sopenharmony_ci struct ixgbe_mac_addr *mac_table; 7528c2ecf20Sopenharmony_ci struct kobject *info_kobj; 7538c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_HWMON 7548c2ecf20Sopenharmony_ci struct hwmon_buff *ixgbe_hwmon_buff; 7558c2ecf20Sopenharmony_ci#endif /* CONFIG_IXGBE_HWMON */ 7568c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS 7578c2ecf20Sopenharmony_ci struct dentry *ixgbe_dbg_adapter; 7588c2ecf20Sopenharmony_ci#endif /*CONFIG_DEBUG_FS*/ 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci u8 default_up; 7618c2ecf20Sopenharmony_ci /* Bitmask indicating in use pools */ 7628c2ecf20Sopenharmony_ci DECLARE_BITMAP(fwd_bitmask, IXGBE_MAX_MACVLANS + 1); 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_ci#define IXGBE_MAX_LINK_HANDLE 10 7658c2ecf20Sopenharmony_ci struct ixgbe_jump_table *jump_tables[IXGBE_MAX_LINK_HANDLE]; 7668c2ecf20Sopenharmony_ci unsigned long tables; 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_ci/* maximum number of RETA entries among all devices supported by ixgbe 7698c2ecf20Sopenharmony_ci * driver: currently it's x550 device in non-SRIOV mode 7708c2ecf20Sopenharmony_ci */ 7718c2ecf20Sopenharmony_ci#define IXGBE_MAX_RETA_ENTRIES 512 7728c2ecf20Sopenharmony_ci u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES]; 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_ci#define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ 7758c2ecf20Sopenharmony_ci u32 *rss_key; 7768c2ecf20Sopenharmony_ci 7778c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_IPSEC 7788c2ecf20Sopenharmony_ci struct ixgbe_ipsec *ipsec; 7798c2ecf20Sopenharmony_ci#endif /* CONFIG_IXGBE_IPSEC */ 7808c2ecf20Sopenharmony_ci spinlock_t vfs_lock; 7818c2ecf20Sopenharmony_ci}; 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_cistatic inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter) 7848c2ecf20Sopenharmony_ci{ 7858c2ecf20Sopenharmony_ci switch (adapter->hw.mac.type) { 7868c2ecf20Sopenharmony_ci case ixgbe_mac_82598EB: 7878c2ecf20Sopenharmony_ci case ixgbe_mac_82599EB: 7888c2ecf20Sopenharmony_ci case ixgbe_mac_X540: 7898c2ecf20Sopenharmony_ci return IXGBE_MAX_RSS_INDICES; 7908c2ecf20Sopenharmony_ci case ixgbe_mac_X550: 7918c2ecf20Sopenharmony_ci case ixgbe_mac_X550EM_x: 7928c2ecf20Sopenharmony_ci case ixgbe_mac_x550em_a: 7938c2ecf20Sopenharmony_ci return IXGBE_MAX_RSS_INDICES_X550; 7948c2ecf20Sopenharmony_ci default: 7958c2ecf20Sopenharmony_ci return 0; 7968c2ecf20Sopenharmony_ci } 7978c2ecf20Sopenharmony_ci} 7988c2ecf20Sopenharmony_ci 7998c2ecf20Sopenharmony_cistruct ixgbe_fdir_filter { 8008c2ecf20Sopenharmony_ci struct hlist_node fdir_node; 8018c2ecf20Sopenharmony_ci union ixgbe_atr_input filter; 8028c2ecf20Sopenharmony_ci u16 sw_idx; 8038c2ecf20Sopenharmony_ci u64 action; 8048c2ecf20Sopenharmony_ci}; 8058c2ecf20Sopenharmony_ci 8068c2ecf20Sopenharmony_cienum ixgbe_state_t { 8078c2ecf20Sopenharmony_ci __IXGBE_TESTING, 8088c2ecf20Sopenharmony_ci __IXGBE_RESETTING, 8098c2ecf20Sopenharmony_ci __IXGBE_DOWN, 8108c2ecf20Sopenharmony_ci __IXGBE_DISABLED, 8118c2ecf20Sopenharmony_ci __IXGBE_REMOVING, 8128c2ecf20Sopenharmony_ci __IXGBE_SERVICE_SCHED, 8138c2ecf20Sopenharmony_ci __IXGBE_SERVICE_INITED, 8148c2ecf20Sopenharmony_ci __IXGBE_IN_SFP_INIT, 8158c2ecf20Sopenharmony_ci __IXGBE_PTP_RUNNING, 8168c2ecf20Sopenharmony_ci __IXGBE_PTP_TX_IN_PROGRESS, 8178c2ecf20Sopenharmony_ci __IXGBE_RESET_REQUESTED, 8188c2ecf20Sopenharmony_ci}; 8198c2ecf20Sopenharmony_ci 8208c2ecf20Sopenharmony_cistruct ixgbe_cb { 8218c2ecf20Sopenharmony_ci union { /* Union defining head/tail partner */ 8228c2ecf20Sopenharmony_ci struct sk_buff *head; 8238c2ecf20Sopenharmony_ci struct sk_buff *tail; 8248c2ecf20Sopenharmony_ci }; 8258c2ecf20Sopenharmony_ci dma_addr_t dma; 8268c2ecf20Sopenharmony_ci u16 append_cnt; 8278c2ecf20Sopenharmony_ci bool page_released; 8288c2ecf20Sopenharmony_ci}; 8298c2ecf20Sopenharmony_ci#define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb) 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_cienum ixgbe_boards { 8328c2ecf20Sopenharmony_ci board_82598, 8338c2ecf20Sopenharmony_ci board_82599, 8348c2ecf20Sopenharmony_ci board_X540, 8358c2ecf20Sopenharmony_ci board_X550, 8368c2ecf20Sopenharmony_ci board_X550EM_x, 8378c2ecf20Sopenharmony_ci board_x550em_x_fw, 8388c2ecf20Sopenharmony_ci board_x550em_a, 8398c2ecf20Sopenharmony_ci board_x550em_a_fw, 8408c2ecf20Sopenharmony_ci}; 8418c2ecf20Sopenharmony_ci 8428c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_82598_info; 8438c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_82599_info; 8448c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_X540_info; 8458c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_X550_info; 8468c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_X550EM_x_info; 8478c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_x550em_x_fw_info; 8488c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_x550em_a_info; 8498c2ecf20Sopenharmony_ciextern const struct ixgbe_info ixgbe_x550em_a_fw_info; 8508c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_DCB 8518c2ecf20Sopenharmony_ciextern const struct dcbnl_rtnl_ops ixgbe_dcbnl_ops; 8528c2ecf20Sopenharmony_ci#endif 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ciextern char ixgbe_driver_name[]; 8558c2ecf20Sopenharmony_ci#ifdef IXGBE_FCOE 8568c2ecf20Sopenharmony_ciextern char ixgbe_default_device_descr[]; 8578c2ecf20Sopenharmony_ci#endif /* IXGBE_FCOE */ 8588c2ecf20Sopenharmony_ci 8598c2ecf20Sopenharmony_ciint ixgbe_open(struct net_device *netdev); 8608c2ecf20Sopenharmony_ciint ixgbe_close(struct net_device *netdev); 8618c2ecf20Sopenharmony_civoid ixgbe_up(struct ixgbe_adapter *adapter); 8628c2ecf20Sopenharmony_civoid ixgbe_down(struct ixgbe_adapter *adapter); 8638c2ecf20Sopenharmony_civoid ixgbe_reinit_locked(struct ixgbe_adapter *adapter); 8648c2ecf20Sopenharmony_civoid ixgbe_reset(struct ixgbe_adapter *adapter); 8658c2ecf20Sopenharmony_civoid ixgbe_set_ethtool_ops(struct net_device *netdev); 8668c2ecf20Sopenharmony_ciint ixgbe_setup_rx_resources(struct ixgbe_adapter *, struct ixgbe_ring *); 8678c2ecf20Sopenharmony_ciint ixgbe_setup_tx_resources(struct ixgbe_ring *); 8688c2ecf20Sopenharmony_civoid ixgbe_free_rx_resources(struct ixgbe_ring *); 8698c2ecf20Sopenharmony_civoid ixgbe_free_tx_resources(struct ixgbe_ring *); 8708c2ecf20Sopenharmony_civoid ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); 8718c2ecf20Sopenharmony_civoid ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); 8728c2ecf20Sopenharmony_civoid ixgbe_disable_rx(struct ixgbe_adapter *adapter); 8738c2ecf20Sopenharmony_civoid ixgbe_disable_tx(struct ixgbe_adapter *adapter); 8748c2ecf20Sopenharmony_civoid ixgbe_update_stats(struct ixgbe_adapter *adapter); 8758c2ecf20Sopenharmony_ciint ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); 8768c2ecf20Sopenharmony_cibool ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, 8778c2ecf20Sopenharmony_ci u16 subdevice_id); 8788c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_IOV 8798c2ecf20Sopenharmony_civoid ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter); 8808c2ecf20Sopenharmony_ci#endif 8818c2ecf20Sopenharmony_ciint ixgbe_add_mac_filter(struct ixgbe_adapter *adapter, 8828c2ecf20Sopenharmony_ci const u8 *addr, u16 queue); 8838c2ecf20Sopenharmony_ciint ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, 8848c2ecf20Sopenharmony_ci const u8 *addr, u16 queue); 8858c2ecf20Sopenharmony_civoid ixgbe_update_pf_promisc_vlvf(struct ixgbe_adapter *adapter, u32 vid); 8868c2ecf20Sopenharmony_civoid ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); 8878c2ecf20Sopenharmony_cinetdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, struct ixgbe_adapter *, 8888c2ecf20Sopenharmony_ci struct ixgbe_ring *); 8898c2ecf20Sopenharmony_civoid ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *, 8908c2ecf20Sopenharmony_ci struct ixgbe_tx_buffer *); 8918c2ecf20Sopenharmony_civoid ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16); 8928c2ecf20Sopenharmony_civoid ixgbe_write_eitr(struct ixgbe_q_vector *); 8938c2ecf20Sopenharmony_ciint ixgbe_poll(struct napi_struct *napi, int budget); 8948c2ecf20Sopenharmony_ciint ethtool_ioctl(struct ifreq *ifr); 8958c2ecf20Sopenharmony_cis32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw); 8968c2ecf20Sopenharmony_cis32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl); 8978c2ecf20Sopenharmony_cis32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl); 8988c2ecf20Sopenharmony_cis32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, 8998c2ecf20Sopenharmony_ci union ixgbe_atr_hash_dword input, 9008c2ecf20Sopenharmony_ci union ixgbe_atr_hash_dword common, 9018c2ecf20Sopenharmony_ci u8 queue); 9028c2ecf20Sopenharmony_cis32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, 9038c2ecf20Sopenharmony_ci union ixgbe_atr_input *input_mask); 9048c2ecf20Sopenharmony_cis32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, 9058c2ecf20Sopenharmony_ci union ixgbe_atr_input *input, 9068c2ecf20Sopenharmony_ci u16 soft_id, u8 queue); 9078c2ecf20Sopenharmony_cis32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, 9088c2ecf20Sopenharmony_ci union ixgbe_atr_input *input, 9098c2ecf20Sopenharmony_ci u16 soft_id); 9108c2ecf20Sopenharmony_civoid ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, 9118c2ecf20Sopenharmony_ci union ixgbe_atr_input *mask); 9128c2ecf20Sopenharmony_ciint ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter, 9138c2ecf20Sopenharmony_ci struct ixgbe_fdir_filter *input, 9148c2ecf20Sopenharmony_ci u16 sw_idx); 9158c2ecf20Sopenharmony_civoid ixgbe_set_rx_mode(struct net_device *netdev); 9168c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_DCB 9178c2ecf20Sopenharmony_civoid ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter); 9188c2ecf20Sopenharmony_ci#endif 9198c2ecf20Sopenharmony_ciint ixgbe_setup_tc(struct net_device *dev, u8 tc); 9208c2ecf20Sopenharmony_civoid ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); 9218c2ecf20Sopenharmony_civoid ixgbe_do_reset(struct net_device *netdev); 9228c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_HWMON 9238c2ecf20Sopenharmony_civoid ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); 9248c2ecf20Sopenharmony_ciint ixgbe_sysfs_init(struct ixgbe_adapter *adapter); 9258c2ecf20Sopenharmony_ci#endif /* CONFIG_IXGBE_HWMON */ 9268c2ecf20Sopenharmony_ci#ifdef IXGBE_FCOE 9278c2ecf20Sopenharmony_civoid ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); 9288c2ecf20Sopenharmony_ciint ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first, 9298c2ecf20Sopenharmony_ci u8 *hdr_len); 9308c2ecf20Sopenharmony_ciint ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, 9318c2ecf20Sopenharmony_ci union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb); 9328c2ecf20Sopenharmony_ciint ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, 9338c2ecf20Sopenharmony_ci struct scatterlist *sgl, unsigned int sgc); 9348c2ecf20Sopenharmony_ciint ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid, 9358c2ecf20Sopenharmony_ci struct scatterlist *sgl, unsigned int sgc); 9368c2ecf20Sopenharmony_ciint ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); 9378c2ecf20Sopenharmony_ciint ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter); 9388c2ecf20Sopenharmony_civoid ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter); 9398c2ecf20Sopenharmony_ciint ixgbe_fcoe_enable(struct net_device *netdev); 9408c2ecf20Sopenharmony_ciint ixgbe_fcoe_disable(struct net_device *netdev); 9418c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_DCB 9428c2ecf20Sopenharmony_ciu8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter); 9438c2ecf20Sopenharmony_ciu8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); 9448c2ecf20Sopenharmony_ci#endif /* CONFIG_IXGBE_DCB */ 9458c2ecf20Sopenharmony_ciint ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); 9468c2ecf20Sopenharmony_ciint ixgbe_fcoe_get_hbainfo(struct net_device *netdev, 9478c2ecf20Sopenharmony_ci struct netdev_fcoe_hbainfo *info); 9488c2ecf20Sopenharmony_ciu8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter); 9498c2ecf20Sopenharmony_ci#endif /* IXGBE_FCOE */ 9508c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS 9518c2ecf20Sopenharmony_civoid ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter); 9528c2ecf20Sopenharmony_civoid ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter); 9538c2ecf20Sopenharmony_civoid ixgbe_dbg_init(void); 9548c2ecf20Sopenharmony_civoid ixgbe_dbg_exit(void); 9558c2ecf20Sopenharmony_ci#else 9568c2ecf20Sopenharmony_cistatic inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {} 9578c2ecf20Sopenharmony_cistatic inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {} 9588c2ecf20Sopenharmony_cistatic inline void ixgbe_dbg_init(void) {} 9598c2ecf20Sopenharmony_cistatic inline void ixgbe_dbg_exit(void) {} 9608c2ecf20Sopenharmony_ci#endif /* CONFIG_DEBUG_FS */ 9618c2ecf20Sopenharmony_cistatic inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) 9628c2ecf20Sopenharmony_ci{ 9638c2ecf20Sopenharmony_ci return netdev_get_tx_queue(ring->netdev, ring->queue_index); 9648c2ecf20Sopenharmony_ci} 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_civoid ixgbe_ptp_init(struct ixgbe_adapter *adapter); 9678c2ecf20Sopenharmony_civoid ixgbe_ptp_suspend(struct ixgbe_adapter *adapter); 9688c2ecf20Sopenharmony_civoid ixgbe_ptp_stop(struct ixgbe_adapter *adapter); 9698c2ecf20Sopenharmony_civoid ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); 9708c2ecf20Sopenharmony_civoid ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); 9718c2ecf20Sopenharmony_civoid ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter); 9728c2ecf20Sopenharmony_civoid ixgbe_ptp_rx_pktstamp(struct ixgbe_q_vector *, struct sk_buff *); 9738c2ecf20Sopenharmony_civoid ixgbe_ptp_rx_rgtstamp(struct ixgbe_q_vector *, struct sk_buff *skb); 9748c2ecf20Sopenharmony_cistatic inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, 9758c2ecf20Sopenharmony_ci union ixgbe_adv_rx_desc *rx_desc, 9768c2ecf20Sopenharmony_ci struct sk_buff *skb) 9778c2ecf20Sopenharmony_ci{ 9788c2ecf20Sopenharmony_ci if (unlikely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_TSIP))) { 9798c2ecf20Sopenharmony_ci ixgbe_ptp_rx_pktstamp(rx_ring->q_vector, skb); 9808c2ecf20Sopenharmony_ci return; 9818c2ecf20Sopenharmony_ci } 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS))) 9848c2ecf20Sopenharmony_ci return; 9858c2ecf20Sopenharmony_ci 9868c2ecf20Sopenharmony_ci ixgbe_ptp_rx_rgtstamp(rx_ring->q_vector, skb); 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_ci /* Update the last_rx_timestamp timer in order to enable watchdog check 9898c2ecf20Sopenharmony_ci * for error case of latched timestamp on a dropped packet. 9908c2ecf20Sopenharmony_ci */ 9918c2ecf20Sopenharmony_ci rx_ring->last_rx_timestamp = jiffies; 9928c2ecf20Sopenharmony_ci} 9938c2ecf20Sopenharmony_ci 9948c2ecf20Sopenharmony_ciint ixgbe_ptp_set_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr); 9958c2ecf20Sopenharmony_ciint ixgbe_ptp_get_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr); 9968c2ecf20Sopenharmony_civoid ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); 9978c2ecf20Sopenharmony_civoid ixgbe_ptp_reset(struct ixgbe_adapter *adapter); 9988c2ecf20Sopenharmony_civoid ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter); 9998c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_IOV 10008c2ecf20Sopenharmony_civoid ixgbe_sriov_reinit(struct ixgbe_adapter *adapter); 10018c2ecf20Sopenharmony_ci#endif 10028c2ecf20Sopenharmony_ci 10038c2ecf20Sopenharmony_cinetdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, 10048c2ecf20Sopenharmony_ci struct ixgbe_adapter *adapter, 10058c2ecf20Sopenharmony_ci struct ixgbe_ring *tx_ring); 10068c2ecf20Sopenharmony_ciu32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter); 10078c2ecf20Sopenharmony_civoid ixgbe_store_key(struct ixgbe_adapter *adapter); 10088c2ecf20Sopenharmony_civoid ixgbe_store_reta(struct ixgbe_adapter *adapter); 10098c2ecf20Sopenharmony_cis32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg, 10108c2ecf20Sopenharmony_ci u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm); 10118c2ecf20Sopenharmony_ci#ifdef CONFIG_IXGBE_IPSEC 10128c2ecf20Sopenharmony_civoid ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter); 10138c2ecf20Sopenharmony_civoid ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter); 10148c2ecf20Sopenharmony_civoid ixgbe_ipsec_restore(struct ixgbe_adapter *adapter); 10158c2ecf20Sopenharmony_civoid ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring, 10168c2ecf20Sopenharmony_ci union ixgbe_adv_rx_desc *rx_desc, 10178c2ecf20Sopenharmony_ci struct sk_buff *skb); 10188c2ecf20Sopenharmony_ciint ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first, 10198c2ecf20Sopenharmony_ci struct ixgbe_ipsec_tx_data *itd); 10208c2ecf20Sopenharmony_civoid ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter, u32 vf); 10218c2ecf20Sopenharmony_ciint ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf); 10228c2ecf20Sopenharmony_ciint ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf); 10238c2ecf20Sopenharmony_ci#else 10248c2ecf20Sopenharmony_cistatic inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { } 10258c2ecf20Sopenharmony_cistatic inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { } 10268c2ecf20Sopenharmony_cistatic inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { } 10278c2ecf20Sopenharmony_cistatic inline void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring, 10288c2ecf20Sopenharmony_ci union ixgbe_adv_rx_desc *rx_desc, 10298c2ecf20Sopenharmony_ci struct sk_buff *skb) { } 10308c2ecf20Sopenharmony_cistatic inline int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring, 10318c2ecf20Sopenharmony_ci struct ixgbe_tx_buffer *first, 10328c2ecf20Sopenharmony_ci struct ixgbe_ipsec_tx_data *itd) { return 0; } 10338c2ecf20Sopenharmony_cistatic inline void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter, 10348c2ecf20Sopenharmony_ci u32 vf) { } 10358c2ecf20Sopenharmony_cistatic inline int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, 10368c2ecf20Sopenharmony_ci u32 *mbuf, u32 vf) { return -EACCES; } 10378c2ecf20Sopenharmony_cistatic inline int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, 10388c2ecf20Sopenharmony_ci u32 *mbuf, u32 vf) { return -EACCES; } 10398c2ecf20Sopenharmony_ci#endif /* CONFIG_IXGBE_IPSEC */ 10408c2ecf20Sopenharmony_ci 10418c2ecf20Sopenharmony_cistatic inline bool ixgbe_enabled_xdp_adapter(struct ixgbe_adapter *adapter) 10428c2ecf20Sopenharmony_ci{ 10438c2ecf20Sopenharmony_ci return !!adapter->xdp_prog; 10448c2ecf20Sopenharmony_ci} 10458c2ecf20Sopenharmony_ci 10468c2ecf20Sopenharmony_ci#endif /* _IXGBE_H_ */ 1047