1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) 2016 - 2018 Cavium Inc. 3 * All rights reserved. 4 * www.cavium.com 5 */ 6 7 #ifndef __ECORE_VF_API_H__ 8 #define __ECORE_VF_API_H__ 9 10 #include "ecore_sp_api.h" 11 #include "ecore_mcp_api.h" 12 13 #ifdef CONFIG_ECORE_SRIOV 14 15 #define ECORE_VF_ACQUIRE_THRESH 3 16 17 /** 18 * @brief Read the VF bulletin and act on it if needed 19 * 20 * @param p_hwfn 21 * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise. 22 * 23 * @return enum _ecore_status 24 */ 25 enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn, 26 u8 *p_change); 27 28 /** 29 * @brief Get link parameters for VF from ecore 30 * 31 * @param p_hwfn 32 * @param params - the link params structure to be filled for the VF 33 */ 34 void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn, 35 struct ecore_mcp_link_params *params); 36 37 /** 38 * @brief Get link state for VF from ecore 39 * 40 * @param p_hwfn 41 * @param link - the link state structure to be filled for the VF 42 */ 43 void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn, 44 struct ecore_mcp_link_state *link); 45 46 /** 47 * @brief Get link capabilities for VF from ecore 48 * 49 * @param p_hwfn 50 * @param p_link_caps - the link capabilities structure to be filled for the VF 51 */ 52 void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn, 53 struct ecore_mcp_link_capabilities *p_link_caps); 54 55 /** 56 * @brief Get number of Rx queues allocated for VF by ecore 57 * 58 * @param p_hwfn 59 * @param num_rxqs - allocated RX queues 60 */ 61 void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn, 62 u8 *num_rxqs); 63 64 /** 65 * @brief Get number of Rx queues allocated for VF by ecore 66 * 67 * @param p_hwfn 68 * @param num_txqs - allocated RX queues 69 */ 70 void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn, 71 u8 *num_txqs); 72 73 /** 74 * @brief Get port mac address for VF 75 * 76 * @param p_hwfn 77 * @param port_mac - destination location for port mac 78 */ 79 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn, 80 u8 *port_mac); 81 82 /** 83 * @brief Get number of VLAN filters allocated for VF by ecore 84 * 85 * @param p_hwfn 86 * @param num_rxqs - allocated VLAN filters 87 */ 88 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn, 89 u8 *num_vlan_filters); 90 91 void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn, 92 u32 *num_sbs); 93 94 /** 95 * @brief Get number of MAC filters allocated for VF by ecore 96 * 97 * @param p_hwfn 98 * @param num_rxqs - allocated MAC filters 99 */ 100 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn, 101 u32 *num_mac_filters); 102 103 /** 104 * @brief Check if VF can set a MAC address 105 * 106 * @param p_hwfn 107 * @param mac 108 * 109 * @return bool 110 */ 111 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac); 112 113 #ifndef LINUX_REMOVE 114 /** 115 * @brief Copy forced MAC address from bulletin board 116 * 117 * @param hwfn 118 * @param dst_mac 119 * @param p_is_forced - out param which indicate in case mac 120 * exist if it forced or not. 121 * 122 * @return bool - return true if mac exist and false if 123 * not. 124 */ 125 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac, 126 u8 *p_is_forced); 127 128 /** 129 * @brief Check if force vlan is set and copy the forced vlan 130 * from bulletin board 131 * 132 * @param hwfn 133 * @param dst_pvid 134 * @return bool 135 */ 136 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid); 137 138 /** 139 * @brief Check if VF is based on PF whose driver is pre-fp-hsi version; 140 * This affects the fastpath implementation of the driver. 141 * 142 * @param p_hwfn 143 * 144 * @return bool - true iff PF is pre-fp-hsi version. 145 */ 146 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn); 147 148 #endif 149 150 /** 151 * @brief Set firmware version information in dev_info from VFs acquire 152 * response tlv 153 * 154 * @param p_hwfn 155 * @param fw_major 156 * @param fw_minor 157 * @param fw_rev 158 * @param fw_eng 159 */ 160 void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn, 161 u16 *fw_major, 162 u16 *fw_minor, 163 u16 *fw_rev, 164 u16 *fw_eng); 165 void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn, 166 u16 *p_vxlan_port, u16 *p_geneve_port); 167 168 #ifdef CONFIG_ECORE_SW_CHANNEL 169 /** 170 * @brief set the VF to use a SW/HW channel when communicating with PF. 171 * NOTICE: today the likely first place to call this from VF 172 * would be OSAL_VF_FILL_ACQUIRE_RESC_REQ(); Might want to consider 173 * something a bit more appropriate. 174 * 175 * @param p_hwfn 176 * @param b_is_hw - true iff VF is to use a HW-channel 177 */ 178 void ecore_vf_set_hw_channel(struct ecore_hwfn *p_hwfn, bool b_is_hw); 179 #endif 180 #endif 181 #endif 182