Lines Matching +full:quad +full:- +full:phase
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2018-2023, Intel Corporation. */
89 * ice_dump_phy_type - helper function to dump phy_type
116 * ice_set_mac_type - Sets MAC type
124 if (hw->vendor_id != PCI_VENDOR_ID_INTEL) in ice_set_mac_type()
125 return -ENODEV; in ice_set_mac_type()
127 switch (hw->device_id) { in ice_set_mac_type()
134 hw->mac_type = ICE_MAC_E810; in ice_set_mac_type()
155 hw->mac_type = ICE_MAC_GENERIC; in ice_set_mac_type()
161 hw->mac_type = ICE_MAC_GENERIC_3K_E825; in ice_set_mac_type()
173 hw->mac_type = ICE_MAC_E830; in ice_set_mac_type()
176 hw->mac_type = ICE_MAC_UNKNOWN; in ice_set_mac_type()
180 ice_debug(hw, ICE_DBG_INIT, "mac_type: %d\n", hw->mac_type); in ice_set_mac_type()
185 * ice_is_generic_mac - check if device's mac_type is generic
192 return (hw->mac_type == ICE_MAC_GENERIC || in ice_is_generic_mac()
193 hw->mac_type == ICE_MAC_GENERIC_3K_E825); in ice_is_generic_mac()
204 return hw->mac_type == ICE_MAC_E810; in ice_is_e810()
215 switch (hw->device_id) { in ice_is_e810t()
217 switch (hw->subsystem_device_id) { in ice_is_e810t()
228 switch (hw->subsystem_device_id) { in ice_is_e810t()
243 * ice_is_e822 - Check if a device is E822 family device
250 switch (hw->device_id) { in ice_is_e822()
270 * returns true if the device is E823-L or E823-C based, false if not.
274 switch (hw->device_id) { in ice_is_e823()
292 * ice_is_e825c - Check if a device is E825C family device
295 * Return: true if the device is E825-C based, false if not.
299 switch (hw->device_id) { in ice_is_e825c()
311 * ice_clear_pf_cfg - Clear PF configuration
327 * ice_aq_manage_mac_read - manage MAC address read command
355 return -EINVAL; in ice_aq_manage_mac_read()
364 flags = le16_to_cpu(cmd->flags) & ICE_AQC_MAN_MAC_READ_M; in ice_aq_manage_mac_read()
368 return -EIO; in ice_aq_manage_mac_read()
372 for (i = 0; i < cmd->num_addr; i++) in ice_aq_manage_mac_read()
374 ether_addr_copy(hw->port_info->mac.lan_addr, in ice_aq_manage_mac_read()
376 ether_addr_copy(hw->port_info->mac.perm_addr, in ice_aq_manage_mac_read()
385 * ice_aq_get_phy_caps - returns PHY capabilities
409 return -EINVAL; in ice_aq_get_phy_caps()
410 hw = pi->hw; in ice_aq_get_phy_caps()
414 return -EINVAL; in ice_aq_get_phy_caps()
419 cmd->param0 |= cpu_to_le16(ICE_AQC_GET_PHY_RQM); in ice_aq_get_phy_caps()
421 cmd->param0 |= cpu_to_le16(report_mode); in ice_aq_get_phy_caps()
443 ice_dump_phy_type(hw, le64_to_cpu(pcaps->phy_type_low), in ice_aq_get_phy_caps()
444 le64_to_cpu(pcaps->phy_type_high), prefix); in ice_aq_get_phy_caps()
448 ice_debug(hw, ICE_DBG_LINK, "%s: caps = 0x%x\n", prefix, pcaps->caps); in ice_aq_get_phy_caps()
450 pcaps->low_power_ctrl_an); in ice_aq_get_phy_caps()
452 pcaps->eee_cap); in ice_aq_get_phy_caps()
454 pcaps->eeer_value); in ice_aq_get_phy_caps()
456 pcaps->link_fec_options); in ice_aq_get_phy_caps()
458 prefix, pcaps->module_compliance_enforcement); in ice_aq_get_phy_caps()
460 prefix, pcaps->extended_compliance_code); in ice_aq_get_phy_caps()
462 pcaps->module_type[0]); in ice_aq_get_phy_caps()
464 pcaps->module_type[1]); in ice_aq_get_phy_caps()
466 pcaps->module_type[2]); in ice_aq_get_phy_caps()
469 pi->phy.phy_type_low = le64_to_cpu(pcaps->phy_type_low); in ice_aq_get_phy_caps()
470 pi->phy.phy_type_high = le64_to_cpu(pcaps->phy_type_high); in ice_aq_get_phy_caps()
471 memcpy(pi->phy.link_info.module_type, &pcaps->module_type, in ice_aq_get_phy_caps()
472 sizeof(pi->phy.link_info.module_type)); in ice_aq_get_phy_caps()
479 * ice_aq_get_link_topo_handle - get link topology node return status
488 * connection type is backplane or BASE-T.
501 cmd->addr.topo_params.node_type_ctx = in ice_aq_get_link_topo_handle()
506 cmd->addr.topo_params.node_type_ctx |= in ice_aq_get_link_topo_handle()
509 return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd); in ice_aq_get_link_topo_handle()
531 return -EINTR; in ice_aq_get_netlist_node()
547 * @node_handle: output parameter if node found - optional
551 * If node_handle is non-NULL it will be modified on function exit. It is only
552 * valid if the function returns zero, and should be ignored on any non-zero
555 * Returns: 0 if the node is found, -ENOENT if no handle was found, and
583 return -ENOENT; in ice_find_netlist_node()
591 * media type is backplane or BASE-T.
597 * connection type is backplane or BASE-T. in ice_is_media_cage_present()
605 * ice_get_media_type - Gets media type
615 hw_link_info = &pi->phy.link_info; in ice_get_media_type()
616 if (hw_link_info->phy_type_low && hw_link_info->phy_type_high) in ice_get_media_type()
620 if (hw_link_info->phy_type_low) { in ice_get_media_type()
626 if (hw_link_info->phy_type_low == ICE_PHY_TYPE_LOW_1G_SGMII && in ice_get_media_type()
627 (hw_link_info->module_type[ICE_AQC_MOD_TYPE_IDENT] == in ice_get_media_type()
629 hw_link_info->module_type[ICE_AQC_MOD_TYPE_IDENT] == in ice_get_media_type()
633 switch (hw_link_info->phy_type_low) { in ice_get_media_type()
705 switch (hw_link_info->phy_type_high) { in ice_get_media_type()
730 switch (hw->mac_type) { in ice_get_link_status_datalen()
743 * @link: pointer to link status structure - optional
764 return -EINVAL; in ice_aq_get_link_info()
765 hw = pi->hw; in ice_aq_get_link_info()
766 li_old = &pi->phy.link_info_old; in ice_aq_get_link_info()
767 hw_media_type = &pi->phy.media_type; in ice_aq_get_link_info()
768 li = &pi->phy.link_info; in ice_aq_get_link_info()
769 hw_fc_info = &pi->fc; in ice_aq_get_link_info()
774 resp->cmd_flags = cpu_to_le16(cmd_flags); in ice_aq_get_link_info()
775 resp->lport_num = pi->lport; in ice_aq_get_link_info()
786 li->link_speed = le16_to_cpu(link_data.link_speed); in ice_aq_get_link_info()
787 li->phy_type_low = le64_to_cpu(link_data.phy_type_low); in ice_aq_get_link_info()
788 li->phy_type_high = le64_to_cpu(link_data.phy_type_high); in ice_aq_get_link_info()
790 li->link_info = link_data.link_info; in ice_aq_get_link_info()
791 li->link_cfg_err = link_data.link_cfg_err; in ice_aq_get_link_info()
792 li->an_info = link_data.an_info; in ice_aq_get_link_info()
793 li->ext_info = link_data.ext_info; in ice_aq_get_link_info()
794 li->max_frame_size = le16_to_cpu(link_data.max_frame_size); in ice_aq_get_link_info()
795 li->fec_info = link_data.cfg & ICE_AQ_FEC_MASK; in ice_aq_get_link_info()
796 li->topo_media_conflict = link_data.topo_media_conflict; in ice_aq_get_link_info()
797 li->pacing = link_data.cfg & (ICE_AQ_CFG_PACING_M | in ice_aq_get_link_info()
804 hw_fc_info->current_mode = ICE_FC_FULL; in ice_aq_get_link_info()
806 hw_fc_info->current_mode = ICE_FC_TX_PAUSE; in ice_aq_get_link_info()
808 hw_fc_info->current_mode = ICE_FC_RX_PAUSE; in ice_aq_get_link_info()
810 hw_fc_info->current_mode = ICE_FC_NONE; in ice_aq_get_link_info()
812 li->lse_ena = !!(resp->cmd_flags & cpu_to_le16(ICE_AQ_LSE_IS_ENABLED)); in ice_aq_get_link_info()
815 ice_debug(hw, ICE_DBG_LINK, " link_speed = 0x%x\n", li->link_speed); in ice_aq_get_link_info()
817 (unsigned long long)li->phy_type_low); in ice_aq_get_link_info()
819 (unsigned long long)li->phy_type_high); in ice_aq_get_link_info()
821 ice_debug(hw, ICE_DBG_LINK, " link_info = 0x%x\n", li->link_info); in ice_aq_get_link_info()
822 ice_debug(hw, ICE_DBG_LINK, " link_cfg_err = 0x%x\n", li->link_cfg_err); in ice_aq_get_link_info()
823 ice_debug(hw, ICE_DBG_LINK, " an_info = 0x%x\n", li->an_info); in ice_aq_get_link_info()
824 ice_debug(hw, ICE_DBG_LINK, " ext_info = 0x%x\n", li->ext_info); in ice_aq_get_link_info()
825 ice_debug(hw, ICE_DBG_LINK, " fec_info = 0x%x\n", li->fec_info); in ice_aq_get_link_info()
826 ice_debug(hw, ICE_DBG_LINK, " lse_ena = 0x%x\n", li->lse_ena); in ice_aq_get_link_info()
828 li->max_frame_size); in ice_aq_get_link_info()
829 ice_debug(hw, ICE_DBG_LINK, " pacing = 0x%x\n", li->pacing); in ice_aq_get_link_info()
836 pi->phy.get_link_info = false; in ice_aq_get_link_info()
865 if (hw->mac_type == ICE_MAC_E830) { in ice_fill_tx_timer_and_fc_thresh()
868 cmd->tx_tmr_value = in ice_fill_tx_timer_and_fc_thresh()
878 cmd->tx_tmr_value = in ice_fill_tx_timer_and_fc_thresh()
887 cmd->fc_refresh_threshold = le16_encode_bits(val, fc_thres_m); in ice_fill_tx_timer_and_fc_thresh()
907 return -EINVAL; in ice_aq_set_mac_cfg()
911 cmd->max_frame_size = cpu_to_le16(max_frame_size); in ice_aq_set_mac_cfg()
919 * ice_init_fltr_mgmt_struct - initializes filter management list and locks
927 hw->switch_info = devm_kzalloc(ice_hw_to_dev(hw), in ice_init_fltr_mgmt_struct()
928 sizeof(*hw->switch_info), GFP_KERNEL); in ice_init_fltr_mgmt_struct()
929 sw = hw->switch_info; in ice_init_fltr_mgmt_struct()
932 return -ENOMEM; in ice_init_fltr_mgmt_struct()
934 INIT_LIST_HEAD(&sw->vsi_list_map_head); in ice_init_fltr_mgmt_struct()
935 sw->prof_res_bm_init = 0; in ice_init_fltr_mgmt_struct()
938 sw->recp_cnt = ICE_SW_LKUP_LAST; in ice_init_fltr_mgmt_struct()
942 devm_kfree(ice_hw_to_dev(hw), hw->switch_info); in ice_init_fltr_mgmt_struct()
949 * ice_cleanup_fltr_mgmt_struct - cleanup filter management list and locks
954 struct ice_switch_info *sw = hw->switch_info; in ice_cleanup_fltr_mgmt_struct()
960 list_for_each_entry_safe(v_pos_map, v_tmp_map, &sw->vsi_list_map_head, in ice_cleanup_fltr_mgmt_struct()
962 list_del(&v_pos_map->list_entry); in ice_cleanup_fltr_mgmt_struct()
965 recps = sw->recp_list; in ice_cleanup_fltr_mgmt_struct()
977 list_del(&lst_itr->list_entry); in ice_cleanup_fltr_mgmt_struct()
978 devm_kfree(ice_hw_to_dev(hw), lst_itr->lkups); in ice_cleanup_fltr_mgmt_struct()
988 list_del(&lst_itr->list_entry); in ice_cleanup_fltr_mgmt_struct()
994 devm_kfree(ice_hw_to_dev(hw), sw->recp_list); in ice_cleanup_fltr_mgmt_struct()
1003 * bandwidth according to the device's configuration during power-on.
1014 hw->itr_gran = ICE_ITR_GRAN_ABOVE_25; in ice_get_itr_intrl_gran()
1015 hw->intrl_gran = ICE_INTRL_GRAN_ABOVE_25; in ice_get_itr_intrl_gran()
1018 hw->itr_gran = ICE_ITR_GRAN_MAX_25; in ice_get_itr_intrl_gran()
1019 hw->intrl_gran = ICE_INTRL_GRAN_MAX_25; in ice_get_itr_intrl_gran()
1025 * ice_init_hw - main hardware initialization routine
1040 hw->pf_id = FIELD_GET(PF_FUNC_RID_FUNC_NUM_M, rd32(hw, PF_FUNC_RID)); in ice_init_hw()
1063 INIT_LIST_HEAD(&hw->fdir_list_head); in ice_init_hw()
1075 if (!hw->port_info) in ice_init_hw()
1076 hw->port_info = devm_kzalloc(ice_hw_to_dev(hw), in ice_init_hw()
1077 sizeof(*hw->port_info), in ice_init_hw()
1079 if (!hw->port_info) { in ice_init_hw()
1080 status = -ENOMEM; in ice_init_hw()
1084 hw->port_info->local_fwd_mode = ICE_LOCAL_FWD_MODE_ENABLED; in ice_init_hw()
1086 hw->port_info->hw = hw; in ice_init_hw()
1093 hw->evb_veb = true; in ice_init_hw()
1096 xa_init_flags(&hw->port_info->sched_node_ids, XA_FLAGS_ALLOC); in ice_init_hw()
1107 status = ice_sched_init_port(hw->port_info); in ice_init_hw()
1113 status = -ENOMEM; in ice_init_hw()
1118 status = ice_aq_get_phy_caps(hw->port_info, false, in ice_init_hw()
1126 status = ice_aq_get_link_info(hw->port_info, false, NULL, NULL); in ice_init_hw()
1131 if (!hw->sw_entry_point_layer) { in ice_init_hw()
1133 status = -EIO; in ice_init_hw()
1136 INIT_LIST_HEAD(&hw->agg_list); in ice_init_hw()
1138 if (!hw->max_burst_size) in ice_init_hw()
1150 status = -ENOMEM; in ice_init_hw()
1164 status = ice_alloc_fd_res_cntr(hw, &hw->fd_ctr_base); in ice_init_hw()
1170 mutex_init(&hw->tnl_lock); in ice_init_hw()
1180 devm_kfree(ice_hw_to_dev(hw), hw->port_info); in ice_init_hw()
1187 * ice_deinit_hw - unroll initialization operations done by ice_init_hw
1196 ice_free_fd_res_cntr(hw, hw->fd_ctr_base); in ice_deinit_hw()
1203 mutex_destroy(&hw->tnl_lock); in ice_deinit_hw()
1213 * ice_check_reset - Check to see if a global reset is complete
1236 return -EIO; in ice_check_reset()
1247 uld_mask = ICE_RESET_DONE_MASK | (hw->func_caps.common_cap.rdma ? in ice_check_reset()
1263 return -EIO; in ice_check_reset()
1270 * ice_pf_reset - Reset the PF
1289 return -EIO; in ice_pf_reset()
1314 return -EIO; in ice_pf_reset()
1321 * ice_reset - Perform different types of reset
1348 return -EINVAL; in ice_reset()
1373 return -EINVAL; in ice_copy_rxq_ctx_to_hw()
1376 return -EINVAL; in ice_copy_rxq_ctx_to_hw()
1432 return -EINVAL; in ice_write_rxq_ctx()
1434 rlan_ctx->prefena = 1; in ice_write_rxq_ctx()
1477 * ice_sbq_send_cmd - send Sideband Queue command to Sideband Queue
1493 * ice_sbq_rw_reg - Fill Sideband Queue command
1507 msg.dest_dev = in->dest_dev; in ice_sbq_rw_reg()
1508 msg.opcode = in->opcode; in ice_sbq_rw_reg()
1511 msg.msg_addr_low = cpu_to_le16(in->msg_addr_low); in ice_sbq_rw_reg()
1512 msg.msg_addr_high = cpu_to_le32(in->msg_addr_high); in ice_sbq_rw_reg()
1514 if (in->opcode) in ice_sbq_rw_reg()
1515 msg.data = cpu_to_le32(in->data); in ice_sbq_rw_reg()
1520 msg_len -= sizeof(msg.data); in ice_sbq_rw_reg()
1526 if (!status && !in->opcode) in ice_sbq_rw_reg()
1527 in->data = le32_to_cpu in ice_sbq_rw_reg()
1528 (((struct ice_sbq_msg_cmpl *)&msg)->data); in ice_sbq_rw_reg()
1561 * ice_sq_send_cmd_retry - send command to Control Queue (ATQ)
1583 opcode = le16_to_cpu(desc->opcode); in ice_sq_send_cmd_retry()
1598 hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY) in ice_sq_send_cmd_retry()
1611 * ice_aq_send_cmd - send FW Admin Queue command to FW Admin Queue
1624 struct ice_aqc_req_res *cmd = &desc->params.res_owner; in ice_aq_send_cmd()
1638 switch (le16_to_cpu(desc->opcode)) { in ice_aq_send_cmd()
1655 if (le16_to_cpu(cmd->res_id) == ICE_AQC_RES_ID_GLBL_LOCK) in ice_aq_send_cmd()
1664 status = ice_sq_send_cmd_retry(hw, &hw->adminq, desc, buf, buf_size, cd); in ice_aq_send_cmd()
1691 hw->fw_branch = resp->fw_branch; in ice_aq_get_fw_ver()
1692 hw->fw_maj_ver = resp->fw_major; in ice_aq_get_fw_ver()
1693 hw->fw_min_ver = resp->fw_minor; in ice_aq_get_fw_ver()
1694 hw->fw_patch = resp->fw_patch; in ice_aq_get_fw_ver()
1695 hw->fw_build = le32_to_cpu(resp->fw_build); in ice_aq_get_fw_ver()
1696 hw->api_branch = resp->api_branch; in ice_aq_get_fw_ver()
1697 hw->api_maj_ver = resp->api_major; in ice_aq_get_fw_ver()
1698 hw->api_min_ver = resp->api_minor; in ice_aq_get_fw_ver()
1699 hw->api_patch = resp->api_patch; in ice_aq_get_fw_ver()
1724 return -EINVAL; in ice_aq_send_driver_ver()
1729 cmd->major_ver = dv->major_ver; in ice_aq_send_driver_ver()
1730 cmd->minor_ver = dv->minor_ver; in ice_aq_send_driver_ver()
1731 cmd->build_ver = dv->build_ver; in ice_aq_send_driver_ver()
1732 cmd->subbuild_ver = dv->subbuild_ver; in ice_aq_send_driver_ver()
1735 while (len < sizeof(dv->driver_string) && in ice_aq_send_driver_ver()
1736 isascii(dv->driver_string[len]) && dv->driver_string[len]) in ice_aq_send_driver_ver()
1739 return ice_aq_send_cmd(hw, &desc, dv->driver_string, len, cd); in ice_aq_send_driver_ver()
1760 cmd->driver_unloading = ICE_AQC_DRIVER_UNLOADING; in ice_aq_q_shutdown()
1777 * 1) 0 - acquired lock, and can perform download package
1778 * 2) -EIO - did not get lock, driver should fail to load
1779 * 3) -EALREADY - did not get lock, but another driver has
1785 * phase of operation, it is possible that the FW may detect a timeout and issue
1804 cmd_resp->res_id = cpu_to_le16(res); in ice_aq_req_res()
1805 cmd_resp->access_type = cpu_to_le16(access); in ice_aq_req_res()
1806 cmd_resp->res_number = cpu_to_le32(sdp_number); in ice_aq_req_res()
1807 cmd_resp->timeout = cpu_to_le32(*timeout); in ice_aq_req_res()
1824 if (le16_to_cpu(cmd_resp->status) == ICE_AQ_RES_GLBL_SUCCESS) { in ice_aq_req_res()
1825 *timeout = le32_to_cpu(cmd_resp->timeout); in ice_aq_req_res()
1827 } else if (le16_to_cpu(cmd_resp->status) == in ice_aq_req_res()
1829 *timeout = le32_to_cpu(cmd_resp->timeout); in ice_aq_req_res()
1830 return -EIO; in ice_aq_req_res()
1831 } else if (le16_to_cpu(cmd_resp->status) == in ice_aq_req_res()
1833 return -EALREADY; in ice_aq_req_res()
1838 return -EIO; in ice_aq_req_res()
1845 if (!status || hw->adminq.sq_last_status == ICE_AQ_RC_EBUSY) in ice_aq_req_res()
1846 *timeout = le32_to_cpu(cmd_resp->timeout); in ice_aq_req_res()
1871 cmd->res_id = cpu_to_le16(res); in ice_aq_release_res()
1872 cmd->res_number = cpu_to_le32(sdp_number); in ice_aq_release_res()
1897 /* A return code of -EALREADY means that another driver has in ice_acquire_res()
1902 if (status == -EALREADY) in ice_acquire_res()
1912 timeout = (timeout > delay) ? timeout - delay : 0; in ice_acquire_res()
1915 if (status == -EALREADY) in ice_acquire_res()
1923 if (status && status != -EALREADY) in ice_acquire_res()
1927 if (status == -EALREADY) { in ice_acquire_res()
1931 ice_debug(hw, ICE_DBG_RES, "Warning: -EALREADY not expected\n"); in ice_acquire_res()
1954 if (status != -EIO) in ice_release_res()
1961 * ice_aq_alloc_free_res - command to allocate/free resources
1979 return -EINVAL; in ice_aq_alloc_free_res()
1985 cmd->num_entries = cpu_to_le16(1); in ice_aq_alloc_free_res()
1991 * ice_alloc_hw_res - allocate resource
2008 return -ENOMEM; in ice_alloc_hw_res()
2011 buf->num_elems = cpu_to_le16(num); in ice_alloc_hw_res()
2012 buf->res_type = cpu_to_le16(type | ICE_AQC_RES_TYPE_FLAG_DEDICATED | in ice_alloc_hw_res()
2015 buf->res_type |= cpu_to_le16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM); in ice_alloc_hw_res()
2021 memcpy(res, buf->elem, sizeof(*buf->elem) * num); in ice_alloc_hw_res()
2029 * ice_free_hw_res - free allocated HW resource
2044 return -ENOMEM; in ice_free_hw_res()
2047 buf->num_elems = cpu_to_le16(num); in ice_free_hw_res()
2048 buf->res_type = cpu_to_le16(type); in ice_free_hw_res()
2049 memcpy(buf->elem, res, sizeof(*buf->elem) * num); in ice_free_hw_res()
2060 * ice_get_num_per_func - determine number of resources per PF
2073 funcs = hweight8(hw->dev_caps.common_cap.valid_functions & in ice_get_num_per_func()
2083 * ice_parse_common_caps - parse common device/function capabilities
2099 u32 logical_id = le32_to_cpu(elem->logical_id); in ice_parse_common_caps()
2100 u32 phys_id = le32_to_cpu(elem->phys_id); in ice_parse_common_caps()
2101 u32 number = le32_to_cpu(elem->number); in ice_parse_common_caps()
2102 u16 cap = le16_to_cpu(elem->cap); in ice_parse_common_caps()
2107 caps->valid_functions = number; in ice_parse_common_caps()
2109 caps->valid_functions); in ice_parse_common_caps()
2112 caps->sr_iov_1_1 = (number == 1); in ice_parse_common_caps()
2114 caps->sr_iov_1_1); in ice_parse_common_caps()
2117 caps->dcb = (number == 1); in ice_parse_common_caps()
2118 caps->active_tc_bitmap = logical_id; in ice_parse_common_caps()
2119 caps->maxtc = phys_id; in ice_parse_common_caps()
2120 ice_debug(hw, ICE_DBG_INIT, "%s: dcb = %d\n", prefix, caps->dcb); in ice_parse_common_caps()
2122 caps->active_tc_bitmap); in ice_parse_common_caps()
2123 ice_debug(hw, ICE_DBG_INIT, "%s: maxtc = %d\n", prefix, caps->maxtc); in ice_parse_common_caps()
2126 caps->rss_table_size = number; in ice_parse_common_caps()
2127 caps->rss_table_entry_width = logical_id; in ice_parse_common_caps()
2129 caps->rss_table_size); in ice_parse_common_caps()
2131 caps->rss_table_entry_width); in ice_parse_common_caps()
2134 caps->num_rxq = number; in ice_parse_common_caps()
2135 caps->rxq_first_id = phys_id; in ice_parse_common_caps()
2137 caps->num_rxq); in ice_parse_common_caps()
2139 caps->rxq_first_id); in ice_parse_common_caps()
2142 caps->num_txq = number; in ice_parse_common_caps()
2143 caps->txq_first_id = phys_id; in ice_parse_common_caps()
2145 caps->num_txq); in ice_parse_common_caps()
2147 caps->txq_first_id); in ice_parse_common_caps()
2150 caps->num_msix_vectors = number; in ice_parse_common_caps()
2151 caps->msix_vector_first_id = phys_id; in ice_parse_common_caps()
2153 caps->num_msix_vectors); in ice_parse_common_caps()
2155 caps->msix_vector_first_id); in ice_parse_common_caps()
2158 caps->nvm_update_pending_nvm = true; in ice_parse_common_caps()
2162 caps->nvm_update_pending_orom = true; in ice_parse_common_caps()
2166 caps->nvm_update_pending_netlist = true; in ice_parse_common_caps()
2170 caps->nvm_unified_update = in ice_parse_common_caps()
2174 caps->nvm_unified_update); in ice_parse_common_caps()
2177 caps->rdma = (number == 1); in ice_parse_common_caps()
2178 ice_debug(hw, ICE_DBG_INIT, "%s: rdma = %d\n", prefix, caps->rdma); in ice_parse_common_caps()
2181 caps->max_mtu = number; in ice_parse_common_caps()
2183 prefix, caps->max_mtu); in ice_parse_common_caps()
2186 caps->pcie_reset_avoidance = (number > 0); in ice_parse_common_caps()
2189 caps->pcie_reset_avoidance); in ice_parse_common_caps()
2192 caps->reset_restrict_support = (number == 1); in ice_parse_common_caps()
2195 caps->reset_restrict_support); in ice_parse_common_caps()
2198 caps->roce_lag = !!(number & ICE_AQC_BIT_ROCEV2_LAG); in ice_parse_common_caps()
2200 prefix, caps->roce_lag); in ice_parse_common_caps()
2201 caps->sriov_lag = !!(number & ICE_AQC_BIT_SRIOV_LAG); in ice_parse_common_caps()
2203 prefix, caps->sriov_lag); in ice_parse_common_caps()
2206 caps->tx_sched_topo_comp_mode_en = (number == 1); in ice_parse_common_caps()
2217 * ice_recalc_port_limited_caps - Recalculate port limited capabilities
2221 * Re-calculate the capabilities that are dependent on the number of physical
2231 if (hw->dev_caps.num_funcs > 4) { in ice_recalc_port_limited_caps()
2233 caps->maxtc = 4; in ice_recalc_port_limited_caps()
2235 caps->maxtc); in ice_recalc_port_limited_caps()
2236 if (caps->rdma) { in ice_recalc_port_limited_caps()
2238 caps->rdma = 0; in ice_recalc_port_limited_caps()
2244 if (caps == &hw->dev_caps.common_cap) in ice_recalc_port_limited_caps()
2250 * ice_parse_vf_func_caps - Parse ICE_AQC_CAPS_VF function caps
2261 u32 logical_id = le32_to_cpu(cap->logical_id); in ice_parse_vf_func_caps()
2262 u32 number = le32_to_cpu(cap->number); in ice_parse_vf_func_caps()
2264 func_p->num_allocd_vfs = number; in ice_parse_vf_func_caps()
2265 func_p->vf_base_id = logical_id; in ice_parse_vf_func_caps()
2267 func_p->num_allocd_vfs); in ice_parse_vf_func_caps()
2269 func_p->vf_base_id); in ice_parse_vf_func_caps()
2273 * ice_parse_vsi_func_caps - Parse ICE_AQC_CAPS_VSI function caps
2284 func_p->guar_num_vsi = ice_get_num_per_func(hw, ICE_MAX_VSI); in ice_parse_vsi_func_caps()
2286 le32_to_cpu(cap->number)); in ice_parse_vsi_func_caps()
2288 func_p->guar_num_vsi); in ice_parse_vsi_func_caps()
2292 * ice_parse_1588_func_caps - Parse ICE_AQC_CAPS_1588 function caps
2303 struct ice_ts_func_info *info = &func_p->ts_func_info; in ice_parse_1588_func_caps()
2304 u32 number = le32_to_cpu(cap->number); in ice_parse_1588_func_caps()
2306 info->ena = ((number & ICE_TS_FUNC_ENA_M) != 0); in ice_parse_1588_func_caps()
2307 func_p->common_cap.ieee_1588 = info->ena; in ice_parse_1588_func_caps()
2309 info->src_tmr_owned = ((number & ICE_TS_SRC_TMR_OWND_M) != 0); in ice_parse_1588_func_caps()
2310 info->tmr_ena = ((number & ICE_TS_TMR_ENA_M) != 0); in ice_parse_1588_func_caps()
2311 info->tmr_index_owned = ((number & ICE_TS_TMR_IDX_OWND_M) != 0); in ice_parse_1588_func_caps()
2312 info->tmr_index_assoc = ((number & ICE_TS_TMR_IDX_ASSOC_M) != 0); in ice_parse_1588_func_caps()
2315 info->clk_freq = FIELD_GET(ICE_TS_CLK_FREQ_M, number); in ice_parse_1588_func_caps()
2316 info->clk_src = ((number & ICE_TS_CLK_SRC_M) != 0); in ice_parse_1588_func_caps()
2318 info->clk_freq = ICE_TIME_REF_FREQ_156_250; in ice_parse_1588_func_caps()
2319 info->clk_src = ICE_CLK_SRC_TCXO; in ice_parse_1588_func_caps()
2322 if (info->clk_freq < NUM_ICE_TIME_REF_FREQ) { in ice_parse_1588_func_caps()
2323 info->time_ref = (enum ice_time_ref_freq)info->clk_freq; in ice_parse_1588_func_caps()
2326 * default to avoid out-of-bounds look ups of frequency in ice_parse_1588_func_caps()
2330 info->clk_freq); in ice_parse_1588_func_caps()
2331 info->time_ref = ICE_TIME_REF_FREQ_25_000; in ice_parse_1588_func_caps()
2335 func_p->common_cap.ieee_1588); in ice_parse_1588_func_caps()
2337 info->src_tmr_owned); in ice_parse_1588_func_caps()
2339 info->tmr_ena); in ice_parse_1588_func_caps()
2341 info->tmr_index_owned); in ice_parse_1588_func_caps()
2343 info->tmr_index_assoc); in ice_parse_1588_func_caps()
2345 info->clk_freq); in ice_parse_1588_func_caps()
2347 info->clk_src); in ice_parse_1588_func_caps()
2351 * ice_parse_fdir_func_caps - Parse ICE_AQC_CAPS_FD function caps
2363 switch (hw->mac_type) { in ice_parse_fdir_func_caps()
2373 func_p->fd_fltr_guar = ice_get_num_per_func(hw, gsize); in ice_parse_fdir_func_caps()
2374 func_p->fd_fltr_best_effort = bsize; in ice_parse_fdir_func_caps()
2377 func_p->fd_fltr_guar); in ice_parse_fdir_func_caps()
2379 func_p->fd_fltr_best_effort); in ice_parse_fdir_func_caps()
2383 * ice_parse_func_caps - Parse function capabilities
2411 found = ice_parse_common_caps(hw, &func_p->common_cap, in ice_parse_func_caps()
2436 ice_recalc_port_limited_caps(hw, &func_p->common_cap); in ice_parse_func_caps()
2440 * ice_parse_valid_functions_cap - Parse ICE_AQC_CAPS_VALID_FUNCTIONS caps
2451 u32 number = le32_to_cpu(cap->number); in ice_parse_valid_functions_cap()
2453 dev_p->num_funcs = hweight32(number); in ice_parse_valid_functions_cap()
2455 dev_p->num_funcs); in ice_parse_valid_functions_cap()
2459 * ice_parse_vf_dev_caps - Parse ICE_AQC_CAPS_VF device caps
2470 u32 number = le32_to_cpu(cap->number); in ice_parse_vf_dev_caps()
2472 dev_p->num_vfs_exposed = number; in ice_parse_vf_dev_caps()
2474 dev_p->num_vfs_exposed); in ice_parse_vf_dev_caps()
2478 * ice_parse_vsi_dev_caps - Parse ICE_AQC_CAPS_VSI device caps
2489 u32 number = le32_to_cpu(cap->number); in ice_parse_vsi_dev_caps()
2491 dev_p->num_vsi_allocd_to_host = number; in ice_parse_vsi_dev_caps()
2493 dev_p->num_vsi_allocd_to_host); in ice_parse_vsi_dev_caps()
2497 * ice_parse_1588_dev_caps - Parse ICE_AQC_CAPS_1588 device caps
2508 struct ice_ts_dev_info *info = &dev_p->ts_dev_info; in ice_parse_1588_dev_caps()
2509 u32 logical_id = le32_to_cpu(cap->logical_id); in ice_parse_1588_dev_caps()
2510 u32 phys_id = le32_to_cpu(cap->phys_id); in ice_parse_1588_dev_caps()
2511 u32 number = le32_to_cpu(cap->number); in ice_parse_1588_dev_caps()
2513 info->ena = ((number & ICE_TS_DEV_ENA_M) != 0); in ice_parse_1588_dev_caps()
2514 dev_p->common_cap.ieee_1588 = info->ena; in ice_parse_1588_dev_caps()
2516 info->tmr0_owner = number & ICE_TS_TMR0_OWNR_M; in ice_parse_1588_dev_caps()
2517 info->tmr0_owned = ((number & ICE_TS_TMR0_OWND_M) != 0); in ice_parse_1588_dev_caps()
2518 info->tmr0_ena = ((number & ICE_TS_TMR0_ENA_M) != 0); in ice_parse_1588_dev_caps()
2520 info->tmr1_owner = FIELD_GET(ICE_TS_TMR1_OWNR_M, number); in ice_parse_1588_dev_caps()
2521 info->tmr1_owned = ((number & ICE_TS_TMR1_OWND_M) != 0); in ice_parse_1588_dev_caps()
2522 info->tmr1_ena = ((number & ICE_TS_TMR1_ENA_M) != 0); in ice_parse_1588_dev_caps()
2524 info->ts_ll_read = ((number & ICE_TS_LL_TX_TS_READ_M) != 0); in ice_parse_1588_dev_caps()
2525 info->ts_ll_int_read = ((number & ICE_TS_LL_TX_TS_INT_READ_M) != 0); in ice_parse_1588_dev_caps()
2527 info->ena_ports = logical_id; in ice_parse_1588_dev_caps()
2528 info->tmr_own_map = phys_id; in ice_parse_1588_dev_caps()
2531 dev_p->common_cap.ieee_1588); in ice_parse_1588_dev_caps()
2533 info->tmr0_owner); in ice_parse_1588_dev_caps()
2535 info->tmr0_owned); in ice_parse_1588_dev_caps()
2537 info->tmr0_ena); in ice_parse_1588_dev_caps()
2539 info->tmr1_owner); in ice_parse_1588_dev_caps()
2541 info->tmr1_owned); in ice_parse_1588_dev_caps()
2543 info->tmr1_ena); in ice_parse_1588_dev_caps()
2545 info->ts_ll_read); in ice_parse_1588_dev_caps()
2547 info->ts_ll_int_read); in ice_parse_1588_dev_caps()
2549 info->ena_ports); in ice_parse_1588_dev_caps()
2551 info->tmr_own_map); in ice_parse_1588_dev_caps()
2555 * ice_parse_fdir_dev_caps - Parse ICE_AQC_CAPS_FD device caps
2566 u32 number = le32_to_cpu(cap->number); in ice_parse_fdir_dev_caps()
2568 dev_p->num_flow_director_fltr = number; in ice_parse_fdir_dev_caps()
2570 dev_p->num_flow_director_fltr); in ice_parse_fdir_dev_caps()
2574 * ice_parse_sensor_reading_cap - Parse ICE_AQC_CAPS_SENSOR_READING cap
2586 dev_p->supported_sensors = le32_to_cpu(cap->number); in ice_parse_sensor_reading_cap()
2590 dev_p->supported_sensors); in ice_parse_sensor_reading_cap()
2594 * ice_parse_nac_topo_dev_caps - Parse ICE_AQC_CAPS_NAC_TOPOLOGY cap
2605 dev_p->nac_topo.mode = le32_to_cpu(cap->number); in ice_parse_nac_topo_dev_caps()
2606 dev_p->nac_topo.id = le32_to_cpu(cap->phys_id) & ICE_NAC_TOPO_ID_M; in ice_parse_nac_topo_dev_caps()
2610 (dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M) ? in ice_parse_nac_topo_dev_caps()
2611 "primary" : "secondary", dev_p->nac_topo.id); in ice_parse_nac_topo_dev_caps()
2614 !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M)); in ice_parse_nac_topo_dev_caps()
2616 !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_DUAL_M)); in ice_parse_nac_topo_dev_caps()
2618 dev_p->nac_topo.id); in ice_parse_nac_topo_dev_caps()
2622 * ice_parse_dev_caps - Parse device capabilities
2650 found = ice_parse_common_caps(hw, &dev_p->common_cap, in ice_parse_dev_caps()
2684 ice_recalc_port_limited_caps(hw, &dev_p->common_cap); in ice_parse_dev_caps()
2688 * ice_is_pf_c827 - check if pf contains c827 phy
2698 if (hw->mac_type != ICE_MAC_E810) in ice_is_pf_c827()
2701 if (hw->device_id != ICE_DEV_ID_E810C_QSFP) in ice_is_pf_c827()
2755 * ice_is_cgu_in_netlist - check for CGU presence
2761 * * true - cgu is present
2762 * * false - cgu is not present
2769 hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032; in ice_is_cgu_in_netlist()
2775 hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384; in ice_is_cgu_in_netlist()
2798 * ice_aq_list_caps - query function/device capabilities
2828 return -EINVAL; in ice_aq_list_caps()
2834 *cap_count = le32_to_cpu(cmd->count); in ice_aq_list_caps()
2840 * ice_discover_dev_caps - Read and extract device capabilities
2856 return -ENOMEM; in ice_discover_dev_caps()
2874 * ice_discover_func_caps - Read and extract function capabilities
2890 return -ENOMEM; in ice_discover_func_caps()
2908 * ice_set_safe_mode_caps - Override dev/func capabilities when in safe mode
2913 struct ice_hw_func_caps *func_caps = &hw->func_caps; in ice_set_safe_mode_caps()
2914 struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; in ice_set_safe_mode_caps()
2919 cached_caps = func_caps->common_cap; in ice_set_safe_mode_caps()
2925 func_caps->common_cap.name = cached_caps.name in ice_set_safe_mode_caps()
2939 func_caps->common_cap.num_rxq = 1; in ice_set_safe_mode_caps()
2940 func_caps->common_cap.num_txq = 1; in ice_set_safe_mode_caps()
2943 func_caps->common_cap.num_msix_vectors = 2; in ice_set_safe_mode_caps()
2944 func_caps->guar_num_vsi = 1; in ice_set_safe_mode_caps()
2947 cached_caps = dev_caps->common_cap; in ice_set_safe_mode_caps()
2948 num_funcs = dev_caps->num_funcs; in ice_set_safe_mode_caps()
2954 dev_caps->common_cap.name = cached_caps.name in ice_set_safe_mode_caps()
2966 dev_caps->num_funcs = num_funcs; in ice_set_safe_mode_caps()
2969 dev_caps->common_cap.num_rxq = num_funcs; in ice_set_safe_mode_caps()
2970 dev_caps->common_cap.num_txq = num_funcs; in ice_set_safe_mode_caps()
2973 dev_caps->common_cap.num_msix_vectors = 2 * num_funcs; in ice_set_safe_mode_caps()
2977 * ice_get_caps - get info about the HW
2984 status = ice_discover_dev_caps(hw, &hw->dev_caps); in ice_get_caps()
2988 return ice_discover_func_caps(hw, &hw->func_caps); in ice_get_caps()
2992 * ice_aq_manage_mac_write - manage MAC address write command
3010 cmd->flags = flags; in ice_aq_manage_mac_write()
3011 ether_addr_copy(cmd->mac_addr, mac_addr); in ice_aq_manage_mac_write()
3033 * ice_clear_pxe_mode - clear pxe operations mode
3037 * like descriptor fetch/write-back mode.
3041 if (ice_check_sq_alive(hw, &hw->adminq)) in ice_clear_pxe_mode()
3046 * ice_aq_set_port_params - set physical port parameters.
3059 struct ice_hw *hw = pi->hw; in ice_aq_set_port_params()
3068 cmd->cmd_flags = cpu_to_le16(cmd_flags); in ice_aq_set_port_params()
3070 cmd->local_fwd_mode = pi->local_fwd_mode | in ice_aq_set_port_params()
3085 switch (hw->device_id) { in ice_is_100m_speed_supported()
3097 * ice_get_link_speed_based_on_phy_type - returns link speed
3248 * [ice_aqc_get_link_status->link_speed]. Caller can pass in
3304 return -EINVAL; in ice_aq_set_phy_cfg()
3306 /* Ensure that only valid bits of cfg->caps can be turned on. */ in ice_aq_set_phy_cfg()
3307 if (cfg->caps & ~ICE_AQ_PHY_ENA_VALID_MASK) { in ice_aq_set_phy_cfg()
3308 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()
3309 cfg->caps); in ice_aq_set_phy_cfg()
3311 cfg->caps &= ICE_AQ_PHY_ENA_VALID_MASK; in ice_aq_set_phy_cfg()
3315 desc.params.set_phy.lport_num = pi->lport; in ice_aq_set_phy_cfg()
3320 (unsigned long long)le64_to_cpu(cfg->phy_type_low)); in ice_aq_set_phy_cfg()
3322 (unsigned long long)le64_to_cpu(cfg->phy_type_high)); in ice_aq_set_phy_cfg()
3323 ice_debug(hw, ICE_DBG_LINK, " caps = 0x%x\n", cfg->caps); in ice_aq_set_phy_cfg()
3325 cfg->low_power_ctrl_an); in ice_aq_set_phy_cfg()
3326 ice_debug(hw, ICE_DBG_LINK, " eee_cap = 0x%x\n", cfg->eee_cap); in ice_aq_set_phy_cfg()
3327 ice_debug(hw, ICE_DBG_LINK, " eeer_value = 0x%x\n", cfg->eeer_value); in ice_aq_set_phy_cfg()
3329 cfg->link_fec_opt); in ice_aq_set_phy_cfg()
3332 if (hw->adminq.sq_last_status == ICE_AQ_RC_EMODE) in ice_aq_set_phy_cfg()
3336 pi->phy.curr_user_phy_cfg = *cfg; in ice_aq_set_phy_cfg()
3342 * ice_update_link_info - update status of the HW network link
3351 return -EINVAL; in ice_update_link_info()
3353 li = &pi->phy.link_info; in ice_update_link_info()
3359 if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) { in ice_update_link_info()
3364 return -ENOMEM; in ice_update_link_info()
3374 * ice_aq_get_phy_equalization - function to read serdes equaliser
3380 * @output: pointer to the caller-supplied buffer to return serdes equaliser
3382 * Return: non-zero status on error and 0 on success.
3401 cmd->activity_id = cpu_to_le16(ICE_AQC_ACT_ID_DNL); in ice_aq_get_phy_equalization()
3425 * ice_aq_get_fec_stats - reads fec stats from phy
3428 * @pcs_port: represents the pcs port number part of above pcs quad
3430 * @output: pointer to the caller-supplied buffer to return requested fec stats
3432 * Return: non-zero status on error and 0 on success.
3443 return -EINVAL; in ice_aq_get_fec_stats()
3452 return -EINVAL; in ice_aq_get_fec_stats()
3485 pi->phy.curr_user_fc_req = cache_data.data.curr_user_fc_req; in ice_cache_phy_user_req()
3488 pi->phy.curr_user_speed_req = in ice_cache_phy_user_req()
3492 pi->phy.curr_user_fec_req = cache_data.data.curr_user_fec_req; in ice_cache_phy_user_req()
3547 * ice_cfg_phy_fc - Configure PHY FC data based on FC mode
3560 return -EINVAL; in ice_cfg_phy_fc()
3578 cfg->caps &= ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE | in ice_cfg_phy_fc()
3582 cfg->caps |= pause_mask; in ice_cfg_phy_fc()
3608 return -EINVAL; in ice_set_fc()
3611 hw = pi->hw; in ice_set_fc()
3615 return -ENOMEM; in ice_set_fc()
3628 status = ice_cfg_phy_fc(pi, &cfg, pi->fc.req_mode); in ice_set_fc()
3633 if (cfg.caps != pcaps->caps) { in ice_set_fc()
3692 if (phy_caps->phy_type_low != phy_cfg->phy_type_low || in ice_phy_caps_equals_cfg()
3693 phy_caps->phy_type_high != phy_cfg->phy_type_high || in ice_phy_caps_equals_cfg()
3694 ((phy_caps->caps & caps_mask) != (phy_cfg->caps & cfg_mask)) || in ice_phy_caps_equals_cfg()
3695 phy_caps->low_power_ctrl_an != phy_cfg->low_power_ctrl_an || in ice_phy_caps_equals_cfg()
3696 phy_caps->eee_cap != phy_cfg->eee_cap || in ice_phy_caps_equals_cfg()
3697 phy_caps->eeer_value != phy_cfg->eeer_value || in ice_phy_caps_equals_cfg()
3698 phy_caps->link_fec_options != phy_cfg->link_fec_opt) in ice_phy_caps_equals_cfg()
3705 * ice_copy_phy_caps_to_cfg - Copy PHY ability data to configuration data
3722 cfg->phy_type_low = caps->phy_type_low; in ice_copy_phy_caps_to_cfg()
3723 cfg->phy_type_high = caps->phy_type_high; in ice_copy_phy_caps_to_cfg()
3724 cfg->caps = caps->caps; in ice_copy_phy_caps_to_cfg()
3725 cfg->low_power_ctrl_an = caps->low_power_ctrl_an; in ice_copy_phy_caps_to_cfg()
3726 cfg->eee_cap = caps->eee_cap; in ice_copy_phy_caps_to_cfg()
3727 cfg->eeer_value = caps->eeer_value; in ice_copy_phy_caps_to_cfg()
3728 cfg->link_fec_opt = caps->link_fec_options; in ice_copy_phy_caps_to_cfg()
3729 cfg->module_compliance_enforcement = in ice_copy_phy_caps_to_cfg()
3730 caps->module_compliance_enforcement; in ice_copy_phy_caps_to_cfg()
3734 * ice_cfg_phy_fec - Configure PHY FEC data based on FEC mode
3748 return -EINVAL; in ice_cfg_phy_fec()
3750 hw = pi->hw; in ice_cfg_phy_fec()
3754 return -ENOMEM; in ice_cfg_phy_fec()
3763 cfg->caps |= pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC; in ice_cfg_phy_fec()
3764 cfg->link_fec_opt = pcaps->link_fec_options; in ice_cfg_phy_fec()
3768 /* Clear RS bits, and AND BASE-R ability in ice_cfg_phy_fec()
3771 cfg->link_fec_opt &= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN | in ice_cfg_phy_fec()
3773 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ | in ice_cfg_phy_fec()
3777 /* Clear BASE-R bits, and AND RS ability in ice_cfg_phy_fec()
3780 cfg->link_fec_opt &= ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN; in ice_cfg_phy_fec()
3781 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_25G_RS_528_REQ | in ice_cfg_phy_fec()
3786 cfg->link_fec_opt &= ~ICE_AQC_PHY_FEC_MASK; in ice_cfg_phy_fec()
3790 cfg->caps &= ICE_AQC_PHY_CAPS_MASK; in ice_cfg_phy_fec()
3791 cfg->link_fec_opt |= pcaps->link_fec_options; in ice_cfg_phy_fec()
3794 status = -EINVAL; in ice_cfg_phy_fec()
3808 cfg->link_fec_opt = tlv.fec_options; in ice_cfg_phy_fec()
3816 * ice_get_link_status - get status of the HW network link
3830 return -EINVAL; in ice_get_link_status()
3832 phy_info = &pi->phy; in ice_get_link_status()
3834 if (phy_info->get_link_info) { in ice_get_link_status()
3838 ice_debug(pi->hw, ICE_DBG_LINK, "get link status error, status = %d\n", in ice_get_link_status()
3842 *link_up = phy_info->link_info.link_info & ICE_AQ_LINK_UP; in ice_get_link_status()
3853 * Sets up the link and restarts the Auto-Negotiation over the link.
3866 cmd->cmd_flags = ICE_AQC_RESTART_AN_LINK_RESTART; in ice_aq_set_link_restart_an()
3867 cmd->lport_num = pi->lport; in ice_aq_set_link_restart_an()
3869 cmd->cmd_flags |= ICE_AQC_RESTART_AN_LINK_ENABLE; in ice_aq_set_link_restart_an()
3871 cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE; in ice_aq_set_link_restart_an()
3873 return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd); in ice_aq_set_link_restart_an()
3896 cmd->lport_num = port_num; in ice_aq_set_event_mask()
3898 cmd->event_mask = cpu_to_le16(mask); in ice_aq_set_event_mask()
3920 cmd->lb_mode = ICE_AQ_MAC_LB_EN; in ice_aq_set_mac_loopback()
3928 * @is_orig_mode: is this LED set to original mode (by the net-list)
3938 struct ice_hw *hw = pi->hw; in ice_aq_set_port_id_led()
3946 cmd->ident_mode = ICE_AQC_PORT_IDENT_LED_ORIG; in ice_aq_set_port_id_led()
3948 cmd->ident_mode = ICE_AQC_PORT_IDENT_LED_BLINK; in ice_aq_set_port_id_led()
3957 * @option_count: input - size of the buffer in port options structures,
3958 * output - number of returned port options
3983 return -EINVAL; in ice_aq_get_port_options()
3989 cmd->lport_num = lport; in ice_aq_get_port_options()
3990 cmd->lport_num_valid = lport_valid; in ice_aq_get_port_options()
3999 cmd->port_options_count); in ice_aq_get_port_options()
4002 cmd->port_options); in ice_aq_get_port_options()
4005 cmd->port_options); in ice_aq_get_port_options()
4006 if (*active_option_idx > (*option_count - 1)) in ice_aq_get_port_options()
4007 return -EIO; in ice_aq_get_port_options()
4013 cmd->pending_port_option_status); in ice_aq_get_port_options()
4016 cmd->pending_port_option_status); in ice_aq_get_port_options()
4017 if (*pending_option_idx > (*option_count - 1)) in ice_aq_get_port_options()
4018 return -EIO; in ice_aq_get_port_options()
4054 return -EINVAL; in ice_aq_set_port_option()
4060 cmd->lport_num = lport; in ice_aq_set_port_option()
4062 cmd->lport_num_valid = lport_valid; in ice_aq_set_port_option()
4063 cmd->selected_port_option = new_option; in ice_aq_set_port_option()
4077 * @length: 1-16 for read, 1 for write.
4094 return -EINVAL; in ice_aq_sff_eeprom()
4099 cmd->lport_num = (u8)(lport & 0xff); in ice_aq_sff_eeprom()
4100 cmd->lport_num_valid = (u8)((lport >> 8) & 0x01); in ice_aq_sff_eeprom()
4105 cmd->i2c_bus_addr = cpu_to_le16(i2c_bus_addr); in ice_aq_sff_eeprom()
4106 cmd->i2c_mem_addr = cpu_to_le16(mem_addr & 0xff); in ice_aq_sff_eeprom()
4107 cmd->eeprom_page = le16_encode_bits(page, ICE_AQC_SFF_EEPROM_PAGE_M); in ice_aq_sff_eeprom()
4153 u16 opcode, vsi_id, vsi_handle = params->vsi_handle, glob_lut_idx = 0; in __ice_aq_get_set_rss_lut()
4154 enum ice_lut_type lut_type = params->lut_type; in __ice_aq_get_set_rss_lut()
4159 u8 *lut = params->lut; in __ice_aq_get_set_rss_lut()
4163 return -EINVAL; in __ice_aq_get_set_rss_lut()
4166 if (lut_size > params->lut_size) in __ice_aq_get_set_rss_lut()
4167 return -EINVAL; in __ice_aq_get_set_rss_lut()
4168 else if (set && lut_size != params->lut_size) in __ice_aq_get_set_rss_lut()
4169 return -EINVAL; in __ice_aq_get_set_rss_lut()
4178 desc_params->vsi_id = cpu_to_le16(vsi_id | ICE_AQC_RSS_VSI_VALID); in __ice_aq_get_set_rss_lut()
4182 params->global_lut_id); in __ice_aq_get_set_rss_lut()
4185 desc_params->flags = cpu_to_le16(flags); in __ice_aq_get_set_rss_lut()
4241 desc_params->vsi_id = cpu_to_le16(vsi_id | ICE_AQC_RSS_VSI_VALID); in __ice_aq_get_set_rss_key()
4259 return -EINVAL; in ice_aq_get_rss_key()
4278 return -EINVAL; in ice_aq_set_rss_key()
4320 return -EINVAL; in ice_aq_add_lan_txq()
4323 return -EINVAL; in ice_aq_add_lan_txq()
4326 sum_size += struct_size(list, txqs, list->num_txqs); in ice_aq_add_lan_txq()
4327 list = (struct ice_aqc_add_tx_qgrp *)(list->txqs + in ice_aq_add_lan_txq()
4328 list->num_txqs); in ice_aq_add_lan_txq()
4332 return -EINVAL; in ice_aq_add_lan_txq()
4336 cmd->num_qgrps = num_qgrps; in ice_aq_add_lan_txq()
4371 return -EINVAL; in ice_aq_dis_lan_txq()
4374 return -EINVAL; in ice_aq_dis_lan_txq()
4376 cmd->num_entries = num_qgrps; in ice_aq_dis_lan_txq()
4382 cmd->cmd_type = ICE_AQC_Q_DIS_CMD_VM_RESET; in ice_aq_dis_lan_txq()
4386 cmd->cmd_type = ICE_AQC_Q_DIS_CMD_VF_RESET; in ice_aq_dis_lan_txq()
4388 vmvf_and_timeout |= (vmvf_num + hw->func_caps.vf_base_id) & in ice_aq_dis_lan_txq()
4396 cmd->vmvf_and_timeout = cpu_to_le16(vmvf_and_timeout); in ice_aq_dis_lan_txq()
4399 cmd->cmd_type |= ICE_AQC_Q_DIS_CMD_FLUSH_PIPE; in ice_aq_dis_lan_txq()
4410 u16 item_size = struct_size(item, q_id, item->num_qs); in ice_aq_dis_lan_txq()
4413 if ((item->num_qs % 2) == 0) in ice_aq_dis_lan_txq()
4422 return -EINVAL; in ice_aq_dis_lan_txq()
4429 vmvf_num, hw->adminq.sq_last_status); in ice_aq_dis_lan_txq()
4433 hw->adminq.sq_last_status); in ice_aq_dis_lan_txq()
4467 return -EINVAL; in ice_aq_cfg_lan_txq()
4469 cmd->cmd_type = ICE_AQC_Q_CFG_TC_CHNG; in ice_aq_cfg_lan_txq()
4470 cmd->num_qs = num_qs; in ice_aq_cfg_lan_txq()
4471 cmd->port_num_chng = (oldport & ICE_AQC_Q_CFG_SRC_PRT_M); in ice_aq_cfg_lan_txq()
4472 cmd->port_num_chng |= FIELD_PREP(ICE_AQC_Q_CFG_DST_PRT_M, newport); in ice_aq_cfg_lan_txq()
4473 cmd->time_out = FIELD_PREP(ICE_AQC_Q_CFG_TIMEOUT_M, 5); in ice_aq_cfg_lan_txq()
4474 cmd->blocked_cgds = 0; in ice_aq_cfg_lan_txq()
4479 hw->adminq.sq_last_status); in ice_aq_cfg_lan_txq()
4508 return -EINVAL; in ice_aq_add_rdma_qsets()
4511 u16 num_qsets = le16_to_cpu(list->num_qsets); in ice_aq_add_rdma_qsets()
4514 list = (struct ice_aqc_add_rdma_qset_data *)(list->rdma_qsets + in ice_aq_add_rdma_qsets()
4519 return -EINVAL; in ice_aq_add_rdma_qsets()
4523 cmd->num_qset_grps = num_qset_grps; in ice_aq_add_rdma_qsets()
4531 * ice_pack_ctx_byte - write a byte to a packed context structure
4544 from = src_ctx + ce_info->offset; in ice_pack_ctx_byte()
4547 shift_width = ce_info->lsb % 8; in ice_pack_ctx_byte()
4548 mask = GENMASK(ce_info->width - 1 + shift_width, shift_width); in ice_pack_ctx_byte()
4555 dest = dest_ctx + (ce_info->lsb / 8); in ice_pack_ctx_byte()
4567 * ice_pack_ctx_word - write a word to a packed context structure
4581 from = src_ctx + ce_info->offset; in ice_pack_ctx_word()
4584 shift_width = ce_info->lsb % 8; in ice_pack_ctx_word()
4585 mask = GENMASK(ce_info->width - 1 + shift_width, shift_width); in ice_pack_ctx_word()
4595 dest = dest_ctx + (ce_info->lsb / 8); in ice_pack_ctx_word()
4607 * ice_pack_ctx_dword - write a dword to a packed context structure
4621 from = src_ctx + ce_info->offset; in ice_pack_ctx_dword()
4624 shift_width = ce_info->lsb % 8; in ice_pack_ctx_dword()
4625 mask = GENMASK(ce_info->width - 1 + shift_width, shift_width); in ice_pack_ctx_dword()
4635 dest = dest_ctx + (ce_info->lsb / 8); in ice_pack_ctx_dword()
4647 * ice_pack_ctx_qword - write a qword to a packed context structure
4661 from = src_ctx + ce_info->offset; in ice_pack_ctx_qword()
4664 shift_width = ce_info->lsb % 8; in ice_pack_ctx_qword()
4665 mask = GENMASK_ULL(ce_info->width - 1 + shift_width, shift_width); in ice_pack_ctx_qword()
4675 dest = dest_ctx + (ce_info->lsb / 8); in ice_pack_ctx_qword()
4687 * ice_set_ctx - set context bits in packed structure
4689 * @src_ctx: pointer to a generic non-packed context structure
4722 return -EINVAL; in ice_set_ctx()
4730 * ice_get_lan_q_ctx - get the LAN queue context for the given VSI and TC
4745 if (q_handle >= vsi->num_lan_q_entries[tc]) in ice_get_lan_q_ctx()
4747 if (!vsi->lan_q_ctx[tc]) in ice_get_lan_q_ctx()
4749 q_ctx = vsi->lan_q_ctx[tc]; in ice_get_lan_q_ctx()
4777 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_ena_vsi_txq()
4778 return -EIO; in ice_ena_vsi_txq()
4780 if (num_qgrps > 1 || buf->num_txqs > 1) in ice_ena_vsi_txq()
4781 return -ENOSPC; in ice_ena_vsi_txq()
4783 hw = pi->hw; in ice_ena_vsi_txq()
4786 return -EINVAL; in ice_ena_vsi_txq()
4788 mutex_lock(&pi->sched_lock); in ice_ena_vsi_txq()
4794 status = -EINVAL; in ice_ena_vsi_txq()
4802 status = -EINVAL; in ice_ena_vsi_txq()
4806 buf->parent_teid = parent->info.node_teid; in ice_ena_vsi_txq()
4807 node.parent_teid = parent->info.node_teid; in ice_ena_vsi_txq()
4810 * - Scheduling mode is Bytes Per Second (BPS), indicated by Bit 0. in ice_ena_vsi_txq()
4811 * - 0 priority among siblings, indicated by Bit 1-3. in ice_ena_vsi_txq()
4812 * - WFQ, indicated by Bit 4. in ice_ena_vsi_txq()
4813 * - 0 Adjustment value is used in PSM credit update flow, indicated by in ice_ena_vsi_txq()
4814 * Bit 5-6. in ice_ena_vsi_txq()
4815 * - Bit 7 is reserved. in ice_ena_vsi_txq()
4819 buf->txqs[0].info.valid_sections = in ice_ena_vsi_txq()
4822 buf->txqs[0].info.generic = 0; in ice_ena_vsi_txq()
4823 buf->txqs[0].info.cir_bw.bw_profile_idx = in ice_ena_vsi_txq()
4825 buf->txqs[0].info.cir_bw.bw_alloc = in ice_ena_vsi_txq()
4827 buf->txqs[0].info.eir_bw.bw_profile_idx = in ice_ena_vsi_txq()
4829 buf->txqs[0].info.eir_bw.bw_alloc = in ice_ena_vsi_txq()
4836 le16_to_cpu(buf->txqs[0].txq_id), in ice_ena_vsi_txq()
4837 hw->adminq.sq_last_status); in ice_ena_vsi_txq()
4841 node.node_teid = buf->txqs[0].q_teid; in ice_ena_vsi_txq()
4843 q_ctx->q_handle = q_handle; in ice_ena_vsi_txq()
4844 q_ctx->q_teid = le32_to_cpu(node.node_teid); in ice_ena_vsi_txq()
4847 status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node, NULL); in ice_ena_vsi_txq()
4852 mutex_unlock(&pi->sched_lock); in ice_ena_vsi_txq()
4880 int status = -ENOENT; in ice_dis_vsi_txq()
4883 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_dis_vsi_txq()
4884 return -EIO; in ice_dis_vsi_txq()
4886 hw = pi->hw; in ice_dis_vsi_txq()
4896 return -EIO; in ice_dis_vsi_txq()
4899 mutex_lock(&pi->sched_lock); in ice_dis_vsi_txq()
4904 node = ice_sched_find_node_by_teid(pi->root, q_teids[i]); in ice_dis_vsi_txq()
4913 if (q_ctx->q_handle != q_handles[i]) { in ice_dis_vsi_txq()
4915 q_ctx->q_handle, q_handles[i]); in ice_dis_vsi_txq()
4918 qg_list->parent_teid = node->info.parent_teid; in ice_dis_vsi_txq()
4919 qg_list->num_qs = 1; in ice_dis_vsi_txq()
4920 qg_list->q_id[0] = cpu_to_le16(q_ids[i]); in ice_dis_vsi_txq()
4927 q_ctx->q_handle = ICE_INVAL_Q_HANDLE; in ice_dis_vsi_txq()
4928 q_ctx->q_teid = ICE_INVAL_TEID; in ice_dis_vsi_txq()
4930 mutex_unlock(&pi->sched_lock); in ice_dis_vsi_txq()
4935 * ice_cfg_vsi_qs - configure the new/existing VSI queues
4951 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_cfg_vsi_qs()
4952 return -EIO; in ice_cfg_vsi_qs()
4954 if (!ice_is_vsi_valid(pi->hw, vsi_handle)) in ice_cfg_vsi_qs()
4955 return -EINVAL; in ice_cfg_vsi_qs()
4957 mutex_lock(&pi->sched_lock); in ice_cfg_vsi_qs()
4970 mutex_unlock(&pi->sched_lock); in ice_cfg_vsi_qs()
4975 * ice_cfg_vsi_lan - configure VSI LAN queues
4992 * ice_cfg_vsi_rdma - configure the VSI RDMA queues
5030 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_ena_vsi_rdma_qset()
5031 return -EIO; in ice_ena_vsi_rdma_qset()
5032 hw = pi->hw; in ice_ena_vsi_rdma_qset()
5035 return -EINVAL; in ice_ena_vsi_rdma_qset()
5040 return -ENOMEM; in ice_ena_vsi_rdma_qset()
5041 mutex_lock(&pi->sched_lock); in ice_ena_vsi_rdma_qset()
5046 ret = -EINVAL; in ice_ena_vsi_rdma_qset()
5049 buf->parent_teid = parent->info.node_teid; in ice_ena_vsi_rdma_qset()
5050 node.parent_teid = parent->info.node_teid; in ice_ena_vsi_rdma_qset()
5052 buf->num_qsets = cpu_to_le16(num_qsets); in ice_ena_vsi_rdma_qset()
5054 buf->rdma_qsets[i].tx_qset_id = cpu_to_le16(rdma_qset[i]); in ice_ena_vsi_rdma_qset()
5055 buf->rdma_qsets[i].info.valid_sections = in ice_ena_vsi_rdma_qset()
5058 buf->rdma_qsets[i].info.generic = 0; in ice_ena_vsi_rdma_qset()
5059 buf->rdma_qsets[i].info.cir_bw.bw_profile_idx = in ice_ena_vsi_rdma_qset()
5061 buf->rdma_qsets[i].info.cir_bw.bw_alloc = in ice_ena_vsi_rdma_qset()
5063 buf->rdma_qsets[i].info.eir_bw.bw_profile_idx = in ice_ena_vsi_rdma_qset()
5065 buf->rdma_qsets[i].info.eir_bw.bw_alloc = in ice_ena_vsi_rdma_qset()
5075 node.node_teid = buf->rdma_qsets[i].qset_teid; in ice_ena_vsi_rdma_qset()
5076 ret = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, in ice_ena_vsi_rdma_qset()
5083 mutex_unlock(&pi->sched_lock); in ice_ena_vsi_rdma_qset()
5089 * ice_dis_vsi_rdma_qset - free RDMA resources
5105 if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY) in ice_dis_vsi_rdma_qset()
5106 return -EIO; in ice_dis_vsi_rdma_qset()
5108 hw = pi->hw; in ice_dis_vsi_rdma_qset()
5110 mutex_lock(&pi->sched_lock); in ice_dis_vsi_rdma_qset()
5115 node = ice_sched_find_node_by_teid(pi->root, qset_teid[i]); in ice_dis_vsi_rdma_qset()
5119 qg_list->parent_teid = node->info.parent_teid; in ice_dis_vsi_rdma_qset()
5120 qg_list->num_qs = 1; in ice_dis_vsi_rdma_qset()
5121 qg_list->q_id[0] = in ice_dis_vsi_rdma_qset()
5133 mutex_unlock(&pi->sched_lock); in ice_dis_vsi_rdma_qset()
5138 * ice_aq_get_cgu_abilities - get cgu abilities
5156 * ice_aq_set_input_pin_cfg - set input pin config
5176 cmd->input_idx = input_idx; in ice_aq_set_input_pin_cfg()
5177 cmd->flags1 = flags1; in ice_aq_set_input_pin_cfg()
5178 cmd->flags2 = flags2; in ice_aq_set_input_pin_cfg()
5179 cmd->freq = cpu_to_le32(freq); in ice_aq_set_input_pin_cfg()
5180 cmd->phase_delay = cpu_to_le32(phase_delay); in ice_aq_set_input_pin_cfg()
5186 * ice_aq_get_input_pin_cfg - get input pin config
5209 cmd->input_idx = input_idx; in ice_aq_get_input_pin_cfg()
5214 *status = cmd->status; in ice_aq_get_input_pin_cfg()
5216 *type = cmd->type; in ice_aq_get_input_pin_cfg()
5218 *flags1 = cmd->flags1; in ice_aq_get_input_pin_cfg()
5220 *flags2 = cmd->flags2; in ice_aq_get_input_pin_cfg()
5222 *freq = le32_to_cpu(cmd->freq); in ice_aq_get_input_pin_cfg()
5224 *phase_delay = le32_to_cpu(cmd->phase_delay); in ice_aq_get_input_pin_cfg()
5231 * ice_aq_set_output_pin_cfg - set output pin config
5237 * @phase_delay: Output phase compensation
5251 cmd->output_idx = output_idx; in ice_aq_set_output_pin_cfg()
5252 cmd->flags = flags; in ice_aq_set_output_pin_cfg()
5253 cmd->src_sel = src_sel; in ice_aq_set_output_pin_cfg()
5254 cmd->freq = cpu_to_le32(freq); in ice_aq_set_output_pin_cfg()
5255 cmd->phase_delay = cpu_to_le32(phase_delay); in ice_aq_set_output_pin_cfg()
5261 * ice_aq_get_output_pin_cfg - get output pin config
5282 cmd->output_idx = output_idx; in ice_aq_get_output_pin_cfg()
5287 *flags = cmd->flags; in ice_aq_get_output_pin_cfg()
5289 *src_sel = cmd->src_sel; in ice_aq_get_output_pin_cfg()
5291 *freq = le32_to_cpu(cmd->freq); in ice_aq_get_output_pin_cfg()
5293 *src_freq = le32_to_cpu(cmd->src_freq); in ice_aq_get_output_pin_cfg()
5300 * ice_aq_get_cgu_dpll_status - get dpll status
5306 * @phase_offset: Phase offset in ns
5323 cmd->dpll_num = dpll_num; in ice_aq_get_cgu_dpll_status()
5327 *ref_state = cmd->ref_state; in ice_aq_get_cgu_dpll_status()
5328 *dpll_state = cmd->dpll_state; in ice_aq_get_cgu_dpll_status()
5329 *config = cmd->config; in ice_aq_get_cgu_dpll_status()
5330 *phase_offset = le32_to_cpu(cmd->phase_offset_h); in ice_aq_get_cgu_dpll_status()
5332 *phase_offset += le32_to_cpu(cmd->phase_offset_l); in ice_aq_get_cgu_dpll_status()
5334 *eec_mode = cmd->eec_mode; in ice_aq_get_cgu_dpll_status()
5341 * ice_aq_set_cgu_dpll_config - set dpll config
5360 cmd->dpll_num = dpll_num; in ice_aq_set_cgu_dpll_config()
5361 cmd->ref_state = ref_state; in ice_aq_set_cgu_dpll_config()
5362 cmd->config = config; in ice_aq_set_cgu_dpll_config()
5363 cmd->eec_mode = eec_mode; in ice_aq_set_cgu_dpll_config()
5369 * ice_aq_set_cgu_ref_prio - set input reference priority
5387 cmd->dpll_num = dpll_num; in ice_aq_set_cgu_ref_prio()
5388 cmd->ref_idx = ref_idx; in ice_aq_set_cgu_ref_prio()
5389 cmd->ref_priority = ref_priority; in ice_aq_set_cgu_ref_prio()
5395 * ice_aq_get_cgu_ref_prio - get input reference priority
5414 cmd->dpll_num = dpll_num; in ice_aq_get_cgu_ref_prio()
5415 cmd->ref_idx = ref_idx; in ice_aq_get_cgu_ref_prio()
5419 *ref_prio = cmd->ref_priority; in ice_aq_get_cgu_ref_prio()
5425 * ice_aq_get_cgu_info - get cgu info
5447 *cgu_id = le32_to_cpu(cmd->cgu_id); in ice_aq_get_cgu_info()
5448 *cgu_cfg_ver = le32_to_cpu(cmd->cgu_cfg_ver); in ice_aq_get_cgu_info()
5449 *cgu_fw_ver = le32_to_cpu(cmd->cgu_fw_ver); in ice_aq_get_cgu_info()
5456 * ice_aq_set_phy_rec_clk_out - set RCLK phy out
5475 cmd->phy_output = phy_output; in ice_aq_set_phy_rec_clk_out()
5476 cmd->port_num = ICE_AQC_SET_PHY_REC_CLK_OUT_CURR_PORT; in ice_aq_set_phy_rec_clk_out()
5477 cmd->flags = enable & ICE_AQC_SET_PHY_REC_CLK_OUT_OUT_EN; in ice_aq_set_phy_rec_clk_out()
5478 cmd->freq = cpu_to_le32(*freq); in ice_aq_set_phy_rec_clk_out()
5482 *freq = le32_to_cpu(cmd->freq); in ice_aq_set_phy_rec_clk_out()
5488 * ice_aq_get_phy_rec_clk_out - get phy recovered signal info
5508 cmd->phy_output = *phy_output; in ice_aq_get_phy_rec_clk_out()
5512 *phy_output = cmd->phy_output; in ice_aq_get_phy_rec_clk_out()
5514 *port_num = cmd->port_num; in ice_aq_get_phy_rec_clk_out()
5516 *flags = cmd->flags; in ice_aq_get_phy_rec_clk_out()
5518 *node_handle = le16_to_cpu(cmd->node_handle); in ice_aq_get_phy_rec_clk_out()
5542 cmd->sensor = ICE_INTERNAL_TEMP_SENSOR; in ice_aq_get_sensor_reading()
5543 cmd->format = ICE_INTERNAL_TEMP_SENSOR_FORMAT; in ice_aq_get_sensor_reading()
5554 * ice_replay_pre_init - replay pre initialization
5561 struct ice_switch_info *sw = hw->switch_info; in ice_replay_pre_init()
5571 list_replace_init(&sw->recp_list[i].filt_rules, in ice_replay_pre_init()
5572 &sw->recp_list[i].filt_replay_rules); in ice_replay_pre_init()
5579 * ice_replay_vsi - replay VSI configuration
5591 return -EINVAL; in ice_replay_vsi()
5593 /* Replay pre-initialization if there is any */ in ice_replay_vsi()
5611 * ice_replay_post - post replay configuration cleanup
5624 * ice_stat_update40 - read 40 bit stat from the chip and update stat values
5635 u64 new_data = rd64(hw, reg) & (BIT_ULL(40) - 1); in ice_stat_update40()
5651 *cur_stat += new_data - *prev_stat; in ice_stat_update40()
5653 /* to manage the potential roll-over */ in ice_stat_update40()
5654 *cur_stat += (new_data + BIT_ULL(40)) - *prev_stat; in ice_stat_update40()
5661 * ice_stat_update32 - read 32 bit stat from the chip and update stat values
5690 *cur_stat += new_data - *prev_stat; in ice_stat_update32()
5692 /* to manage the potential roll-over */ in ice_stat_update32()
5693 *cur_stat += (new_data + BIT_ULL(32)) - *prev_stat; in ice_stat_update32()
5700 * ice_sched_query_elem - query element information from HW
5716 buf->node_teid = cpu_to_le32(node_teid); in ice_sched_query_elem()
5728 * @bus_addr: 7-bit I2C bus address
5730 * @params: I2C parameters: bit [7] - Repeated start,
5732 * bit [4] - I2C address type,
5733 * bits [3:0] - data size to read (0-16 bytes)
5753 return -EINVAL; in ice_aq_read_i2c()
5757 cmd->i2c_bus_addr = cpu_to_le16(bus_addr); in ice_aq_read_i2c()
5758 cmd->topo_addr = topo_addr; in ice_aq_read_i2c()
5759 cmd->i2c_params = params; in ice_aq_read_i2c()
5760 cmd->i2c_addr = addr; in ice_aq_read_i2c()
5769 *data = resp->i2c_data[i]; in ice_aq_read_i2c()
5781 * @bus_addr: 7-bit I2C bus address
5783 * @params: I2C parameters: bit [4] - I2C address type, bits [3:0] - data size to write (0-7 bytes)
5790 * * 0 - Successful write to the i2c device
5791 * * -EINVAL - Data size greater than 4 bytes
5792 * * -EIO - FW error
5810 return -EINVAL; in ice_aq_write_i2c()
5812 cmd->i2c_bus_addr = cpu_to_le16(bus_addr); in ice_aq_write_i2c()
5813 cmd->topo_addr = topo_addr; in ice_aq_write_i2c()
5814 cmd->i2c_params = params; in ice_aq_write_i2c()
5815 cmd->i2c_addr = addr; in ice_aq_write_i2c()
5817 memcpy(cmd->i2c_data, data, data_size); in ice_aq_write_i2c()
5841 cmd->gpio_ctrl_handle = cpu_to_le16(gpio_ctrl_handle); in ice_aq_set_gpio()
5842 cmd->gpio_num = pin_idx; in ice_aq_set_gpio()
5843 cmd->gpio_val = value ? 1 : 0; in ice_aq_set_gpio()
5869 cmd->gpio_ctrl_handle = cpu_to_le16(gpio_ctrl_handle); in ice_aq_get_gpio()
5870 cmd->gpio_num = pin_idx; in ice_aq_get_gpio()
5876 *value = !!cmd->gpio_val; in ice_aq_get_gpio()
5891 if (hw->api_maj_ver == maj) { in ice_is_fw_api_min_ver()
5892 if (hw->api_min_ver > min) in ice_is_fw_api_min_ver()
5894 if (hw->api_min_ver == min && hw->api_patch >= patch) in ice_is_fw_api_min_ver()
5896 } else if (hw->api_maj_ver > maj) { in ice_is_fw_api_min_ver()
5928 struct ice_hw *hw = pi->hw; in ice_get_link_default_override()
5939 tlv_start = tlv + pi->lport * ICE_SR_PFA_LINK_OVERRIDE_WORDS + in ice_get_link_default_override()
5948 ldo->options = FIELD_GET(ICE_LINK_OVERRIDE_OPT_M, buf); in ice_get_link_default_override()
5949 ldo->phy_config = (buf & ICE_LINK_OVERRIDE_PHY_CFG_M) >> in ice_get_link_default_override()
5959 ldo->fec_options = buf & ICE_LINK_OVERRIDE_FEC_OPT_M; in ice_get_link_default_override()
5970 ldo->phy_type_low |= ((u64)buf << (i * 16)); in ice_get_link_default_override()
5983 ldo->phy_type_high |= ((u64)buf << (i * 16)); in ice_get_link_default_override()
5990 * ice_is_phy_caps_an_enabled - check if PHY capabilities autoneg is enabled
5995 if (caps->caps & ICE_AQC_PHY_AN_MODE || in ice_is_phy_caps_an_enabled()
5996 caps->low_power_ctrl_an & (ICE_AQC_PHY_AN_EN_CLAUSE28 | in ice_is_phy_caps_an_enabled()
6005 * ice_aq_set_lldp_mib - Set the LLDP MIB
6008 * @buf: pointer to the caller-supplied buffer to store the MIB block
6024 return -EINVAL; in ice_aq_set_lldp_mib()
6031 cmd->type = mib_type; in ice_aq_set_lldp_mib()
6032 cmd->length = cpu_to_le16(buf_size); in ice_aq_set_lldp_mib()
6038 * ice_fw_supports_lldp_fltr_ctrl - check NVM version supports lldp_fltr_ctrl
6043 if (hw->mac_type != ICE_MAC_E810) in ice_fw_supports_lldp_fltr_ctrl()
6052 * ice_lldp_fltr_add_remove - add or remove a LLDP Rx switch filter
6068 cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_ADD; in ice_lldp_fltr_add_remove()
6070 cmd->cmd_flags = ICE_AQC_LLDP_FILTER_ACTION_DELETE; in ice_lldp_fltr_add_remove()
6072 cmd->vsi_num = cpu_to_le16(vsi_num); in ice_lldp_fltr_add_remove()
6078 * ice_lldp_execute_pending_mib - execute LLDP pending MIB request
6109 * by [fls(speed) - 1]
6127 * ice_get_link_speed - get integer speed from table
6128 * @index: array index from fls(aq speed) - 1