linux/drivers/net/ethernet/intel/igb/igb.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2007 - 2018 Intel Corporation. */

/* Linux PRO/1000 Ethernet Driver main header file */

#ifndef _IGB_H_
#define _IGB_H_

#include "e1000_mac.h"
#include "e1000_82575.h"

#include <linux/timecounter.h>
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/bitops.h>
#include <linux/if_vlan.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/pci.h>
#include <linux/mdio.h>

#include <net/xdp.h>

struct igb_adapter;

#define E1000_PCS_CFG_IGN_SD

/* Interrupt defines */
#define IGB_START_ITR
#define IGB_4K_ITR
#define IGB_20K_ITR
#define IGB_70K_ITR

/* TX/RX descriptor defines */
#define IGB_DEFAULT_TXD
#define IGB_DEFAULT_TX_WORK
#define IGB_MIN_TXD
#define IGB_MAX_TXD

#define IGB_DEFAULT_RXD
#define IGB_MIN_RXD
#define IGB_MAX_RXD

#define IGB_DEFAULT_ITR
#define IGB_MAX_ITR_USECS
#define IGB_MIN_ITR_USECS
#define NON_Q_VECTORS
#define MAX_Q_VECTORS
#define MAX_MSIX_ENTRIES

/* Transmit and receive queues */
#define IGB_MAX_RX_QUEUES
#define IGB_MAX_RX_QUEUES_82575
#define IGB_MAX_RX_QUEUES_I211
#define IGB_MAX_TX_QUEUES
#define IGB_MAX_VF_MC_ENTRIES
#define IGB_MAX_VF_FUNCTIONS
#define IGB_MAX_VFTA_ENTRIES
#define IGB_82576_VF_DEV_ID
#define IGB_I350_VF_DEV_ID

/* NVM version defines */
#define IGB_MAJOR_MASK
#define IGB_MINOR_MASK
#define IGB_BUILD_MASK
#define IGB_COMB_VER_MASK
#define IGB_MAJOR_SHIFT
#define IGB_MINOR_SHIFT
#define IGB_COMB_VER_SHFT
#define IGB_NVM_VER_INVALID
#define IGB_ETRACK_SHIFT
#define NVM_ETRACK_WORD
#define NVM_COMB_VER_OFF
#define NVM_COMB_VER_PTR

/* Transmit and receive latency (for PTP timestamps) */
#define IGB_I210_TX_LATENCY_10
#define IGB_I210_TX_LATENCY_100
#define IGB_I210_TX_LATENCY_1000
#define IGB_I210_RX_LATENCY_10
#define IGB_I210_RX_LATENCY_100
#define IGB_I210_RX_LATENCY_1000

/* XDP */
#define IGB_XDP_PASS
#define IGB_XDP_CONSUMED
#define IGB_XDP_TX
#define IGB_XDP_REDIR

struct vf_data_storage {};

/* Number of unicast MAC filters reserved for the PF in the RAR registers */
#define IGB_PF_MAC_FILTERS_RESERVED

struct vf_mac_filter {};

#define IGB_VF_FLAG_CTS
#define IGB_VF_FLAG_UNI_PROMISC
#define IGB_VF_FLAG_MULTI_PROMISC
#define IGB_VF_FLAG_PF_SET_MAC

/* RX descriptor control thresholds.
 * PTHRESH - MAC will consider prefetch if it has fewer than this number of
 *           descriptors available in its onboard memory.
 *           Setting this to 0 disables RX descriptor prefetch.
 * HTHRESH - MAC will only prefetch if there are at least this many descriptors
 *           available in host memory.
 *           If PTHRESH is 0, this should also be 0.
 * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
 *           descriptors until either it has this many to write back, or the
 *           ITR timer expires.
 */
#define IGB_RX_PTHRESH
#define IGB_RX_HTHRESH
#define IGB_TX_PTHRESH
#define IGB_TX_HTHRESH
#define IGB_RX_WTHRESH
#define IGB_TX_WTHRESH

/* this is the size past which hardware will drop packets when setting LPE=0 */
#define MAXIMUM_ETHERNET_VLAN_SIZE

#define IGB_ETH_PKT_HDR_PAD

/* Supported Rx Buffer Sizes */
#define IGB_RXBUFFER_256
#define IGB_RXBUFFER_1536
#define IGB_RXBUFFER_2048
#define IGB_RXBUFFER_3072
#define IGB_RX_HDR_LEN
#define IGB_TS_HDR_LEN

/* Attempt to maximize the headroom available for incoming frames.  We
 * use a 2K buffer for receives and need 1536/1534 to store the data for
 * the frame.  This leaves us with 512 bytes of room.  From that we need
 * to deduct the space needed for the shared info and the padding needed
 * to IP align the frame.
 *
 * Note: For cache line sizes 256 or larger this value is going to end
 *	 up negative.  In these cases we should fall back to the 3K
 *	 buffers.
 */
#if (PAGE_SIZE < 8192)
#define IGB_MAX_FRAME_BUILD_SKB
#define IGB_2K_TOO_SMALL_WITH_PADDING

static inline int igb_compute_pad(int rx_buf_len)
{}

static inline int igb_skb_pad(void)
{}

#define IGB_SKB_PAD
#else
#define IGB_SKB_PAD
#endif

/* How many Rx Buffers do we bundle into one write to the hardware ? */
#define IGB_RX_BUFFER_WRITE

#define IGB_RX_DMA_ATTR

#define AUTO_ALL_MODES
#define IGB_EEPROM_APME

#ifndef IGB_MASTER_SLAVE
/* Switch to override PHY master/slave setting */
#define IGB_MASTER_SLAVE
#endif

#define IGB_MNG_VLAN_NONE

enum igb_tx_flags {};

/* VLAN info */
#define IGB_TX_FLAGS_VLAN_MASK
#define IGB_TX_FLAGS_VLAN_SHIFT

/* The largest size we can write to the descriptor is 65535.  In order to
 * maintain a power of two alignment we have to limit ourselves to 32K.
 */
#define IGB_MAX_TXD_PWR
#define IGB_MAX_DATA_PER_TXD

/* Tx Descriptors needed, worst case */
#define TXD_USE_COUNT(S)
#define DESC_NEEDED

/* EEPROM byte offsets */
#define IGB_SFF_8472_SWAP
#define IGB_SFF_8472_COMP

/* Bitmasks */
#define IGB_SFF_ADDRESSING_MODE
#define IGB_SFF_8472_UNSUP

/* TX resources are shared between XDP and netstack
 * and we need to tag the buffer type to distinguish them
 */
enum igb_tx_buf_type {};

/* wrapper around a pointer to a socket buffer,
 * so a DMA handle can be stored along with the buffer
 */
struct igb_tx_buffer {};

struct igb_rx_buffer {};

struct igb_tx_queue_stats {};

struct igb_rx_queue_stats {};

struct igb_ring_container {};

struct igb_ring {} ____cacheline_internodealigned_in_smp;

struct igb_q_vector {};

enum e1000_ring_flags_t {};

#define ring_uses_large_buffer(ring)
#define set_ring_uses_large_buffer(ring)
#define clear_ring_uses_large_buffer(ring)

#define ring_uses_build_skb(ring)
#define set_ring_build_skb_enabled(ring)
#define clear_ring_build_skb_enabled(ring)

static inline unsigned int igb_rx_bufsz(struct igb_ring *ring)
{}

static inline unsigned int igb_rx_pg_order(struct igb_ring *ring)
{}

#define igb_rx_pg_size(_ring)

#define IGB_TXD_DCMD

#define IGB_RX_DESC(R, i)
#define IGB_TX_DESC(R, i)
#define IGB_TX_CTXTDESC(R, i)

/* igb_test_staterr - tests bits within Rx descriptor status and error fields */
static inline __le32 igb_test_staterr(union e1000_adv_rx_desc *rx_desc,
				      const u32 stat_err_bits)
{}

/* igb_desc_unused - calculate if we have unused descriptors */
static inline int igb_desc_unused(struct igb_ring *ring)
{}

#ifdef CONFIG_IGB_HWMON

#define IGB_HWMON_TYPE_LOC
#define IGB_HWMON_TYPE_TEMP
#define IGB_HWMON_TYPE_CAUTION
#define IGB_HWMON_TYPE_MAX

struct hwmon_attr {};

struct hwmon_buff {};
#endif

/* The number of L2 ether-type filter registers, Index 3 is reserved
 * for PTP 1588 timestamp
 */
#define MAX_ETYPE_FILTER
/* ETQF filter list: one static filter per filter consumer. This is
 * to avoid filter collisions later. Add new filters here!!
 *
 * Current filters:		Filter 3
 */
#define IGB_ETQF_FILTER_1588

#define IGB_N_EXTTS
#define IGB_N_PEROUT
#define IGB_N_SDP
#define IGB_RETA_SIZE

enum igb_filter_match_flags {};

#define IGB_MAX_RXNFC_FILTERS

/* RX network flow classification data structure */
struct igb_nfc_input {};

struct igb_nfc_filter {};

struct igb_mac_addr {};

#define IGB_MAC_STATE_DEFAULT
#define IGB_MAC_STATE_IN_USE
#define IGB_MAC_STATE_SRC_ADDR
#define IGB_MAC_STATE_QUEUE_STEERING

/* board specific private data structure */
struct igb_adapter {};

/* flags controlling PTP/1588 function */
#define IGB_PTP_ENABLED
#define IGB_PTP_OVERFLOW_CHECK

#define IGB_FLAG_HAS_MSI
#define IGB_FLAG_DCA_ENABLED
#define IGB_FLAG_QUAD_PORT_A
#define IGB_FLAG_QUEUE_PAIRS
#define IGB_FLAG_DMAC
#define IGB_FLAG_RSS_FIELD_IPV4_UDP
#define IGB_FLAG_RSS_FIELD_IPV6_UDP
#define IGB_FLAG_WOL_SUPPORTED
#define IGB_FLAG_NEED_LINK_UPDATE
#define IGB_FLAG_MEDIA_RESET
#define IGB_FLAG_MAS_CAPABLE
#define IGB_FLAG_MAS_ENABLE
#define IGB_FLAG_HAS_MSIX
#define IGB_FLAG_EEE
#define IGB_FLAG_VLAN_PROMISC
#define IGB_FLAG_RX_LEGACY
#define IGB_FLAG_FQTSS

/* Media Auto Sense */
#define IGB_MAS_ENABLE_0
#define IGB_MAS_ENABLE_1
#define IGB_MAS_ENABLE_2
#define IGB_MAS_ENABLE_3

/* DMA Coalescing defines */
#define IGB_MIN_TXPBSIZE
#define IGB_TX_BUF_4096
#define IGB_DMCTLX_DCFLUSH_DIS

#define IGB_82576_TSYNC_SHIFT
enum e1000_state_t {};

enum igb_boards {};

extern char igb_driver_name[];

int igb_xmit_xdp_ring(struct igb_adapter *adapter,
		      struct igb_ring *ring,
		      struct xdp_frame *xdpf);
int igb_open(struct net_device *netdev);
int igb_close(struct net_device *netdev);
int igb_up(struct igb_adapter *);
void igb_down(struct igb_adapter *);
void igb_reinit_locked(struct igb_adapter *);
void igb_reset(struct igb_adapter *);
int igb_reinit_queues(struct igb_adapter *);
void igb_write_rss_indir_tbl(struct igb_adapter *);
int igb_set_spd_dplx(struct igb_adapter *, u32, u8);
int igb_setup_tx_resources(struct igb_ring *);
int igb_setup_rx_resources(struct igb_ring *);
void igb_free_tx_resources(struct igb_ring *);
void igb_free_rx_resources(struct igb_ring *);
void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
void igb_setup_tctl(struct igb_adapter *);
void igb_setup_rctl(struct igb_adapter *);
void igb_setup_srrctl(struct igb_adapter *, struct igb_ring *);
netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
void igb_alloc_rx_buffers(struct igb_ring *, u16);
void igb_update_stats(struct igb_adapter *);
bool igb_has_link(struct igb_adapter *adapter);
void igb_set_ethtool_ops(struct net_device *);
void igb_power_up_link(struct igb_adapter *);
void igb_set_fw_version(struct igb_adapter *);
void igb_ptp_init(struct igb_adapter *adapter);
void igb_ptp_stop(struct igb_adapter *adapter);
void igb_ptp_reset(struct igb_adapter *adapter);
void igb_ptp_suspend(struct igb_adapter *adapter);
void igb_ptp_rx_hang(struct igb_adapter *adapter);
void igb_ptp_tx_hang(struct igb_adapter *adapter);
void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb);
int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
			ktime_t *timestamp);
int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
unsigned int igb_get_max_rss_queues(struct igb_adapter *);
#ifdef CONFIG_IGB_HWMON
void igb_sysfs_exit(struct igb_adapter *adapter);
int igb_sysfs_init(struct igb_adapter *adapter);
#endif
static inline s32 igb_reset_phy(struct e1000_hw *hw)
{}

static inline s32 igb_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
{}

static inline s32 igb_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
{}

static inline s32 igb_get_phy_info(struct e1000_hw *hw)
{}

static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring)
{}

int igb_add_filter(struct igb_adapter *adapter,
		   struct igb_nfc_filter *input);
int igb_erase_filter(struct igb_adapter *adapter,
		     struct igb_nfc_filter *input);

int igb_add_mac_steering_filter(struct igb_adapter *adapter,
				const u8 *addr, u8 queue, u8 flags);
int igb_del_mac_steering_filter(struct igb_adapter *adapter,
				const u8 *addr, u8 queue, u8 flags);

#endif /* _IGB_H_ */