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> 11837f08fdSAnirudh Venkataramanan #include <linux/netdevice.h> 12837f08fdSAnirudh Venkataramanan #include <linux/compiler.h> 13dc49c772SAnirudh Venkataramanan #include <linux/etherdevice.h> 14cdedef59SAnirudh Venkataramanan #include <linux/skbuff.h> 153a858ba3SAnirudh Venkataramanan #include <linux/cpumask.h> 16fcea6f3dSAnirudh Venkataramanan #include <linux/rtnetlink.h> 173a858ba3SAnirudh Venkataramanan #include <linux/if_vlan.h> 18cdedef59SAnirudh Venkataramanan #include <linux/dma-mapping.h> 19837f08fdSAnirudh Venkataramanan #include <linux/pci.h> 20940b61afSAnirudh Venkataramanan #include <linux/workqueue.h> 21837f08fdSAnirudh Venkataramanan #include <linux/aer.h> 22940b61afSAnirudh Venkataramanan #include <linux/interrupt.h> 23fcea6f3dSAnirudh Venkataramanan #include <linux/ethtool.h> 24940b61afSAnirudh Venkataramanan #include <linux/timer.h> 257ec59eeaSAnirudh Venkataramanan #include <linux/delay.h> 26837f08fdSAnirudh Venkataramanan #include <linux/bitmap.h> 273a858ba3SAnirudh Venkataramanan #include <linux/log2.h> 28d76a60baSAnirudh Venkataramanan #include <linux/ip.h> 29d76a60baSAnirudh Venkataramanan #include <linux/ipv6.h> 30940b61afSAnirudh Venkataramanan #include <linux/if_bridge.h> 31d76a60baSAnirudh Venkataramanan #include <net/ipv6.h> 32837f08fdSAnirudh Venkataramanan #include "ice_devids.h" 33837f08fdSAnirudh Venkataramanan #include "ice_type.h" 34940b61afSAnirudh Venkataramanan #include "ice_txrx.h" 359c20346bSAnirudh Venkataramanan #include "ice_switch.h" 36f31e4b6fSAnirudh Venkataramanan #include "ice_common.h" 379c20346bSAnirudh Venkataramanan #include "ice_sched.h" 38837f08fdSAnirudh Venkataramanan 39fcea6f3dSAnirudh Venkataramanan extern const char ice_drv_ver[]; 40837f08fdSAnirudh Venkataramanan #define ICE_BAR0 0 413a858ba3SAnirudh Venkataramanan #define ICE_DFLT_NUM_DESC 128 42fcea6f3dSAnirudh Venkataramanan #define ICE_MIN_NUM_DESC 8 43fcea6f3dSAnirudh Venkataramanan #define ICE_MAX_NUM_DESC 8160 443a858ba3SAnirudh Venkataramanan #define ICE_REQ_DESC_MULTIPLE 32 455513b920SAnirudh Venkataramanan #define ICE_DFLT_TRAFFIC_CLASS BIT(0) 46940b61afSAnirudh Venkataramanan #define ICE_INT_NAME_STR_LEN (IFNAMSIZ + 16) 47fcea6f3dSAnirudh Venkataramanan #define ICE_ETHTOOL_FWVER_LEN 32 48f31e4b6fSAnirudh Venkataramanan #define ICE_AQ_LEN 64 49940b61afSAnirudh Venkataramanan #define ICE_MIN_MSIX 2 503a858ba3SAnirudh Venkataramanan #define ICE_NO_VSI 0xffff 51940b61afSAnirudh Venkataramanan #define ICE_MAX_VSI_ALLOC 130 52940b61afSAnirudh Venkataramanan #define ICE_MAX_TXQS 2048 53940b61afSAnirudh Venkataramanan #define ICE_MAX_RXQS 2048 543a858ba3SAnirudh Venkataramanan #define ICE_VSI_MAP_CONTIG 0 553a858ba3SAnirudh Venkataramanan #define ICE_VSI_MAP_SCATTER 1 563a858ba3SAnirudh Venkataramanan #define ICE_MAX_SCATTER_TXQS 16 573a858ba3SAnirudh Venkataramanan #define ICE_MAX_SCATTER_RXQS 16 58cdedef59SAnirudh Venkataramanan #define ICE_Q_WAIT_RETRY_LIMIT 10 59cdedef59SAnirudh Venkataramanan #define ICE_Q_WAIT_MAX_RETRY (5 * ICE_Q_WAIT_RETRY_LIMIT) 60d76a60baSAnirudh Venkataramanan #define ICE_MAX_LG_RSS_QS 256 61d76a60baSAnirudh Venkataramanan #define ICE_MAX_SMALL_RSS_QS 8 62940b61afSAnirudh Venkataramanan #define ICE_RES_VALID_BIT 0x8000 63940b61afSAnirudh Venkataramanan #define ICE_RES_MISC_VEC_ID (ICE_RES_VALID_BIT - 1) 643a858ba3SAnirudh Venkataramanan #define ICE_INVAL_Q_INDEX 0xffff 65837f08fdSAnirudh Venkataramanan 66fcea6f3dSAnirudh Venkataramanan #define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4) 67fcea6f3dSAnirudh Venkataramanan 68837f08fdSAnirudh Venkataramanan #define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) 69837f08fdSAnirudh Venkataramanan 703a858ba3SAnirudh Venkataramanan #define ICE_MAX_MTU (ICE_AQ_SET_MAC_FRAME_SIZE_MAX - \ 713a858ba3SAnirudh Venkataramanan ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN) 723a858ba3SAnirudh Venkataramanan 733a858ba3SAnirudh Venkataramanan #define ICE_UP_TABLE_TRANSLATE(val, i) \ 743a858ba3SAnirudh Venkataramanan (((val) << ICE_AQ_VSI_UP_TABLE_UP##i##_S) & \ 753a858ba3SAnirudh Venkataramanan ICE_AQ_VSI_UP_TABLE_UP##i##_M) 763a858ba3SAnirudh Venkataramanan 772b245cb2SAnirudh Venkataramanan #define ICE_TX_DESC(R, i) (&(((struct ice_tx_desc *)((R)->desc))[i])) 78cdedef59SAnirudh Venkataramanan #define ICE_RX_DESC(R, i) (&(((union ice_32b_rx_flex_desc *)((R)->desc))[i])) 79d76a60baSAnirudh Venkataramanan #define ICE_TX_CTX_DESC(R, i) (&(((struct ice_tx_ctx_desc *)((R)->desc))[i])) 80cdedef59SAnirudh Venkataramanan 810b28b702SAnirudh Venkataramanan /* Macro for each VSI in a PF */ 820b28b702SAnirudh Venkataramanan #define ice_for_each_vsi(pf, i) \ 830b28b702SAnirudh Venkataramanan for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++) 840b28b702SAnirudh Venkataramanan 850b28b702SAnirudh Venkataramanan /* Macros for each tx/rx ring in a VSI */ 86cdedef59SAnirudh Venkataramanan #define ice_for_each_txq(vsi, i) \ 87cdedef59SAnirudh Venkataramanan for ((i) = 0; (i) < (vsi)->num_txq; (i)++) 88cdedef59SAnirudh Venkataramanan 89cdedef59SAnirudh Venkataramanan #define ice_for_each_rxq(vsi, i) \ 90cdedef59SAnirudh Venkataramanan for ((i) = 0; (i) < (vsi)->num_rxq; (i)++) 91cdedef59SAnirudh Venkataramanan 923a858ba3SAnirudh Venkataramanan struct ice_tc_info { 933a858ba3SAnirudh Venkataramanan u16 qoffset; 943a858ba3SAnirudh Venkataramanan u16 qcount; 953a858ba3SAnirudh Venkataramanan }; 963a858ba3SAnirudh Venkataramanan 973a858ba3SAnirudh Venkataramanan struct ice_tc_cfg { 983a858ba3SAnirudh Venkataramanan u8 numtc; /* Total number of enabled TCs */ 993a858ba3SAnirudh Venkataramanan u8 ena_tc; /* TX map */ 1003a858ba3SAnirudh Venkataramanan struct ice_tc_info tc_info[ICE_MAX_TRAFFIC_CLASS]; 1013a858ba3SAnirudh Venkataramanan }; 1023a858ba3SAnirudh Venkataramanan 103940b61afSAnirudh Venkataramanan struct ice_res_tracker { 104940b61afSAnirudh Venkataramanan u16 num_entries; 105940b61afSAnirudh Venkataramanan u16 search_hint; 106940b61afSAnirudh Venkataramanan u16 list[1]; 107940b61afSAnirudh Venkataramanan }; 108940b61afSAnirudh Venkataramanan 109940b61afSAnirudh Venkataramanan struct ice_sw { 110940b61afSAnirudh Venkataramanan struct ice_pf *pf; 111940b61afSAnirudh Venkataramanan u16 sw_id; /* switch ID for this switch */ 112940b61afSAnirudh Venkataramanan u16 bridge_mode; /* VEB/VEPA/Port Virtualizer */ 113940b61afSAnirudh Venkataramanan }; 114940b61afSAnirudh Venkataramanan 115837f08fdSAnirudh Venkataramanan enum ice_state { 116837f08fdSAnirudh Venkataramanan __ICE_DOWN, 1170b28b702SAnirudh Venkataramanan __ICE_NEEDS_RESTART, 1180b28b702SAnirudh Venkataramanan __ICE_RESET_RECOVERY_PENDING, /* set by driver when reset starts */ 119940b61afSAnirudh Venkataramanan __ICE_PFR_REQ, /* set by driver and peers */ 1200b28b702SAnirudh Venkataramanan __ICE_CORER_REQ, /* set by driver and peers */ 1210b28b702SAnirudh Venkataramanan __ICE_GLOBR_REQ, /* set by driver and peers */ 1220b28b702SAnirudh Venkataramanan __ICE_CORER_RECV, /* set by OICR handler */ 1230b28b702SAnirudh Venkataramanan __ICE_GLOBR_RECV, /* set by OICR handler */ 1240b28b702SAnirudh Venkataramanan __ICE_EMPR_RECV, /* set by OICR handler */ 1250b28b702SAnirudh Venkataramanan __ICE_SUSPENDED, /* set on module remove path */ 1260b28b702SAnirudh Venkataramanan __ICE_RESET_FAILED, /* set by reset/rebuild */ 127940b61afSAnirudh Venkataramanan __ICE_ADMINQ_EVENT_PENDING, 128*e94d4478SAnirudh Venkataramanan __ICE_FLTR_OVERFLOW_PROMISC, 129fcea6f3dSAnirudh Venkataramanan __ICE_CFG_BUSY, 130940b61afSAnirudh Venkataramanan __ICE_SERVICE_SCHED, 131837f08fdSAnirudh Venkataramanan __ICE_STATE_NBITS /* must be last */ 132837f08fdSAnirudh Venkataramanan }; 133837f08fdSAnirudh Venkataramanan 134*e94d4478SAnirudh Venkataramanan enum ice_vsi_flags { 135*e94d4478SAnirudh Venkataramanan ICE_VSI_FLAG_UMAC_FLTR_CHANGED, 136*e94d4478SAnirudh Venkataramanan ICE_VSI_FLAG_MMAC_FLTR_CHANGED, 137*e94d4478SAnirudh Venkataramanan ICE_VSI_FLAG_VLAN_FLTR_CHANGED, 138*e94d4478SAnirudh Venkataramanan ICE_VSI_FLAG_PROMISC_CHANGED, 139*e94d4478SAnirudh Venkataramanan ICE_VSI_FLAG_NBITS /* must be last */ 140*e94d4478SAnirudh Venkataramanan }; 141*e94d4478SAnirudh Venkataramanan 142940b61afSAnirudh Venkataramanan /* struct that defines a VSI, associated with a dev */ 143940b61afSAnirudh Venkataramanan struct ice_vsi { 144940b61afSAnirudh Venkataramanan struct net_device *netdev; 1453a858ba3SAnirudh Venkataramanan struct ice_sw *vsw; /* switch this VSI is on */ 1463a858ba3SAnirudh Venkataramanan struct ice_pf *back; /* back pointer to PF */ 147940b61afSAnirudh Venkataramanan struct ice_port_info *port_info; /* back pointer to port_info */ 1483a858ba3SAnirudh Venkataramanan struct ice_ring **rx_rings; /* rx ring array */ 1493a858ba3SAnirudh Venkataramanan struct ice_ring **tx_rings; /* tx ring array */ 1503a858ba3SAnirudh Venkataramanan struct ice_q_vector **q_vectors; /* q_vector array */ 151cdedef59SAnirudh Venkataramanan 152cdedef59SAnirudh Venkataramanan irqreturn_t (*irq_handler)(int irq, void *data); 153cdedef59SAnirudh Venkataramanan 154fcea6f3dSAnirudh Venkataramanan u64 tx_linearize; 1553a858ba3SAnirudh Venkataramanan DECLARE_BITMAP(state, __ICE_STATE_NBITS); 156*e94d4478SAnirudh Venkataramanan DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS); 157d76a60baSAnirudh Venkataramanan unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 158*e94d4478SAnirudh Venkataramanan unsigned int current_netdev_flags; 159fcea6f3dSAnirudh Venkataramanan u32 tx_restart; 160fcea6f3dSAnirudh Venkataramanan u32 tx_busy; 161fcea6f3dSAnirudh Venkataramanan u32 rx_buf_failed; 162fcea6f3dSAnirudh Venkataramanan u32 rx_page_failed; 1633a858ba3SAnirudh Venkataramanan int num_q_vectors; 1643a858ba3SAnirudh Venkataramanan int base_vector; 1653a858ba3SAnirudh Venkataramanan enum ice_vsi_type type; 166940b61afSAnirudh Venkataramanan u16 vsi_num; /* HW (absolute) index of this VSI */ 1673a858ba3SAnirudh Venkataramanan u16 idx; /* software index in pf->vsi[] */ 1683a858ba3SAnirudh Venkataramanan 1693a858ba3SAnirudh Venkataramanan /* Interrupt thresholds */ 1703a858ba3SAnirudh Venkataramanan u16 work_lmt; 1713a858ba3SAnirudh Venkataramanan 172d76a60baSAnirudh Venkataramanan /* RSS config */ 173d76a60baSAnirudh Venkataramanan u16 rss_table_size; /* HW RSS table size */ 174d76a60baSAnirudh Venkataramanan u16 rss_size; /* Allocated RSS queues */ 175d76a60baSAnirudh Venkataramanan u8 *rss_hkey_user; /* User configured hash keys */ 176d76a60baSAnirudh Venkataramanan u8 *rss_lut_user; /* User configured lookup table entries */ 177d76a60baSAnirudh Venkataramanan u8 rss_lut_type; /* used to configure Get/Set RSS LUT AQ call */ 178d76a60baSAnirudh Venkataramanan 179cdedef59SAnirudh Venkataramanan u16 max_frame; 180cdedef59SAnirudh Venkataramanan u16 rx_buf_len; 181cdedef59SAnirudh Venkataramanan 1823a858ba3SAnirudh Venkataramanan struct ice_aqc_vsi_props info; /* VSI properties */ 1833a858ba3SAnirudh Venkataramanan 184fcea6f3dSAnirudh Venkataramanan /* VSI stats */ 185fcea6f3dSAnirudh Venkataramanan struct rtnl_link_stats64 net_stats; 186fcea6f3dSAnirudh Venkataramanan struct ice_eth_stats eth_stats; 187fcea6f3dSAnirudh Venkataramanan struct ice_eth_stats eth_stats_prev; 188fcea6f3dSAnirudh Venkataramanan 189*e94d4478SAnirudh Venkataramanan struct list_head tmp_sync_list; /* MAC filters to be synced */ 190*e94d4478SAnirudh Venkataramanan struct list_head tmp_unsync_list; /* MAC filters to be unsynced */ 191*e94d4478SAnirudh Venkataramanan 192cdedef59SAnirudh Venkataramanan bool irqs_ready; 193cdedef59SAnirudh Venkataramanan bool current_isup; /* Sync 'link up' logging */ 194fcea6f3dSAnirudh Venkataramanan bool stat_offsets_loaded; 195cdedef59SAnirudh Venkataramanan 1963a858ba3SAnirudh Venkataramanan /* queue information */ 1973a858ba3SAnirudh Venkataramanan u8 tx_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */ 1983a858ba3SAnirudh Venkataramanan u8 rx_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */ 1993a858ba3SAnirudh Venkataramanan u16 txq_map[ICE_MAX_TXQS]; /* index in pf->avail_txqs */ 2003a858ba3SAnirudh Venkataramanan u16 rxq_map[ICE_MAX_RXQS]; /* index in pf->avail_rxqs */ 2013a858ba3SAnirudh Venkataramanan u16 alloc_txq; /* Allocated Tx queues */ 2023a858ba3SAnirudh Venkataramanan u16 num_txq; /* Used Tx queues */ 2033a858ba3SAnirudh Venkataramanan u16 alloc_rxq; /* Allocated Rx queues */ 2043a858ba3SAnirudh Venkataramanan u16 num_rxq; /* Used Rx queues */ 2053a858ba3SAnirudh Venkataramanan u16 num_desc; 2063a858ba3SAnirudh Venkataramanan struct ice_tc_cfg tc_cfg; 2073a858ba3SAnirudh Venkataramanan } ____cacheline_internodealigned_in_smp; 2083a858ba3SAnirudh Venkataramanan 2093a858ba3SAnirudh Venkataramanan /* struct that defines an interrupt vector */ 2103a858ba3SAnirudh Venkataramanan struct ice_q_vector { 2113a858ba3SAnirudh Venkataramanan struct ice_vsi *vsi; 2123a858ba3SAnirudh Venkataramanan cpumask_t affinity_mask; 2133a858ba3SAnirudh Venkataramanan struct napi_struct napi; 2143a858ba3SAnirudh Venkataramanan struct ice_ring_container rx; 2153a858ba3SAnirudh Venkataramanan struct ice_ring_container tx; 216cdedef59SAnirudh Venkataramanan struct irq_affinity_notify affinity_notify; 2173a858ba3SAnirudh Venkataramanan u16 v_idx; /* index in the vsi->q_vector array. */ 2183a858ba3SAnirudh Venkataramanan u8 num_ring_tx; /* total number of tx rings in vector */ 2193a858ba3SAnirudh Venkataramanan u8 num_ring_rx; /* total number of rx rings in vector */ 220cdedef59SAnirudh Venkataramanan char name[ICE_INT_NAME_STR_LEN]; 221940b61afSAnirudh Venkataramanan } ____cacheline_internodealigned_in_smp; 222940b61afSAnirudh Venkataramanan 223940b61afSAnirudh Venkataramanan enum ice_pf_flags { 224940b61afSAnirudh Venkataramanan ICE_FLAG_MSIX_ENA, 225940b61afSAnirudh Venkataramanan ICE_FLAG_FLTR_SYNC, 226940b61afSAnirudh Venkataramanan ICE_FLAG_RSS_ENA, 227940b61afSAnirudh Venkataramanan ICE_PF_FLAGS_NBITS /* must be last */ 228940b61afSAnirudh Venkataramanan }; 229940b61afSAnirudh Venkataramanan 230837f08fdSAnirudh Venkataramanan struct ice_pf { 231837f08fdSAnirudh Venkataramanan struct pci_dev *pdev; 232940b61afSAnirudh Venkataramanan struct msix_entry *msix_entries; 233940b61afSAnirudh Venkataramanan struct ice_res_tracker *irq_tracker; 234940b61afSAnirudh Venkataramanan struct ice_vsi **vsi; /* VSIs created by the driver */ 235940b61afSAnirudh Venkataramanan struct ice_sw *first_sw; /* first switch created by firmware */ 236837f08fdSAnirudh Venkataramanan DECLARE_BITMAP(state, __ICE_STATE_NBITS); 237940b61afSAnirudh Venkataramanan DECLARE_BITMAP(avail_txqs, ICE_MAX_TXQS); 238940b61afSAnirudh Venkataramanan DECLARE_BITMAP(avail_rxqs, ICE_MAX_RXQS); 239940b61afSAnirudh Venkataramanan DECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS); 240940b61afSAnirudh Venkataramanan unsigned long serv_tmr_period; 241940b61afSAnirudh Venkataramanan unsigned long serv_tmr_prev; 242940b61afSAnirudh Venkataramanan struct timer_list serv_tmr; 243940b61afSAnirudh Venkataramanan struct work_struct serv_task; 244940b61afSAnirudh Venkataramanan struct mutex avail_q_mutex; /* protects access to avail_[rx|tx]qs */ 245940b61afSAnirudh Venkataramanan struct mutex sw_mutex; /* lock for protecting VSI alloc flow */ 246837f08fdSAnirudh Venkataramanan u32 msg_enable; 247d76a60baSAnirudh Venkataramanan u32 hw_csum_rx_error; 248940b61afSAnirudh Venkataramanan u32 oicr_idx; /* Other interrupt cause vector index */ 249940b61afSAnirudh Venkataramanan u32 num_lan_msix; /* Total MSIX vectors for base driver */ 250940b61afSAnirudh Venkataramanan u32 num_avail_msix; /* remaining MSIX vectors left unclaimed */ 251940b61afSAnirudh Venkataramanan u16 num_lan_tx; /* num lan tx queues setup */ 252940b61afSAnirudh Venkataramanan u16 num_lan_rx; /* num lan rx queues setup */ 253940b61afSAnirudh Venkataramanan u16 q_left_tx; /* remaining num tx queues left unclaimed */ 254940b61afSAnirudh Venkataramanan u16 q_left_rx; /* remaining num rx queues left unclaimed */ 255940b61afSAnirudh Venkataramanan u16 next_vsi; /* Next free slot in pf->vsi[] - 0-based! */ 256940b61afSAnirudh Venkataramanan u16 num_alloc_vsi; 2570b28b702SAnirudh Venkataramanan u16 corer_count; /* Core reset count */ 2580b28b702SAnirudh Venkataramanan u16 globr_count; /* Global reset count */ 2590b28b702SAnirudh Venkataramanan u16 empr_count; /* EMP reset count */ 2600b28b702SAnirudh Venkataramanan u16 pfr_count; /* PF reset count */ 2610b28b702SAnirudh Venkataramanan 262fcea6f3dSAnirudh Venkataramanan struct ice_hw_port_stats stats; 263fcea6f3dSAnirudh Venkataramanan struct ice_hw_port_stats stats_prev; 264837f08fdSAnirudh Venkataramanan struct ice_hw hw; 265fcea6f3dSAnirudh Venkataramanan bool stat_prev_loaded; /* has previous stats been loaded */ 266940b61afSAnirudh Venkataramanan char int_name[ICE_INT_NAME_STR_LEN]; 267837f08fdSAnirudh Venkataramanan }; 268940b61afSAnirudh Venkataramanan 2693a858ba3SAnirudh Venkataramanan struct ice_netdev_priv { 2703a858ba3SAnirudh Venkataramanan struct ice_vsi *vsi; 2713a858ba3SAnirudh Venkataramanan }; 2723a858ba3SAnirudh Venkataramanan 273940b61afSAnirudh Venkataramanan /** 274940b61afSAnirudh Venkataramanan * ice_irq_dynamic_ena - Enable default interrupt generation settings 275940b61afSAnirudh Venkataramanan * @hw: pointer to hw struct 276cdedef59SAnirudh Venkataramanan * @vsi: pointer to vsi struct, can be NULL 277cdedef59SAnirudh Venkataramanan * @q_vector: pointer to q_vector, can be NULL 278940b61afSAnirudh Venkataramanan */ 279cdedef59SAnirudh Venkataramanan static inline void ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, 280cdedef59SAnirudh Venkataramanan struct ice_q_vector *q_vector) 281940b61afSAnirudh Venkataramanan { 282cdedef59SAnirudh Venkataramanan u32 vector = (vsi && q_vector) ? vsi->base_vector + q_vector->v_idx : 283cdedef59SAnirudh Venkataramanan ((struct ice_pf *)hw->back)->oicr_idx; 284940b61afSAnirudh Venkataramanan int itr = ICE_ITR_NONE; 285940b61afSAnirudh Venkataramanan u32 val; 286940b61afSAnirudh Venkataramanan 287940b61afSAnirudh Venkataramanan /* clear the PBA here, as this function is meant to clean out all 288940b61afSAnirudh Venkataramanan * previous interrupts and enable the interrupt 289940b61afSAnirudh Venkataramanan */ 290940b61afSAnirudh Venkataramanan val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M | 291940b61afSAnirudh Venkataramanan (itr << GLINT_DYN_CTL_ITR_INDX_S); 292cdedef59SAnirudh Venkataramanan if (vsi) 293cdedef59SAnirudh Venkataramanan if (test_bit(__ICE_DOWN, vsi->state)) 294cdedef59SAnirudh Venkataramanan return; 295940b61afSAnirudh Venkataramanan wr32(hw, GLINT_DYN_CTL(vector), val); 296940b61afSAnirudh Venkataramanan } 297cdedef59SAnirudh Venkataramanan 2985513b920SAnirudh Venkataramanan static inline void ice_vsi_set_tc_cfg(struct ice_vsi *vsi) 2995513b920SAnirudh Venkataramanan { 3005513b920SAnirudh Venkataramanan vsi->tc_cfg.ena_tc = ICE_DFLT_TRAFFIC_CLASS; 3015513b920SAnirudh Venkataramanan vsi->tc_cfg.numtc = 1; 3025513b920SAnirudh Venkataramanan } 3035513b920SAnirudh Venkataramanan 304fcea6f3dSAnirudh Venkataramanan void ice_set_ethtool_ops(struct net_device *netdev); 305fcea6f3dSAnirudh Venkataramanan int ice_up(struct ice_vsi *vsi); 306fcea6f3dSAnirudh Venkataramanan int ice_down(struct ice_vsi *vsi); 307d76a60baSAnirudh Venkataramanan int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); 308d76a60baSAnirudh Venkataramanan int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); 309d76a60baSAnirudh Venkataramanan void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); 310fcea6f3dSAnirudh Venkataramanan void ice_print_link_msg(struct ice_vsi *vsi, bool isup); 311d76a60baSAnirudh Venkataramanan 312837f08fdSAnirudh Venkataramanan #endif /* _ICE_H_ */ 313