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