| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* Copyright (c) 2018, Intel Corporation. */ |
| 3 |
|
| 4 |
#ifndef _ICE_LIB_H_ |
| 5 |
#define _ICE_LIB_H_ |
| 6 |
|
| 7 |
#include "ice.h" |
| 8 |
#include "ice_vlan.h" |
| 9 |
|
| 10 |
/* Flags used for VSI configuration and rebuild */ |
| 11 |
#define ICE_VSI_FLAG_INIT BIT(0) |
| 12 |
#define ICE_VSI_FLAG_NO_INIT 0 |
| 13 |
|
| 14 |
#define ICE_L2TSEL_QRX_CONTEXT_REG_IDX 3 |
| 15 |
#define ICE_L2TSEL_BIT_OFFSET 23 |
| 16 |
enum ice_l2tsel { |
| 17 |
ICE_L2TSEL_EXTRACT_FIRST_TAG_L2TAG2_2ND, |
| 18 |
ICE_L2TSEL_EXTRACT_FIRST_TAG_L2TAG1, |
| 19 |
}; |
| 20 |
|
| 21 |
const char *ice_vsi_type_str(enum ice_vsi_type vsi_type); |
| 22 |
|
| 23 |
bool ice_pf_state_is_nominal(struct ice_pf *pf); |
| 24 |
|
| 25 |
void ice_update_eth_stats(struct ice_vsi *vsi); |
| 26 |
|
| 27 |
void ice_vsi_cfg_msix(struct ice_vsi *vsi); |
| 28 |
|
| 29 |
int ice_vsi_start_all_rx_rings(struct ice_vsi *vsi); |
| 30 |
|
| 31 |
int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi); |
| 32 |
|
| 33 |
int |
| 34 |
ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, |
| 35 |
u16 rel_vmvf_num); |
| 36 |
|
| 37 |
int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi); |
| 38 |
|
| 39 |
void ice_vsi_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create); |
| 40 |
void ice_cfg_sw_rx_lldp(struct ice_pf *pf, bool enable); |
| 41 |
|
| 42 |
int ice_set_link(struct ice_vsi *vsi, bool ena); |
| 43 |
|
| 44 |
void ice_vsi_delete(struct ice_vsi *vsi); |
| 45 |
|
| 46 |
int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc); |
| 47 |
|
| 48 |
int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi); |
| 49 |
|
| 50 |
void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc); |
| 51 |
|
| 52 |
struct ice_vsi * |
| 53 |
ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params); |
| 54 |
|
| 55 |
void ice_vsi_set_napi_queues(struct ice_vsi *vsi); |
| 56 |
void ice_napi_add(struct ice_vsi *vsi); |
| 57 |
|
| 58 |
void ice_vsi_clear_napi_queues(struct ice_vsi *vsi); |
| 59 |
|
| 60 |
int ice_vsi_release(struct ice_vsi *vsi); |
| 61 |
|
| 62 |
void ice_vsi_close(struct ice_vsi *vsi); |
| 63 |
|
| 64 |
int ice_ena_vsi(struct ice_vsi *vsi, bool locked); |
| 65 |
|
| 66 |
void ice_vsi_decfg(struct ice_vsi *vsi); |
| 67 |
void ice_dis_vsi(struct ice_vsi *vsi, bool locked); |
| 68 |
|
| 69 |
int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags); |
| 70 |
int ice_vsi_cfg(struct ice_vsi *vsi); |
| 71 |
struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf); |
| 72 |
void ice_vsi_free(struct ice_vsi *vsi); |
| 73 |
|
| 74 |
bool ice_is_reset_in_progress(unsigned long *state); |
| 75 |
int ice_wait_for_reset(struct ice_pf *pf, unsigned long timeout); |
| 76 |
|
| 77 |
void |
| 78 |
ice_write_qrxflxp_cntxt(struct ice_hw *hw, u16 pf_q, u32 rxdid, u32 prio, |
| 79 |
bool ena_ts); |
| 80 |
|
| 81 |
void ice_vsi_free_irq(struct ice_vsi *vsi); |
| 82 |
|
| 83 |
void ice_vsi_free_rx_rings(struct ice_vsi *vsi); |
| 84 |
|
| 85 |
void ice_vsi_free_tx_rings(struct ice_vsi *vsi); |
| 86 |
|
| 87 |
void ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena); |
| 88 |
|
| 89 |
void ice_vsi_cfg_crc_strip(struct ice_vsi *vsi, bool disable); |
| 90 |
|
| 91 |
void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes); |
| 92 |
|
| 93 |
void ice_update_rx_ring_stats(struct ice_rx_ring *ring, u64 pkts, u64 bytes); |
| 94 |
|
| 95 |
void ice_fetch_tx_ring_stats(const struct ice_tx_ring *ring, |
| 96 |
u64 *pkts, u64 *bytes); |
| 97 |
|
| 98 |
void ice_fetch_rx_ring_stats(const struct ice_rx_ring *ring, |
| 99 |
u64 *pkts, u64 *bytes); |
| 100 |
|
| 101 |
void ice_write_intrl(struct ice_q_vector *q_vector, u8 intrl); |
| 102 |
void ice_write_itr(struct ice_ring_container *rc, u16 itr); |
| 103 |
void ice_set_q_vector_intrl(struct ice_q_vector *q_vector); |
| 104 |
|
| 105 |
bool ice_is_safe_mode(struct ice_pf *pf); |
| 106 |
bool ice_is_rdma_ena(struct ice_pf *pf); |
| 107 |
bool ice_is_recovery_mode(struct ice_hw *hw); |
| 108 |
bool ice_is_dflt_vsi_in_use(struct ice_port_info *pi); |
| 109 |
bool ice_is_vsi_dflt_vsi(struct ice_vsi *vsi); |
| 110 |
int ice_set_dflt_vsi(struct ice_vsi *vsi); |
| 111 |
int ice_clear_dflt_vsi(struct ice_vsi *vsi); |
| 112 |
int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate); |
| 113 |
int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate); |
| 114 |
int ice_get_link_speed_kbps(struct ice_vsi *vsi); |
| 115 |
int ice_get_link_speed_mbps(struct ice_vsi *vsi); |
| 116 |
int |
| 117 |
ice_vsi_update_security(struct ice_vsi *vsi, void (*fill)(struct ice_vsi_ctx *)); |
| 118 |
|
| 119 |
void ice_vsi_ctx_set_antispoof(struct ice_vsi_ctx *ctx); |
| 120 |
|
| 121 |
void ice_vsi_ctx_clear_antispoof(struct ice_vsi_ctx *ctx); |
| 122 |
int ice_vsi_update_local_lb(struct ice_vsi *vsi, bool set); |
| 123 |
int ice_vsi_add_vlan_zero(struct ice_vsi *vsi); |
| 124 |
int ice_vsi_del_vlan_zero(struct ice_vsi *vsi); |
| 125 |
bool ice_vsi_has_non_zero_vlans(struct ice_vsi *vsi); |
| 126 |
u16 ice_vsi_num_non_zero_vlans(struct ice_vsi *vsi); |
| 127 |
bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f); |
| 128 |
void ice_set_feature_support(struct ice_pf *pf, enum ice_feature f); |
| 129 |
void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f); |
| 130 |
void ice_init_feature_support(struct ice_pf *pf); |
| 131 |
bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi); |
| 132 |
void ice_vsi_update_l2tsel(struct ice_vsi *vsi, enum ice_l2tsel l2tsel); |
| 133 |
#endif /* !_ICE_LIB_H_ */ |