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