ice_get_initial_sw_cfg - Get initial port and default VSI data * @hw: pointer to the hardware structure */
| 3821 | * @hw: pointer to the hardware structure |
| 3822 | */ |
| 3823 | enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw) |
| 3824 | { |
| 3825 | struct ice_aqc_get_sw_cfg_resp_elem *rbuf; |
| 3826 | enum ice_status status; |
| 3827 | u8 num_total_ports; |
| 3828 | u16 req_desc = 0; |
| 3829 | u16 num_elems; |
| 3830 | u8 j = 0; |
| 3831 | u16 i; |
| 3832 | |
| 3833 | num_total_ports = 1; |
| 3834 | |
| 3835 | rbuf = (struct ice_aqc_get_sw_cfg_resp_elem *) |
| 3836 | ice_malloc(hw, ICE_SW_CFG_MAX_BUF_LEN); |
| 3837 | |
| 3838 | if (!rbuf) |
| 3839 | return ICE_ERR_NO_MEMORY; |
| 3840 | |
| 3841 | /* Multiple calls to ice_aq_get_sw_cfg may be required |
| 3842 | * to get all the switch configuration information. The need |
| 3843 | * for additional calls is indicated by ice_aq_get_sw_cfg |
| 3844 | * writing a non-zero value in req_desc |
| 3845 | */ |
| 3846 | do { |
| 3847 | struct ice_aqc_get_sw_cfg_resp_elem *ele; |
| 3848 | |
| 3849 | status = ice_aq_get_sw_cfg(hw, rbuf, ICE_SW_CFG_MAX_BUF_LEN, |
| 3850 | &req_desc, &num_elems, NULL); |
| 3851 | |
| 3852 | if (status) |
| 3853 | break; |
| 3854 | |
| 3855 | for (i = 0, ele = rbuf; i < num_elems; i++, ele++) { |
| 3856 | u16 pf_vf_num, swid, vsi_port_num; |
| 3857 | bool is_vf = false; |
| 3858 | u8 res_type; |
| 3859 | |
| 3860 | vsi_port_num = LE16_TO_CPU(ele->vsi_port_num) & |
| 3861 | ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M; |
| 3862 | |
| 3863 | pf_vf_num = LE16_TO_CPU(ele->pf_vf_num) & |
| 3864 | ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_M; |
| 3865 | |
| 3866 | swid = LE16_TO_CPU(ele->swid); |
| 3867 | |
| 3868 | if (LE16_TO_CPU(ele->pf_vf_num) & |
| 3869 | ICE_AQC_GET_SW_CONF_RESP_IS_VF) |
| 3870 | is_vf = true; |
| 3871 | |
| 3872 | res_type = (u8)(LE16_TO_CPU(ele->vsi_port_num) >> |
| 3873 | ICE_AQC_GET_SW_CONF_RESP_TYPE_S); |
| 3874 | |
| 3875 | switch (res_type) { |
| 3876 | case ICE_AQC_GET_SW_CONF_RESP_VSI: |
| 3877 | if (hw->dcf_enabled && !is_vf) |
| 3878 | hw->pf_id = pf_vf_num; |
| 3879 | break; |
| 3880 | case ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT: |
no test coverage detected