xref: /openbmc/linux/drivers/net/ethernet/intel/ice/ice.h (revision fbc7b27af0f9fb181811424e29caf6825594a841)
1837f08fdSAnirudh Venkataramanan /* SPDX-License-Identifier: GPL-2.0 */
2837f08fdSAnirudh Venkataramanan /* Copyright (c) 2018, Intel Corporation. */
3837f08fdSAnirudh Venkataramanan 
4837f08fdSAnirudh Venkataramanan #ifndef _ICE_H_
5837f08fdSAnirudh Venkataramanan #define _ICE_H_
6837f08fdSAnirudh Venkataramanan 
7837f08fdSAnirudh Venkataramanan #include <linux/types.h>
8837f08fdSAnirudh Venkataramanan #include <linux/errno.h>
9837f08fdSAnirudh Venkataramanan #include <linux/kernel.h>
10837f08fdSAnirudh Venkataramanan #include <linux/module.h>
11462acf6aSTony Nguyen #include <linux/firmware.h>
12837f08fdSAnirudh Venkataramanan #include <linux/netdevice.h>
13837f08fdSAnirudh Venkataramanan #include <linux/compiler.h>
14dc49c772SAnirudh Venkataramanan #include <linux/etherdevice.h>
15cdedef59SAnirudh Venkataramanan #include <linux/skbuff.h>
163a858ba3SAnirudh Venkataramanan #include <linux/cpumask.h>
17fcea6f3dSAnirudh Venkataramanan #include <linux/rtnetlink.h>
183a858ba3SAnirudh Venkataramanan #include <linux/if_vlan.h>
19cdedef59SAnirudh Venkataramanan #include <linux/dma-mapping.h>
20837f08fdSAnirudh Venkataramanan #include <linux/pci.h>
21940b61afSAnirudh Venkataramanan #include <linux/workqueue.h>
22d69ea414SJacob Keller #include <linux/wait.h>
23837f08fdSAnirudh Venkataramanan #include <linux/aer.h>
24940b61afSAnirudh Venkataramanan #include <linux/interrupt.h>
25fcea6f3dSAnirudh Venkataramanan #include <linux/ethtool.h>
26940b61afSAnirudh Venkataramanan #include <linux/timer.h>
277ec59eeaSAnirudh Venkataramanan #include <linux/delay.h>
28837f08fdSAnirudh Venkataramanan #include <linux/bitmap.h>
293a858ba3SAnirudh Venkataramanan #include <linux/log2.h>
30d76a60baSAnirudh Venkataramanan #include <linux/ip.h>
31cf909e19SAnirudh Venkataramanan #include <linux/sctp.h>
32d76a60baSAnirudh Venkataramanan #include <linux/ipv6.h>
33efc2214bSMaciej Fijalkowski #include <linux/pkt_sched.h>
34940b61afSAnirudh Venkataramanan #include <linux/if_bridge.h>
35e3710a01SPaul M Stillwell Jr #include <linux/ctype.h>
36efc2214bSMaciej Fijalkowski #include <linux/bpf.h>
37f9f5301eSDave Ertman #include <linux/auxiliary_bus.h>
38ddf30f7fSAnirudh Venkataramanan #include <linux/avf/virtchnl.h>
3928bf2672SBrett Creeley #include <linux/cpu_rmap.h>
40cdf1f1f1SJacob Keller #include <linux/dim.h>
410754d65bSKiran Patil #include <net/pkt_cls.h>
421adf7eadSJacob Keller #include <net/devlink.h>
43d76a60baSAnirudh Venkataramanan #include <net/ipv6.h>
442d4238f5SKrzysztof Kazimierczak #include <net/xdp_sock.h>
45c7a21904SMichal Swiatkowski #include <net/xdp_sock_drv.h>
46a4e82a81STony Nguyen #include <net/geneve.h>
47a4e82a81STony Nguyen #include <net/gre.h>
48a4e82a81STony Nguyen #include <net/udp_tunnel.h>
49a4e82a81STony Nguyen #include <net/vxlan.h>
50d41f26b5SBruce Allan #if IS_ENABLED(CONFIG_DCB)
51d41f26b5SBruce Allan #include <scsi/iscsi_proto.h>
52d41f26b5SBruce Allan #endif /* CONFIG_DCB */
53837f08fdSAnirudh Venkataramanan #include "ice_devids.h"
54837f08fdSAnirudh Venkataramanan #include "ice_type.h"
55940b61afSAnirudh Venkataramanan #include "ice_txrx.h"
5637b6f646SAnirudh Venkataramanan #include "ice_dcb.h"
579c20346bSAnirudh Venkataramanan #include "ice_switch.h"
58f31e4b6fSAnirudh Venkataramanan #include "ice_common.h"
59*fbc7b27aSKiran Patil #include "ice_flow.h"
609c20346bSAnirudh Venkataramanan #include "ice_sched.h"
61348048e7SDave Ertman #include "ice_idc_int.h"
62ddf30f7fSAnirudh Venkataramanan #include "ice_virtchnl_pf.h"
63007676b4SAnirudh Venkataramanan #include "ice_sriov.h"
6406c16d89SJacob Keller #include "ice_ptp.h"
65148beb61SHenry Tieman #include "ice_fdir.h"
662d4238f5SKrzysztof Kazimierczak #include "ice_xsk.h"
6728bf2672SBrett Creeley #include "ice_arfs.h"
6837165e3fSMichal Swiatkowski #include "ice_repr.h"
690d08a441SKiran Patil #include "ice_eswitch.h"
70df006dd4SDave Ertman #include "ice_lag.h"
71837f08fdSAnirudh Venkataramanan 
72837f08fdSAnirudh Venkataramanan #define ICE_BAR0		0
733a858ba3SAnirudh Venkataramanan #define ICE_REQ_DESC_MULTIPLE	32
748be92a76SPreethi Banala #define ICE_MIN_NUM_DESC	64
753b6bf296SBruce Allan #define ICE_MAX_NUM_DESC	8160
761aec6e1bSBrett Creeley #define ICE_DFLT_MIN_RX_DESC	512
77dd47e1fdSJesse Brandeburg #define ICE_DFLT_NUM_TX_DESC	256
78dd47e1fdSJesse Brandeburg #define ICE_DFLT_NUM_RX_DESC	2048
79ad71b256SBrett Creeley 
805513b920SAnirudh Venkataramanan #define ICE_DFLT_TRAFFIC_CLASS	BIT(0)
81940b61afSAnirudh Venkataramanan #define ICE_INT_NAME_STR_LEN	(IFNAMSIZ + 16)
828f5ee3c4SJacob Keller #define ICE_AQ_LEN		192
8311836214SBrett Creeley #define ICE_MBXSQ_LEN		64
848f5ee3c4SJacob Keller #define ICE_SBQ_LEN		64
85f3fe97f6SBrett Creeley #define ICE_MIN_LAN_TXRX_MSIX	1
86f3fe97f6SBrett Creeley #define ICE_MIN_LAN_OICR_MSIX	1
87f3fe97f6SBrett Creeley #define ICE_MIN_MSIX		(ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX)
88da62c5ffSQi Zhang #define ICE_FDIR_MSIX		2
89d25a0fc4SDave Ertman #define ICE_RDMA_NUM_AEQ_MSIX	4
90d25a0fc4SDave Ertman #define ICE_MIN_RDMA_MSIX	2
91f66756e0SGrzegorz Nitka #define ICE_ESWITCH_MSIX	1
923a858ba3SAnirudh Venkataramanan #define ICE_NO_VSI		0xffff
933a858ba3SAnirudh Venkataramanan #define ICE_VSI_MAP_CONTIG	0
943a858ba3SAnirudh Venkataramanan #define ICE_VSI_MAP_SCATTER	1
953a858ba3SAnirudh Venkataramanan #define ICE_MAX_SCATTER_TXQS	16
963a858ba3SAnirudh Venkataramanan #define ICE_MAX_SCATTER_RXQS	16
97cdedef59SAnirudh Venkataramanan #define ICE_Q_WAIT_RETRY_LIMIT	10
98cdedef59SAnirudh Venkataramanan #define ICE_Q_WAIT_MAX_RETRY	(5 * ICE_Q_WAIT_RETRY_LIMIT)
99d76a60baSAnirudh Venkataramanan #define ICE_MAX_LG_RSS_QS	256
100940b61afSAnirudh Venkataramanan #define ICE_RES_VALID_BIT	0x8000
101940b61afSAnirudh Venkataramanan #define ICE_RES_MISC_VEC_ID	(ICE_RES_VALID_BIT - 1)
102d25a0fc4SDave Ertman #define ICE_RES_RDMA_VEC_ID	(ICE_RES_MISC_VEC_ID - 1)
103da62c5ffSQi Zhang /* All VF control VSIs share the same IRQ, so assign a unique ID for them */
104d25a0fc4SDave Ertman #define ICE_RES_VF_CTRL_VEC_ID	(ICE_RES_RDMA_VEC_ID - 1)
1053a858ba3SAnirudh Venkataramanan #define ICE_INVAL_Q_INDEX	0xffff
1060f9d5027SAnirudh Venkataramanan #define ICE_INVAL_VFID		256
107837f08fdSAnirudh Venkataramanan 
1088134d5ffSBrett Creeley #define ICE_MAX_RXQS_PER_TC		256	/* Used when setting VSI context per TC Rx queues */
1090754d65bSKiran Patil 
1100754d65bSKiran Patil #define ICE_CHNL_START_TC		1
1110754d65bSKiran Patil #define ICE_CHNL_MAX_TC			16
1120754d65bSKiran Patil 
113afd9d4abSAnirudh Venkataramanan #define ICE_MAX_RESET_WAIT		20
114afd9d4abSAnirudh Venkataramanan 
115fcea6f3dSAnirudh Venkataramanan #define ICE_VSIQF_HKEY_ARRAY_SIZE	((VSIQF_HKEY_MAX_INDEX + 1) *	4)
116fcea6f3dSAnirudh Venkataramanan 
117837f08fdSAnirudh Venkataramanan #define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
118837f08fdSAnirudh Venkataramanan 
119efc2214bSMaciej Fijalkowski #define ICE_MAX_MTU	(ICE_AQ_SET_MAC_FRAME_SIZE_MAX - ICE_ETH_PKT_HDR_PAD)
1203a858ba3SAnirudh Venkataramanan 
1213a858ba3SAnirudh Venkataramanan #define ICE_UP_TABLE_TRANSLATE(val, i) \
1223a858ba3SAnirudh Venkataramanan 		(((val) << ICE_AQ_VSI_UP_TABLE_UP##i##_S) & \
1233a858ba3SAnirudh Venkataramanan 		  ICE_AQ_VSI_UP_TABLE_UP##i##_M)
1243a858ba3SAnirudh Venkataramanan 
1252b245cb2SAnirudh Venkataramanan #define ICE_TX_DESC(R, i) (&(((struct ice_tx_desc *)((R)->desc))[i]))
126cdedef59SAnirudh Venkataramanan #define ICE_RX_DESC(R, i) (&(((union ice_32b_rx_flex_desc *)((R)->desc))[i]))
127d76a60baSAnirudh Venkataramanan #define ICE_TX_CTX_DESC(R, i) (&(((struct ice_tx_ctx_desc *)((R)->desc))[i]))
128cac2a27cSHenry Tieman #define ICE_TX_FDIRDESC(R, i) (&(((struct ice_fltr_desc *)((R)->desc))[i]))
129cdedef59SAnirudh Venkataramanan 
130*fbc7b27aSKiran Patil /* Minimum BW limit is 500 Kbps for any scheduler node */
131*fbc7b27aSKiran Patil #define ICE_MIN_BW_LIMIT		500
132*fbc7b27aSKiran Patil /* User can specify BW in either Kbit/Mbit/Gbit and OS converts it in bytes.
133*fbc7b27aSKiran Patil  * use it to convert user specified BW limit into Kbps
134*fbc7b27aSKiran Patil  */
135*fbc7b27aSKiran Patil #define ICE_BW_KBPS_DIVISOR		125
136*fbc7b27aSKiran Patil 
1370b28b702SAnirudh Venkataramanan /* Macro for each VSI in a PF */
1380b28b702SAnirudh Venkataramanan #define ice_for_each_vsi(pf, i) \
1390b28b702SAnirudh Venkataramanan 	for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++)
1400b28b702SAnirudh Venkataramanan 
1412faf63b6SMaciej Fijalkowski /* Macros for each Tx/Xdp/Rx ring in a VSI */
142cdedef59SAnirudh Venkataramanan #define ice_for_each_txq(vsi, i) \
143cdedef59SAnirudh Venkataramanan 	for ((i) = 0; (i) < (vsi)->num_txq; (i)++)
144cdedef59SAnirudh Venkataramanan 
1452faf63b6SMaciej Fijalkowski #define ice_for_each_xdp_txq(vsi, i) \
1462faf63b6SMaciej Fijalkowski 	for ((i) = 0; (i) < (vsi)->num_xdp_txq; (i)++)
1472faf63b6SMaciej Fijalkowski 
148cdedef59SAnirudh Venkataramanan #define ice_for_each_rxq(vsi, i) \
149cdedef59SAnirudh Venkataramanan 	for ((i) = 0; (i) < (vsi)->num_rxq; (i)++)
150cdedef59SAnirudh Venkataramanan 
151d337f2afSAnirudh Venkataramanan /* Macros for each allocated Tx/Rx ring whether used or not in a VSI */
152f8ba7db8SJacob Keller #define ice_for_each_alloc_txq(vsi, i) \
153f8ba7db8SJacob Keller 	for ((i) = 0; (i) < (vsi)->alloc_txq; (i)++)
154f8ba7db8SJacob Keller 
155f8ba7db8SJacob Keller #define ice_for_each_alloc_rxq(vsi, i) \
156f8ba7db8SJacob Keller 	for ((i) = 0; (i) < (vsi)->alloc_rxq; (i)++)
157f8ba7db8SJacob Keller 
15867fe64d7SBrett Creeley #define ice_for_each_q_vector(vsi, i) \
15967fe64d7SBrett Creeley 	for ((i) = 0; (i) < (vsi)->num_q_vectors; (i)++)
16067fe64d7SBrett Creeley 
1610754d65bSKiran Patil #define ice_for_each_chnl_tc(i)	\
1620754d65bSKiran Patil 	for ((i) = ICE_CHNL_START_TC; (i) < ICE_CHNL_MAX_TC; (i)++)
1630754d65bSKiran Patil 
1645eda8afdSAkeem G Abodunrin #define ICE_UCAST_PROMISC_BITS (ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX | \
1655eda8afdSAkeem G Abodunrin 				ICE_PROMISC_UCAST_RX | ICE_PROMISC_MCAST_RX)
1665eda8afdSAkeem G Abodunrin 
1675eda8afdSAkeem G Abodunrin #define ICE_UCAST_VLAN_PROMISC_BITS (ICE_PROMISC_UCAST_TX | \
1685eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_MCAST_TX | \
1695eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_UCAST_RX | \
1705eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_MCAST_RX | \
1715eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_VLAN_TX  | \
1725eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_VLAN_RX)
1735eda8afdSAkeem G Abodunrin 
1745eda8afdSAkeem G Abodunrin #define ICE_MCAST_PROMISC_BITS (ICE_PROMISC_MCAST_TX | ICE_PROMISC_MCAST_RX)
1755eda8afdSAkeem G Abodunrin 
1765eda8afdSAkeem G Abodunrin #define ICE_MCAST_VLAN_PROMISC_BITS (ICE_PROMISC_MCAST_TX | \
1775eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_MCAST_RX | \
1785eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_VLAN_TX  | \
1795eda8afdSAkeem G Abodunrin 				     ICE_PROMISC_VLAN_RX)
1805eda8afdSAkeem G Abodunrin 
1814015d11eSBrett Creeley #define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
1824015d11eSBrett Creeley 
18340b24760SAnirudh Venkataramanan enum ice_feature {
18440b24760SAnirudh Venkataramanan 	ICE_F_DSCP,
185325b2064SMaciej Machnikowski 	ICE_F_SMA_CTRL,
18640b24760SAnirudh Venkataramanan 	ICE_F_MAX
18740b24760SAnirudh Venkataramanan };
18840b24760SAnirudh Venkataramanan 
18922bf877eSMaciej Fijalkowski DECLARE_STATIC_KEY_FALSE(ice_xdp_locking_key);
19022bf877eSMaciej Fijalkowski 
1910754d65bSKiran Patil struct ice_channel {
1920754d65bSKiran Patil 	struct list_head list;
1930754d65bSKiran Patil 	u8 type;
1940754d65bSKiran Patil 	u16 sw_id;
1950754d65bSKiran Patil 	u16 base_q;
1960754d65bSKiran Patil 	u16 num_rxq;
1970754d65bSKiran Patil 	u16 num_txq;
1980754d65bSKiran Patil 	u16 vsi_num;
1990754d65bSKiran Patil 	u8 ena_tc;
2000754d65bSKiran Patil 	struct ice_aqc_vsi_props info;
2010754d65bSKiran Patil 	u64 max_tx_rate;
2020754d65bSKiran Patil 	u64 min_tx_rate;
2030754d65bSKiran Patil 	struct ice_vsi *ch_vsi;
2040754d65bSKiran Patil };
2050754d65bSKiran Patil 
206eff380aaSAnirudh Venkataramanan struct ice_txq_meta {
207eff380aaSAnirudh Venkataramanan 	u32 q_teid;	/* Tx-scheduler element identifier */
208eff380aaSAnirudh Venkataramanan 	u16 q_id;	/* Entry in VSI's txq_map bitmap */
209eff380aaSAnirudh Venkataramanan 	u16 q_handle;	/* Relative index of Tx queue within TC */
210eff380aaSAnirudh Venkataramanan 	u16 vsi_idx;	/* VSI index that Tx queue belongs to */
211eff380aaSAnirudh Venkataramanan 	u8 tc;		/* TC number that Tx queue belongs to */
212eff380aaSAnirudh Venkataramanan };
213eff380aaSAnirudh Venkataramanan 
2143a858ba3SAnirudh Venkataramanan struct ice_tc_info {
2153a858ba3SAnirudh Venkataramanan 	u16 qoffset;
216c5a2a4a3SUsha Ketineni 	u16 qcount_tx;
217c5a2a4a3SUsha Ketineni 	u16 qcount_rx;
218c5a2a4a3SUsha Ketineni 	u8 netdev_tc;
2193a858ba3SAnirudh Venkataramanan };
2203a858ba3SAnirudh Venkataramanan 
2213a858ba3SAnirudh Venkataramanan struct ice_tc_cfg {
2223a858ba3SAnirudh Venkataramanan 	u8 numtc; /* Total number of enabled TCs */
2230754d65bSKiran Patil 	u16 ena_tc; /* Tx map */
2243a858ba3SAnirudh Venkataramanan 	struct ice_tc_info tc_info[ICE_MAX_TRAFFIC_CLASS];
2253a858ba3SAnirudh Venkataramanan };
2263a858ba3SAnirudh Venkataramanan 
227940b61afSAnirudh Venkataramanan struct ice_res_tracker {
228940b61afSAnirudh Venkataramanan 	u16 num_entries;
229cbe66bfeSBrett Creeley 	u16 end;
230e94c0df9SGustavo A. R. Silva 	u16 list[];
231940b61afSAnirudh Venkataramanan };
232940b61afSAnirudh Venkataramanan 
23303f7a986SAnirudh Venkataramanan struct ice_qs_cfg {
23494c4441bSAnirudh Venkataramanan 	struct mutex *qs_mutex;  /* will be assigned to &pf->avail_q_mutex */
23503f7a986SAnirudh Venkataramanan 	unsigned long *pf_map;
23603f7a986SAnirudh Venkataramanan 	unsigned long pf_map_size;
23703f7a986SAnirudh Venkataramanan 	unsigned int q_count;
23803f7a986SAnirudh Venkataramanan 	unsigned int scatter_count;
23903f7a986SAnirudh Venkataramanan 	u16 *vsi_map;
24003f7a986SAnirudh Venkataramanan 	u16 vsi_map_offset;
24103f7a986SAnirudh Venkataramanan 	u8 mapping_mode;
24203f7a986SAnirudh Venkataramanan };
24303f7a986SAnirudh Venkataramanan 
244940b61afSAnirudh Venkataramanan struct ice_sw {
245940b61afSAnirudh Venkataramanan 	struct ice_pf *pf;
246940b61afSAnirudh Venkataramanan 	u16 sw_id;		/* switch ID for this switch */
247940b61afSAnirudh Venkataramanan 	u16 bridge_mode;	/* VEB/VEPA/Port Virtualizer */
248fc0f39bcSBrett Creeley 	struct ice_vsi *dflt_vsi;	/* default VSI for this switch */
249fc0f39bcSBrett Creeley 	u8 dflt_vsi_ena:1;	/* true if above dflt_vsi is enabled */
250940b61afSAnirudh Venkataramanan };
251940b61afSAnirudh Venkataramanan 
252e97fb1aeSAnirudh Venkataramanan enum ice_pf_state {
2537e408e07SAnirudh Venkataramanan 	ICE_TESTING,
2547e408e07SAnirudh Venkataramanan 	ICE_DOWN,
2557e408e07SAnirudh Venkataramanan 	ICE_NEEDS_RESTART,
2567e408e07SAnirudh Venkataramanan 	ICE_PREPARED_FOR_RESET,	/* set by driver when prepared */
2577e408e07SAnirudh Venkataramanan 	ICE_RESET_OICR_RECV,		/* set by driver after rcv reset OICR */
258348048e7SDave Ertman 	ICE_PFR_REQ,		/* set by driver */
259348048e7SDave Ertman 	ICE_CORER_REQ,		/* set by driver */
260348048e7SDave Ertman 	ICE_GLOBR_REQ,		/* set by driver */
2617e408e07SAnirudh Venkataramanan 	ICE_CORER_RECV,		/* set by OICR handler */
2627e408e07SAnirudh Venkataramanan 	ICE_GLOBR_RECV,		/* set by OICR handler */
2637e408e07SAnirudh Venkataramanan 	ICE_EMPR_RECV,		/* set by OICR handler */
2647e408e07SAnirudh Venkataramanan 	ICE_SUSPENDED,		/* set on module remove path */
2657e408e07SAnirudh Venkataramanan 	ICE_RESET_FAILED,		/* set by reset/rebuild */
266ddf30f7fSAnirudh Venkataramanan 	/* When checking for the PF to be in a nominal operating state, the
267ddf30f7fSAnirudh Venkataramanan 	 * bits that are grouped at the beginning of the list need to be
2687e408e07SAnirudh Venkataramanan 	 * checked. Bits occurring before ICE_STATE_NOMINAL_CHECK_BITS will
269ddf30f7fSAnirudh Venkataramanan 	 * be checked. If you need to add a bit into consideration for nominal
270ddf30f7fSAnirudh Venkataramanan 	 * operating state, it must be added before
2717e408e07SAnirudh Venkataramanan 	 * ICE_STATE_NOMINAL_CHECK_BITS. Do not move this entry's position
272ddf30f7fSAnirudh Venkataramanan 	 * without appropriate consideration.
273ddf30f7fSAnirudh Venkataramanan 	 */
2747e408e07SAnirudh Venkataramanan 	ICE_STATE_NOMINAL_CHECK_BITS,
2757e408e07SAnirudh Venkataramanan 	ICE_ADMINQ_EVENT_PENDING,
2767e408e07SAnirudh Venkataramanan 	ICE_MAILBOXQ_EVENT_PENDING,
2778f5ee3c4SJacob Keller 	ICE_SIDEBANDQ_EVENT_PENDING,
2787e408e07SAnirudh Venkataramanan 	ICE_MDD_EVENT_PENDING,
2797e408e07SAnirudh Venkataramanan 	ICE_VFLR_EVENT_PENDING,
2807e408e07SAnirudh Venkataramanan 	ICE_FLTR_OVERFLOW_PROMISC,
2817e408e07SAnirudh Venkataramanan 	ICE_VF_DIS,
282c503e632SAnirudh Venkataramanan 	ICE_VF_DEINIT_IN_PROGRESS,
2837e408e07SAnirudh Venkataramanan 	ICE_CFG_BUSY,
2847e408e07SAnirudh Venkataramanan 	ICE_SERVICE_SCHED,
2857e408e07SAnirudh Venkataramanan 	ICE_SERVICE_DIS,
2867e408e07SAnirudh Venkataramanan 	ICE_FD_FLUSH_REQ,
2877e408e07SAnirudh Venkataramanan 	ICE_OICR_INTR_DIS,		/* Global OICR interrupt disabled */
2887e408e07SAnirudh Venkataramanan 	ICE_MDD_VF_PRINT_PENDING,	/* set when MDD event handle */
2897e408e07SAnirudh Venkataramanan 	ICE_VF_RESETS_DISABLED,	/* disable resets during ice_remove */
2907e408e07SAnirudh Venkataramanan 	ICE_LINK_DEFAULT_OVERRIDE_PENDING,
2917e408e07SAnirudh Venkataramanan 	ICE_PHY_INIT_COMPLETE,
2927e408e07SAnirudh Venkataramanan 	ICE_FD_VF_FLUSH_CTX,		/* set at FD Rx IRQ or timeout */
2937e408e07SAnirudh Venkataramanan 	ICE_STATE_NBITS		/* must be last */
294837f08fdSAnirudh Venkataramanan };
295837f08fdSAnirudh Venkataramanan 
296e97fb1aeSAnirudh Venkataramanan enum ice_vsi_state {
297e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_DOWN,
298e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_NEEDS_RESTART,
299a476d72aSAnirudh Venkataramanan 	ICE_VSI_NETDEV_ALLOCD,
300a476d72aSAnirudh Venkataramanan 	ICE_VSI_NETDEV_REGISTERED,
301e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_UMAC_FLTR_CHANGED,
302e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_MMAC_FLTR_CHANGED,
303e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_VLAN_FLTR_CHANGED,
304e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_PROMISC_CHANGED,
305e97fb1aeSAnirudh Venkataramanan 	ICE_VSI_STATE_NBITS		/* must be last */
306e94d4478SAnirudh Venkataramanan };
307e94d4478SAnirudh Venkataramanan 
308940b61afSAnirudh Venkataramanan /* struct that defines a VSI, associated with a dev */
309940b61afSAnirudh Venkataramanan struct ice_vsi {
310940b61afSAnirudh Venkataramanan 	struct net_device *netdev;
3113a858ba3SAnirudh Venkataramanan 	struct ice_sw *vsw;		 /* switch this VSI is on */
3123a858ba3SAnirudh Venkataramanan 	struct ice_pf *back;		 /* back pointer to PF */
313940b61afSAnirudh Venkataramanan 	struct ice_port_info *port_info; /* back pointer to port_info */
314e72bba21SMaciej Fijalkowski 	struct ice_rx_ring **rx_rings;	 /* Rx ring array */
315e72bba21SMaciej Fijalkowski 	struct ice_tx_ring **tx_rings;	 /* Tx ring array */
3163a858ba3SAnirudh Venkataramanan 	struct ice_q_vector **q_vectors; /* q_vector array */
317cdedef59SAnirudh Venkataramanan 
318cdedef59SAnirudh Venkataramanan 	irqreturn_t (*irq_handler)(int irq, void *data);
319cdedef59SAnirudh Venkataramanan 
320fcea6f3dSAnirudh Venkataramanan 	u64 tx_linearize;
321e97fb1aeSAnirudh Venkataramanan 	DECLARE_BITMAP(state, ICE_VSI_STATE_NBITS);
322e94d4478SAnirudh Venkataramanan 	unsigned int current_netdev_flags;
323fcea6f3dSAnirudh Venkataramanan 	u32 tx_restart;
324fcea6f3dSAnirudh Venkataramanan 	u32 tx_busy;
325fcea6f3dSAnirudh Venkataramanan 	u32 rx_buf_failed;
326fcea6f3dSAnirudh Venkataramanan 	u32 rx_page_failed;
32788865fc4SKarol Kolacinski 	u16 num_q_vectors;
32888865fc4SKarol Kolacinski 	u16 base_vector;		/* IRQ base for OS reserved vectors */
3293a858ba3SAnirudh Venkataramanan 	enum ice_vsi_type type;
330940b61afSAnirudh Venkataramanan 	u16 vsi_num;			/* HW (absolute) index of this VSI */
3313a858ba3SAnirudh Venkataramanan 	u16 idx;			/* software index in pf->vsi[] */
3323a858ba3SAnirudh Venkataramanan 
3338ede0178SAnirudh Venkataramanan 	s16 vf_id;			/* VF ID for SR-IOV VSIs */
3348ede0178SAnirudh Venkataramanan 
335d95276ceSAkeem G Abodunrin 	u16 ethtype;			/* Ethernet protocol for pause frame */
336148beb61SHenry Tieman 	u16 num_gfltr;
337148beb61SHenry Tieman 	u16 num_bfltr;
338d95276ceSAkeem G Abodunrin 
339d76a60baSAnirudh Venkataramanan 	/* RSS config */
340d76a60baSAnirudh Venkataramanan 	u16 rss_table_size;	/* HW RSS table size */
341d76a60baSAnirudh Venkataramanan 	u16 rss_size;		/* Allocated RSS queues */
342d76a60baSAnirudh Venkataramanan 	u8 *rss_hkey_user;	/* User configured hash keys */
343d76a60baSAnirudh Venkataramanan 	u8 *rss_lut_user;	/* User configured lookup table entries */
344d76a60baSAnirudh Venkataramanan 	u8 rss_lut_type;	/* used to configure Get/Set RSS LUT AQ call */
345d76a60baSAnirudh Venkataramanan 
34628bf2672SBrett Creeley 	/* aRFS members only allocated for the PF VSI */
34728bf2672SBrett Creeley #define ICE_MAX_ARFS_LIST	1024
34828bf2672SBrett Creeley #define ICE_ARFS_LST_MASK	(ICE_MAX_ARFS_LIST - 1)
34928bf2672SBrett Creeley 	struct hlist_head *arfs_fltr_list;
35028bf2672SBrett Creeley 	struct ice_arfs_active_fltr_cntrs *arfs_fltr_cntrs;
35128bf2672SBrett Creeley 	spinlock_t arfs_lock;	/* protects aRFS hash table and filter state */
35228bf2672SBrett Creeley 	atomic_t *arfs_last_fltr_id;
35328bf2672SBrett Creeley 
354cdedef59SAnirudh Venkataramanan 	u16 max_frame;
355cdedef59SAnirudh Venkataramanan 	u16 rx_buf_len;
356cdedef59SAnirudh Venkataramanan 
3573a858ba3SAnirudh Venkataramanan 	struct ice_aqc_vsi_props info;	 /* VSI properties */
3583a858ba3SAnirudh Venkataramanan 
359fcea6f3dSAnirudh Venkataramanan 	/* VSI stats */
360fcea6f3dSAnirudh Venkataramanan 	struct rtnl_link_stats64 net_stats;
361fcea6f3dSAnirudh Venkataramanan 	struct ice_eth_stats eth_stats;
362fcea6f3dSAnirudh Venkataramanan 	struct ice_eth_stats eth_stats_prev;
363fcea6f3dSAnirudh Venkataramanan 
364e94d4478SAnirudh Venkataramanan 	struct list_head tmp_sync_list;		/* MAC filters to be synced */
365e94d4478SAnirudh Venkataramanan 	struct list_head tmp_unsync_list;	/* MAC filters to be unsynced */
366e94d4478SAnirudh Venkataramanan 
3670ab54c5fSJesse Brandeburg 	u8 irqs_ready:1;
3680ab54c5fSJesse Brandeburg 	u8 current_isup:1;		 /* Sync 'link up' logging */
3690ab54c5fSJesse Brandeburg 	u8 stat_offsets_loaded:1;
370cd6d6b83SBrett Creeley 	u16 num_vlan;
371cdedef59SAnirudh Venkataramanan 
3723a858ba3SAnirudh Venkataramanan 	/* queue information */
3733a858ba3SAnirudh Venkataramanan 	u8 tx_mapping_mode;		 /* ICE_MAP_MODE_[CONTIG|SCATTER] */
3743a858ba3SAnirudh Venkataramanan 	u8 rx_mapping_mode;		 /* ICE_MAP_MODE_[CONTIG|SCATTER] */
37578b5713aSAnirudh Venkataramanan 	u16 *txq_map;			 /* index in pf->avail_txqs */
37678b5713aSAnirudh Venkataramanan 	u16 *rxq_map;			 /* index in pf->avail_rxqs */
3773a858ba3SAnirudh Venkataramanan 	u16 alloc_txq;			 /* Allocated Tx queues */
3783a858ba3SAnirudh Venkataramanan 	u16 num_txq;			 /* Used Tx queues */
3793a858ba3SAnirudh Venkataramanan 	u16 alloc_rxq;			 /* Allocated Rx queues */
3803a858ba3SAnirudh Venkataramanan 	u16 num_rxq;			 /* Used Rx queues */
38187324e74SHenry Tieman 	u16 req_txq;			 /* User requested Tx queues */
38287324e74SHenry Tieman 	u16 req_rxq;			 /* User requested Rx queues */
383ad71b256SBrett Creeley 	u16 num_rx_desc;
384ad71b256SBrett Creeley 	u16 num_tx_desc;
385348048e7SDave Ertman 	u16 qset_handle[ICE_MAX_TRAFFIC_CLASS];
3863a858ba3SAnirudh Venkataramanan 	struct ice_tc_cfg tc_cfg;
387efc2214bSMaciej Fijalkowski 	struct bpf_prog *xdp_prog;
388e72bba21SMaciej Fijalkowski 	struct ice_tx_ring **xdp_rings;	 /* XDP ring array */
389e102db78SMaciej Fijalkowski 	unsigned long *af_xdp_zc_qps;	 /* tracks AF_XDP ZC enabled qps */
390efc2214bSMaciej Fijalkowski 	u16 num_xdp_txq;		 /* Used XDP queues */
391efc2214bSMaciej Fijalkowski 	u8 xdp_mapping_mode;		 /* ICE_MAP_MODE_[CONTIG|SCATTER] */
392b126bd6bSKiran Patil 
3931a1c40dfSGrzegorz Nitka 	struct net_device **target_netdevs;
3941a1c40dfSGrzegorz Nitka 
3950754d65bSKiran Patil 	struct tc_mqprio_qopt_offload mqprio_qopt; /* queue parameters */
3960754d65bSKiran Patil 
3970754d65bSKiran Patil 	/* Channel Specific Fields */
3980754d65bSKiran Patil 	struct ice_vsi *tc_map_vsi[ICE_CHNL_MAX_TC];
3990754d65bSKiran Patil 	u16 cnt_q_avail;
4000754d65bSKiran Patil 	u16 next_base_q;	/* next queue to be used for channel setup */
4010754d65bSKiran Patil 	struct list_head ch_list;
4020754d65bSKiran Patil 	u16 num_chnl_rxq;
4030754d65bSKiran Patil 	u16 num_chnl_txq;
4040754d65bSKiran Patil 	u16 ch_rss_size;
4050754d65bSKiran Patil 	/* store away rss size info before configuring ADQ channels so that,
4060754d65bSKiran Patil 	 * it can be used after tc-qdisc delete, to get back RSS setting as
4070754d65bSKiran Patil 	 * they were before
4080754d65bSKiran Patil 	 */
4090754d65bSKiran Patil 	u16 orig_rss_size;
4100754d65bSKiran Patil 	/* this keeps tracks of all enabled TC with and without DCB
4110754d65bSKiran Patil 	 * and inclusive of ADQ, vsi->mqprio_opt keeps track of queue
4120754d65bSKiran Patil 	 * information
4130754d65bSKiran Patil 	 */
4140754d65bSKiran Patil 	u8 all_numtc;
4150754d65bSKiran Patil 	u16 all_enatc;
4160754d65bSKiran Patil 
4170754d65bSKiran Patil 	/* store away TC info, to be used for rebuild logic */
4180754d65bSKiran Patil 	u8 old_numtc;
4190754d65bSKiran Patil 	u16 old_ena_tc;
4200754d65bSKiran Patil 
4210754d65bSKiran Patil 	struct ice_channel *ch;
4220754d65bSKiran Patil 
423b126bd6bSKiran Patil 	/* setup back reference, to which aggregator node this VSI
424b126bd6bSKiran Patil 	 * corresponds to
425b126bd6bSKiran Patil 	 */
426b126bd6bSKiran Patil 	struct ice_agg_node *agg_node;
4273a858ba3SAnirudh Venkataramanan } ____cacheline_internodealigned_in_smp;
4283a858ba3SAnirudh Venkataramanan 
4293a858ba3SAnirudh Venkataramanan /* struct that defines an interrupt vector */
4303a858ba3SAnirudh Venkataramanan struct ice_q_vector {
4313a858ba3SAnirudh Venkataramanan 	struct ice_vsi *vsi;
4328244dd2dSBrett Creeley 
4333a858ba3SAnirudh Venkataramanan 	u16 v_idx;			/* index in the vsi->q_vector array. */
434b07833a0SBrett Creeley 	u16 reg_idx;
435d337f2afSAnirudh Venkataramanan 	u8 num_ring_rx;			/* total number of Rx rings in vector */
4368244dd2dSBrett Creeley 	u8 num_ring_tx;			/* total number of Tx rings in vector */
437cdf1f1f1SJacob Keller 	u8 wb_on_itr:1;			/* if true, WB on ITR is enabled */
4389e4ab4c2SBrett Creeley 	/* in usecs, need to use ice_intrl_to_usecs_reg() before writing this
4399e4ab4c2SBrett Creeley 	 * value to the device
4409e4ab4c2SBrett Creeley 	 */
4419e4ab4c2SBrett Creeley 	u8 intrl;
4428244dd2dSBrett Creeley 
4438244dd2dSBrett Creeley 	struct napi_struct napi;
4448244dd2dSBrett Creeley 
4458244dd2dSBrett Creeley 	struct ice_ring_container rx;
4468244dd2dSBrett Creeley 	struct ice_ring_container tx;
4478244dd2dSBrett Creeley 
4488244dd2dSBrett Creeley 	cpumask_t affinity_mask;
4498244dd2dSBrett Creeley 	struct irq_affinity_notify affinity_notify;
4508244dd2dSBrett Creeley 
451*fbc7b27aSKiran Patil 	struct ice_channel *ch;
452*fbc7b27aSKiran Patil 
4538244dd2dSBrett Creeley 	char name[ICE_INT_NAME_STR_LEN];
454cdf1f1f1SJacob Keller 
455cdf1f1f1SJacob Keller 	u16 total_events;	/* net_dim(): number of interrupts processed */
456940b61afSAnirudh Venkataramanan } ____cacheline_internodealigned_in_smp;
457940b61afSAnirudh Venkataramanan 
458940b61afSAnirudh Venkataramanan enum ice_pf_flags {
459940b61afSAnirudh Venkataramanan 	ICE_FLAG_FLTR_SYNC,
460d25a0fc4SDave Ertman 	ICE_FLAG_RDMA_ENA,
461940b61afSAnirudh Venkataramanan 	ICE_FLAG_RSS_ENA,
462ddf30f7fSAnirudh Venkataramanan 	ICE_FLAG_SRIOV_ENA,
46375d2b253SAnirudh Venkataramanan 	ICE_FLAG_SRIOV_CAPABLE,
46437b6f646SAnirudh Venkataramanan 	ICE_FLAG_DCB_CAPABLE,
46537b6f646SAnirudh Venkataramanan 	ICE_FLAG_DCB_ENA,
466148beb61SHenry Tieman 	ICE_FLAG_FD_ENA,
46706c16d89SJacob Keller 	ICE_FLAG_PTP_SUPPORTED,		/* PTP is supported by NVM */
46806c16d89SJacob Keller 	ICE_FLAG_PTP,			/* PTP is enabled by software */
469d25a0fc4SDave Ertman 	ICE_FLAG_AUX_ENA,
470462acf6aSTony Nguyen 	ICE_FLAG_ADV_FEATURES,
4710754d65bSKiran Patil 	ICE_FLAG_TC_MQPRIO,		/* support for Multi queue TC */
4720d08a441SKiran Patil 	ICE_FLAG_CLS_FLOWER,
473ab4ab73fSBruce Allan 	ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA,
474b4e813ddSBruce Allan 	ICE_FLAG_TOTAL_PORT_SHUTDOWN_ENA,
4756d599946STony Nguyen 	ICE_FLAG_NO_MEDIA,
47684a118abSDave Ertman 	ICE_FLAG_FW_LLDP_AGENT,
477c77849f5SAnirudh Venkataramanan 	ICE_FLAG_MOD_POWER_UNSUPPORTED,
4783a257a14SAnirudh Venkataramanan 	ICE_FLAG_ETHTOOL_CTXT,		/* set when ethtool holds RTNL lock */
4797237f5b0SMaciej Fijalkowski 	ICE_FLAG_LEGACY_RX,
48001b5e89aSBrett Creeley 	ICE_FLAG_VF_TRUE_PROMISC_ENA,
4819d5c5a52SPaul Greenwalt 	ICE_FLAG_MDD_AUTO_RESET_VF,
482ea78ce4dSPaul Greenwalt 	ICE_FLAG_LINK_LENIENT_MODE_ENA,
483940b61afSAnirudh Venkataramanan 	ICE_PF_FLAGS_NBITS		/* must be last */
484940b61afSAnirudh Venkataramanan };
485940b61afSAnirudh Venkataramanan 
4861a1c40dfSGrzegorz Nitka struct ice_switchdev_info {
4871a1c40dfSGrzegorz Nitka 	struct ice_vsi *control_vsi;
4881a1c40dfSGrzegorz Nitka 	struct ice_vsi *uplink_vsi;
4891a1c40dfSGrzegorz Nitka 	bool is_running;
4901a1c40dfSGrzegorz Nitka };
4911a1c40dfSGrzegorz Nitka 
492b126bd6bSKiran Patil struct ice_agg_node {
493b126bd6bSKiran Patil 	u32 agg_id;
494b126bd6bSKiran Patil #define ICE_MAX_VSIS_IN_AGG_NODE	64
495b126bd6bSKiran Patil 	u32 num_vsis;
496b126bd6bSKiran Patil 	u8 valid;
497b126bd6bSKiran Patil };
498b126bd6bSKiran Patil 
499837f08fdSAnirudh Venkataramanan struct ice_pf {
500837f08fdSAnirudh Venkataramanan 	struct pci_dev *pdev;
501eb0208ecSPreethi Banala 
502dce730f1SJacob Keller 	struct devlink_region *nvm_region;
5038d7aab35SJacob Keller 	struct devlink_region *devcaps_region;
504dce730f1SJacob Keller 
5052ae0aa47SWojciech Drewek 	/* devlink port data */
5062ae0aa47SWojciech Drewek 	struct devlink_port devlink_port;
5072ae0aa47SWojciech Drewek 
508eb0208ecSPreethi Banala 	/* OS reserved IRQ details */
509940b61afSAnirudh Venkataramanan 	struct msix_entry *msix_entries;
510cbe66bfeSBrett Creeley 	struct ice_res_tracker *irq_tracker;
511cbe66bfeSBrett Creeley 	/* First MSIX vector used by SR-IOV VFs. Calculated by subtracting the
512cbe66bfeSBrett Creeley 	 * number of MSIX vectors needed for all SR-IOV VFs from the number of
513cbe66bfeSBrett Creeley 	 * MSIX vectors allowed on this PF.
514cbe66bfeSBrett Creeley 	 */
515cbe66bfeSBrett Creeley 	u16 sriov_base_vector;
516eb0208ecSPreethi Banala 
517148beb61SHenry Tieman 	u16 ctrl_vsi_idx;		/* control VSI index in pf->vsi array */
518148beb61SHenry Tieman 
519940b61afSAnirudh Venkataramanan 	struct ice_vsi **vsi;		/* VSIs created by the driver */
520940b61afSAnirudh Venkataramanan 	struct ice_sw *first_sw;	/* first switch created by firmware */
5213ea9bd5dSMichal Swiatkowski 	u16 eswitch_mode;		/* current mode of eswitch */
522ddf30f7fSAnirudh Venkataramanan 	/* Virtchnl/SR-IOV config info */
523ddf30f7fSAnirudh Venkataramanan 	struct ice_vf *vf;
52453bb6698SJesse Brandeburg 	u16 num_alloc_vfs;		/* actual number of VFs allocated */
52575d2b253SAnirudh Venkataramanan 	u16 num_vfs_supported;		/* num VFs supported for this PF */
52646c276ceSBrett Creeley 	u16 num_qps_per_vf;
52746c276ceSBrett Creeley 	u16 num_msix_per_vf;
5289d5c5a52SPaul Greenwalt 	/* used to ratelimit the MDD event logging */
5299d5c5a52SPaul Greenwalt 	unsigned long last_printed_mdd_jiffies;
5300891c896SVignesh Sridhar 	DECLARE_BITMAP(malvfs, ICE_MAX_VF_COUNT);
53140b24760SAnirudh Venkataramanan 	DECLARE_BITMAP(features, ICE_F_MAX);
5327e408e07SAnirudh Venkataramanan 	DECLARE_BITMAP(state, ICE_STATE_NBITS);
533940b61afSAnirudh Venkataramanan 	DECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS);
53478b5713aSAnirudh Venkataramanan 	unsigned long *avail_txqs;	/* bitmap to track PF Tx queue usage */
53578b5713aSAnirudh Venkataramanan 	unsigned long *avail_rxqs;	/* bitmap to track PF Rx queue usage */
536940b61afSAnirudh Venkataramanan 	unsigned long serv_tmr_period;
537940b61afSAnirudh Venkataramanan 	unsigned long serv_tmr_prev;
538940b61afSAnirudh Venkataramanan 	struct timer_list serv_tmr;
539940b61afSAnirudh Venkataramanan 	struct work_struct serv_task;
540940b61afSAnirudh Venkataramanan 	struct mutex avail_q_mutex;	/* protects access to avail_[rx|tx]qs */
541940b61afSAnirudh Venkataramanan 	struct mutex sw_mutex;		/* lock for protecting VSI alloc flow */
542b94b013eSDave Ertman 	struct mutex tc_mutex;		/* lock to protect TC changes */
543837f08fdSAnirudh Venkataramanan 	u32 msg_enable;
54406c16d89SJacob Keller 	struct ice_ptp ptp;
545d25a0fc4SDave Ertman 	u16 num_rdma_msix;		/* Total MSIX vectors for RDMA driver */
546d25a0fc4SDave Ertman 	u16 rdma_base_vector;
547d69ea414SJacob Keller 
548d69ea414SJacob Keller 	/* spinlock to protect the AdminQ wait list */
549d69ea414SJacob Keller 	spinlock_t aq_wait_lock;
550d69ea414SJacob Keller 	struct hlist_head aq_wait_list;
551d69ea414SJacob Keller 	wait_queue_head_t aq_wait_queue;
552d69ea414SJacob Keller 
5531c08052eSJacob Keller 	wait_queue_head_t reset_wait_queue;
5541c08052eSJacob Keller 
555d76a60baSAnirudh Venkataramanan 	u32 hw_csum_rx_error;
55688865fc4SKarol Kolacinski 	u16 oicr_idx;		/* Other interrupt cause MSIX vector index */
55788865fc4SKarol Kolacinski 	u16 num_avail_sw_msix;	/* remaining MSIX SW vectors left unclaimed */
55878b5713aSAnirudh Venkataramanan 	u16 max_pf_txqs;	/* Total Tx queues PF wide */
55978b5713aSAnirudh Venkataramanan 	u16 max_pf_rxqs;	/* Total Rx queues PF wide */
56088865fc4SKarol Kolacinski 	u16 num_lan_msix;	/* Total MSIX vectors for base driver */
561f9867df6SAnirudh Venkataramanan 	u16 num_lan_tx;		/* num LAN Tx queues setup */
562f9867df6SAnirudh Venkataramanan 	u16 num_lan_rx;		/* num LAN Rx queues setup */
563940b61afSAnirudh Venkataramanan 	u16 next_vsi;		/* Next free slot in pf->vsi[] - 0-based! */
564940b61afSAnirudh Venkataramanan 	u16 num_alloc_vsi;
5650b28b702SAnirudh Venkataramanan 	u16 corer_count;	/* Core reset count */
5660b28b702SAnirudh Venkataramanan 	u16 globr_count;	/* Global reset count */
5670b28b702SAnirudh Venkataramanan 	u16 empr_count;		/* EMP reset count */
5680b28b702SAnirudh Venkataramanan 	u16 pfr_count;		/* PF reset count */
5690b28b702SAnirudh Venkataramanan 
570769c500dSAkeem G Abodunrin 	u8 wol_ena : 1;		/* software state of WoL */
571769c500dSAkeem G Abodunrin 	u32 wakeup_reason;	/* last wakeup reason */
572fcea6f3dSAnirudh Venkataramanan 	struct ice_hw_port_stats stats;
573fcea6f3dSAnirudh Venkataramanan 	struct ice_hw_port_stats stats_prev;
574837f08fdSAnirudh Venkataramanan 	struct ice_hw hw;
5750ab54c5fSJesse Brandeburg 	u8 stat_prev_loaded:1; /* has previous stats been loaded */
5767b9ffc76SAnirudh Venkataramanan 	u16 dcbx_cap;
577b3969fd7SSudheer Mogilappagari 	u32 tx_timeout_count;
578b3969fd7SSudheer Mogilappagari 	unsigned long tx_timeout_last_recovery;
579b3969fd7SSudheer Mogilappagari 	u32 tx_timeout_recovery_level;
580940b61afSAnirudh Venkataramanan 	char int_name[ICE_INT_NAME_STR_LEN];
581d25a0fc4SDave Ertman 	struct auxiliary_device *adev;
582d25a0fc4SDave Ertman 	int aux_idx;
5830e674aebSAnirudh Venkataramanan 	u32 sw_int_count;
5841a3571b5SPaul Greenwalt 
5850d08a441SKiran Patil 	struct hlist_head tc_flower_fltr_list;
5860d08a441SKiran Patil 
5871a3571b5SPaul Greenwalt 	__le64 nvm_phy_type_lo; /* NVM PHY type low */
5881a3571b5SPaul Greenwalt 	__le64 nvm_phy_type_hi; /* NVM PHY type high */
589ea78ce4dSPaul Greenwalt 	struct ice_link_default_override_tlv link_dflt_override;
590df006dd4SDave Ertman 	struct ice_lag *lag; /* Link Aggregation information */
591b126bd6bSKiran Patil 
5921a1c40dfSGrzegorz Nitka 	struct ice_switchdev_info switchdev;
5931a1c40dfSGrzegorz Nitka 
594b126bd6bSKiran Patil #define ICE_INVALID_AGG_NODE_ID		0
595b126bd6bSKiran Patil #define ICE_PF_AGG_NODE_ID_START	1
596b126bd6bSKiran Patil #define ICE_MAX_PF_AGG_NODES		32
597b126bd6bSKiran Patil 	struct ice_agg_node pf_agg_node[ICE_MAX_PF_AGG_NODES];
598b126bd6bSKiran Patil #define ICE_VF_AGG_NODE_ID_START	65
599b126bd6bSKiran Patil #define ICE_MAX_VF_AGG_NODES		32
600b126bd6bSKiran Patil 	struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES];
601837f08fdSAnirudh Venkataramanan };
602940b61afSAnirudh Venkataramanan 
6033a858ba3SAnirudh Venkataramanan struct ice_netdev_priv {
6043a858ba3SAnirudh Venkataramanan 	struct ice_vsi *vsi;
60537165e3fSMichal Swiatkowski 	struct ice_repr *repr;
6063a858ba3SAnirudh Venkataramanan };
6073a858ba3SAnirudh Venkataramanan 
608940b61afSAnirudh Venkataramanan /**
609*fbc7b27aSKiran Patil  * ice_vector_ch_enabled
610*fbc7b27aSKiran Patil  * @qv: pointer to q_vector, can be NULL
611*fbc7b27aSKiran Patil  *
612*fbc7b27aSKiran Patil  * This function returns true if vector is channel enabled otherwise false
613*fbc7b27aSKiran Patil  */
614*fbc7b27aSKiran Patil static inline bool ice_vector_ch_enabled(struct ice_q_vector *qv)
615*fbc7b27aSKiran Patil {
616*fbc7b27aSKiran Patil 	return !!qv->ch; /* Enable it to run with TC */
617*fbc7b27aSKiran Patil }
618*fbc7b27aSKiran Patil 
619*fbc7b27aSKiran Patil /**
620940b61afSAnirudh Venkataramanan  * ice_irq_dynamic_ena - Enable default interrupt generation settings
621f9867df6SAnirudh Venkataramanan  * @hw: pointer to HW struct
622f9867df6SAnirudh Venkataramanan  * @vsi: pointer to VSI struct, can be NULL
623cdedef59SAnirudh Venkataramanan  * @q_vector: pointer to q_vector, can be NULL
624940b61afSAnirudh Venkataramanan  */
625c8b7abddSBruce Allan static inline void
626c8b7abddSBruce Allan ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi,
627cdedef59SAnirudh Venkataramanan 		    struct ice_q_vector *q_vector)
628940b61afSAnirudh Venkataramanan {
629b07833a0SBrett Creeley 	u32 vector = (vsi && q_vector) ? q_vector->reg_idx :
630cbe66bfeSBrett Creeley 				((struct ice_pf *)hw->back)->oicr_idx;
631940b61afSAnirudh Venkataramanan 	int itr = ICE_ITR_NONE;
632940b61afSAnirudh Venkataramanan 	u32 val;
633940b61afSAnirudh Venkataramanan 
634940b61afSAnirudh Venkataramanan 	/* clear the PBA here, as this function is meant to clean out all
635940b61afSAnirudh Venkataramanan 	 * previous interrupts and enable the interrupt
636940b61afSAnirudh Venkataramanan 	 */
637940b61afSAnirudh Venkataramanan 	val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M |
638940b61afSAnirudh Venkataramanan 	      (itr << GLINT_DYN_CTL_ITR_INDX_S);
639cdedef59SAnirudh Venkataramanan 	if (vsi)
640e97fb1aeSAnirudh Venkataramanan 		if (test_bit(ICE_VSI_DOWN, vsi->state))
641cdedef59SAnirudh Venkataramanan 			return;
642940b61afSAnirudh Venkataramanan 	wr32(hw, GLINT_DYN_CTL(vector), val);
643940b61afSAnirudh Venkataramanan }
644cdedef59SAnirudh Venkataramanan 
645c2a23e00SBrett Creeley /**
646462acf6aSTony Nguyen  * ice_netdev_to_pf - Retrieve the PF struct associated with a netdev
647462acf6aSTony Nguyen  * @netdev: pointer to the netdev struct
648462acf6aSTony Nguyen  */
649462acf6aSTony Nguyen static inline struct ice_pf *ice_netdev_to_pf(struct net_device *netdev)
650462acf6aSTony Nguyen {
651462acf6aSTony Nguyen 	struct ice_netdev_priv *np = netdev_priv(netdev);
652462acf6aSTony Nguyen 
653462acf6aSTony Nguyen 	return np->vsi->back;
654462acf6aSTony Nguyen }
655462acf6aSTony Nguyen 
656efc2214bSMaciej Fijalkowski static inline bool ice_is_xdp_ena_vsi(struct ice_vsi *vsi)
657efc2214bSMaciej Fijalkowski {
658efc2214bSMaciej Fijalkowski 	return !!vsi->xdp_prog;
659efc2214bSMaciej Fijalkowski }
660efc2214bSMaciej Fijalkowski 
661e72bba21SMaciej Fijalkowski static inline void ice_set_ring_xdp(struct ice_tx_ring *ring)
662efc2214bSMaciej Fijalkowski {
663efc2214bSMaciej Fijalkowski 	ring->flags |= ICE_TX_FLAGS_RING_XDP;
664efc2214bSMaciej Fijalkowski }
665efc2214bSMaciej Fijalkowski 
666462acf6aSTony Nguyen /**
6671742b3d5SMagnus Karlsson  * ice_xsk_pool - get XSK buffer pool bound to a ring
668e72bba21SMaciej Fijalkowski  * @ring: Rx ring to use
6692d4238f5SKrzysztof Kazimierczak  *
6701742b3d5SMagnus Karlsson  * Returns a pointer to xdp_umem structure if there is a buffer pool present,
6712d4238f5SKrzysztof Kazimierczak  * NULL otherwise.
6722d4238f5SKrzysztof Kazimierczak  */
673e72bba21SMaciej Fijalkowski static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_rx_ring *ring)
6742d4238f5SKrzysztof Kazimierczak {
675e102db78SMaciej Fijalkowski 	struct ice_vsi *vsi = ring->vsi;
67665bb559bSKrzysztof Kazimierczak 	u16 qid = ring->q_index;
6772d4238f5SKrzysztof Kazimierczak 
678e72bba21SMaciej Fijalkowski 	if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
679e72bba21SMaciej Fijalkowski 		return NULL;
680e72bba21SMaciej Fijalkowski 
681e72bba21SMaciej Fijalkowski 	return xsk_get_pool_from_qid(vsi->netdev, qid);
682e72bba21SMaciej Fijalkowski }
683e72bba21SMaciej Fijalkowski 
684e72bba21SMaciej Fijalkowski /**
685e72bba21SMaciej Fijalkowski  * ice_tx_xsk_pool - get XSK buffer pool bound to a ring
686e72bba21SMaciej Fijalkowski  * @ring: Tx ring to use
687e72bba21SMaciej Fijalkowski  *
688e72bba21SMaciej Fijalkowski  * Returns a pointer to xdp_umem structure if there is a buffer pool present,
689e72bba21SMaciej Fijalkowski  * NULL otherwise. Tx equivalent of ice_xsk_pool.
690e72bba21SMaciej Fijalkowski  */
691e72bba21SMaciej Fijalkowski static inline struct xsk_buff_pool *ice_tx_xsk_pool(struct ice_tx_ring *ring)
692e72bba21SMaciej Fijalkowski {
693e72bba21SMaciej Fijalkowski 	struct ice_vsi *vsi = ring->vsi;
694e72bba21SMaciej Fijalkowski 	u16 qid;
695e72bba21SMaciej Fijalkowski 
696e72bba21SMaciej Fijalkowski 	qid = ring->q_index - vsi->num_xdp_txq;
6972d4238f5SKrzysztof Kazimierczak 
698e102db78SMaciej Fijalkowski 	if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
6992d4238f5SKrzysztof Kazimierczak 		return NULL;
7002d4238f5SKrzysztof Kazimierczak 
701e102db78SMaciej Fijalkowski 	return xsk_get_pool_from_qid(vsi->netdev, qid);
7022d4238f5SKrzysztof Kazimierczak }
7032d4238f5SKrzysztof Kazimierczak 
7042d4238f5SKrzysztof Kazimierczak /**
705208ff751SAnirudh Venkataramanan  * ice_get_main_vsi - Get the PF VSI
706208ff751SAnirudh Venkataramanan  * @pf: PF instance
707208ff751SAnirudh Venkataramanan  *
708208ff751SAnirudh Venkataramanan  * returns pf->vsi[0], which by definition is the PF VSI
709c2a23e00SBrett Creeley  */
710208ff751SAnirudh Venkataramanan static inline struct ice_vsi *ice_get_main_vsi(struct ice_pf *pf)
711c2a23e00SBrett Creeley {
712208ff751SAnirudh Venkataramanan 	if (pf->vsi)
713208ff751SAnirudh Venkataramanan 		return pf->vsi[0];
714c2a23e00SBrett Creeley 
715c2a23e00SBrett Creeley 	return NULL;
716c2a23e00SBrett Creeley }
717c2a23e00SBrett Creeley 
718148beb61SHenry Tieman /**
7197aae80ceSWojciech Drewek  * ice_get_netdev_priv_vsi - return VSI associated with netdev priv.
7207aae80ceSWojciech Drewek  * @np: private netdev structure
7217aae80ceSWojciech Drewek  */
7227aae80ceSWojciech Drewek static inline struct ice_vsi *ice_get_netdev_priv_vsi(struct ice_netdev_priv *np)
7237aae80ceSWojciech Drewek {
7247aae80ceSWojciech Drewek 	/* In case of port representor return source port VSI. */
7257aae80ceSWojciech Drewek 	if (np->repr)
7267aae80ceSWojciech Drewek 		return np->repr->src_vsi;
7277aae80ceSWojciech Drewek 	else
7287aae80ceSWojciech Drewek 		return np->vsi;
7297aae80ceSWojciech Drewek }
7307aae80ceSWojciech Drewek 
7317aae80ceSWojciech Drewek /**
732148beb61SHenry Tieman  * ice_get_ctrl_vsi - Get the control VSI
733148beb61SHenry Tieman  * @pf: PF instance
734148beb61SHenry Tieman  */
735148beb61SHenry Tieman static inline struct ice_vsi *ice_get_ctrl_vsi(struct ice_pf *pf)
736148beb61SHenry Tieman {
737148beb61SHenry Tieman 	/* if pf->ctrl_vsi_idx is ICE_NO_VSI, control VSI was not set up */
738148beb61SHenry Tieman 	if (!pf->vsi || pf->ctrl_vsi_idx == ICE_NO_VSI)
739148beb61SHenry Tieman 		return NULL;
740148beb61SHenry Tieman 
741148beb61SHenry Tieman 	return pf->vsi[pf->ctrl_vsi_idx];
742148beb61SHenry Tieman }
743148beb61SHenry Tieman 
744df006dd4SDave Ertman /**
7451a1c40dfSGrzegorz Nitka  * ice_is_switchdev_running - check if switchdev is configured
7461a1c40dfSGrzegorz Nitka  * @pf: pointer to PF structure
7471a1c40dfSGrzegorz Nitka  *
7481a1c40dfSGrzegorz Nitka  * Returns true if eswitch mode is set to DEVLINK_ESWITCH_MODE_SWITCHDEV
7491a1c40dfSGrzegorz Nitka  * and switchdev is configured, false otherwise.
7501a1c40dfSGrzegorz Nitka  */
7511a1c40dfSGrzegorz Nitka static inline bool ice_is_switchdev_running(struct ice_pf *pf)
7521a1c40dfSGrzegorz Nitka {
7531a1c40dfSGrzegorz Nitka 	return pf->switchdev.is_running;
7541a1c40dfSGrzegorz Nitka }
7551a1c40dfSGrzegorz Nitka 
7561a1c40dfSGrzegorz Nitka /**
757df006dd4SDave Ertman  * ice_set_sriov_cap - enable SRIOV in PF flags
758df006dd4SDave Ertman  * @pf: PF struct
759df006dd4SDave Ertman  */
760df006dd4SDave Ertman static inline void ice_set_sriov_cap(struct ice_pf *pf)
761df006dd4SDave Ertman {
762df006dd4SDave Ertman 	if (pf->hw.func_caps.common_cap.sr_iov_1_1)
763df006dd4SDave Ertman 		set_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags);
764df006dd4SDave Ertman }
765df006dd4SDave Ertman 
766df006dd4SDave Ertman /**
767df006dd4SDave Ertman  * ice_clear_sriov_cap - disable SRIOV in PF flags
768df006dd4SDave Ertman  * @pf: PF struct
769df006dd4SDave Ertman  */
770df006dd4SDave Ertman static inline void ice_clear_sriov_cap(struct ice_pf *pf)
771df006dd4SDave Ertman {
772df006dd4SDave Ertman 	clear_bit(ICE_FLAG_SRIOV_CAPABLE, pf->flags);
773df006dd4SDave Ertman }
774df006dd4SDave Ertman 
7754ab95646SHenry Tieman #define ICE_FD_STAT_CTR_BLOCK_COUNT	256
7764ab95646SHenry Tieman #define ICE_FD_STAT_PF_IDX(base_idx) \
7774ab95646SHenry Tieman 			((base_idx) * ICE_FD_STAT_CTR_BLOCK_COUNT)
7784ab95646SHenry Tieman #define ICE_FD_SB_STAT_IDX(base_idx) ICE_FD_STAT_PF_IDX(base_idx)
7794ab95646SHenry Tieman 
7800754d65bSKiran Patil /**
7810754d65bSKiran Patil  * ice_is_adq_active - any active ADQs
7820754d65bSKiran Patil  * @pf: pointer to PF
7830754d65bSKiran Patil  *
7840754d65bSKiran Patil  * This function returns true if there are any ADQs configured (which is
7850754d65bSKiran Patil  * determined by looking at VSI type (which should be VSI_PF), numtc, and
7860754d65bSKiran Patil  * TC_MQPRIO flag) otherwise return false
7870754d65bSKiran Patil  */
7880754d65bSKiran Patil static inline bool ice_is_adq_active(struct ice_pf *pf)
7890754d65bSKiran Patil {
7900754d65bSKiran Patil 	struct ice_vsi *vsi;
7910754d65bSKiran Patil 
7920754d65bSKiran Patil 	vsi = ice_get_main_vsi(pf);
7930754d65bSKiran Patil 	if (!vsi)
7940754d65bSKiran Patil 		return false;
7950754d65bSKiran Patil 
7960754d65bSKiran Patil 	/* is ADQ configured */
7970754d65bSKiran Patil 	if (vsi->tc_cfg.numtc > ICE_CHNL_START_TC &&
7980754d65bSKiran Patil 	    test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))
7990754d65bSKiran Patil 		return true;
8000754d65bSKiran Patil 
8010754d65bSKiran Patil 	return false;
8020754d65bSKiran Patil }
8030754d65bSKiran Patil 
804df006dd4SDave Ertman bool netif_is_ice(struct net_device *dev);
8050e674aebSAnirudh Venkataramanan int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
8060e674aebSAnirudh Venkataramanan int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
807148beb61SHenry Tieman int ice_vsi_open_ctrl(struct ice_vsi *vsi);
8081a1c40dfSGrzegorz Nitka int ice_vsi_open(struct ice_vsi *vsi);
809fcea6f3dSAnirudh Venkataramanan void ice_set_ethtool_ops(struct net_device *netdev);
8107aae80ceSWojciech Drewek void ice_set_ethtool_repr_ops(struct net_device *netdev);
811462acf6aSTony Nguyen void ice_set_ethtool_safe_mode_ops(struct net_device *netdev);
8128c243700SAnirudh Venkataramanan u16 ice_get_avail_txq_count(struct ice_pf *pf);
8138c243700SAnirudh Venkataramanan u16 ice_get_avail_rxq_count(struct ice_pf *pf);
81487324e74SHenry Tieman int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);
8155a4a8673SBruce Allan void ice_update_vsi_stats(struct ice_vsi *vsi);
8165a4a8673SBruce Allan void ice_update_pf_stats(struct ice_pf *pf);
817fcea6f3dSAnirudh Venkataramanan int ice_up(struct ice_vsi *vsi);
818fcea6f3dSAnirudh Venkataramanan int ice_down(struct ice_vsi *vsi);
8190e674aebSAnirudh Venkataramanan int ice_vsi_cfg(struct ice_vsi *vsi);
8200e674aebSAnirudh Venkataramanan struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);
82122bf877eSMaciej Fijalkowski int ice_vsi_determine_xdp_res(struct ice_vsi *vsi);
822efc2214bSMaciej Fijalkowski int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog);
823efc2214bSMaciej Fijalkowski int ice_destroy_xdp_rings(struct ice_vsi *vsi);
824efc2214bSMaciej Fijalkowski int
825efc2214bSMaciej Fijalkowski ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
826efc2214bSMaciej Fijalkowski 	     u32 flags);
827b66a972aSBrett Creeley int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size);
828b66a972aSBrett Creeley int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size);
829b66a972aSBrett Creeley int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed);
830b66a972aSBrett Creeley int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed);
831d76a60baSAnirudh Venkataramanan void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
83287324e74SHenry Tieman int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);
833fcea6f3dSAnirudh Venkataramanan void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
834f9f5301eSDave Ertman int ice_plug_aux_dev(struct ice_pf *pf);
835f9f5301eSDave Ertman void ice_unplug_aux_dev(struct ice_pf *pf);
836d25a0fc4SDave Ertman int ice_init_rdma(struct ice_pf *pf);
8370fee3577SLihong Yang const char *ice_stat_str(enum ice_status stat_err);
8380fee3577SLihong Yang const char *ice_aq_str(enum ice_aq_err aq_err);
83931765519SAnirudh Venkataramanan bool ice_is_wol_supported(struct ice_hw *hw);
84028bf2672SBrett Creeley int
84128bf2672SBrett Creeley ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
84228bf2672SBrett Creeley 		    bool is_tun);
843148beb61SHenry Tieman void ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena);
844cac2a27cSHenry Tieman int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);
845cac2a27cSHenry Tieman int ice_del_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);
8464ab95646SHenry Tieman int ice_get_ethtool_fdir_entry(struct ice_hw *hw, struct ethtool_rxnfc *cmd);
8474ab95646SHenry Tieman int
8484ab95646SHenry Tieman ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,
8494ab95646SHenry Tieman 		      u32 *rule_locs);
850148beb61SHenry Tieman void ice_fdir_release_flows(struct ice_hw *hw);
85183af0039SHenry Tieman void ice_fdir_replay_flows(struct ice_hw *hw);
85283af0039SHenry Tieman void ice_fdir_replay_fltrs(struct ice_pf *pf);
853148beb61SHenry Tieman int ice_fdir_create_dflt_rules(struct ice_pf *pf);
854d69ea414SJacob Keller int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
855d69ea414SJacob Keller 			  struct ice_rq_event_info *event);
8560e674aebSAnirudh Venkataramanan int ice_open(struct net_device *netdev);
857e95fc857SKrzysztof Goreczny int ice_open_internal(struct net_device *netdev);
8580e674aebSAnirudh Venkataramanan int ice_stop(struct net_device *netdev);
85928bf2672SBrett Creeley void ice_service_task_schedule(struct ice_pf *pf);
860d76a60baSAnirudh Venkataramanan 
861d25a0fc4SDave Ertman /**
862d25a0fc4SDave Ertman  * ice_set_rdma_cap - enable RDMA support
863d25a0fc4SDave Ertman  * @pf: PF struct
864d25a0fc4SDave Ertman  */
865d25a0fc4SDave Ertman static inline void ice_set_rdma_cap(struct ice_pf *pf)
866d25a0fc4SDave Ertman {
867f9f5301eSDave Ertman 	if (pf->hw.func_caps.common_cap.rdma && pf->num_rdma_msix) {
868d25a0fc4SDave Ertman 		set_bit(ICE_FLAG_RDMA_ENA, pf->flags);
869bfe84435SDave Ertman 		set_bit(ICE_FLAG_AUX_ENA, pf->flags);
870f9f5301eSDave Ertman 		ice_plug_aux_dev(pf);
871f9f5301eSDave Ertman 	}
872d25a0fc4SDave Ertman }
873d25a0fc4SDave Ertman 
874d25a0fc4SDave Ertman /**
875d25a0fc4SDave Ertman  * ice_clear_rdma_cap - disable RDMA support
876d25a0fc4SDave Ertman  * @pf: PF struct
877d25a0fc4SDave Ertman  */
878d25a0fc4SDave Ertman static inline void ice_clear_rdma_cap(struct ice_pf *pf)
879d25a0fc4SDave Ertman {
880f9f5301eSDave Ertman 	ice_unplug_aux_dev(pf);
881d25a0fc4SDave Ertman 	clear_bit(ICE_FLAG_RDMA_ENA, pf->flags);
882bfe84435SDave Ertman 	clear_bit(ICE_FLAG_AUX_ENA, pf->flags);
883d25a0fc4SDave Ertman }
884837f08fdSAnirudh Venkataramanan #endif /* _ICE_H_ */
885