Lines Matching +full:ethernet +full:- +full:phy +full:- +full:package
1 /* SPDX-License-Identifier: BSD-3-Clause */
127 * ice_dump_phy_type - helper function to dump phy_type
158 * ice_set_mac_type - Sets MAC type
168 if (hw->vendor_id != ICE_INTEL_VENDOR_ID) in ice_set_mac_type()
171 switch (hw->device_id) { in ice_set_mac_type()
178 hw->mac_type = ICE_MAC_E810; in ice_set_mac_type()
199 hw->mac_type = ICE_MAC_GENERIC; in ice_set_mac_type()
205 hw->mac_type = ICE_MAC_GENERIC_3K_E825; in ice_set_mac_type()
225 hw->mac_type = ICE_MAC_E830; in ice_set_mac_type()
228 hw->mac_type = ICE_MAC_UNKNOWN; in ice_set_mac_type()
232 ice_debug(hw, ICE_DBG_INIT, "mac_type: %d\n", hw->mac_type); in ice_set_mac_type()
244 return (hw->mac_type == ICE_MAC_GENERIC || in ice_is_generic_mac()
245 hw->mac_type == ICE_MAC_GENERIC_3K || in ice_is_generic_mac()
246 hw->mac_type == ICE_MAC_GENERIC_3K_E825); in ice_is_generic_mac()
257 return hw->mac_type == ICE_MAC_E810; in ice_is_e810()
268 switch (hw->device_id) { in ice_is_e810t()
270 switch (hw->subsystem_device_id) { in ice_is_e810t()
281 switch (hw->subsystem_device_id) { in ice_is_e810t()
303 return hw->mac_type == ICE_MAC_E830; in ice_is_e830()
310 * returns true if the device is E823-L or E823-C based, false if not.
314 switch (hw->device_id) { in ice_is_e823()
335 * returns true if the device is E825-C based, false if not.
339 switch (hw->device_id) { in ice_is_e825c()
351 * ice_clear_pf_cfg - Clear PF configuration
367 * ice_aq_manage_mac_read - manage MAC address read command
404 flags = LE16_TO_CPU(cmd->flags) & ICE_AQC_MAN_MAC_READ_M; in ice_aq_manage_mac_read()
412 for (i = 0; i < cmd->num_addr; i++) in ice_aq_manage_mac_read()
414 ice_memcpy(hw->port_info->mac.lan_addr, in ice_aq_manage_mac_read()
417 ice_memcpy(hw->port_info->mac.perm_addr, in ice_aq_manage_mac_read()
427 * @phy_type_low: PHY type low bits
428 * @phy_type_high: PHY type high bits
429 * @media_mask_low: media type PHY type low bitmask
430 * @media_mask_high: media type PHY type high bitmask
432 * Return true if PHY type [low|high] bits are only of media type PHY types
439 /* check if a PHY type exist for media type */ in ice_phy_maps_to_media()
444 /* check that PHY types are only of media type */ in ice_phy_maps_to_media()
453 * ice_set_media_type - Sets media type
456 * Set ice_port_info PHY media type based on PHY type. This should be called
457 * from Get PHY caps with media.
464 phy_type_high = pi->phy.phy_type_high; in ice_set_media_type()
465 phy_type_low = pi->phy.phy_type_low; in ice_set_media_type()
466 media_type = &pi->phy.media_type; in ice_set_media_type()
469 if (!(pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE)) in ice_set_media_type()
471 /* else if PHY types are only BASE-T, then media type is BASET */ in ice_set_media_type()
475 /* else if any PHY type is BACKPLANE, then media type is BACKPLANE */ in ice_set_media_type()
479 /* else if PHY types are only optical, or optical and C2M, then media in ice_set_media_type()
490 /* else if PHY types are only DA, or DA and C2C, then media type DA */ in ice_set_media_type()
499 /* else if PHY types are only C2M or only C2C, then media is AUI */ in ice_set_media_type()
513 * ice_aq_get_phy_caps - returns PHY capabilities
517 * @pcaps: structure for PHY capabilities to be filled
520 * Returns the various PHY capabilities supported on the Port (0x0600)
538 hw = pi->hw; in ice_aq_get_phy_caps()
547 cmd->param0 |= CPU_TO_LE16(ICE_AQC_GET_PHY_RQM); in ice_aq_get_phy_caps()
549 cmd->param0 |= CPU_TO_LE16(report_mode); in ice_aq_get_phy_caps()
553 ice_debug(hw, ICE_DBG_LINK, "get phy caps dump\n"); in ice_aq_get_phy_caps()
572 ice_dump_phy_type(hw, LE64_TO_CPU(pcaps->phy_type_low), in ice_aq_get_phy_caps()
573 LE64_TO_CPU(pcaps->phy_type_high), prefix); in ice_aq_get_phy_caps()
577 ice_debug(hw, ICE_DBG_LINK, "%s: caps = 0x%x\n", prefix, pcaps->caps); in ice_aq_get_phy_caps()
579 pcaps->low_power_ctrl_an); in ice_aq_get_phy_caps()
581 pcaps->eee_cap); in ice_aq_get_phy_caps()
583 pcaps->eeer_value); in ice_aq_get_phy_caps()
585 pcaps->link_fec_options); in ice_aq_get_phy_caps()
587 prefix, pcaps->module_compliance_enforcement); in ice_aq_get_phy_caps()
589 prefix, pcaps->extended_compliance_code); in ice_aq_get_phy_caps()
591 pcaps->module_type[0]); in ice_aq_get_phy_caps()
593 pcaps->module_type[1]); in ice_aq_get_phy_caps()
595 pcaps->module_type[2]); in ice_aq_get_phy_caps()
598 pi->phy.phy_type_low = LE64_TO_CPU(pcaps->phy_type_low); in ice_aq_get_phy_caps()
599 pi->phy.phy_type_high = LE64_TO_CPU(pcaps->phy_type_high); in ice_aq_get_phy_caps()
600 ice_memcpy(pi->phy.link_info.module_type, &pcaps->module_type, in ice_aq_get_phy_caps()
601 sizeof(pi->phy.link_info.module_type), in ice_aq_get_phy_caps()
605 pi->phy.media_type); in ice_aq_get_phy_caps()
612 * ice_aq_get_phy_equalization - function to read serdes equalizer value from
618 * @output: pointer to the caller-supplied buffer to return serdes equalizer
621 * non-zero status on error
644 cmd->activity_id = CPU_TO_LE16(ICE_AQC_ACT_ID_DNL); in ice_aq_get_phy_equalization()
645 cmd->ctx = 0; in ice_aq_get_phy_equalization()
655 #define ice_get_link_status_data_ver(hw) ((hw)->mac_type == ICE_MAC_E830 ? \
675 * @link: pointer to link status structure - optional
696 hw = pi->hw; in ice_aq_get_link_info()
698 li_old = &pi->phy.link_info_old; in ice_aq_get_link_info()
699 li = &pi->phy.link_info; in ice_aq_get_link_info()
700 hw_fc_info = &pi->fc; in ice_aq_get_link_info()
705 resp->cmd_flags = CPU_TO_LE16(cmd_flags); in ice_aq_get_link_info()
706 resp->lport_num = pi->lport; in ice_aq_get_link_info()
717 li->link_speed = LE16_TO_CPU(link_data.link_speed); in ice_aq_get_link_info()
718 li->phy_type_low = LE64_TO_CPU(link_data.phy_type_low); in ice_aq_get_link_info()
719 li->phy_type_high = LE64_TO_CPU(link_data.phy_type_high); in ice_aq_get_link_info()
720 li->link_info = link_data.link_info; in ice_aq_get_link_info()
721 li->link_cfg_err = link_data.link_cfg_err; in ice_aq_get_link_info()
722 li->an_info = link_data.an_info; in ice_aq_get_link_info()
723 li->ext_info = link_data.ext_info; in ice_aq_get_link_info()
724 li->max_frame_size = LE16_TO_CPU(link_data.max_frame_size); in ice_aq_get_link_info()
725 li->fec_info = link_data.cfg & ICE_AQ_FEC_MASK; in ice_aq_get_link_info()
726 li->topo_media_conflict = link_data.topo_media_conflict; in ice_aq_get_link_info()
727 li->pacing = link_data.cfg & (ICE_AQ_CFG_PACING_M | in ice_aq_get_link_info()
734 hw_fc_info->current_mode = ICE_FC_FULL; in ice_aq_get_link_info()
736 hw_fc_info->current_mode = ICE_FC_TX_PAUSE; in ice_aq_get_link_info()
738 hw_fc_info->current_mode = ICE_FC_RX_PAUSE; in ice_aq_get_link_info()
740 hw_fc_info->current_mode = ICE_FC_NONE; in ice_aq_get_link_info()
742 li->lse_ena = !!(resp->cmd_flags & CPU_TO_LE16(ICE_AQ_LSE_IS_ENABLED)); in ice_aq_get_link_info()
745 ice_debug(hw, ICE_DBG_LINK, " link_speed = 0x%x\n", li->link_speed); in ice_aq_get_link_info()
747 (unsigned long long)li->phy_type_low); in ice_aq_get_link_info()
749 (unsigned long long)li->phy_type_high); in ice_aq_get_link_info()
750 ice_debug(hw, ICE_DBG_LINK, " link_info = 0x%x\n", li->link_info); in ice_aq_get_link_info()
751 ice_debug(hw, ICE_DBG_LINK, " link_cfg_err = 0x%x\n", li->link_cfg_err); in ice_aq_get_link_info()
752 ice_debug(hw, ICE_DBG_LINK, " an_info = 0x%x\n", li->an_info); in ice_aq_get_link_info()
753 ice_debug(hw, ICE_DBG_LINK, " ext_info = 0x%x\n", li->ext_info); in ice_aq_get_link_info()
754 ice_debug(hw, ICE_DBG_LINK, " fec_info = 0x%x\n", li->fec_info); in ice_aq_get_link_info()
755 ice_debug(hw, ICE_DBG_LINK, " lse_ena = 0x%x\n", li->lse_ena); in ice_aq_get_link_info()
757 li->max_frame_size); in ice_aq_get_link_info()
758 ice_debug(hw, ICE_DBG_LINK, " pacing = 0x%x\n", li->pacing); in ice_aq_get_link_info()
765 pi->phy.get_link_info = false; in ice_aq_get_link_info()
794 if ((hw)->mac_type == ICE_MAC_E830) { in ice_fill_tx_timer_and_fc_thresh()
798 cmd->tx_tmr_value = CPU_TO_LE16(tx_timer_val); in ice_fill_tx_timer_and_fc_thresh()
808 cmd->tx_tmr_value = CPU_TO_LE16(tx_timer_val); in ice_fill_tx_timer_and_fc_thresh()
815 cmd->fc_refresh_threshold = CPU_TO_LE16(fc_thres_val); in ice_fill_tx_timer_and_fc_thresh()
841 cmd->max_frame_size = CPU_TO_LE16(max_frame_size); in ice_aq_set_mac_cfg()
844 cmd->drop_opts |= ICE_AQ_SET_MAC_AUTO_DROP_BLOCKING_PKTS; in ice_aq_set_mac_cfg()
851 * ice_init_fltr_mgmt_struct - initializes filter management list and locks
859 hw->switch_info = (struct ice_switch_info *) in ice_init_fltr_mgmt_struct()
860 ice_malloc(hw, sizeof(*hw->switch_info)); in ice_init_fltr_mgmt_struct()
862 sw = hw->switch_info; in ice_init_fltr_mgmt_struct()
867 INIT_LIST_HEAD(&sw->vsi_list_map_head); in ice_init_fltr_mgmt_struct()
868 sw->prof_res_bm_init = 0; in ice_init_fltr_mgmt_struct()
870 status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list); in ice_init_fltr_mgmt_struct()
872 ice_free(hw, hw->switch_info); in ice_init_fltr_mgmt_struct()
879 * ice_cleanup_fltr_mgmt_single - clears single filter mngt struct
894 LIST_FOR_EACH_ENTRY_SAFE(v_pos_map, v_tmp_map, &sw->vsi_list_map_head, in ice_cleanup_fltr_mgmt_single()
896 LIST_DEL(&v_pos_map->list_entry); in ice_cleanup_fltr_mgmt_single()
899 recps = sw->recp_list; in ice_cleanup_fltr_mgmt_single()
907 LIST_DEL(&rg_entry->l_entry); in ice_cleanup_fltr_mgmt_single()
920 LIST_DEL(&lst_itr->list_entry); in ice_cleanup_fltr_mgmt_single()
921 ice_free(hw, lst_itr->lkups); in ice_cleanup_fltr_mgmt_single()
932 LIST_DEL(&lst_itr->list_entry); in ice_cleanup_fltr_mgmt_single()
940 ice_free(hw, sw->recp_list); in ice_cleanup_fltr_mgmt_single()
945 * ice_cleanup_fltr_mgmt_struct - cleanup filter management list and locks
950 ice_cleanup_fltr_mgmt_single(hw, hw->switch_info); in ice_cleanup_fltr_mgmt_struct()
958 * bandwidth according to the device's configuration during power-on.
970 hw->itr_gran = ICE_ITR_GRAN_ABOVE_25; in ice_get_itr_intrl_gran()
971 hw->intrl_gran = ICE_INTRL_GRAN_ABOVE_25; in ice_get_itr_intrl_gran()
974 hw->itr_gran = ICE_ITR_GRAN_MAX_25; in ice_get_itr_intrl_gran()
975 hw->intrl_gran = ICE_INTRL_GRAN_MAX_25; in ice_get_itr_intrl_gran()
981 * ice_print_rollback_msg - print FW rollback message
990 orom = &hw->flash.orom; in ice_print_rollback_msg()
991 nvm = &hw->flash.nvm; in ice_print_rollback_msg()
994 nvm->major, nvm->minor, nvm->eetrack, orom->major, in ice_print_rollback_msg()
995 orom->build, orom->patch); in ice_print_rollback_msg()
997 … %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devi… in ice_print_rollback_msg()
998 nvm_str, hw->fw_maj_ver, hw->fw_min_ver); in ice_print_rollback_msg()
1009 hw->umac_shared = true; in ice_set_umac_shared()
1013 * ice_init_hw - main hardware initialization routine
1030 hw->pf_id = (u8)(rd32(hw, PF_FUNC_RID) & in ice_init_hw()
1039 hw->fw_vsi_num = ICE_DFLT_VSI_INVAL; in ice_init_hw()
1046 status = ice_fwlog_set(hw, &hw->fwlog_cfg); in ice_init_hw()
1051 if (hw->fwlog_cfg.options & ICE_FWLOG_OPTION_REGISTER_ON_INIT) { in ice_init_hw()
1071 if (!hw->skip_clear_pf) { in ice_init_hw()
1083 if (!hw->port_info) in ice_init_hw()
1084 hw->port_info = (struct ice_port_info *) in ice_init_hw()
1085 ice_malloc(hw, sizeof(*hw->port_info)); in ice_init_hw()
1086 if (!hw->port_info) { in ice_init_hw()
1091 hw->port_info->loopback_mode = ICE_AQC_SET_P_PARAMS_LOOPBACK_MODE_NORMAL; in ice_init_hw()
1094 hw->port_info->hw = hw; in ice_init_hw()
1101 hw->evb_veb = true; in ice_init_hw()
1111 status = ice_sched_init_port(hw->port_info); in ice_init_hw()
1121 /* Initialize port_info struct with PHY capabilities */ in ice_init_hw()
1122 status = ice_aq_get_phy_caps(hw->port_info, false, in ice_init_hw()
1126 ice_warn(hw, "Get PHY capabilities failed status = %d, continuing anyway\n", in ice_init_hw()
1130 status = ice_aq_get_link_info(hw->port_info, false, NULL, NULL); in ice_init_hw()
1134 if (!hw->sw_entry_point_layer) { in ice_init_hw()
1139 INIT_LIST_HEAD(&hw->agg_list); in ice_init_hw()
1141 if (!hw->max_burst_size) in ice_init_hw()
1174 ice_init_lock(&hw->tnl_lock); in ice_init_hw()
1183 ice_free(hw, hw->port_info); in ice_init_hw()
1184 hw->port_info = NULL; in ice_init_hw()
1191 * ice_deinit_hw - unroll initialization operations done by ice_init_hw
1206 ice_destroy_lock(&hw->tnl_lock); in ice_deinit_hw()
1208 if (hw->port_info) { in ice_deinit_hw()
1209 ice_free(hw, hw->port_info); in ice_deinit_hw()
1210 hw->port_info = NULL; in ice_deinit_hw()
1220 * ice_check_reset - Check to see if a global reset is complete
1254 uld_mask = ICE_RESET_DONE_MASK | (hw->func_caps.common_cap.iwarp ? in ice_check_reset()
1279 * ice_pf_reset - Reset the PF
1310 * that is occurring during a download package operation. in ice_pf_reset()
1332 * ice_reset - Perform different types of reset
1402 * ice_copy_rxq_ctx_from_hw - Copy rxq context register from HW
1477 rlan_ctx->prefena = 1; in ice_write_rxq_ctx()
1484 * ice_read_rxq_ctx - Read rxq context from HW
1531 * Bit[0-175] is valid
1751 * ice_get_sbq - returns the right control queue to use for sideband
1757 return &hw->adminq; in ice_get_sbq()
1758 return &hw->sbq; in ice_get_sbq()
1762 * ice_sbq_send_cmd - send Sideband Queue command to Sideband Queue
1778 * ice_sbq_send_cmd_nolock - send Sideband Queue command to Sideband Queue
1796 * ice_sbq_rw_reg_lp - Fill Sideband Queue command, with lock parameter
1813 msg.dest_dev = in->dest_dev; in ice_sbq_rw_reg_lp()
1814 msg.opcode = in->opcode; in ice_sbq_rw_reg_lp()
1817 msg.msg_addr_low = CPU_TO_LE16(in->msg_addr_low); in ice_sbq_rw_reg_lp()
1818 msg.msg_addr_high = CPU_TO_LE32(in->msg_addr_high); in ice_sbq_rw_reg_lp()
1820 if (in->opcode) in ice_sbq_rw_reg_lp()
1821 msg.data = CPU_TO_LE32(in->data); in ice_sbq_rw_reg_lp()
1826 msg_len -= sizeof(msg.data); in ice_sbq_rw_reg_lp()
1836 if (!status && !in->opcode) in ice_sbq_rw_reg_lp()
1837 in->data = LE32_TO_CPU in ice_sbq_rw_reg_lp()
1838 (((struct ice_sbq_msg_cmpl *)&msg)->data); in ice_sbq_rw_reg_lp()
1843 * ice_sbq_rw_reg - Fill Sideband Queue command
1854 * ice_sbq_lock - Lock the sideband queue's sq_lock
1859 ice_acquire_lock(&ice_get_sbq(hw)->sq_lock); in ice_sbq_lock()
1863 * ice_sbq_unlock - Unlock the sideband queue's sq_lock
1868 ice_release_lock(&ice_get_sbq(hw)->sq_lock); in ice_sbq_unlock()
1902 * ice_sq_send_cmd_retry - send command to Control Queue (ATQ)
1925 opcode = LE16_TO_CPU(desc->opcode); in ice_sq_send_cmd_retry()
1944 hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY) in ice_sq_send_cmd_retry()
1965 * ice_aq_send_cmd - send FW Admin Queue command to FW Admin Queue
1978 return ice_sq_send_cmd_retry(hw, &hw->adminq, desc, buf, buf_size, cd); in ice_aq_send_cmd()
2001 hw->fw_branch = resp->fw_branch; in ice_aq_get_fw_ver()
2002 hw->fw_maj_ver = resp->fw_major; in ice_aq_get_fw_ver()
2003 hw->fw_min_ver = resp->fw_minor; in ice_aq_get_fw_ver()
2004 hw->fw_patch = resp->fw_patch; in ice_aq_get_fw_ver()
2005 hw->fw_build = LE32_TO_CPU(resp->fw_build); in ice_aq_get_fw_ver()
2006 hw->api_branch = resp->api_branch; in ice_aq_get_fw_ver()
2007 hw->api_maj_ver = resp->api_major; in ice_aq_get_fw_ver()
2008 hw->api_min_ver = resp->api_minor; in ice_aq_get_fw_ver()
2009 hw->api_patch = resp->api_patch; in ice_aq_get_fw_ver()
2039 cmd->major_ver = dv->major_ver; in ice_aq_send_driver_ver()
2040 cmd->minor_ver = dv->minor_ver; in ice_aq_send_driver_ver()
2041 cmd->build_ver = dv->build_ver; in ice_aq_send_driver_ver()
2042 cmd->subbuild_ver = dv->subbuild_ver; in ice_aq_send_driver_ver()
2045 while (len < sizeof(dv->driver_string) && in ice_aq_send_driver_ver()
2046 IS_ASCII(dv->driver_string[len]) && dv->driver_string[len]) in ice_aq_send_driver_ver()
2049 return ice_aq_send_cmd(hw, &desc, dv->driver_string, len, cd); in ice_aq_send_driver_ver()
2070 cmd->driver_unloading = ICE_AQC_DRIVER_UNLOADING; in ice_aq_q_shutdown()
2087 * 1) 0 - acquired lock, and can perform download package
2088 * 2) ICE_ERR_AQ_ERROR - did not get lock, driver should fail to load
2089 * 3) ICE_ERR_AQ_NO_WORK - did not get lock, but another driver has
2090 * successfully downloaded the package; the driver does
2091 * not have to download the package and can continue
2099 * Package, Update Package or the Release Resource AQ commands timed out.
2116 cmd_resp->res_id = CPU_TO_LE16(res); in ice_aq_req_res()
2117 cmd_resp->access_type = CPU_TO_LE16(access); in ice_aq_req_res()
2118 cmd_resp->res_number = CPU_TO_LE32(sdp_number); in ice_aq_req_res()
2119 cmd_resp->timeout = CPU_TO_LE32(*timeout); in ice_aq_req_res()
2136 if (LE16_TO_CPU(cmd_resp->status) == ICE_AQ_RES_GLBL_SUCCESS) { in ice_aq_req_res()
2137 *timeout = LE32_TO_CPU(cmd_resp->timeout); in ice_aq_req_res()
2139 } else if (LE16_TO_CPU(cmd_resp->status) == in ice_aq_req_res()
2141 *timeout = LE32_TO_CPU(cmd_resp->timeout); in ice_aq_req_res()
2143 } else if (LE16_TO_CPU(cmd_resp->status) == in ice_aq_req_res()
2157 if (!status || hw->adminq.sq_last_status == ICE_AQ_RC_EBUSY) in ice_aq_req_res()
2158 *timeout = LE32_TO_CPU(cmd_resp->timeout); in ice_aq_req_res()
2185 cmd->res_id = CPU_TO_LE16(res); in ice_aq_release_res()
2186 cmd->res_number = CPU_TO_LE32(sdp_number); in ice_aq_release_res()
2228 timeout = (timeout > delay) ? timeout - delay : 0; in ice_acquire_res()
2272 (total_delay < hw->adminq.sq_cmd_timeout)) { in ice_release_res()
2280 * ice_aq_alloc_free_res - command to allocate/free resources
2312 cmd->num_entries = CPU_TO_LE16(num_entries); in ice_aq_alloc_free_res()
2318 * ice_alloc_hw_res - allocate resource
2338 buf->num_elems = CPU_TO_LE16(num); in ice_alloc_hw_res()
2339 buf->res_type = CPU_TO_LE16(type | ICE_AQC_RES_TYPE_FLAG_DEDICATED | in ice_alloc_hw_res()
2342 buf->res_type |= CPU_TO_LE16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM); in ice_alloc_hw_res()
2349 ice_memcpy(res, buf->elem, sizeof(*buf->elem) * num, in ice_alloc_hw_res()
2358 * ice_free_hw_res - free allocated HW resource
2376 buf->num_elems = CPU_TO_LE16(num); in ice_free_hw_res()
2377 buf->res_type = CPU_TO_LE16(type); in ice_free_hw_res()
2378 ice_memcpy(buf->elem, res, sizeof(*buf->elem) * num, in ice_free_hw_res()
2391 * ice_get_num_per_func - determine number of resources per PF
2404 funcs = ice_hweight8(hw->dev_caps.common_cap.valid_functions & in ice_get_num_per_func()
2414 * ice_print_led_caps - print LED capabilities
2428 caps->led_pin_num); in ice_print_led_caps()
2431 caps->led_pin_num); in ice_print_led_caps()
2434 if (!caps->led[i]) in ice_print_led_caps()
2439 prefix, i, caps->led[i]); in ice_print_led_caps()
2442 caps->led[i]); in ice_print_led_caps()
2447 * ice_print_sdp_caps - print SDP capabilities
2461 caps->sdp_pin_num); in ice_print_sdp_caps()
2464 caps->sdp_pin_num); in ice_print_sdp_caps()
2467 if (!caps->sdp[i]) in ice_print_sdp_caps()
2472 prefix, i, caps->sdp[i]); in ice_print_sdp_caps()
2475 i, caps->sdp[i]); in ice_print_sdp_caps()
2480 * ice_parse_common_caps - parse common device/function capabilities
2496 u32 logical_id = LE32_TO_CPU(elem->logical_id); in ice_parse_common_caps()
2497 u32 phys_id = LE32_TO_CPU(elem->phys_id); in ice_parse_common_caps()
2498 u32 number = LE32_TO_CPU(elem->number); in ice_parse_common_caps()
2499 u16 cap = LE16_TO_CPU(elem->cap); in ice_parse_common_caps()
2504 caps->switching_mode = number; in ice_parse_common_caps()
2506 caps->switching_mode); in ice_parse_common_caps()
2509 caps->mgmt_mode = number; in ice_parse_common_caps()
2510 caps->mgmt_protocols_mctp = logical_id; in ice_parse_common_caps()
2512 caps->mgmt_mode); in ice_parse_common_caps()
2514 caps->mgmt_protocols_mctp); in ice_parse_common_caps()
2517 caps->os2bmc = number; in ice_parse_common_caps()
2518 ice_debug(hw, ICE_DBG_INIT, "%s: os2bmc = %u\n", prefix, caps->os2bmc); in ice_parse_common_caps()
2521 caps->valid_functions = number; in ice_parse_common_caps()
2523 caps->valid_functions); in ice_parse_common_caps()
2526 caps->sr_iov_1_1 = (number == 1); in ice_parse_common_caps()
2528 caps->sr_iov_1_1); in ice_parse_common_caps()
2531 caps->vmdq = (number == 1); in ice_parse_common_caps()
2532 ice_debug(hw, ICE_DBG_INIT, "%s: vmdq = %u\n", prefix, caps->vmdq); in ice_parse_common_caps()
2535 caps->evb_802_1_qbg = (number == 1); in ice_parse_common_caps()
2539 caps->evb_802_1_qbh = (number == 1); in ice_parse_common_caps()
2543 caps->dcb = (number == 1); in ice_parse_common_caps()
2544 caps->active_tc_bitmap = logical_id; in ice_parse_common_caps()
2545 caps->maxtc = phys_id; in ice_parse_common_caps()
2546 ice_debug(hw, ICE_DBG_INIT, "%s: dcb = %u\n", prefix, caps->dcb); in ice_parse_common_caps()
2548 caps->active_tc_bitmap); in ice_parse_common_caps()
2549 ice_debug(hw, ICE_DBG_INIT, "%s: maxtc = %u\n", prefix, caps->maxtc); in ice_parse_common_caps()
2552 caps->iscsi = (number == 1); in ice_parse_common_caps()
2553 ice_debug(hw, ICE_DBG_INIT, "%s: iscsi = %u\n", prefix, caps->iscsi); in ice_parse_common_caps()
2556 caps->rss_table_size = number; in ice_parse_common_caps()
2557 caps->rss_table_entry_width = logical_id; in ice_parse_common_caps()
2559 caps->rss_table_size); in ice_parse_common_caps()
2561 caps->rss_table_entry_width); in ice_parse_common_caps()
2564 caps->num_rxq = number; in ice_parse_common_caps()
2565 caps->rxq_first_id = phys_id; in ice_parse_common_caps()
2567 caps->num_rxq); in ice_parse_common_caps()
2569 caps->rxq_first_id); in ice_parse_common_caps()
2572 caps->num_txq = number; in ice_parse_common_caps()
2573 caps->txq_first_id = phys_id; in ice_parse_common_caps()
2575 caps->num_txq); in ice_parse_common_caps()
2577 caps->txq_first_id); in ice_parse_common_caps()
2580 caps->num_msix_vectors = number; in ice_parse_common_caps()
2581 caps->msix_vector_first_id = phys_id; in ice_parse_common_caps()
2583 caps->num_msix_vectors); in ice_parse_common_caps()
2585 caps->msix_vector_first_id); in ice_parse_common_caps()
2588 caps->sec_rev_disabled = in ice_parse_common_caps()
2592 caps->sec_rev_disabled); in ice_parse_common_caps()
2593 caps->update_disabled = in ice_parse_common_caps()
2597 caps->update_disabled); in ice_parse_common_caps()
2598 caps->nvm_unified_update = in ice_parse_common_caps()
2602 caps->nvm_unified_update); in ice_parse_common_caps()
2603 caps->netlist_auth = in ice_parse_common_caps()
2607 caps->netlist_auth); in ice_parse_common_caps()
2610 caps->mgmt_cem = (number == 1); in ice_parse_common_caps()
2612 caps->mgmt_cem); in ice_parse_common_caps()
2615 caps->iwarp = (number == 1); in ice_parse_common_caps()
2616 ice_debug(hw, ICE_DBG_INIT, "%s: iwarp = %u\n", prefix, caps->iwarp); in ice_parse_common_caps()
2619 caps->roce_lag = !!(number & ICE_AQC_BIT_ROCEV2_LAG); in ice_parse_common_caps()
2621 prefix, caps->roce_lag); in ice_parse_common_caps()
2625 caps->led[phys_id] = true; in ice_parse_common_caps()
2626 caps->led_pin_num++; in ice_parse_common_caps()
2632 caps->sdp[phys_id] = true; in ice_parse_common_caps()
2633 caps->sdp_pin_num++; in ice_parse_common_caps()
2638 caps->wr_csr_prot = number; in ice_parse_common_caps()
2639 caps->wr_csr_prot |= (u64)logical_id << 32; in ice_parse_common_caps()
2641 (unsigned long long)caps->wr_csr_prot); in ice_parse_common_caps()
2644 caps->num_wol_proxy_fltr = number; in ice_parse_common_caps()
2645 caps->wol_proxy_vsi_seid = logical_id; in ice_parse_common_caps()
2646 caps->apm_wol_support = !!(phys_id & ICE_WOL_SUPPORT_M); in ice_parse_common_caps()
2647 caps->acpi_prog_mthd = !!(phys_id & in ice_parse_common_caps()
2649 caps->proxy_support = !!(phys_id & ICE_PROXY_SUPPORT_M); in ice_parse_common_caps()
2651 caps->num_wol_proxy_fltr); in ice_parse_common_caps()
2653 caps->wol_proxy_vsi_seid); in ice_parse_common_caps()
2655 prefix, caps->apm_wol_support); in ice_parse_common_caps()
2658 caps->max_mtu = number; in ice_parse_common_caps()
2660 prefix, caps->max_mtu); in ice_parse_common_caps()
2663 caps->pcie_reset_avoidance = (number > 0); in ice_parse_common_caps()
2666 caps->pcie_reset_avoidance); in ice_parse_common_caps()
2669 caps->reset_restrict_support = (number == 1); in ice_parse_common_caps()
2672 caps->reset_restrict_support); in ice_parse_common_caps()
2679 u8 index = (u8)(cap - ICE_AQC_CAPS_EXT_TOPO_DEV_IMG0); in ice_parse_common_caps()
2681 caps->ext_topo_dev_img_ver_high[index] = number; in ice_parse_common_caps()
2682 caps->ext_topo_dev_img_ver_low[index] = logical_id; in ice_parse_common_caps()
2683 caps->ext_topo_dev_img_part_num[index] = in ice_parse_common_caps()
2686 caps->ext_topo_dev_img_load_en[index] = in ice_parse_common_caps()
2688 caps->ext_topo_dev_img_prog_en[index] = in ice_parse_common_caps()
2690 caps->ext_topo_dev_img_ver_schema[index] = in ice_parse_common_caps()
2695 caps->ext_topo_dev_img_ver_high[index]); in ice_parse_common_caps()
2699 caps->ext_topo_dev_img_ver_low[index]); in ice_parse_common_caps()
2703 caps->ext_topo_dev_img_part_num[index]); in ice_parse_common_caps()
2707 caps->ext_topo_dev_img_load_en[index]); in ice_parse_common_caps()
2711 caps->ext_topo_dev_img_prog_en[index]); in ice_parse_common_caps()
2715 caps->ext_topo_dev_img_ver_schema[index]); in ice_parse_common_caps()
2719 caps->tx_sched_topo_comp_mode_en = (number == 1); in ice_parse_common_caps()
2722 caps->dyn_flattening_en = (number == 1); in ice_parse_common_caps()
2724 prefix, caps->dyn_flattening_en); in ice_parse_common_caps()
2727 caps->orom_recovery_update = (number == 1); in ice_parse_common_caps()
2729 prefix, caps->orom_recovery_update); in ice_parse_common_caps()
2732 caps->next_cluster_id_support = (number == 1); in ice_parse_common_caps()
2734 prefix, caps->next_cluster_id_support); in ice_parse_common_caps()
2745 * ice_recalc_port_limited_caps - Recalculate port limited capabilities
2749 * Re-calculate the capabilities that are dependent on the number of physical
2759 if (hw->dev_caps.num_funcs > 4) { in ice_recalc_port_limited_caps()
2761 caps->maxtc = 4; in ice_recalc_port_limited_caps()
2763 caps->maxtc); in ice_recalc_port_limited_caps()
2764 if (caps->iwarp) { in ice_recalc_port_limited_caps()
2766 caps->iwarp = 0; in ice_recalc_port_limited_caps()
2772 if (caps == &hw->dev_caps.common_cap) in ice_recalc_port_limited_caps()
2778 * ice_parse_vf_func_caps - Parse ICE_AQC_CAPS_VF function caps
2789 u32 number = LE32_TO_CPU(cap->number); in ice_parse_vf_func_caps()
2790 u32 logical_id = LE32_TO_CPU(cap->logical_id); in ice_parse_vf_func_caps()
2792 func_p->num_allocd_vfs = number; in ice_parse_vf_func_caps()
2793 func_p->vf_base_id = logical_id; in ice_parse_vf_func_caps()
2795 func_p->num_allocd_vfs); in ice_parse_vf_func_caps()
2797 func_p->vf_base_id); in ice_parse_vf_func_caps()
2801 * ice_parse_vsi_func_caps - Parse ICE_AQC_CAPS_VSI function caps
2812 func_p->guar_num_vsi = ice_get_num_per_func(hw, ICE_MAX_VSI); in ice_parse_vsi_func_caps()
2814 LE32_TO_CPU(cap->number)); in ice_parse_vsi_func_caps()
2816 func_p->guar_num_vsi); in ice_parse_vsi_func_caps()
2820 * ice_parse_func_caps - Parse function capabilities
2848 found = ice_parse_common_caps(hw, &func_p->common_cap, in ice_parse_func_caps()
2867 ice_print_led_caps(hw, &func_p->common_cap, "func caps", true); in ice_parse_func_caps()
2868 ice_print_sdp_caps(hw, &func_p->common_cap, "func caps", true); in ice_parse_func_caps()
2870 ice_recalc_port_limited_caps(hw, &func_p->common_cap); in ice_parse_func_caps()
2874 * ice_parse_valid_functions_cap - Parse ICE_AQC_CAPS_VALID_FUNCTIONS caps
2885 u32 number = LE32_TO_CPU(cap->number); in ice_parse_valid_functions_cap()
2887 dev_p->num_funcs = ice_hweight32(number); in ice_parse_valid_functions_cap()
2889 dev_p->num_funcs); in ice_parse_valid_functions_cap()
2894 * ice_parse_vf_dev_caps - Parse ICE_AQC_CAPS_VF device caps
2905 u32 number = LE32_TO_CPU(cap->number); in ice_parse_vf_dev_caps()
2907 dev_p->num_vfs_exposed = number; in ice_parse_vf_dev_caps()
2909 dev_p->num_vfs_exposed); in ice_parse_vf_dev_caps()
2913 * ice_parse_vsi_dev_caps - Parse ICE_AQC_CAPS_VSI device caps
2924 u32 number = LE32_TO_CPU(cap->number); in ice_parse_vsi_dev_caps()
2926 dev_p->num_vsi_allocd_to_host = number; in ice_parse_vsi_dev_caps()
2928 dev_p->num_vsi_allocd_to_host); in ice_parse_vsi_dev_caps()
2932 * ice_parse_nac_topo_dev_caps - Parse ICE_AQC_CAPS_NAC_TOPOLOGY cap
2943 dev_p->nac_topo.mode = LE32_TO_CPU(cap->number); in ice_parse_nac_topo_dev_caps()
2944 dev_p->nac_topo.id = LE32_TO_CPU(cap->phys_id) & ICE_NAC_TOPO_ID_M; in ice_parse_nac_topo_dev_caps()
2947 (dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M) ? in ice_parse_nac_topo_dev_caps()
2948 "primary" : "secondary", dev_p->nac_topo.id); in ice_parse_nac_topo_dev_caps()
2951 !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M)); in ice_parse_nac_topo_dev_caps()
2953 !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_DUAL_M)); in ice_parse_nac_topo_dev_caps()
2955 dev_p->nac_topo.id); in ice_parse_nac_topo_dev_caps()
2959 * ice_parse_sensor_reading_cap - Parse ICE_AQC_CAPS_SENSOR_READING cap
2971 dev_p->supported_sensors = LE32_TO_CPU(cap->number); in ice_parse_sensor_reading_cap()
2975 dev_p->supported_sensors); in ice_parse_sensor_reading_cap()
2979 * ice_parse_dev_caps - Parse device capabilities
3007 found = ice_parse_common_caps(hw, &dev_p->common_cap, in ice_parse_dev_caps()
3035 ice_print_led_caps(hw, &dev_p->common_cap, "dev caps", true); in ice_parse_dev_caps()
3036 ice_print_sdp_caps(hw, &dev_p->common_cap, "dev caps", true); in ice_parse_dev_caps()
3038 ice_recalc_port_limited_caps(hw, &dev_p->common_cap); in ice_parse_dev_caps()
3075 * @node_handle: output parameter if node found - optional
3079 * If node_handle is non-NULL it will be modified on function exit. It is only
3080 * valid if the function returns zero, and should be ignored on any non-zero
3117 * ice_aq_list_caps - query function/device capabilities
3153 *cap_count = LE32_TO_CPU(cmd->count); in ice_aq_list_caps()
3159 * ice_discover_dev_caps - Read and extract device capabilities
3193 * ice_discover_func_caps - Read and extract function capabilities
3227 * ice_set_safe_mode_caps - Override dev/func capabilities when in safe mode
3232 struct ice_hw_func_caps *func_caps = &hw->func_caps; in ice_set_safe_mode_caps()
3233 struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; in ice_set_safe_mode_caps()
3238 cached_caps = func_caps->common_cap; in ice_set_safe_mode_caps()
3244 func_caps->common_cap.name = cached_caps.name in ice_set_safe_mode_caps()
3255 func_caps->common_cap.num_rxq = 1; in ice_set_safe_mode_caps()
3256 func_caps->common_cap.num_txq = 1; in ice_set_safe_mode_caps()
3259 func_caps->common_cap.num_msix_vectors = 2; in ice_set_safe_mode_caps()
3260 func_caps->guar_num_vsi = 1; in ice_set_safe_mode_caps()
3263 cached_caps = dev_caps->common_cap; in ice_set_safe_mode_caps()
3264 num_funcs = dev_caps->num_funcs; in ice_set_safe_mode_caps()
3270 dev_caps->common_cap.name = cached_caps.name in ice_set_safe_mode_caps()
3279 dev_caps->num_funcs = num_funcs; in ice_set_safe_mode_caps()
3282 dev_caps->common_cap.num_rxq = num_funcs; in ice_set_safe_mode_caps()
3283 dev_caps->common_cap.num_txq = num_funcs; in ice_set_safe_mode_caps()
3286 dev_caps->common_cap.num_msix_vectors = 2 * num_funcs; in ice_set_safe_mode_caps()
3290 * ice_get_caps - get info about the HW
3297 status = ice_discover_dev_caps(hw, &hw->dev_caps); in ice_get_caps()
3301 return ice_discover_func_caps(hw, &hw->func_caps); in ice_get_caps()
3305 * ice_aq_manage_mac_write - manage MAC address write command
3323 cmd->flags = flags; in ice_aq_manage_mac_write()
3324 ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_NONDMA); in ice_aq_manage_mac_write()
3346 * ice_clear_pxe_mode - clear pxe operations mode
3350 * like descriptor fetch/write-back mode.
3354 if (ice_check_sq_alive(hw, &hw->adminq)) in ice_clear_pxe_mode()
3359 * ice_aq_set_port_params - set physical port parameters
3375 struct ice_hw *hw = pi->hw; in ice_aq_set_port_params()
3382 cmd->lb_mode = pi->loopback_mode | in ice_aq_set_port_params()
3384 cmd->bad_frame_vsi = CPU_TO_LE16(bad_frame_vsi); in ice_aq_set_port_params()
3391 cmd->cmd_flags = CPU_TO_LE16(cmd_flags); in ice_aq_set_port_params()
3405 switch (hw->device_id) { in ice_is_100m_speed_supported()
3417 * ice_get_link_speed_based_on_phy_type - returns link speed
3421 * This helper function will convert an entry in PHY type structure
3424 * be one bit set, as this function will convert one PHY type to its
3568 * [ice_aqc_get_link_status->link_speed]. Caller can pass in
3608 * @cfg: structure with PHY configuration data to be set
3611 * Set the various PHY configuration parameters supported on the Port.
3612 * One or more of the Set PHY config parameters may be ignored in an MFP
3613 * mode as the PF may not have the privilege to set some of the PHY Config
3626 /* Ensure that only valid bits of cfg->caps can be turned on. */ in ice_aq_set_phy_cfg()
3627 if (cfg->caps & ~ICE_AQ_PHY_ENA_VALID_MASK) { in ice_aq_set_phy_cfg()
3628 ice_debug(hw, ICE_DBG_PHY, "Invalid bit is set in ice_aqc_set_phy_cfg_data->caps : 0x%x\n", in ice_aq_set_phy_cfg()
3629 cfg->caps); in ice_aq_set_phy_cfg()
3631 cfg->caps &= ICE_AQ_PHY_ENA_VALID_MASK; in ice_aq_set_phy_cfg()
3635 desc.params.set_phy.lport_num = pi->lport; in ice_aq_set_phy_cfg()
3638 ice_debug(hw, ICE_DBG_LINK, "set phy cfg\n"); in ice_aq_set_phy_cfg()
3640 (unsigned long long)LE64_TO_CPU(cfg->phy_type_low)); in ice_aq_set_phy_cfg()
3642 (unsigned long long)LE64_TO_CPU(cfg->phy_type_high)); in ice_aq_set_phy_cfg()
3643 ice_debug(hw, ICE_DBG_LINK, " caps = 0x%x\n", cfg->caps); in ice_aq_set_phy_cfg()
3645 cfg->low_power_ctrl_an); in ice_aq_set_phy_cfg()
3646 ice_debug(hw, ICE_DBG_LINK, " eee_cap = 0x%x\n", cfg->eee_cap); in ice_aq_set_phy_cfg()
3647 ice_debug(hw, ICE_DBG_LINK, " eeer_value = 0x%x\n", cfg->eeer_value); in ice_aq_set_phy_cfg()
3649 cfg->link_fec_opt); in ice_aq_set_phy_cfg()
3653 if (hw->adminq.sq_last_status == ICE_AQ_RC_EMODE) in ice_aq_set_phy_cfg()
3657 pi->phy.curr_user_phy_cfg = *cfg; in ice_aq_set_phy_cfg()
3663 * ice_update_link_info - update status of the HW network link
3674 li = &pi->phy.link_info; in ice_update_link_info()
3680 if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) { in ice_update_link_info()
3684 hw = pi->hw; in ice_update_link_info()
3694 ice_memcpy(li->module_type, &pcaps->module_type, in ice_update_link_info()
3695 sizeof(li->module_type), in ice_update_link_info()
3707 * @cache_data: PHY logging data
3708 * @cache_mode: PHY logging mode
3722 pi->phy.curr_user_fc_req = cache_data.data.curr_user_fc_req; in ice_cache_phy_user_req()
3725 pi->phy.curr_user_speed_req = in ice_cache_phy_user_req()
3729 pi->phy.curr_user_fec_req = cache_data.data.curr_user_fec_req; in ice_cache_phy_user_req()
3738 * @caps: PHY capabilities
3740 * Convert PHY FC capabilities to ice FC mode
3759 * @caps: PHY capabilities
3762 * Convert PHY FEC capabilities to ice FEC mode
3788 * ice_cfg_phy_fc - Configure PHY FC data based on FC mode
3790 * @cfg: PHY configuration data to set FC mode
3809 ice_malloc(pi->hw, sizeof(*pcaps)); in ice_cfg_phy_fc()
3818 ice_free(pi->hw, pcaps); in ice_cfg_phy_fc()
3822 pause_mask |= pcaps->caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE; in ice_cfg_phy_fc()
3823 pause_mask |= pcaps->caps & ICE_AQC_PHY_EN_RX_LINK_PAUSE; in ice_cfg_phy_fc()
3825 ice_free(pi->hw, pcaps); in ice_cfg_phy_fc()
3843 cfg->caps &= ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE | in ice_cfg_phy_fc()
3847 cfg->caps |= pause_mask; in ice_cfg_phy_fc()
3876 hw = pi->hw; in ice_set_fc()
3883 /* Get the current PHY config */ in ice_set_fc()
3894 /* Configure the set PHY data */ in ice_set_fc()
3895 status = ice_cfg_phy_fc(pi, &cfg, pi->fc.req_mode); in ice_set_fc()
3904 if (cfg.caps != pcaps->caps) { in ice_set_fc()
3942 * @phy_caps: PHY capabilities
3943 * @phy_cfg: PHY configuration
3945 * Helper function to determine if PHY capabilities matches PHY
3964 if (phy_caps->phy_type_low != phy_cfg->phy_type_low || in ice_phy_caps_equals_cfg()
3965 phy_caps->phy_type_high != phy_cfg->phy_type_high || in ice_phy_caps_equals_cfg()
3966 ((phy_caps->caps & caps_mask) != (phy_cfg->caps & cfg_mask)) || in ice_phy_caps_equals_cfg()
3967 phy_caps->low_power_ctrl_an != phy_cfg->low_power_ctrl_an || in ice_phy_caps_equals_cfg()
3968 phy_caps->eee_cap != phy_cfg->eee_cap || in ice_phy_caps_equals_cfg()
3969 phy_caps->eeer_value != phy_cfg->eeer_value || in ice_phy_caps_equals_cfg()
3970 phy_caps->link_fec_options != phy_cfg->link_fec_opt) in ice_phy_caps_equals_cfg()
3977 * ice_copy_phy_caps_to_cfg - Copy PHY ability data to configuration data
3979 * @caps: PHY ability structure to copy data from
3980 * @cfg: PHY configuration structure to copy data to
3982 * Helper function to copy AQC PHY get ability data to PHY set configuration
3994 cfg->phy_type_low = caps->phy_type_low; in ice_copy_phy_caps_to_cfg()
3995 cfg->phy_type_high = caps->phy_type_high; in ice_copy_phy_caps_to_cfg()
3996 cfg->caps = caps->caps; in ice_copy_phy_caps_to_cfg()
3997 cfg->low_power_ctrl_an = caps->low_power_ctrl_an; in ice_copy_phy_caps_to_cfg()
3998 cfg->eee_cap = caps->eee_cap; in ice_copy_phy_caps_to_cfg()
3999 cfg->eeer_value = caps->eeer_value; in ice_copy_phy_caps_to_cfg()
4000 cfg->link_fec_opt = caps->link_fec_options; in ice_copy_phy_caps_to_cfg()
4001 cfg->module_compliance_enforcement = in ice_copy_phy_caps_to_cfg()
4002 caps->module_compliance_enforcement; in ice_copy_phy_caps_to_cfg()
4006 * ice_cfg_phy_fec - Configure PHY FEC data based on FEC mode
4008 * @cfg: PHY configuration data to set FEC mode
4022 hw = pi->hw; in ice_cfg_phy_fec()
4037 cfg->caps |= (pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC); in ice_cfg_phy_fec()
4038 cfg->link_fec_opt = pcaps->link_fec_options; in ice_cfg_phy_fec()
4042 /* Clear RS bits, and AND BASE-R ability in ice_cfg_phy_fec()
4045 cfg->link_fec_opt &= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN | in ice_cfg_phy_fec()
4047 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ | in ice_cfg_phy_fec()
4051 /* Clear BASE-R bits, and AND RS ability in ice_cfg_phy_fec()
4054 cfg->link_fec_opt &= ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN; in ice_cfg_phy_fec()
4055 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_25G_RS_528_REQ | in ice_cfg_phy_fec()
4060 cfg->link_fec_opt &= ~ICE_AQC_PHY_FEC_MASK; in ice_cfg_phy_fec()
4068 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_DIS; in ice_cfg_phy_fec()
4069 /* fall-through */ in ice_cfg_phy_fec()
4072 cfg->caps &= ICE_AQC_PHY_CAPS_MASK; in ice_cfg_phy_fec()
4073 cfg->link_fec_opt |= pcaps->link_fec_options; in ice_cfg_phy_fec()
4080 if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(pi->hw) && in ice_cfg_phy_fec()
4081 !ice_fw_supports_report_dflt_cfg(pi->hw)) { in ice_cfg_phy_fec()
4089 cfg->link_fec_opt = tlv.fec_options; in ice_cfg_phy_fec()
4099 * ice_get_link_status - get status of the HW network link
4115 phy_info = &pi->phy; in ice_get_link_status()
4117 if (phy_info->get_link_info) { in ice_get_link_status()
4121 ice_debug(pi->hw, ICE_DBG_LINK, "get link status error, status = %d\n", in ice_get_link_status()
4125 *link_up = phy_info->link_info.link_info & ICE_AQ_LINK_UP; in ice_get_link_status()
4136 * Sets up the link and restarts the Auto-Negotiation over the link.
4150 cmd->cmd_flags = ICE_AQC_RESTART_AN_LINK_RESTART; in ice_aq_set_link_restart_an()
4151 cmd->lport_num = pi->lport; in ice_aq_set_link_restart_an()
4153 cmd->cmd_flags |= ICE_AQC_RESTART_AN_LINK_ENABLE; in ice_aq_set_link_restart_an()
4155 cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE; in ice_aq_set_link_restart_an()
4157 status = ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd); in ice_aq_set_link_restart_an()
4162 pi->phy.curr_user_phy_cfg.caps |= ICE_AQC_PHY_EN_LINK; in ice_aq_set_link_restart_an()
4164 pi->phy.curr_user_phy_cfg.caps &= ~ICE_AQC_PHY_EN_LINK; in ice_aq_set_link_restart_an()
4189 cmd->lport_num = port_num; in ice_aq_set_event_mask()
4191 cmd->event_mask = CPU_TO_LE16(mask); in ice_aq_set_event_mask()
4213 cmd->lb_mode = ICE_AQ_MAC_LB_EN; in ice_aq_set_mac_loopback()
4221 * @is_orig_mode: is this LED set to original mode (by the net-list)
4231 struct ice_hw *hw = pi->hw; in ice_aq_set_port_id_led()
4239 cmd->ident_mode = ICE_AQC_PORT_IDENT_LED_ORIG; in ice_aq_set_port_id_led()
4241 cmd->ident_mode = ICE_AQC_PORT_IDENT_LED_BLINK; in ice_aq_set_port_id_led()
4255 * @length: 1-16 for read, 1 for write.
4276 cmd->lport_num = (u8)(lport & 0xff); in ice_aq_sff_eeprom()
4277 cmd->lport_num_valid = (u8)((lport >> 8) & 0x01); in ice_aq_sff_eeprom()
4278 cmd->i2c_bus_addr = CPU_TO_LE16(((bus_addr >> 1) & in ice_aq_sff_eeprom()
4283 cmd->i2c_mem_addr = CPU_TO_LE16(mem_addr & 0xff); in ice_aq_sff_eeprom()
4284 cmd->eeprom_page = CPU_TO_LE16((u16)page << ICE_AQC_SFF_EEPROM_PAGE_S); in ice_aq_sff_eeprom()
4286 cmd->i2c_bus_addr |= CPU_TO_LE16(ICE_AQC_SFF_IS_WRITE); in ice_aq_sff_eeprom()
4313 ice_memcpy(&cmd->topo_params, topo_params, sizeof(*topo_params), in ice_aq_prog_topo_dev_nvm()
4349 ice_memcpy(&cmd->topo_params, topo_params, sizeof(*topo_params), in ice_aq_read_topo_dev_nvm()
4351 cmd->start_address = CPU_TO_LE32(start_address); in ice_aq_read_topo_dev_nvm()
4357 ice_memcpy(data, cmd->data_read, data_size, ICE_NONDMA_TO_NONDMA); in ice_aq_read_topo_dev_nvm()
4407 return -1; in ice_lut_size_to_type()
4431 vsi_handle = params->vsi_handle; in __ice_aq_get_set_rss_lut()
4432 lut = params->lut; in __ice_aq_get_set_rss_lut()
4433 lut_size = ice_lut_type_to_size(params->lut_type); in __ice_aq_get_set_rss_lut()
4434 lut_type = params->lut_type & ICE_LUT_TYPE_MASK; in __ice_aq_get_set_rss_lut()
4437 glob_lut_idx = params->global_lut_id; in __ice_aq_get_set_rss_lut()
4442 if (lut_size > params->lut_size) in __ice_aq_get_set_rss_lut()
4445 if (set && lut_size != params->lut_size) in __ice_aq_get_set_rss_lut()
4457 cmd_resp->vsi_id = CPU_TO_LE16(((vsi_id << in __ice_aq_get_set_rss_lut()
4468 cmd_resp->flags = CPU_TO_LE16(flags); in __ice_aq_get_set_rss_lut()
4470 params->lut_size = LE16_TO_CPU(desc.datalen); in __ice_aq_get_set_rss_lut()
4526 cmd_resp->vsi_id = CPU_TO_LE16(((vsi_id << in __ice_aq_get_set_rss_key()
4616 sum_size += ice_struct_size(list, txqs, list->num_txqs); in ice_aq_add_lan_txq()
4617 list = (struct ice_aqc_add_tx_qgrp *)(list->txqs + in ice_aq_add_lan_txq()
4618 list->num_txqs); in ice_aq_add_lan_txq()
4626 cmd->num_qgrps = num_qgrps; in ice_aq_add_lan_txq()
4666 cmd->num_entries = num_qgrps; in ice_aq_dis_lan_txq()
4668 cmd->vmvf_and_timeout = CPU_TO_LE16((5 << ICE_AQC_Q_DIS_TIMEOUT_S) & in ice_aq_dis_lan_txq()
4673 cmd->cmd_type = ICE_AQC_Q_DIS_CMD_VM_RESET; in ice_aq_dis_lan_txq()
4674 cmd->vmvf_and_timeout |= in ice_aq_dis_lan_txq()
4678 cmd->cmd_type = ICE_AQC_Q_DIS_CMD_VF_RESET; in ice_aq_dis_lan_txq()
4680 cmd->vmvf_and_timeout |= in ice_aq_dis_lan_txq()
4681 CPU_TO_LE16((vmvf_num + hw->func_caps.vf_base_id) & in ice_aq_dis_lan_txq()
4690 cmd->cmd_type |= ICE_AQC_Q_DIS_CMD_FLUSH_PIPE; in ice_aq_dis_lan_txq()
4701 u16 item_size = ice_struct_size(item, q_id, item->num_qs); in ice_aq_dis_lan_txq()
4704 if ((item->num_qs % 2) == 0) in ice_aq_dis_lan_txq()
4720 vmvf_num, hw->adminq.sq_last_status); in ice_aq_dis_lan_txq()
4724 hw->adminq.sq_last_status); in ice_aq_dis_lan_txq()
4737 * @timeout: timeout in units of 100 usec (valid values 0-50)
4739 * @buf: struct containing src/dest TEID and per-queue info
4773 cmd->cmd_type |= ICE_AQC_Q_CMD_TYPE_MOVE; in ice_aq_move_recfg_lan_txq()
4776 cmd->cmd_type |= ICE_AQC_Q_CMD_TYPE_TC_CHANGE; in ice_aq_move_recfg_lan_txq()
4779 cmd->cmd_type |= ICE_AQC_Q_CMD_SUBSEQ_CALL; in ice_aq_move_recfg_lan_txq()
4782 cmd->cmd_type |= ICE_AQC_Q_CMD_FLUSH_PIPE; in ice_aq_move_recfg_lan_txq()
4784 cmd->num_qs = num_qs; in ice_aq_move_recfg_lan_txq()
4785 cmd->timeout = ((timeout << ICE_AQC_Q_CMD_TIMEOUT_S) & in ice_aq_move_recfg_lan_txq()
4791 *txqs_moved = cmd->num_qs; in ice_aq_move_recfg_lan_txq()
4793 if (hw->adminq.sq_last_status == ICE_AQ_RC_EAGAIN && in ice_aq_move_recfg_lan_txq()
4795 *blocked_cgds = LE32_TO_CPU(cmd->blocked_cgds); in ice_aq_move_recfg_lan_txq()
4833 u16 num_qsets = LE16_TO_CPU(list->num_qsets); in ice_aq_add_rdma_qsets()
4836 list = (struct ice_aqc_add_rdma_qset_data *)(list->rdma_qsets + in ice_aq_add_rdma_qsets()
4845 cmd->num_qset_grps = num_qset_grps; in ice_aq_add_rdma_qsets()
4853 * ice_write_byte - write a byte to a packed context structure
4866 from = src_ctx + ce_info->offset; in ice_write_byte()
4869 shift_width = ce_info->lsb % 8; in ice_write_byte()
4870 mask = (u8)(BIT(ce_info->width) - 1); in ice_write_byte()
4880 dest = dest_ctx + (ce_info->lsb / 8); in ice_write_byte()
4892 * ice_write_word - write a word to a packed context structure
4906 from = src_ctx + ce_info->offset; in ice_write_word()
4909 shift_width = ce_info->lsb % 8; in ice_write_word()
4910 mask = BIT(ce_info->width) - 1; in ice_write_word()
4923 dest = dest_ctx + (ce_info->lsb / 8); in ice_write_word()
4935 * ice_write_dword - write a dword to a packed context structure
4949 from = src_ctx + ce_info->offset; in ice_write_dword()
4952 shift_width = ce_info->lsb % 8; in ice_write_dword()
4958 if (ce_info->width < 32) in ice_write_dword()
4959 mask = BIT(ce_info->width) - 1; in ice_write_dword()
4974 dest = dest_ctx + (ce_info->lsb / 8); in ice_write_dword()
4986 * ice_write_qword - write a qword to a packed context structure
5000 from = src_ctx + ce_info->offset; in ice_write_qword()
5003 shift_width = ce_info->lsb % 8; in ice_write_qword()
5009 if (ce_info->width < 64) in ice_write_qword()
5010 mask = BIT_ULL(ce_info->width) - 1; in ice_write_qword()
5025 dest = dest_ctx + (ce_info->lsb / 8); in ice_write_qword()
5037 * ice_set_ctx - set context bits in packed structure
5039 * @src_ctx: pointer to a generic non-packed context structure
5113 cmd->cluster_id = CPU_TO_LE16(cluster_id); in ice_aq_get_internal_data()
5114 cmd->table_id = CPU_TO_LE16(table_id); in ice_aq_get_internal_data()
5115 cmd->idx = CPU_TO_LE32(start); in ice_aq_get_internal_data()
5123 *ret_next_cluster = LE16_TO_CPU(cmd->cluster_id); in ice_aq_get_internal_data()
5125 *ret_next_table = LE16_TO_CPU(cmd->table_id); in ice_aq_get_internal_data()
5127 *ret_next_index = LE32_TO_CPU(cmd->idx); in ice_aq_get_internal_data()
5134 * ice_read_byte - read context byte into struct
5147 shift_width = ce_info->lsb % 8; in ice_read_byte()
5148 mask = (u8)(BIT(ce_info->width) - 1); in ice_read_byte()
5154 src = src_ctx + (ce_info->lsb / 8); in ice_read_byte()
5163 target = dest_ctx + ce_info->offset; in ice_read_byte()
5170 * ice_read_word - read context word into struct
5184 shift_width = ce_info->lsb % 8; in ice_read_word()
5185 mask = BIT(ce_info->width) - 1; in ice_read_word()
5191 src = src_ctx + (ce_info->lsb / 8); in ice_read_word()
5206 target = dest_ctx + ce_info->offset; in ice_read_word()
5213 * ice_read_dword - read context dword into struct
5227 shift_width = ce_info->lsb % 8; in ice_read_dword()
5233 if (ce_info->width < 32) in ice_read_dword()
5234 mask = BIT(ce_info->width) - 1; in ice_read_dword()
5242 src = src_ctx + (ce_info->lsb / 8); in ice_read_dword()
5257 target = dest_ctx + ce_info->offset; in ice_read_dword()
5264 * ice_read_qword - read context qword into struct
5278 shift_width = ce_info->lsb % 8; in ice_read_qword()
5284 if (ce_info->width < 64) in ice_read_qword()
5285 mask = BIT_ULL(ce_info->width) - 1; in ice_read_qword()
5293 src = src_ctx + (ce_info->lsb / 8); in ice_read_qword()
5308 target = dest_ctx + ce_info->offset; in ice_read_qword()
5315 * ice_get_ctx - extract context bits from a packed structure
5317 * @dest_ctx: pointer to a generic non-packed context structure
5349 * ice_get_lan_q_ctx - get the LAN queue context for the given VSI and TC
5364 if (q_handle >= vsi->num_lan_q_entries[tc]) in ice_get_lan_q_ctx()
5366 if (!vsi->lan_q_ctx[tc]) in ice_get_lan_q_ctx()
5368 q_ctx = vsi->lan_q_ctx[tc]; in ice_get_lan_q_ctx()
5396 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_ena_vsi_txq()
5399 if (num_qgrps > 1 || buf->num_txqs > 1) in ice_ena_vsi_txq()
5402 hw = pi->hw; in ice_ena_vsi_txq()
5407 ice_acquire_lock(&pi->sched_lock); in ice_ena_vsi_txq()
5425 buf->parent_teid = parent->info.node_teid; in ice_ena_vsi_txq()
5426 node.parent_teid = parent->info.node_teid; in ice_ena_vsi_txq()
5429 * - Scheduling mode is Bytes Per Second (BPS), indicated by Bit 0. in ice_ena_vsi_txq()
5430 * - 0 priority among siblings, indicated by Bit 1-3. in ice_ena_vsi_txq()
5431 * - WFQ, indicated by Bit 4. in ice_ena_vsi_txq()
5432 * - 0 Adjustment value is used in PSM credit update flow, indicated by in ice_ena_vsi_txq()
5433 * Bit 5-6. in ice_ena_vsi_txq()
5434 * - Bit 7 is reserved. in ice_ena_vsi_txq()
5438 buf->txqs[0].info.valid_sections = in ice_ena_vsi_txq()
5441 buf->txqs[0].info.generic = 0; in ice_ena_vsi_txq()
5442 buf->txqs[0].info.cir_bw.bw_profile_idx = in ice_ena_vsi_txq()
5444 buf->txqs[0].info.cir_bw.bw_alloc = in ice_ena_vsi_txq()
5446 buf->txqs[0].info.eir_bw.bw_profile_idx = in ice_ena_vsi_txq()
5448 buf->txqs[0].info.eir_bw.bw_alloc = in ice_ena_vsi_txq()
5455 LE16_TO_CPU(buf->txqs[0].txq_id), in ice_ena_vsi_txq()
5456 hw->adminq.sq_last_status); in ice_ena_vsi_txq()
5460 node.node_teid = buf->txqs[0].q_teid; in ice_ena_vsi_txq()
5462 q_ctx->q_handle = q_handle; in ice_ena_vsi_txq()
5463 q_ctx->q_teid = LE32_TO_CPU(node.node_teid); in ice_ena_vsi_txq()
5466 status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node, NULL); in ice_ena_vsi_txq()
5471 ice_release_lock(&pi->sched_lock); in ice_ena_vsi_txq()
5502 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_dis_vsi_txq()
5505 hw = pi->hw; in ice_dis_vsi_txq()
5523 ice_acquire_lock(&pi->sched_lock); in ice_dis_vsi_txq()
5528 node = ice_sched_find_node_by_teid(pi->root, q_teids[i]); in ice_dis_vsi_txq()
5537 if (q_ctx->q_handle != q_handles[i]) { in ice_dis_vsi_txq()
5539 q_ctx->q_handle, q_handles[i]); in ice_dis_vsi_txq()
5542 qg_list->parent_teid = node->info.parent_teid; in ice_dis_vsi_txq()
5543 qg_list->num_qs = 1; in ice_dis_vsi_txq()
5544 qg_list->q_id[0] = CPU_TO_LE16(q_ids[i]); in ice_dis_vsi_txq()
5551 q_ctx->q_handle = ICE_INVAL_Q_HANDLE; in ice_dis_vsi_txq()
5553 ice_release_lock(&pi->sched_lock); in ice_dis_vsi_txq()
5559 * ice_cfg_vsi_qs - configure the new/existing VSI queues
5575 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_cfg_vsi_qs()
5578 if (!ice_is_vsi_valid(pi->hw, vsi_handle)) in ice_cfg_vsi_qs()
5581 ice_acquire_lock(&pi->sched_lock); in ice_cfg_vsi_qs()
5594 ice_release_lock(&pi->sched_lock); in ice_cfg_vsi_qs()
5599 * ice_cfg_vsi_lan - configure VSI LAN queues
5616 * ice_cfg_vsi_rdma - configure the VSI RDMA queues
5654 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_ena_vsi_rdma_qset()
5656 hw = pi->hw; in ice_ena_vsi_rdma_qset()
5665 ice_acquire_lock(&pi->sched_lock); in ice_ena_vsi_rdma_qset()
5673 buf->parent_teid = parent->info.node_teid; in ice_ena_vsi_rdma_qset()
5674 node.parent_teid = parent->info.node_teid; in ice_ena_vsi_rdma_qset()
5676 buf->num_qsets = CPU_TO_LE16(num_qsets); in ice_ena_vsi_rdma_qset()
5678 buf->rdma_qsets[i].tx_qset_id = CPU_TO_LE16(rdma_qset[i]); in ice_ena_vsi_rdma_qset()
5679 buf->rdma_qsets[i].info.valid_sections = in ice_ena_vsi_rdma_qset()
5682 buf->rdma_qsets[i].info.generic = 0; in ice_ena_vsi_rdma_qset()
5683 buf->rdma_qsets[i].info.cir_bw.bw_profile_idx = in ice_ena_vsi_rdma_qset()
5685 buf->rdma_qsets[i].info.cir_bw.bw_alloc = in ice_ena_vsi_rdma_qset()
5687 buf->rdma_qsets[i].info.eir_bw.bw_profile_idx = in ice_ena_vsi_rdma_qset()
5689 buf->rdma_qsets[i].info.eir_bw.bw_alloc = in ice_ena_vsi_rdma_qset()
5699 node.node_teid = buf->rdma_qsets[i].qset_teid; in ice_ena_vsi_rdma_qset()
5700 status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, in ice_ena_vsi_rdma_qset()
5707 ice_release_lock(&pi->sched_lock); in ice_ena_vsi_rdma_qset()
5713 * ice_dis_vsi_rdma_qset - free RDMA resources
5729 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_dis_vsi_rdma_qset()
5732 hw = pi->hw; in ice_dis_vsi_rdma_qset()
5739 ice_acquire_lock(&pi->sched_lock); in ice_dis_vsi_rdma_qset()
5744 node = ice_sched_find_node_by_teid(pi->root, qset_teid[i]); in ice_dis_vsi_rdma_qset()
5748 qg_list->parent_teid = node->info.parent_teid; in ice_dis_vsi_rdma_qset()
5749 qg_list->num_qs = 1; in ice_dis_vsi_rdma_qset()
5750 qg_list->q_id[0] = in ice_dis_vsi_rdma_qset()
5762 ice_release_lock(&pi->sched_lock); in ice_dis_vsi_rdma_qset()
5791 cmd->sensor = sensor; in ice_aq_get_sensor_reading()
5792 cmd->format = format; in ice_aq_get_sensor_reading()
5804 * ice_is_main_vsi - checks whether the VSI is main VSI
5813 return vsi_handle == ICE_MAIN_VSI_HANDLE && hw->vsi_ctx[vsi_handle]; in ice_is_main_vsi()
5817 * ice_replay_pre_init - replay pre initialization
5836 LIST_REPLACE_INIT(&sw->recp_list[i].filt_rules, in ice_replay_pre_init()
5837 &sw->recp_list[i].filt_replay_rules); in ice_replay_pre_init()
5840 status = ice_sched_replay_root_node_bw(hw->port_info); in ice_replay_pre_init()
5844 return ice_sched_replay_tc_node_bw(hw->port_info); in ice_replay_pre_init()
5848 * ice_replay_vsi - replay VSI configuration
5857 struct ice_switch_info *sw = hw->switch_info; in ice_replay_vsi()
5858 struct ice_port_info *pi = hw->port_info; in ice_replay_vsi()
5864 /* Replay pre-initialization if there is any */ in ice_replay_vsi()
5882 * ice_replay_post - post replay configuration cleanup
5895 * ice_stat_update40 - read 40 bit stat from the chip and update stat values
5906 u64 new_data = rd64(hw, reg) & (BIT_ULL(40) - 1); in ice_stat_update40()
5922 *cur_stat += new_data - *prev_stat; in ice_stat_update40()
5924 /* to manage the potential roll-over */ in ice_stat_update40()
5925 *cur_stat += (new_data + BIT_ULL(40)) - *prev_stat; in ice_stat_update40()
5932 * ice_stat_update32 - read 32 bit stat from the chip and update stat values
5961 *cur_stat += new_data - *prev_stat; in ice_stat_update32()
5963 /* to manage the potential roll-over */ in ice_stat_update32()
5964 *cur_stat += (new_data + BIT_ULL(32)) - *prev_stat; in ice_stat_update32()
5971 * ice_stat_update_repc - read GLV_REPC stats from chip and update stat values
6017 cur_stats->rx_no_desc += no_desc; in ice_stat_update_repc()
6018 cur_stats->rx_errors += error_cnt; in ice_stat_update_repc()
6043 cmd->dword0_addr = CPU_TO_LE32(reg_addr0); in ice_aq_alternate_write()
6044 cmd->dword1_addr = CPU_TO_LE32(reg_addr1); in ice_aq_alternate_write()
6045 cmd->dword0_value = CPU_TO_LE32(reg_val0); in ice_aq_alternate_write()
6046 cmd->dword1_value = CPU_TO_LE32(reg_val1); in ice_aq_alternate_write()
6079 cmd->dword0_addr = CPU_TO_LE32(reg_addr0); in ice_aq_alternate_read()
6080 cmd->dword1_addr = CPU_TO_LE32(reg_addr1); in ice_aq_alternate_read()
6085 *reg_val0 = LE32_TO_CPU(cmd->dword0_value); in ice_aq_alternate_read()
6088 *reg_val1 = LE32_TO_CPU(cmd->dword1_value); in ice_aq_alternate_read()
6115 cmd->flags = bios_mode; in ice_aq_alternate_write_done()
6119 *reset_needed = (LE16_TO_CPU(cmd->flags) & in ice_aq_alternate_write_done()
6145 * ice_sched_query_elem - query element information from HW
6161 buf->node_teid = CPU_TO_LE32(node_teid); in ice_sched_query_elem()
6170 * ice_get_fw_mode - returns FW mode
6202 struct ice_port_info *pi = hw->port_info; in ice_get_cur_lldp_persist_status()
6221 (ICE_AQC_NVM_LLDP_STATUS_M_LEN * pi->lport); in ice_get_cur_lldp_persist_status()
6224 (ICE_AQC_NVM_LLDP_STATUS_M_LEN * pi->lport); in ice_get_cur_lldp_persist_status()
6242 struct ice_port_info *pi = hw->port_info; in ice_get_dflt_lldp_persist_status()
6293 (ICE_AQC_NVM_LLDP_STATUS_M_LEN * pi->lport); in ice_get_dflt_lldp_persist_status()
6296 (ICE_AQC_NVM_LLDP_STATUS_M_LEN * pi->lport); in ice_get_dflt_lldp_persist_status()
6309 * @bus_addr: 7-bit I2C bus address
6311 * @params: I2C parameters: bit [7] - Repeated start, bits [6:5] data offset size,
6312 * bit [4] - I2C address type, bits [3:0] - data size to read (0-16 bytes)
6336 cmd->i2c_bus_addr = CPU_TO_LE16(bus_addr); in ice_aq_read_i2c()
6337 cmd->topo_addr = topo_addr; in ice_aq_read_i2c()
6338 cmd->i2c_params = params; in ice_aq_read_i2c()
6339 cmd->i2c_addr = addr; in ice_aq_read_i2c()
6348 *data = resp->i2c_data[i]; in ice_aq_read_i2c()
6360 * @bus_addr: 7-bit I2C bus address
6362 * @params: I2C parameters: bit [4] - I2C address type, bits [3:0] - data size to write (0-7 bytes)
6386 cmd->i2c_bus_addr = CPU_TO_LE16(bus_addr); in ice_aq_write_i2c()
6387 cmd->topo_addr = topo_addr; in ice_aq_write_i2c()
6388 cmd->i2c_params = params; in ice_aq_write_i2c()
6389 cmd->i2c_addr = addr; in ice_aq_write_i2c()
6392 cmd->i2c_data[i] = *data; in ice_aq_write_i2c()
6418 cmd->gpio_ctrl_handle = CPU_TO_LE16(gpio_ctrl_handle); in ice_aq_set_gpio()
6419 cmd->gpio_num = pin_idx; in ice_aq_set_gpio()
6420 cmd->gpio_val = value ? 1 : 0; in ice_aq_set_gpio()
6446 cmd->gpio_ctrl_handle = CPU_TO_LE16(gpio_ctrl_handle); in ice_aq_get_gpio()
6447 cmd->gpio_num = pin_idx; in ice_aq_get_gpio()
6453 *value = !!cmd->gpio_val; in ice_aq_get_gpio()
6468 if (hw->api_maj_ver == maj) { in ice_is_fw_api_min_ver()
6469 if (hw->api_min_ver > min) in ice_is_fw_api_min_ver()
6471 if (hw->api_min_ver == min && hw->api_patch >= patch) in ice_is_fw_api_min_ver()
6473 } else if (hw->api_maj_ver > maj) { in ice_is_fw_api_min_ver()
6493 if (hw->fw_branch == branch) { in ice_is_fw_min_ver()
6494 if (hw->fw_maj_ver > maj) in ice_is_fw_min_ver()
6496 if (hw->fw_maj_ver == maj) { in ice_is_fw_min_ver()
6497 if (hw->fw_min_ver > min) in ice_is_fw_min_ver()
6499 if (hw->fw_min_ver == min && hw->fw_patch >= patch) in ice_is_fw_min_ver()
6532 struct ice_hw *hw = pi->hw; in ice_get_link_default_override()
6543 tlv_start = tlv + pi->lport * ICE_SR_PFA_LINK_OVERRIDE_WORDS + in ice_get_link_default_override()
6552 ldo->options = buf & ICE_LINK_OVERRIDE_OPT_M; in ice_get_link_default_override()
6553 ldo->phy_config = (buf & ICE_LINK_OVERRIDE_PHY_CFG_M) >> in ice_get_link_default_override()
6556 /* link PHY config */ in ice_get_link_default_override()
6560 ice_debug(hw, ICE_DBG_INIT, "Failed to read override phy config.\n"); in ice_get_link_default_override()
6563 ldo->fec_options = buf & ICE_LINK_OVERRIDE_FEC_OPT_M; in ice_get_link_default_override()
6565 /* PHY types low */ in ice_get_link_default_override()
6574 ldo->phy_type_low |= ((u64)buf << (i * 16)); in ice_get_link_default_override()
6577 /* PHY types high */ in ice_get_link_default_override()
6587 ldo->phy_type_high |= ((u64)buf << (i * 16)); in ice_get_link_default_override()
6594 * ice_is_phy_caps_an_enabled - check if PHY capabilities autoneg is enabled
6595 * @caps: get PHY capability data
6599 if (caps->caps & ICE_AQC_PHY_AN_MODE || in ice_is_phy_caps_an_enabled()
6600 caps->low_power_ctrl_an & (ICE_AQC_PHY_AN_EN_CLAUSE28 | in ice_is_phy_caps_an_enabled()
6617 if (hw->api_maj_ver > ICE_FW_API_HEALTH_REPORT_MAJ) in ice_is_fw_health_report_supported()
6620 if (hw->api_maj_ver == ICE_FW_API_HEALTH_REPORT_MAJ) { in ice_is_fw_health_report_supported()
6621 if (hw->api_min_ver > ICE_FW_API_HEALTH_REPORT_MIN) in ice_is_fw_health_report_supported()
6623 if (hw->api_min_ver == ICE_FW_API_HEALTH_REPORT_MIN && in ice_is_fw_health_report_supported()
6624 hw->api_patch >= ICE_FW_API_HEALTH_REPORT_PATCH) in ice_is_fw_health_report_supported()
6632 * ice_aq_set_health_status_config - Configure FW health events
6638 * PF. The supported event types are: PF-specific, all PFs, and global
6652 cmd->event_source = event_source; in ice_aq_set_health_status_config()
6661 * @option_count: input - size of the buffer in port options structures,
6662 * output - number of returned port options
6692 cmd->lport_num = lport; in ice_aq_get_port_options()
6693 cmd->lport_num_valid = lport_valid; in ice_aq_get_port_options()
6701 *option_count = cmd->port_options_count & ICE_AQC_PORT_OPT_COUNT_M; in ice_aq_get_port_options()
6703 *active_option_valid = cmd->port_options & ICE_AQC_PORT_OPT_VALID; in ice_aq_get_port_options()
6705 *active_option_idx = cmd->port_options & in ice_aq_get_port_options()
6707 if (*active_option_idx > (*option_count - 1)) in ice_aq_get_port_options()
6713 *pending_option_valid = cmd->pending_port_option_status & in ice_aq_get_port_options()
6716 *pending_option_idx = cmd->pending_port_option_status & in ice_aq_get_port_options()
6718 if (*pending_option_idx > (*option_count - 1)) in ice_aq_get_port_options()
6758 cmd->lport_num = lport; in ice_aq_set_port_option()
6760 cmd->lport_num_valid = lport_valid; in ice_aq_set_port_option()
6761 cmd->selected_port_option = new_option; in ice_aq_set_port_option()
6767 * ice_aq_set_lldp_mib - Set the LLDP MIB
6770 * @buf: pointer to the caller-supplied buffer to store the MIB block
6793 cmd->type = mib_type; in ice_aq_set_lldp_mib()
6794 cmd->length = CPU_TO_LE16(buf_size); in ice_aq_set_lldp_mib()
6800 * ice_fw_supports_lldp_fltr_ctrl - check NVM version supports lldp_fltr_ctrl
6805 if (hw->mac_type != ICE_MAC_E810 && hw->mac_type != ICE_MAC_GENERIC) in ice_fw_supports_lldp_fltr_ctrl()
6814 * ice_lldp_fltr_add_remove - add or remove a LLDP Rx switch filter
6830 cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_ADD; in ice_lldp_fltr_add_remove()
6832 cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_DELETE; in ice_lldp_fltr_add_remove()
6834 cmd->vsi_num = CPU_TO_LE16(vsi_num); in ice_lldp_fltr_add_remove()
6840 * ice_lldp_execute_pending_mib - execute LLDP pending MIB request
6870 * value, but is indexed by [fls(speed) - 1]
6888 * ice_get_link_speed - get integer speed from table
6889 * @index: array index from fls(aq speed) - 1
6929 if (hw->api_maj_ver >= ICE_FW_API_AUTO_DROP_MAJ && in ice_is_fw_auto_drop_supported()
6930 hw->api_min_ver >= ICE_FW_API_AUTO_DROP_MIN) in ice_is_fw_auto_drop_supported()