18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright (c) 2018, Intel Corporation. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _ICE_H_
58c2ecf20Sopenharmony_ci#define _ICE_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/types.h>
88c2ecf20Sopenharmony_ci#include <linux/errno.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/module.h>
118c2ecf20Sopenharmony_ci#include <linux/firmware.h>
128c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
138c2ecf20Sopenharmony_ci#include <linux/compiler.h>
148c2ecf20Sopenharmony_ci#include <linux/etherdevice.h>
158c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
168c2ecf20Sopenharmony_ci#include <linux/cpumask.h>
178c2ecf20Sopenharmony_ci#include <linux/rtnetlink.h>
188c2ecf20Sopenharmony_ci#include <linux/if_vlan.h>
198c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h>
208c2ecf20Sopenharmony_ci#include <linux/pci.h>
218c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
228c2ecf20Sopenharmony_ci#include <linux/wait.h>
238c2ecf20Sopenharmony_ci#include <linux/aer.h>
248c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
258c2ecf20Sopenharmony_ci#include <linux/ethtool.h>
268c2ecf20Sopenharmony_ci#include <linux/timer.h>
278c2ecf20Sopenharmony_ci#include <linux/delay.h>
288c2ecf20Sopenharmony_ci#include <linux/bitmap.h>
298c2ecf20Sopenharmony_ci#include <linux/log2.h>
308c2ecf20Sopenharmony_ci#include <linux/ip.h>
318c2ecf20Sopenharmony_ci#include <linux/sctp.h>
328c2ecf20Sopenharmony_ci#include <linux/ipv6.h>
338c2ecf20Sopenharmony_ci#include <linux/pkt_sched.h>
348c2ecf20Sopenharmony_ci#include <linux/if_bridge.h>
358c2ecf20Sopenharmony_ci#include <linux/ctype.h>
368c2ecf20Sopenharmony_ci#include <linux/bpf.h>
378c2ecf20Sopenharmony_ci#include <linux/avf/virtchnl.h>
388c2ecf20Sopenharmony_ci#include <linux/cpu_rmap.h>
398c2ecf20Sopenharmony_ci#include <net/devlink.h>
408c2ecf20Sopenharmony_ci#include <net/ipv6.h>
418c2ecf20Sopenharmony_ci#include <net/xdp_sock.h>
428c2ecf20Sopenharmony_ci#include <net/geneve.h>
438c2ecf20Sopenharmony_ci#include <net/gre.h>
448c2ecf20Sopenharmony_ci#include <net/udp_tunnel.h>
458c2ecf20Sopenharmony_ci#include <net/vxlan.h>
468c2ecf20Sopenharmony_ci#include "ice_devids.h"
478c2ecf20Sopenharmony_ci#include "ice_type.h"
488c2ecf20Sopenharmony_ci#include "ice_txrx.h"
498c2ecf20Sopenharmony_ci#include "ice_dcb.h"
508c2ecf20Sopenharmony_ci#include "ice_switch.h"
518c2ecf20Sopenharmony_ci#include "ice_common.h"
528c2ecf20Sopenharmony_ci#include "ice_sched.h"
538c2ecf20Sopenharmony_ci#include "ice_virtchnl_pf.h"
548c2ecf20Sopenharmony_ci#include "ice_sriov.h"
558c2ecf20Sopenharmony_ci#include "ice_fdir.h"
568c2ecf20Sopenharmony_ci#include "ice_xsk.h"
578c2ecf20Sopenharmony_ci#include "ice_arfs.h"
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define ICE_BAR0		0
608c2ecf20Sopenharmony_ci#define ICE_REQ_DESC_MULTIPLE	32
618c2ecf20Sopenharmony_ci#define ICE_MIN_NUM_DESC	64
628c2ecf20Sopenharmony_ci#define ICE_MAX_NUM_DESC	8160
638c2ecf20Sopenharmony_ci#define ICE_DFLT_MIN_RX_DESC	512
648c2ecf20Sopenharmony_ci#define ICE_DFLT_NUM_TX_DESC	256
658c2ecf20Sopenharmony_ci#define ICE_DFLT_NUM_RX_DESC	2048
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define ICE_DFLT_TRAFFIC_CLASS	BIT(0)
688c2ecf20Sopenharmony_ci#define ICE_INT_NAME_STR_LEN	(IFNAMSIZ + 16)
698c2ecf20Sopenharmony_ci#define ICE_AQ_LEN		64
708c2ecf20Sopenharmony_ci#define ICE_MBXSQ_LEN		64
718c2ecf20Sopenharmony_ci#define ICE_MIN_LAN_TXRX_MSIX	1
728c2ecf20Sopenharmony_ci#define ICE_MIN_LAN_OICR_MSIX	1
738c2ecf20Sopenharmony_ci#define ICE_MIN_MSIX		(ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX)
748c2ecf20Sopenharmony_ci#define ICE_FDIR_MSIX		1
758c2ecf20Sopenharmony_ci#define ICE_NO_VSI		0xffff
768c2ecf20Sopenharmony_ci#define ICE_VSI_MAP_CONTIG	0
778c2ecf20Sopenharmony_ci#define ICE_VSI_MAP_SCATTER	1
788c2ecf20Sopenharmony_ci#define ICE_MAX_SCATTER_TXQS	16
798c2ecf20Sopenharmony_ci#define ICE_MAX_SCATTER_RXQS	16
808c2ecf20Sopenharmony_ci#define ICE_Q_WAIT_RETRY_LIMIT	10
818c2ecf20Sopenharmony_ci#define ICE_Q_WAIT_MAX_RETRY	(5 * ICE_Q_WAIT_RETRY_LIMIT)
828c2ecf20Sopenharmony_ci#define ICE_MAX_LG_RSS_QS	256
838c2ecf20Sopenharmony_ci#define ICE_RES_VALID_BIT	0x8000
848c2ecf20Sopenharmony_ci#define ICE_RES_MISC_VEC_ID	(ICE_RES_VALID_BIT - 1)
858c2ecf20Sopenharmony_ci#define ICE_INVAL_Q_INDEX	0xffff
868c2ecf20Sopenharmony_ci#define ICE_INVAL_VFID		256
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define ICE_MAX_RESET_WAIT		20
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define ICE_VSIQF_HKEY_ARRAY_SIZE	((VSIQF_HKEY_MAX_INDEX + 1) *	4)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define ICE_MAX_MTU	(ICE_AQ_SET_MAC_FRAME_SIZE_MAX - ICE_ETH_PKT_HDR_PAD)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define ICE_UP_TABLE_TRANSLATE(val, i) \
978c2ecf20Sopenharmony_ci		(((val) << ICE_AQ_VSI_UP_TABLE_UP##i##_S) & \
988c2ecf20Sopenharmony_ci		  ICE_AQ_VSI_UP_TABLE_UP##i##_M)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define ICE_TX_DESC(R, i) (&(((struct ice_tx_desc *)((R)->desc))[i]))
1018c2ecf20Sopenharmony_ci#define ICE_RX_DESC(R, i) (&(((union ice_32b_rx_flex_desc *)((R)->desc))[i]))
1028c2ecf20Sopenharmony_ci#define ICE_TX_CTX_DESC(R, i) (&(((struct ice_tx_ctx_desc *)((R)->desc))[i]))
1038c2ecf20Sopenharmony_ci#define ICE_TX_FDIRDESC(R, i) (&(((struct ice_fltr_desc *)((R)->desc))[i]))
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci/* Macro for each VSI in a PF */
1068c2ecf20Sopenharmony_ci#define ice_for_each_vsi(pf, i) \
1078c2ecf20Sopenharmony_ci	for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* Macros for each Tx/Rx ring in a VSI */
1108c2ecf20Sopenharmony_ci#define ice_for_each_txq(vsi, i) \
1118c2ecf20Sopenharmony_ci	for ((i) = 0; (i) < (vsi)->num_txq; (i)++)
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define ice_for_each_rxq(vsi, i) \
1148c2ecf20Sopenharmony_ci	for ((i) = 0; (i) < (vsi)->num_rxq; (i)++)
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* Macros for each allocated Tx/Rx ring whether used or not in a VSI */
1178c2ecf20Sopenharmony_ci#define ice_for_each_alloc_txq(vsi, i) \
1188c2ecf20Sopenharmony_ci	for ((i) = 0; (i) < (vsi)->alloc_txq; (i)++)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define ice_for_each_alloc_rxq(vsi, i) \
1218c2ecf20Sopenharmony_ci	for ((i) = 0; (i) < (vsi)->alloc_rxq; (i)++)
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define ice_for_each_q_vector(vsi, i) \
1248c2ecf20Sopenharmony_ci	for ((i) = 0; (i) < (vsi)->num_q_vectors; (i)++)
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#define ICE_UCAST_PROMISC_BITS (ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX | \
1278c2ecf20Sopenharmony_ci				ICE_PROMISC_UCAST_RX | ICE_PROMISC_MCAST_RX)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define ICE_UCAST_VLAN_PROMISC_BITS (ICE_PROMISC_UCAST_TX | \
1308c2ecf20Sopenharmony_ci				     ICE_PROMISC_MCAST_TX | \
1318c2ecf20Sopenharmony_ci				     ICE_PROMISC_UCAST_RX | \
1328c2ecf20Sopenharmony_ci				     ICE_PROMISC_MCAST_RX | \
1338c2ecf20Sopenharmony_ci				     ICE_PROMISC_VLAN_TX  | \
1348c2ecf20Sopenharmony_ci				     ICE_PROMISC_VLAN_RX)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define ICE_MCAST_PROMISC_BITS (ICE_PROMISC_MCAST_TX | ICE_PROMISC_MCAST_RX)
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define ICE_MCAST_VLAN_PROMISC_BITS (ICE_PROMISC_MCAST_TX | \
1398c2ecf20Sopenharmony_ci				     ICE_PROMISC_MCAST_RX | \
1408c2ecf20Sopenharmony_ci				     ICE_PROMISC_VLAN_TX  | \
1418c2ecf20Sopenharmony_ci				     ICE_PROMISC_VLAN_RX)
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cistruct ice_txq_meta {
1468c2ecf20Sopenharmony_ci	u32 q_teid;	/* Tx-scheduler element identifier */
1478c2ecf20Sopenharmony_ci	u16 q_id;	/* Entry in VSI's txq_map bitmap */
1488c2ecf20Sopenharmony_ci	u16 q_handle;	/* Relative index of Tx queue within TC */
1498c2ecf20Sopenharmony_ci	u16 vsi_idx;	/* VSI index that Tx queue belongs to */
1508c2ecf20Sopenharmony_ci	u8 tc;		/* TC number that Tx queue belongs to */
1518c2ecf20Sopenharmony_ci};
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_cistruct ice_tc_info {
1548c2ecf20Sopenharmony_ci	u16 qoffset;
1558c2ecf20Sopenharmony_ci	u16 qcount_tx;
1568c2ecf20Sopenharmony_ci	u16 qcount_rx;
1578c2ecf20Sopenharmony_ci	u8 netdev_tc;
1588c2ecf20Sopenharmony_ci};
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistruct ice_tc_cfg {
1618c2ecf20Sopenharmony_ci	u8 numtc; /* Total number of enabled TCs */
1628c2ecf20Sopenharmony_ci	u8 ena_tc; /* Tx map */
1638c2ecf20Sopenharmony_ci	struct ice_tc_info tc_info[ICE_MAX_TRAFFIC_CLASS];
1648c2ecf20Sopenharmony_ci};
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_cistruct ice_res_tracker {
1678c2ecf20Sopenharmony_ci	u16 num_entries;
1688c2ecf20Sopenharmony_ci	u16 end;
1698c2ecf20Sopenharmony_ci	u16 list[1];
1708c2ecf20Sopenharmony_ci};
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_cistruct ice_qs_cfg {
1738c2ecf20Sopenharmony_ci	struct mutex *qs_mutex;  /* will be assigned to &pf->avail_q_mutex */
1748c2ecf20Sopenharmony_ci	unsigned long *pf_map;
1758c2ecf20Sopenharmony_ci	unsigned long pf_map_size;
1768c2ecf20Sopenharmony_ci	unsigned int q_count;
1778c2ecf20Sopenharmony_ci	unsigned int scatter_count;
1788c2ecf20Sopenharmony_ci	u16 *vsi_map;
1798c2ecf20Sopenharmony_ci	u16 vsi_map_offset;
1808c2ecf20Sopenharmony_ci	u8 mapping_mode;
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_cistruct ice_sw {
1848c2ecf20Sopenharmony_ci	struct ice_pf *pf;
1858c2ecf20Sopenharmony_ci	u16 sw_id;		/* switch ID for this switch */
1868c2ecf20Sopenharmony_ci	u16 bridge_mode;	/* VEB/VEPA/Port Virtualizer */
1878c2ecf20Sopenharmony_ci	struct ice_vsi *dflt_vsi;	/* default VSI for this switch */
1888c2ecf20Sopenharmony_ci	u8 dflt_vsi_ena:1;	/* true if above dflt_vsi is enabled */
1898c2ecf20Sopenharmony_ci};
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_cienum ice_state {
1928c2ecf20Sopenharmony_ci	__ICE_TESTING,
1938c2ecf20Sopenharmony_ci	__ICE_DOWN,
1948c2ecf20Sopenharmony_ci	__ICE_NEEDS_RESTART,
1958c2ecf20Sopenharmony_ci	__ICE_PREPARED_FOR_RESET,	/* set by driver when prepared */
1968c2ecf20Sopenharmony_ci	__ICE_RESET_OICR_RECV,		/* set by driver after rcv reset OICR */
1978c2ecf20Sopenharmony_ci	__ICE_PFR_REQ,			/* set by driver and peers */
1988c2ecf20Sopenharmony_ci	__ICE_CORER_REQ,		/* set by driver and peers */
1998c2ecf20Sopenharmony_ci	__ICE_GLOBR_REQ,		/* set by driver and peers */
2008c2ecf20Sopenharmony_ci	__ICE_CORER_RECV,		/* set by OICR handler */
2018c2ecf20Sopenharmony_ci	__ICE_GLOBR_RECV,		/* set by OICR handler */
2028c2ecf20Sopenharmony_ci	__ICE_EMPR_RECV,		/* set by OICR handler */
2038c2ecf20Sopenharmony_ci	__ICE_SUSPENDED,		/* set on module remove path */
2048c2ecf20Sopenharmony_ci	__ICE_RESET_FAILED,		/* set by reset/rebuild */
2058c2ecf20Sopenharmony_ci	/* When checking for the PF to be in a nominal operating state, the
2068c2ecf20Sopenharmony_ci	 * bits that are grouped at the beginning of the list need to be
2078c2ecf20Sopenharmony_ci	 * checked. Bits occurring before __ICE_STATE_NOMINAL_CHECK_BITS will
2088c2ecf20Sopenharmony_ci	 * be checked. If you need to add a bit into consideration for nominal
2098c2ecf20Sopenharmony_ci	 * operating state, it must be added before
2108c2ecf20Sopenharmony_ci	 * __ICE_STATE_NOMINAL_CHECK_BITS. Do not move this entry's position
2118c2ecf20Sopenharmony_ci	 * without appropriate consideration.
2128c2ecf20Sopenharmony_ci	 */
2138c2ecf20Sopenharmony_ci	__ICE_STATE_NOMINAL_CHECK_BITS,
2148c2ecf20Sopenharmony_ci	__ICE_ADMINQ_EVENT_PENDING,
2158c2ecf20Sopenharmony_ci	__ICE_MAILBOXQ_EVENT_PENDING,
2168c2ecf20Sopenharmony_ci	__ICE_MDD_EVENT_PENDING,
2178c2ecf20Sopenharmony_ci	__ICE_VFLR_EVENT_PENDING,
2188c2ecf20Sopenharmony_ci	__ICE_FLTR_OVERFLOW_PROMISC,
2198c2ecf20Sopenharmony_ci	__ICE_VF_DIS,
2208c2ecf20Sopenharmony_ci	__ICE_CFG_BUSY,
2218c2ecf20Sopenharmony_ci	__ICE_SERVICE_SCHED,
2228c2ecf20Sopenharmony_ci	__ICE_SERVICE_DIS,
2238c2ecf20Sopenharmony_ci	__ICE_FD_FLUSH_REQ,
2248c2ecf20Sopenharmony_ci	__ICE_OICR_INTR_DIS,		/* Global OICR interrupt disabled */
2258c2ecf20Sopenharmony_ci	__ICE_MDD_VF_PRINT_PENDING,	/* set when MDD event handle */
2268c2ecf20Sopenharmony_ci	__ICE_VF_RESETS_DISABLED,	/* disable resets during ice_remove */
2278c2ecf20Sopenharmony_ci	__ICE_LINK_DEFAULT_OVERRIDE_PENDING,
2288c2ecf20Sopenharmony_ci	__ICE_PHY_INIT_COMPLETE,
2298c2ecf20Sopenharmony_ci	__ICE_STATE_NBITS		/* must be last */
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cienum ice_vsi_flags {
2338c2ecf20Sopenharmony_ci	ICE_VSI_FLAG_UMAC_FLTR_CHANGED,
2348c2ecf20Sopenharmony_ci	ICE_VSI_FLAG_MMAC_FLTR_CHANGED,
2358c2ecf20Sopenharmony_ci	ICE_VSI_FLAG_VLAN_FLTR_CHANGED,
2368c2ecf20Sopenharmony_ci	ICE_VSI_FLAG_PROMISC_CHANGED,
2378c2ecf20Sopenharmony_ci	ICE_VSI_FLAG_NBITS		/* must be last */
2388c2ecf20Sopenharmony_ci};
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/* struct that defines a VSI, associated with a dev */
2418c2ecf20Sopenharmony_cistruct ice_vsi {
2428c2ecf20Sopenharmony_ci	struct net_device *netdev;
2438c2ecf20Sopenharmony_ci	struct ice_sw *vsw;		 /* switch this VSI is on */
2448c2ecf20Sopenharmony_ci	struct ice_pf *back;		 /* back pointer to PF */
2458c2ecf20Sopenharmony_ci	struct ice_port_info *port_info; /* back pointer to port_info */
2468c2ecf20Sopenharmony_ci	struct ice_ring **rx_rings;	 /* Rx ring array */
2478c2ecf20Sopenharmony_ci	struct ice_ring **tx_rings;	 /* Tx ring array */
2488c2ecf20Sopenharmony_ci	struct ice_q_vector **q_vectors; /* q_vector array */
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci	irqreturn_t (*irq_handler)(int irq, void *data);
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci	u64 tx_linearize;
2538c2ecf20Sopenharmony_ci	DECLARE_BITMAP(state, __ICE_STATE_NBITS);
2548c2ecf20Sopenharmony_ci	DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS);
2558c2ecf20Sopenharmony_ci	unsigned int current_netdev_flags;
2568c2ecf20Sopenharmony_ci	u32 tx_restart;
2578c2ecf20Sopenharmony_ci	u32 tx_busy;
2588c2ecf20Sopenharmony_ci	u32 rx_buf_failed;
2598c2ecf20Sopenharmony_ci	u32 rx_page_failed;
2608c2ecf20Sopenharmony_ci	u32 rx_gro_dropped;
2618c2ecf20Sopenharmony_ci	u16 num_q_vectors;
2628c2ecf20Sopenharmony_ci	u16 base_vector;		/* IRQ base for OS reserved vectors */
2638c2ecf20Sopenharmony_ci	enum ice_vsi_type type;
2648c2ecf20Sopenharmony_ci	u16 vsi_num;			/* HW (absolute) index of this VSI */
2658c2ecf20Sopenharmony_ci	u16 idx;			/* software index in pf->vsi[] */
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci	s16 vf_id;			/* VF ID for SR-IOV VSIs */
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	u16 ethtype;			/* Ethernet protocol for pause frame */
2708c2ecf20Sopenharmony_ci	u16 num_gfltr;
2718c2ecf20Sopenharmony_ci	u16 num_bfltr;
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci	/* RSS config */
2748c2ecf20Sopenharmony_ci	u16 rss_table_size;	/* HW RSS table size */
2758c2ecf20Sopenharmony_ci	u16 rss_size;		/* Allocated RSS queues */
2768c2ecf20Sopenharmony_ci	u8 *rss_hkey_user;	/* User configured hash keys */
2778c2ecf20Sopenharmony_ci	u8 *rss_lut_user;	/* User configured lookup table entries */
2788c2ecf20Sopenharmony_ci	u8 rss_lut_type;	/* used to configure Get/Set RSS LUT AQ call */
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	/* aRFS members only allocated for the PF VSI */
2818c2ecf20Sopenharmony_ci#define ICE_MAX_ARFS_LIST	1024
2828c2ecf20Sopenharmony_ci#define ICE_ARFS_LST_MASK	(ICE_MAX_ARFS_LIST - 1)
2838c2ecf20Sopenharmony_ci	struct hlist_head *arfs_fltr_list;
2848c2ecf20Sopenharmony_ci	struct ice_arfs_active_fltr_cntrs *arfs_fltr_cntrs;
2858c2ecf20Sopenharmony_ci	spinlock_t arfs_lock;	/* protects aRFS hash table and filter state */
2868c2ecf20Sopenharmony_ci	atomic_t *arfs_last_fltr_id;
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	/* devlink port data */
2898c2ecf20Sopenharmony_ci	struct devlink_port devlink_port;
2908c2ecf20Sopenharmony_ci	bool devlink_port_registered;
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci	u16 max_frame;
2938c2ecf20Sopenharmony_ci	u16 rx_buf_len;
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci	struct ice_aqc_vsi_props info;	 /* VSI properties */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci	/* VSI stats */
2988c2ecf20Sopenharmony_ci	struct rtnl_link_stats64 net_stats;
2998c2ecf20Sopenharmony_ci	struct ice_eth_stats eth_stats;
3008c2ecf20Sopenharmony_ci	struct ice_eth_stats eth_stats_prev;
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci	struct list_head tmp_sync_list;		/* MAC filters to be synced */
3038c2ecf20Sopenharmony_ci	struct list_head tmp_unsync_list;	/* MAC filters to be unsynced */
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci	u8 irqs_ready:1;
3068c2ecf20Sopenharmony_ci	u8 current_isup:1;		 /* Sync 'link up' logging */
3078c2ecf20Sopenharmony_ci	u8 stat_offsets_loaded:1;
3088c2ecf20Sopenharmony_ci	u8 vlan_ena:1;
3098c2ecf20Sopenharmony_ci	u16 num_vlan;
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	/* queue information */
3128c2ecf20Sopenharmony_ci	u8 tx_mapping_mode;		 /* ICE_MAP_MODE_[CONTIG|SCATTER] */
3138c2ecf20Sopenharmony_ci	u8 rx_mapping_mode;		 /* ICE_MAP_MODE_[CONTIG|SCATTER] */
3148c2ecf20Sopenharmony_ci	u16 *txq_map;			 /* index in pf->avail_txqs */
3158c2ecf20Sopenharmony_ci	u16 *rxq_map;			 /* index in pf->avail_rxqs */
3168c2ecf20Sopenharmony_ci	u16 alloc_txq;			 /* Allocated Tx queues */
3178c2ecf20Sopenharmony_ci	u16 num_txq;			 /* Used Tx queues */
3188c2ecf20Sopenharmony_ci	u16 alloc_rxq;			 /* Allocated Rx queues */
3198c2ecf20Sopenharmony_ci	u16 num_rxq;			 /* Used Rx queues */
3208c2ecf20Sopenharmony_ci	u16 req_txq;			 /* User requested Tx queues */
3218c2ecf20Sopenharmony_ci	u16 req_rxq;			 /* User requested Rx queues */
3228c2ecf20Sopenharmony_ci	u16 num_rx_desc;
3238c2ecf20Sopenharmony_ci	u16 num_tx_desc;
3248c2ecf20Sopenharmony_ci	struct ice_tc_cfg tc_cfg;
3258c2ecf20Sopenharmony_ci	struct bpf_prog *xdp_prog;
3268c2ecf20Sopenharmony_ci	struct ice_ring **xdp_rings;	 /* XDP ring array */
3278c2ecf20Sopenharmony_ci	u16 num_xdp_txq;		 /* Used XDP queues */
3288c2ecf20Sopenharmony_ci	u8 xdp_mapping_mode;		 /* ICE_MAP_MODE_[CONTIG|SCATTER] */
3298c2ecf20Sopenharmony_ci	struct xsk_buff_pool **xsk_pools;
3308c2ecf20Sopenharmony_ci	u16 num_xsk_pools_used;
3318c2ecf20Sopenharmony_ci	u16 num_xsk_pools;
3328c2ecf20Sopenharmony_ci} ____cacheline_internodealigned_in_smp;
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/* struct that defines an interrupt vector */
3358c2ecf20Sopenharmony_cistruct ice_q_vector {
3368c2ecf20Sopenharmony_ci	struct ice_vsi *vsi;
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	u16 v_idx;			/* index in the vsi->q_vector array. */
3398c2ecf20Sopenharmony_ci	u16 reg_idx;
3408c2ecf20Sopenharmony_ci	u8 num_ring_rx;			/* total number of Rx rings in vector */
3418c2ecf20Sopenharmony_ci	u8 num_ring_tx;			/* total number of Tx rings in vector */
3428c2ecf20Sopenharmony_ci	u8 itr_countdown;		/* when 0 should adjust adaptive ITR */
3438c2ecf20Sopenharmony_ci	/* in usecs, need to use ice_intrl_to_usecs_reg() before writing this
3448c2ecf20Sopenharmony_ci	 * value to the device
3458c2ecf20Sopenharmony_ci	 */
3468c2ecf20Sopenharmony_ci	u8 intrl;
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci	struct napi_struct napi;
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci	struct ice_ring_container rx;
3518c2ecf20Sopenharmony_ci	struct ice_ring_container tx;
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci	cpumask_t affinity_mask;
3548c2ecf20Sopenharmony_ci	struct irq_affinity_notify affinity_notify;
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci	char name[ICE_INT_NAME_STR_LEN];
3578c2ecf20Sopenharmony_ci} ____cacheline_internodealigned_in_smp;
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_cienum ice_pf_flags {
3608c2ecf20Sopenharmony_ci	ICE_FLAG_FLTR_SYNC,
3618c2ecf20Sopenharmony_ci	ICE_FLAG_RSS_ENA,
3628c2ecf20Sopenharmony_ci	ICE_FLAG_SRIOV_ENA,
3638c2ecf20Sopenharmony_ci	ICE_FLAG_SRIOV_CAPABLE,
3648c2ecf20Sopenharmony_ci	ICE_FLAG_DCB_CAPABLE,
3658c2ecf20Sopenharmony_ci	ICE_FLAG_DCB_ENA,
3668c2ecf20Sopenharmony_ci	ICE_FLAG_FD_ENA,
3678c2ecf20Sopenharmony_ci	ICE_FLAG_ADV_FEATURES,
3688c2ecf20Sopenharmony_ci	ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA,
3698c2ecf20Sopenharmony_ci	ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA,
3708c2ecf20Sopenharmony_ci	ICE_FLAG_NO_MEDIA,
3718c2ecf20Sopenharmony_ci	ICE_FLAG_FW_LLDP_AGENT,
3728c2ecf20Sopenharmony_ci	ICE_FLAG_ETHTOOL_CTXT,		/* set when ethtool holds RTNL lock */
3738c2ecf20Sopenharmony_ci	ICE_FLAG_LEGACY_RX,
3748c2ecf20Sopenharmony_ci	ICE_FLAG_VF_TRUE_PROMISC_ENA,
3758c2ecf20Sopenharmony_ci	ICE_FLAG_MDD_AUTO_RESET_VF,
3768c2ecf20Sopenharmony_ci	ICE_FLAG_LINK_LENIENT_MODE_ENA,
3778c2ecf20Sopenharmony_ci	ICE_PF_FLAGS_NBITS		/* must be last */
3788c2ecf20Sopenharmony_ci};
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_cistruct ice_pf {
3818c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci	struct devlink_region *nvm_region;
3848c2ecf20Sopenharmony_ci	struct devlink_region *devcaps_region;
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci	/* OS reserved IRQ details */
3878c2ecf20Sopenharmony_ci	struct msix_entry *msix_entries;
3888c2ecf20Sopenharmony_ci	struct ice_res_tracker *irq_tracker;
3898c2ecf20Sopenharmony_ci	/* First MSIX vector used by SR-IOV VFs. Calculated by subtracting the
3908c2ecf20Sopenharmony_ci	 * number of MSIX vectors needed for all SR-IOV VFs from the number of
3918c2ecf20Sopenharmony_ci	 * MSIX vectors allowed on this PF.
3928c2ecf20Sopenharmony_ci	 */
3938c2ecf20Sopenharmony_ci	u16 sriov_base_vector;
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci	u16 ctrl_vsi_idx;		/* control VSI index in pf->vsi array */
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci	struct ice_vsi **vsi;		/* VSIs created by the driver */
3988c2ecf20Sopenharmony_ci	struct ice_sw *first_sw;	/* first switch created by firmware */
3998c2ecf20Sopenharmony_ci	/* Virtchnl/SR-IOV config info */
4008c2ecf20Sopenharmony_ci	struct ice_vf *vf;
4018c2ecf20Sopenharmony_ci	u16 num_alloc_vfs;		/* actual number of VFs allocated */
4028c2ecf20Sopenharmony_ci	u16 num_vfs_supported;		/* num VFs supported for this PF */
4038c2ecf20Sopenharmony_ci	u16 num_qps_per_vf;
4048c2ecf20Sopenharmony_ci	u16 num_msix_per_vf;
4058c2ecf20Sopenharmony_ci	/* used to ratelimit the MDD event logging */
4068c2ecf20Sopenharmony_ci	unsigned long last_printed_mdd_jiffies;
4078c2ecf20Sopenharmony_ci	DECLARE_BITMAP(state, __ICE_STATE_NBITS);
4088c2ecf20Sopenharmony_ci	DECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS);
4098c2ecf20Sopenharmony_ci	unsigned long *avail_txqs;	/* bitmap to track PF Tx queue usage */
4108c2ecf20Sopenharmony_ci	unsigned long *avail_rxqs;	/* bitmap to track PF Rx queue usage */
4118c2ecf20Sopenharmony_ci	unsigned long serv_tmr_period;
4128c2ecf20Sopenharmony_ci	unsigned long serv_tmr_prev;
4138c2ecf20Sopenharmony_ci	struct timer_list serv_tmr;
4148c2ecf20Sopenharmony_ci	struct work_struct serv_task;
4158c2ecf20Sopenharmony_ci	struct mutex avail_q_mutex;	/* protects access to avail_[rx|tx]qs */
4168c2ecf20Sopenharmony_ci	struct mutex sw_mutex;		/* lock for protecting VSI alloc flow */
4178c2ecf20Sopenharmony_ci	struct mutex tc_mutex;		/* lock to protect TC changes */
4188c2ecf20Sopenharmony_ci	u32 msg_enable;
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci	/* spinlock to protect the AdminQ wait list */
4218c2ecf20Sopenharmony_ci	spinlock_t aq_wait_lock;
4228c2ecf20Sopenharmony_ci	struct hlist_head aq_wait_list;
4238c2ecf20Sopenharmony_ci	wait_queue_head_t aq_wait_queue;
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci	u32 hw_csum_rx_error;
4268c2ecf20Sopenharmony_ci	u16 oicr_idx;		/* Other interrupt cause MSIX vector index */
4278c2ecf20Sopenharmony_ci	u16 num_avail_sw_msix;	/* remaining MSIX SW vectors left unclaimed */
4288c2ecf20Sopenharmony_ci	u16 max_pf_txqs;	/* Total Tx queues PF wide */
4298c2ecf20Sopenharmony_ci	u16 max_pf_rxqs;	/* Total Rx queues PF wide */
4308c2ecf20Sopenharmony_ci	u16 num_lan_msix;	/* Total MSIX vectors for base driver */
4318c2ecf20Sopenharmony_ci	u16 num_lan_tx;		/* num LAN Tx queues setup */
4328c2ecf20Sopenharmony_ci	u16 num_lan_rx;		/* num LAN Rx queues setup */
4338c2ecf20Sopenharmony_ci	u16 next_vsi;		/* Next free slot in pf->vsi[] - 0-based! */
4348c2ecf20Sopenharmony_ci	u16 num_alloc_vsi;
4358c2ecf20Sopenharmony_ci	u16 corer_count;	/* Core reset count */
4368c2ecf20Sopenharmony_ci	u16 globr_count;	/* Global reset count */
4378c2ecf20Sopenharmony_ci	u16 empr_count;		/* EMP reset count */
4388c2ecf20Sopenharmony_ci	u16 pfr_count;		/* PF reset count */
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci	u8 wol_ena : 1;		/* software state of WoL */
4418c2ecf20Sopenharmony_ci	u32 wakeup_reason;	/* last wakeup reason */
4428c2ecf20Sopenharmony_ci	struct ice_hw_port_stats stats;
4438c2ecf20Sopenharmony_ci	struct ice_hw_port_stats stats_prev;
4448c2ecf20Sopenharmony_ci	struct ice_hw hw;
4458c2ecf20Sopenharmony_ci	u8 stat_prev_loaded:1; /* has previous stats been loaded */
4468c2ecf20Sopenharmony_ci	u16 dcbx_cap;
4478c2ecf20Sopenharmony_ci	u32 tx_timeout_count;
4488c2ecf20Sopenharmony_ci	unsigned long tx_timeout_last_recovery;
4498c2ecf20Sopenharmony_ci	u32 tx_timeout_recovery_level;
4508c2ecf20Sopenharmony_ci	char int_name[ICE_INT_NAME_STR_LEN];
4518c2ecf20Sopenharmony_ci	u32 sw_int_count;
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci	__le64 nvm_phy_type_lo; /* NVM PHY type low */
4548c2ecf20Sopenharmony_ci	__le64 nvm_phy_type_hi; /* NVM PHY type high */
4558c2ecf20Sopenharmony_ci	struct ice_link_default_override_tlv link_dflt_override;
4568c2ecf20Sopenharmony_ci};
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_cistruct ice_netdev_priv {
4598c2ecf20Sopenharmony_ci	struct ice_vsi *vsi;
4608c2ecf20Sopenharmony_ci};
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci/**
4638c2ecf20Sopenharmony_ci * ice_irq_dynamic_ena - Enable default interrupt generation settings
4648c2ecf20Sopenharmony_ci * @hw: pointer to HW struct
4658c2ecf20Sopenharmony_ci * @vsi: pointer to VSI struct, can be NULL
4668c2ecf20Sopenharmony_ci * @q_vector: pointer to q_vector, can be NULL
4678c2ecf20Sopenharmony_ci */
4688c2ecf20Sopenharmony_cistatic inline void
4698c2ecf20Sopenharmony_ciice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi,
4708c2ecf20Sopenharmony_ci		    struct ice_q_vector *q_vector)
4718c2ecf20Sopenharmony_ci{
4728c2ecf20Sopenharmony_ci	u32 vector = (vsi && q_vector) ? q_vector->reg_idx :
4738c2ecf20Sopenharmony_ci				((struct ice_pf *)hw->back)->oicr_idx;
4748c2ecf20Sopenharmony_ci	int itr = ICE_ITR_NONE;
4758c2ecf20Sopenharmony_ci	u32 val;
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci	/* clear the PBA here, as this function is meant to clean out all
4788c2ecf20Sopenharmony_ci	 * previous interrupts and enable the interrupt
4798c2ecf20Sopenharmony_ci	 */
4808c2ecf20Sopenharmony_ci	val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M |
4818c2ecf20Sopenharmony_ci	      (itr << GLINT_DYN_CTL_ITR_INDX_S);
4828c2ecf20Sopenharmony_ci	if (vsi)
4838c2ecf20Sopenharmony_ci		if (test_bit(__ICE_DOWN, vsi->state))
4848c2ecf20Sopenharmony_ci			return;
4858c2ecf20Sopenharmony_ci	wr32(hw, GLINT_DYN_CTL(vector), val);
4868c2ecf20Sopenharmony_ci}
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ci/**
4898c2ecf20Sopenharmony_ci * ice_netdev_to_pf - Retrieve the PF struct associated with a netdev
4908c2ecf20Sopenharmony_ci * @netdev: pointer to the netdev struct
4918c2ecf20Sopenharmony_ci */
4928c2ecf20Sopenharmony_cistatic inline struct ice_pf *ice_netdev_to_pf(struct net_device *netdev)
4938c2ecf20Sopenharmony_ci{
4948c2ecf20Sopenharmony_ci	struct ice_netdev_priv *np = netdev_priv(netdev);
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci	return np->vsi->back;
4978c2ecf20Sopenharmony_ci}
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_cistatic inline bool ice_is_xdp_ena_vsi(struct ice_vsi *vsi)
5008c2ecf20Sopenharmony_ci{
5018c2ecf20Sopenharmony_ci	return !!READ_ONCE(vsi->xdp_prog);
5028c2ecf20Sopenharmony_ci}
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_cistatic inline void ice_set_ring_xdp(struct ice_ring *ring)
5058c2ecf20Sopenharmony_ci{
5068c2ecf20Sopenharmony_ci	ring->flags |= ICE_TX_FLAGS_RING_XDP;
5078c2ecf20Sopenharmony_ci}
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci/**
5108c2ecf20Sopenharmony_ci * ice_xsk_pool - get XSK buffer pool bound to a ring
5118c2ecf20Sopenharmony_ci * @ring: ring to use
5128c2ecf20Sopenharmony_ci *
5138c2ecf20Sopenharmony_ci * Returns a pointer to xdp_umem structure if there is a buffer pool present,
5148c2ecf20Sopenharmony_ci * NULL otherwise.
5158c2ecf20Sopenharmony_ci */
5168c2ecf20Sopenharmony_cistatic inline struct xsk_buff_pool *ice_xsk_pool(struct ice_ring *ring)
5178c2ecf20Sopenharmony_ci{
5188c2ecf20Sopenharmony_ci	struct xsk_buff_pool **pools = ring->vsi->xsk_pools;
5198c2ecf20Sopenharmony_ci	u16 qid = ring->q_index;
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	if (ice_ring_is_xdp(ring))
5228c2ecf20Sopenharmony_ci		qid -= ring->vsi->num_xdp_txq;
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci	if (qid >= ring->vsi->num_xsk_pools || !pools || !pools[qid] ||
5258c2ecf20Sopenharmony_ci	    !ice_is_xdp_ena_vsi(ring->vsi))
5268c2ecf20Sopenharmony_ci		return NULL;
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_ci	return pools[qid];
5298c2ecf20Sopenharmony_ci}
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci/**
5328c2ecf20Sopenharmony_ci * ice_get_main_vsi - Get the PF VSI
5338c2ecf20Sopenharmony_ci * @pf: PF instance
5348c2ecf20Sopenharmony_ci *
5358c2ecf20Sopenharmony_ci * returns pf->vsi[0], which by definition is the PF VSI
5368c2ecf20Sopenharmony_ci */
5378c2ecf20Sopenharmony_cistatic inline struct ice_vsi *ice_get_main_vsi(struct ice_pf *pf)
5388c2ecf20Sopenharmony_ci{
5398c2ecf20Sopenharmony_ci	if (pf->vsi)
5408c2ecf20Sopenharmony_ci		return pf->vsi[0];
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci	return NULL;
5438c2ecf20Sopenharmony_ci}
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ci/**
5468c2ecf20Sopenharmony_ci * ice_get_ctrl_vsi - Get the control VSI
5478c2ecf20Sopenharmony_ci * @pf: PF instance
5488c2ecf20Sopenharmony_ci */
5498c2ecf20Sopenharmony_cistatic inline struct ice_vsi *ice_get_ctrl_vsi(struct ice_pf *pf)
5508c2ecf20Sopenharmony_ci{
5518c2ecf20Sopenharmony_ci	/* if pf->ctrl_vsi_idx is ICE_NO_VSI, control VSI was not set up */
5528c2ecf20Sopenharmony_ci	if (!pf->vsi || pf->ctrl_vsi_idx == ICE_NO_VSI)
5538c2ecf20Sopenharmony_ci		return NULL;
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci	return pf->vsi[pf->ctrl_vsi_idx];
5568c2ecf20Sopenharmony_ci}
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci#define ICE_FD_STAT_CTR_BLOCK_COUNT	256
5598c2ecf20Sopenharmony_ci#define ICE_FD_STAT_PF_IDX(base_idx) \
5608c2ecf20Sopenharmony_ci			((base_idx) * ICE_FD_STAT_CTR_BLOCK_COUNT)
5618c2ecf20Sopenharmony_ci#define ICE_FD_SB_STAT_IDX(base_idx) ICE_FD_STAT_PF_IDX(base_idx)
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ciint ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
5648c2ecf20Sopenharmony_ciint ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
5658c2ecf20Sopenharmony_ciint ice_vsi_open_ctrl(struct ice_vsi *vsi);
5668c2ecf20Sopenharmony_civoid ice_set_ethtool_ops(struct net_device *netdev);
5678c2ecf20Sopenharmony_civoid ice_set_ethtool_safe_mode_ops(struct net_device *netdev);
5688c2ecf20Sopenharmony_ciu16 ice_get_avail_txq_count(struct ice_pf *pf);
5698c2ecf20Sopenharmony_ciu16 ice_get_avail_rxq_count(struct ice_pf *pf);
5708c2ecf20Sopenharmony_ciint ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);
5718c2ecf20Sopenharmony_civoid ice_update_vsi_stats(struct ice_vsi *vsi);
5728c2ecf20Sopenharmony_civoid ice_update_pf_stats(struct ice_pf *pf);
5738c2ecf20Sopenharmony_ciint ice_up(struct ice_vsi *vsi);
5748c2ecf20Sopenharmony_ciint ice_down(struct ice_vsi *vsi);
5758c2ecf20Sopenharmony_ciint ice_vsi_cfg(struct ice_vsi *vsi);
5768c2ecf20Sopenharmony_cistruct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);
5778c2ecf20Sopenharmony_ciint ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog);
5788c2ecf20Sopenharmony_ciint ice_destroy_xdp_rings(struct ice_vsi *vsi);
5798c2ecf20Sopenharmony_ciint
5808c2ecf20Sopenharmony_ciice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
5818c2ecf20Sopenharmony_ci	     u32 flags);
5828c2ecf20Sopenharmony_ciint ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
5838c2ecf20Sopenharmony_ciint ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
5848c2ecf20Sopenharmony_civoid ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
5858c2ecf20Sopenharmony_ciint ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);
5868c2ecf20Sopenharmony_civoid ice_print_link_msg(struct ice_vsi *vsi, bool isup);
5878c2ecf20Sopenharmony_ciconst char *ice_stat_str(enum ice_status stat_err);
5888c2ecf20Sopenharmony_ciconst char *ice_aq_str(enum ice_aq_err aq_err);
5898c2ecf20Sopenharmony_cibool ice_is_wol_supported(struct ice_hw *hw);
5908c2ecf20Sopenharmony_ciint
5918c2ecf20Sopenharmony_ciice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
5928c2ecf20Sopenharmony_ci		    bool is_tun);
5938c2ecf20Sopenharmony_civoid ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena);
5948c2ecf20Sopenharmony_ciint ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);
5958c2ecf20Sopenharmony_ciint ice_del_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);
5968c2ecf20Sopenharmony_ciint ice_get_ethtool_fdir_entry(struct ice_hw *hw, struct ethtool_rxnfc *cmd);
5978c2ecf20Sopenharmony_ciint
5988c2ecf20Sopenharmony_ciice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,
5998c2ecf20Sopenharmony_ci		      u32 *rule_locs);
6008c2ecf20Sopenharmony_civoid ice_fdir_release_flows(struct ice_hw *hw);
6018c2ecf20Sopenharmony_civoid ice_fdir_replay_flows(struct ice_hw *hw);
6028c2ecf20Sopenharmony_civoid ice_fdir_replay_fltrs(struct ice_pf *pf);
6038c2ecf20Sopenharmony_ciint ice_fdir_create_dflt_rules(struct ice_pf *pf);
6048c2ecf20Sopenharmony_ciint ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
6058c2ecf20Sopenharmony_ci			  struct ice_rq_event_info *event);
6068c2ecf20Sopenharmony_ciint ice_open(struct net_device *netdev);
6078c2ecf20Sopenharmony_ciint ice_open_internal(struct net_device *netdev);
6088c2ecf20Sopenharmony_ciint ice_stop(struct net_device *netdev);
6098c2ecf20Sopenharmony_civoid ice_service_task_schedule(struct ice_pf *pf);
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci#endif /* _ICE_H_ */
612