Lines Matching +full:cap +full:- +full:get
1 // SPDX-License-Identifier: GPL-2.0
13 * ixgbe_should_retry_aci_send_cmd_execute - decide if ACI command should
37 * ixgbe_aci_send_cmd_execute - execute sending FW Admin Command to FW Admin
48 * * - 0 - success.
49 * * - -EIO - CSR mechanism is not enabled.
50 * * - -EBUSY - CSR mechanism is busy.
51 * * - -EINVAL - buf_size is too big or
53 * * - -ETIME - Admin Command X command timeout.
54 * * - -EIO - Admin Command X invalid state of HICR register or
67 hw->aci.last_status = IXGBE_ACI_RC_OK; in ixgbe_aci_send_cmd_execute()
73 return -EIO; in ixgbe_aci_send_cmd_execute()
76 hw->aci.last_status = IXGBE_ACI_RC_EBUSY; in ixgbe_aci_send_cmd_execute()
77 return -EBUSY; in ixgbe_aci_send_cmd_execute()
80 opcode = le16_to_cpu(desc->opcode); in ixgbe_aci_send_cmd_execute()
83 return -EINVAL; in ixgbe_aci_send_cmd_execute()
86 desc->flags |= cpu_to_le16(IXGBE_ACI_FLAG_BUF); in ixgbe_aci_send_cmd_execute()
88 if (desc->flags & cpu_to_le16(IXGBE_ACI_FLAG_BUF)) { in ixgbe_aci_send_cmd_execute()
91 return -EINVAL; in ixgbe_aci_send_cmd_execute()
98 memcpy(&buf_tail, buf + buf_size - buf_tail_size, in ixgbe_aci_send_cmd_execute()
102 desc->flags |= cpu_to_le16(IXGBE_ACI_FLAG_LB); in ixgbe_aci_send_cmd_execute()
104 desc->datalen = cpu_to_le16(buf_size); in ixgbe_aci_send_cmd_execute()
106 if (desc->flags & cpu_to_le16(IXGBE_ACI_FLAG_RD)) { in ixgbe_aci_send_cmd_execute()
162 return -ETIME; in ixgbe_aci_send_cmd_execute()
165 return -EIO; in ixgbe_aci_send_cmd_execute()
172 if (desc->opcode != cpu_to_le16(opcode) && in ixgbe_aci_send_cmd_execute()
174 return -EIO; in ixgbe_aci_send_cmd_execute()
176 if (desc->retval) { in ixgbe_aci_send_cmd_execute()
177 hw->aci.last_status = (enum ixgbe_aci_err) in ixgbe_aci_send_cmd_execute()
178 le16_to_cpu(desc->retval); in ixgbe_aci_send_cmd_execute()
179 return -EIO; in ixgbe_aci_send_cmd_execute()
188 memcpy(buf + buf_size - buf_tail_size, &buf_tail, in ixgbe_aci_send_cmd_execute()
197 * ixgbe_aci_send_cmd - send FW Admin Command to FW Admin Command Interface
213 u16 opcode = le16_to_cpu(desc->opcode); in ixgbe_aci_send_cmd()
226 return -ENOMEM; in ixgbe_aci_send_cmd()
234 mutex_lock(&hw->aci.lock); in ixgbe_aci_send_cmd()
236 last_status = hw->aci.last_status; in ixgbe_aci_send_cmd()
237 mutex_unlock(&hw->aci.lock); in ixgbe_aci_send_cmd()
257 * ixgbe_aci_check_event_pending - check if there are any pending events
267 u32 ep_bit_mask = hw->bus.func ? GL_FWSTS_EP_PF1 : GL_FWSTS_EP_PF0; in ixgbe_aci_check_event_pending()
274 * ixgbe_aci_get_event - get an event from ACI
292 if (!e || (!e->msg_buf && e->buf_len)) in ixgbe_aci_get_event()
293 return -EINVAL; in ixgbe_aci_get_event()
295 mutex_lock(&hw->aci.lock); in ixgbe_aci_get_event()
299 err = -ENOENT; in ixgbe_aci_get_event()
305 err = ixgbe_aci_send_cmd_execute(hw, &desc, e->msg_buf, e->buf_len); in ixgbe_aci_get_event()
311 err = -ENOENT; in ixgbe_aci_get_event()
316 e->msg_len = min_t(u16, le16_to_cpu(desc.datalen), e->buf_len); in ixgbe_aci_get_event()
318 memcpy(&e->desc, &desc, sizeof(e->desc)); in ixgbe_aci_get_event()
325 mutex_unlock(&hw->aci.lock); in ixgbe_aci_get_event()
331 * ixgbe_fill_dflt_direct_cmd_desc - fill ACI descriptor with default values.
342 desc->opcode = cpu_to_le16(opcode); in ixgbe_fill_dflt_direct_cmd_desc()
343 desc->flags = cpu_to_le16(IXGBE_ACI_FLAG_SI); in ixgbe_fill_dflt_direct_cmd_desc()
347 * ixgbe_aci_req_res - request a common resource
374 cmd_resp->res_id = cpu_to_le16(res); in ixgbe_aci_req_res()
375 cmd_resp->access_type = cpu_to_le16(access); in ixgbe_aci_req_res()
376 cmd_resp->res_number = cpu_to_le32(sdp_number); in ixgbe_aci_req_res()
377 cmd_resp->timeout = cpu_to_le32(*timeout); in ixgbe_aci_req_res()
386 if (!err || hw->aci.last_status == IXGBE_ACI_RC_EBUSY) in ixgbe_aci_req_res()
387 *timeout = le32_to_cpu(cmd_resp->timeout); in ixgbe_aci_req_res()
393 * ixgbe_aci_release_res - release a common resource using ACI
412 cmd->res_id = cpu_to_le16(res); in ixgbe_aci_release_res()
413 cmd->res_number = cpu_to_le32(sdp_number); in ixgbe_aci_release_res()
419 * ixgbe_acquire_res - acquire the ownership of a resource
428 * performed any necessary updates, the -EALREADY is returned,
445 /* A return code of -EALREADY means that another driver has in ixgbe_acquire_res()
450 if (err == -EALREADY) in ixgbe_acquire_res()
463 retry_timeout - delay : 0; in ixgbe_acquire_res()
466 /* Success - lock acquired. in ixgbe_acquire_res()
467 * -EALREADY - lock free, no work to do. in ixgbe_acquire_res()
469 if (!err || err == -EALREADY) in ixgbe_acquire_res()
477 * ixgbe_release_res - release a common resource
493 while (err == -ETIME && in ixgbe_release_res()
502 * ixgbe_parse_e610_caps - Parse common device/function capabilities
519 u32 logical_id = le32_to_cpu(elem->logical_id); in ixgbe_parse_e610_caps()
520 u32 phys_id = le32_to_cpu(elem->phys_id); in ixgbe_parse_e610_caps()
521 u32 number = le32_to_cpu(elem->number); in ixgbe_parse_e610_caps()
522 u16 cap = le16_to_cpu(elem->cap); in ixgbe_parse_e610_caps() local
524 switch (cap) { in ixgbe_parse_e610_caps()
526 caps->valid_functions = number; in ixgbe_parse_e610_caps()
529 caps->sr_iov_1_1 = (number == 1); in ixgbe_parse_e610_caps()
532 caps->vmdq = (number == 1); in ixgbe_parse_e610_caps()
535 caps->dcb = (number == 1); in ixgbe_parse_e610_caps()
536 caps->active_tc_bitmap = logical_id; in ixgbe_parse_e610_caps()
537 caps->maxtc = phys_id; in ixgbe_parse_e610_caps()
540 caps->rss_table_size = number; in ixgbe_parse_e610_caps()
541 caps->rss_table_entry_width = logical_id; in ixgbe_parse_e610_caps()
544 caps->num_rxq = number; in ixgbe_parse_e610_caps()
545 caps->rxq_first_id = phys_id; in ixgbe_parse_e610_caps()
548 caps->num_txq = number; in ixgbe_parse_e610_caps()
549 caps->txq_first_id = phys_id; in ixgbe_parse_e610_caps()
552 caps->num_msix_vectors = number; in ixgbe_parse_e610_caps()
553 caps->msix_vector_first_id = phys_id; in ixgbe_parse_e610_caps()
558 caps->max_mtu = number; in ixgbe_parse_e610_caps()
561 caps->pcie_reset_avoidance = (number > 0); in ixgbe_parse_e610_caps()
564 caps->reset_restrict_support = (number == 1); in ixgbe_parse_e610_caps()
571 u8 index = cap - IXGBE_ACI_CAPS_EXT_TOPO_DEV_IMG0; in ixgbe_parse_e610_caps()
573 caps->ext_topo_dev_img_ver_high[index] = number; in ixgbe_parse_e610_caps()
574 caps->ext_topo_dev_img_ver_low[index] = logical_id; in ixgbe_parse_e610_caps()
575 caps->ext_topo_dev_img_part_num[index] = in ixgbe_parse_e610_caps()
577 caps->ext_topo_dev_img_load_en[index] = in ixgbe_parse_e610_caps()
579 caps->ext_topo_dev_img_prog_en[index] = in ixgbe_parse_e610_caps()
592 * ixgbe_parse_valid_functions_cap - Parse IXGBE_ACI_CAPS_VALID_FUNCTIONS caps
595 * @cap: capability element to parse
602 struct ixgbe_aci_cmd_list_caps_elem *cap) in ixgbe_parse_valid_functions_cap() argument
604 dev_p->num_funcs = hweight32(le32_to_cpu(cap->number)); in ixgbe_parse_valid_functions_cap()
608 * ixgbe_parse_vf_dev_caps - Parse IXGBE_ACI_CAPS_VF device caps
611 * @cap: capability element to parse
617 struct ixgbe_aci_cmd_list_caps_elem *cap) in ixgbe_parse_vf_dev_caps() argument
619 dev_p->num_vfs_exposed = le32_to_cpu(cap->number); in ixgbe_parse_vf_dev_caps()
623 * ixgbe_parse_vsi_dev_caps - Parse IXGBE_ACI_CAPS_VSI device caps
626 * @cap: capability element to parse
632 struct ixgbe_aci_cmd_list_caps_elem *cap) in ixgbe_parse_vsi_dev_caps() argument
634 dev_p->num_vsi_allocd_to_host = le32_to_cpu(cap->number); in ixgbe_parse_vsi_dev_caps()
638 * ixgbe_parse_fdir_dev_caps - Parse IXGBE_ACI_CAPS_FD device caps
641 * @cap: capability element to parse
647 struct ixgbe_aci_cmd_list_caps_elem *cap) in ixgbe_parse_fdir_dev_caps() argument
649 dev_p->num_flow_director_fltr = le32_to_cpu(cap->number); in ixgbe_parse_fdir_dev_caps()
653 * ixgbe_parse_dev_caps - Parse device capabilities
678 u16 cap = le16_to_cpu(cap_resp[i].cap); in ixgbe_parse_dev_caps() local
680 ixgbe_parse_e610_caps(hw, &dev_p->common_cap, &cap_resp[i], in ixgbe_parse_dev_caps()
683 switch (cap) { in ixgbe_parse_dev_caps()
705 * ixgbe_parse_vf_func_caps - Parse IXGBE_ACI_CAPS_VF function caps
708 * @cap: pointer to the capability element to parse
714 struct ixgbe_aci_cmd_list_caps_elem *cap) in ixgbe_parse_vf_func_caps() argument
716 func_p->num_allocd_vfs = le32_to_cpu(cap->number); in ixgbe_parse_vf_func_caps()
717 func_p->vf_base_id = le32_to_cpu(cap->logical_id); in ixgbe_parse_vf_func_caps()
721 * ixgbe_get_num_per_func - determine number of resources per PF
734 u8 funcs = hweight8(hw->dev_caps.common_cap.valid_functions & in ixgbe_get_num_per_func()
741 * ixgbe_parse_vsi_func_caps - Parse IXGBE_ACI_CAPS_VSI function caps
744 * @cap: pointer to the capability element to parse
750 struct ixgbe_aci_cmd_list_caps_elem *cap) in ixgbe_parse_vsi_func_caps() argument
752 func_p->guar_num_vsi = ixgbe_get_num_per_func(hw, IXGBE_MAX_VSI); in ixgbe_parse_vsi_func_caps()
756 * ixgbe_parse_func_caps - Parse function capabilities
781 u16 cap = le16_to_cpu(cap_resp[i].cap); in ixgbe_parse_func_caps() local
783 ixgbe_parse_e610_caps(hw, &func_p->common_cap, in ixgbe_parse_func_caps()
786 switch (cap) { in ixgbe_parse_func_caps()
801 * ixgbe_aci_list_caps - query function/device capabilities
808 * Get the function (0x000A) or device (0x000B) capabilities description from
813 * small, it is possible the command will return -ENOMEM. The
819 * Exit code of -ENOMEM means the buffer size is too small.
832 return -EINVAL; in ixgbe_aci_list_caps()
838 *cap_count = le32_to_cpu(cmd->count); in ixgbe_aci_list_caps()
844 * ixgbe_discover_dev_caps - Read and extract device capabilities
862 return -ENOMEM; in ixgbe_discover_dev_caps()
883 * ixgbe_discover_func_caps - Read and extract function capabilities
901 return -ENOMEM; in ixgbe_discover_func_caps()
922 * ixgbe_get_caps - get info about the HW
933 err = ixgbe_discover_dev_caps(hw, &hw->dev_caps); in ixgbe_get_caps()
937 return ixgbe_discover_func_caps(hw, &hw->func_caps); in ixgbe_get_caps()
941 * ixgbe_aci_disable_rxen - disable RX
957 cmd->lport_num = hw->bus.func; in ixgbe_aci_disable_rxen()
963 * ixgbe_aci_get_phy_caps - returns PHY capabilities
985 return -EINVAL; in ixgbe_aci_get_phy_caps()
990 cmd->param0 |= cpu_to_le16(IXGBE_ACI_GET_PHY_RQM); in ixgbe_aci_get_phy_caps()
992 cmd->param0 |= cpu_to_le16(report_mode); in ixgbe_aci_get_phy_caps()
995 hw->phy.phy_type_low = le64_to_cpu(pcaps->phy_type_low); in ixgbe_aci_get_phy_caps()
996 hw->phy.phy_type_high = le64_to_cpu(pcaps->phy_type_high); in ixgbe_aci_get_phy_caps()
997 memcpy(hw->link.link_info.module_type, &pcaps->module_type, in ixgbe_aci_get_phy_caps()
998 sizeof(hw->link.link_info.module_type)); in ixgbe_aci_get_phy_caps()
1005 * ixgbe_copy_phy_caps_to_cfg - Copy PHY ability data to configuration data
1019 cfg->phy_type_low = caps->phy_type_low; in ixgbe_copy_phy_caps_to_cfg()
1020 cfg->phy_type_high = caps->phy_type_high; in ixgbe_copy_phy_caps_to_cfg()
1021 cfg->caps = caps->caps; in ixgbe_copy_phy_caps_to_cfg()
1022 cfg->low_power_ctrl_an = caps->low_power_ctrl_an; in ixgbe_copy_phy_caps_to_cfg()
1023 cfg->eee_cap = caps->eee_cap; in ixgbe_copy_phy_caps_to_cfg()
1024 cfg->eeer_value = caps->eeer_value; in ixgbe_copy_phy_caps_to_cfg()
1025 cfg->link_fec_opt = caps->link_fec_options; in ixgbe_copy_phy_caps_to_cfg()
1026 cfg->module_compliance_enforcement = in ixgbe_copy_phy_caps_to_cfg()
1027 caps->module_compliance_enforcement; in ixgbe_copy_phy_caps_to_cfg()
1031 * ixgbe_aci_set_phy_cfg - set PHY configuration
1050 return -EINVAL; in ixgbe_aci_set_phy_cfg()
1052 /* Ensure that only valid bits of cfg->caps can be turned on. */ in ixgbe_aci_set_phy_cfg()
1053 cfg->caps &= IXGBE_ACI_PHY_ENA_VALID_MASK; in ixgbe_aci_set_phy_cfg()
1056 desc.params.set_phy.lport_num = hw->bus.func; in ixgbe_aci_set_phy_cfg()
1061 hw->phy.curr_user_phy_cfg = *cfg; in ixgbe_aci_set_phy_cfg()
1067 * ixgbe_aci_set_link_restart_an - set up link and restart AN
1071 * Function sets up the link and restarts the Auto-Negotiation over the link.
1084 cmd->cmd_flags = IXGBE_ACI_RESTART_AN_LINK_RESTART; in ixgbe_aci_set_link_restart_an()
1085 cmd->lport_num = hw->bus.func; in ixgbe_aci_set_link_restart_an()
1087 cmd->cmd_flags |= IXGBE_ACI_RESTART_AN_LINK_ENABLE; in ixgbe_aci_set_link_restart_an()
1089 cmd->cmd_flags &= ~IXGBE_ACI_RESTART_AN_LINK_ENABLE; in ixgbe_aci_set_link_restart_an()
1095 * ixgbe_is_media_cage_present - check if media cage is present
1101 * media type is backplane or BASE-T.
1112 cmd->addr.topo_params.node_type_ctx = in ixgbe_is_media_cage_present()
1117 cmd->addr.topo_params.node_type_ctx |= in ixgbe_is_media_cage_present()
1123 * connection type is backplane or BASE-T. in ixgbe_is_media_cage_present()
1129 * ixgbe_get_media_type_from_phy_type - Gets media type based on phy type
1147 hw_link_info = &hw->link.link_info; in ixgbe_get_media_type_from_phy_type()
1148 if (hw_link_info->phy_type_low && hw_link_info->phy_type_high) in ixgbe_get_media_type_from_phy_type()
1152 if (hw_link_info->phy_type_low) { in ixgbe_get_media_type_from_phy_type()
1158 if (hw_link_info->phy_type_low == IXGBE_PHY_TYPE_LOW_1G_SGMII && in ixgbe_get_media_type_from_phy_type()
1159 (hw_link_info->module_type[IXGBE_ACI_MOD_TYPE_IDENT] == in ixgbe_get_media_type_from_phy_type()
1161 hw_link_info->module_type[IXGBE_ACI_MOD_TYPE_IDENT] == in ixgbe_get_media_type_from_phy_type()
1165 switch (hw_link_info->phy_type_low) { in ixgbe_get_media_type_from_phy_type()
1204 switch (hw_link_info->phy_type_high) { in ixgbe_get_media_type_from_phy_type()
1213 * ixgbe_update_link_info - update status of the HW network link
1227 return -EINVAL; in ixgbe_update_link_info()
1229 li = &hw->link.link_info; in ixgbe_update_link_info()
1235 if (!(li->link_info & IXGBE_ACI_MEDIA_AVAILABLE)) in ixgbe_update_link_info()
1240 return -ENOMEM; in ixgbe_update_link_info()
1246 memcpy(li->module_type, &pcaps->module_type, in ixgbe_update_link_info()
1247 sizeof(li->module_type)); in ixgbe_update_link_info()
1255 * ixgbe_get_link_status - get status of the HW network link
1268 return -EINVAL; in ixgbe_get_link_status()
1270 if (hw->link.get_link_info) { in ixgbe_get_link_status()
1277 *link_up = hw->link.link_info.link_info & IXGBE_ACI_LINK_UP; in ixgbe_get_link_status()
1283 * ixgbe_aci_get_link_info - get the link status
1286 * @link: pointer to link status structure - optional
1288 * Get the current Link Status using ACI command (0x607).
1307 return -EINVAL; in ixgbe_aci_get_link_info()
1309 li_old = &hw->link.link_info_old; in ixgbe_aci_get_link_info()
1310 li = &hw->link.link_info; in ixgbe_aci_get_link_info()
1311 hw_fc_info = &hw->fc; in ixgbe_aci_get_link_info()
1316 resp->cmd_flags = cpu_to_le16(cmd_flags); in ixgbe_aci_get_link_info()
1317 resp->lport_num = hw->bus.func; in ixgbe_aci_get_link_info()
1327 li->link_speed = le16_to_cpu(link_data.link_speed); in ixgbe_aci_get_link_info()
1328 li->phy_type_low = le64_to_cpu(link_data.phy_type_low); in ixgbe_aci_get_link_info()
1329 li->phy_type_high = le64_to_cpu(link_data.phy_type_high); in ixgbe_aci_get_link_info()
1330 li->link_info = link_data.link_info; in ixgbe_aci_get_link_info()
1331 li->link_cfg_err = link_data.link_cfg_err; in ixgbe_aci_get_link_info()
1332 li->an_info = link_data.an_info; in ixgbe_aci_get_link_info()
1333 li->ext_info = link_data.ext_info; in ixgbe_aci_get_link_info()
1334 li->max_frame_size = le16_to_cpu(link_data.max_frame_size); in ixgbe_aci_get_link_info()
1335 li->fec_info = link_data.cfg & IXGBE_ACI_FEC_MASK; in ixgbe_aci_get_link_info()
1336 li->topo_media_conflict = link_data.topo_media_conflict; in ixgbe_aci_get_link_info()
1337 li->pacing = link_data.cfg & (IXGBE_ACI_CFG_PACING_M | in ixgbe_aci_get_link_info()
1344 hw_fc_info->current_mode = ixgbe_fc_full; in ixgbe_aci_get_link_info()
1346 hw_fc_info->current_mode = ixgbe_fc_tx_pause; in ixgbe_aci_get_link_info()
1348 hw_fc_info->current_mode = ixgbe_fc_rx_pause; in ixgbe_aci_get_link_info()
1350 hw_fc_info->current_mode = ixgbe_fc_none; in ixgbe_aci_get_link_info()
1352 li->lse_ena = !!(le16_to_cpu(resp->cmd_flags) & in ixgbe_aci_get_link_info()
1360 hw->link.get_link_info = false; in ixgbe_aci_get_link_info()
1366 * ixgbe_aci_set_event_mask - set event mask
1384 cmd->lport_num = port_num; in ixgbe_aci_set_event_mask()
1386 cmd->event_mask = cpu_to_le16(mask); in ixgbe_aci_set_event_mask()
1391 * ixgbe_configure_lse - enable/disable link status events
1405 err = ixgbe_aci_set_event_mask(hw, (u8)hw->bus.func, mask); in ixgbe_configure_lse()
1414 * ixgbe_get_media_type_e610 - Gets media type
1417 * In order to get the media type, the function gets PHY
1434 * Get PHY Caps admin command instead of Get Link Status, find most in ixgbe_get_media_type_e610()
1438 if (!(hw->link.link_info.link_info & IXGBE_ACI_LINK_UP) && in ixgbe_get_media_type_e610()
1439 (hw->link.link_info.link_info & IXGBE_ACI_MEDIA_AVAILABLE)) { in ixgbe_get_media_type_e610()
1442 /* Get PHY Capabilities */ in ixgbe_get_media_type_e610()
1451 hw->link.link_info.phy_type_high = in ixgbe_get_media_type_e610()
1452 BIT_ULL(highest_bit - 1); in ixgbe_get_media_type_e610()
1453 hw->link.link_info.phy_type_low = 0; in ixgbe_get_media_type_e610()
1457 hw->link.link_info.phy_type_low = in ixgbe_get_media_type_e610()
1458 BIT_ULL(highest_bit - 1); in ixgbe_get_media_type_e610()
1459 hw->link.link_info.phy_type_high = 0; in ixgbe_get_media_type_e610()
1465 hw->phy.media_type = ixgbe_get_media_type_from_phy_type(hw); in ixgbe_get_media_type_e610()
1467 return hw->phy.media_type; in ixgbe_get_media_type_e610()
1471 * ixgbe_setup_link_e610 - Set up link
1484 return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait); in ixgbe_setup_link_e610()
1488 * ixgbe_check_link_e610 - Determine link and speed status
1506 return -EINVAL; in ixgbe_check_link_e610()
1510 * by sending Get Link Status admin command. in ixgbe_check_link_e610()
1512 hw->link.get_link_info = true; in ixgbe_check_link_e610()
1521 for (i = 0; i < hw->mac.max_link_up_time; i++) { in ixgbe_check_link_e610()
1523 hw->link.get_link_info = true; in ixgbe_check_link_e610()
1538 switch (hw->link.link_info.link_speed) { in ixgbe_check_link_e610()
1569 * ixgbe_get_link_capabilities_e610 - Determine link capabilities
1583 return -EINVAL; in ixgbe_get_link_capabilities_e610()
1586 *speed = hw->phy.speeds_supported; in ixgbe_get_link_capabilities_e610()
1592 * ixgbe_cfg_phy_fc - Configure PHY Flow Control (FC) data based on FC mode
1608 return -EINVAL; in ixgbe_cfg_phy_fc()
1626 cfg->caps &= ~(IXGBE_ACI_PHY_EN_TX_LINK_PAUSE | in ixgbe_cfg_phy_fc()
1630 cfg->caps |= pause_mask; in ixgbe_cfg_phy_fc()
1636 * ixgbe_setup_fc_e610 - Set up flow control
1649 /* Get the current PHY config */ in ixgbe_setup_fc_e610()
1658 err = ixgbe_cfg_phy_fc(hw, &cfg, hw->fc.requested_mode); in ixgbe_setup_fc_e610()
1675 * ixgbe_fc_autoneg_e610 - Configure flow control
1684 /* Get current link err. in ixgbe_fc_autoneg_e610()
1692 if (!(hw->link.link_info.link_info & IXGBE_ACI_LINK_UP)) in ixgbe_fc_autoneg_e610()
1695 /* Check if auto-negotiation has completed */ in ixgbe_fc_autoneg_e610()
1696 if (!(hw->link.link_info.an_info & IXGBE_ACI_AN_COMPLETED)) in ixgbe_fc_autoneg_e610()
1699 hw->fc.fc_was_autonegged = true; in ixgbe_fc_autoneg_e610()
1703 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg_e610()
1704 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg_e610()
1708 * ixgbe_disable_rx_e610 - Disable RX unit
1728 hw->mac.set_lben = true; in ixgbe_disable_rx_e610()
1730 hw->mac.set_lben = false; in ixgbe_disable_rx_e610()
1735 /* If we fail - disable RX using register write */ in ixgbe_disable_rx_e610()
1746 * ixgbe_init_phy_ops_e610 - PHY specific init
1756 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_phy_ops_e610()
1757 struct ixgbe_phy_info *phy = &hw->phy; in ixgbe_init_phy_ops_e610()
1759 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) in ixgbe_init_phy_ops_e610()
1760 phy->ops.set_phy_power = ixgbe_set_phy_power_e610; in ixgbe_init_phy_ops_e610()
1762 phy->ops.set_phy_power = NULL; in ixgbe_init_phy_ops_e610()
1765 return phy->ops.identify(hw); in ixgbe_init_phy_ops_e610()
1769 * ixgbe_identify_phy_e610 - Identify PHY
1783 hw->phy.type = ixgbe_phy_fw; in ixgbe_identify_phy_e610()
1801 hw->phy.speeds_supported = IXGBE_LINK_SPEED_UNKNOWN; in ixgbe_identify_phy_e610()
1807 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_10_FULL; in ixgbe_identify_phy_e610()
1811 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_100_FULL; in ixgbe_identify_phy_e610()
1818 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_identify_phy_e610()
1827 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_identify_phy_e610()
1830 * auto-negotiation set used during driver initialization due to in ixgbe_identify_phy_e610()
1834 if (!hw->phy.autoneg_advertised && in ixgbe_identify_phy_e610()
1835 hw->device_id != IXGBE_DEV_ID_E610_2_5G_T) in ixgbe_identify_phy_e610()
1836 hw->phy.autoneg_advertised = hw->phy.speeds_supported; in ixgbe_identify_phy_e610()
1843 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_2_5GB_FULL; in ixgbe_identify_phy_e610()
1845 if (!hw->phy.autoneg_advertised && in ixgbe_identify_phy_e610()
1846 hw->device_id == IXGBE_DEV_ID_E610_2_5G_T) in ixgbe_identify_phy_e610()
1847 hw->phy.autoneg_advertised = hw->phy.speeds_supported; in ixgbe_identify_phy_e610()
1852 hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL; in ixgbe_identify_phy_e610()
1855 memcpy(&hw->phy.id, pcaps.phy_id_oui, sizeof(u32)); in ixgbe_identify_phy_e610()
1857 hw->phy.eee_speeds_supported = IXGBE_LINK_SPEED_10_FULL | in ixgbe_identify_phy_e610()
1860 hw->phy.eee_speeds_advertised = hw->phy.eee_speeds_supported; in ixgbe_identify_phy_e610()
1866 * ixgbe_identify_module_e610 - Identify SFP module type
1884 (hw->link.link_info.link_info & IXGBE_ACI_MEDIA_AVAILABLE); in ixgbe_identify_module_e610()
1887 hw->phy.sfp_type = ixgbe_sfp_type_unknown; in ixgbe_identify_module_e610()
1889 /* Get module type from hw context updated by in ixgbe_identify_module_e610()
1892 module_type = hw->link.link_info.module_type[IXGBE_ACI_MOD_TYPE_IDENT]; in ixgbe_identify_module_e610()
1896 hw->phy.sfp_type = ixgbe_sfp_type_da_cu; in ixgbe_identify_module_e610()
1898 hw->phy.sfp_type = ixgbe_sfp_type_sr; in ixgbe_identify_module_e610()
1901 hw->phy.sfp_type = ixgbe_sfp_type_lr; in ixgbe_identify_module_e610()
1904 hw->phy.sfp_type = ixgbe_sfp_type_not_present; in ixgbe_identify_module_e610()
1905 return -ENOENT; in ixgbe_identify_module_e610()
1912 * ixgbe_setup_phy_link_e610 - Sets up firmware-controlled PHYs
1915 * Set the parameters for the firmware-controlled PHYs.
1932 /* If media is not available get default config. */ in ixgbe_setup_phy_link_e610()
1933 if (!(hw->link.link_info.link_info & IXGBE_ACI_MEDIA_AVAILABLE)) in ixgbe_setup_phy_link_e610()
1943 /* Get Active configuration to avoid unintended changes. */ in ixgbe_setup_phy_link_e610()
1951 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10_FULL) { in ixgbe_setup_phy_link_e610()
1955 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) { in ixgbe_setup_phy_link_e610()
1960 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) { in ixgbe_setup_phy_link_e610()
1968 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_2_5GB_FULL) { in ixgbe_setup_phy_link_e610()
1975 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) { in ixgbe_setup_phy_link_e610()
1980 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) { in ixgbe_setup_phy_link_e610()
2012 * ixgbe_set_phy_power_e610 - Control power for copper PHY
2052 * ixgbe_enter_lplu_e610 - Transition to low power states
2056 * (from D0 to non-D0). Link is required to enter LPLU so avoid resetting the
2081 * ixgbe_init_eeprom_params_e610 - Initialize EEPROM params
2091 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_init_eeprom_params_e610()
2095 if (eeprom->type != ixgbe_eeprom_uninitialized) in ixgbe_init_eeprom_params_e610()
2098 eeprom->type = ixgbe_flash; in ixgbe_init_eeprom_params_e610()
2104 eeprom->word_size = BIT(sr_size) * IXGBE_SR_WORDS_IN_1KB; in ixgbe_init_eeprom_params_e610()
2106 hw_dbg(hw, "Eeprom params: type = %d, size = %d\n", eeprom->type, in ixgbe_init_eeprom_params_e610()
2107 eeprom->word_size); in ixgbe_init_eeprom_params_e610()
2113 * ixgbe_aci_get_netlist_node - get a node handle
2119 * Get the netlist node and assigns it to
2134 return -EOPNOTSUPP; in ixgbe_aci_get_netlist_node()
2146 * ixgbe_acquire_nvm - Generic request for acquiring the NVM ownership
2169 * ixgbe_release_nvm - Generic request for releasing the NVM ownership
2187 * ixgbe_aci_read_nvm - read NVM
2208 return -EINVAL; in ixgbe_aci_read_nvm()
2215 cmd->cmd_flags |= IXGBE_ACI_NVM_FLASH_ONLY; in ixgbe_aci_read_nvm()
2219 cmd->cmd_flags |= IXGBE_ACI_NVM_LAST_CMD; in ixgbe_aci_read_nvm()
2220 cmd->module_typeid = cpu_to_le16(module_typeid); in ixgbe_aci_read_nvm()
2221 cmd->offset_low = cpu_to_le16(offset & 0xFFFF); in ixgbe_aci_read_nvm()
2222 cmd->offset_high = (offset >> 16) & 0xFF; in ixgbe_aci_read_nvm()
2223 cmd->length = cpu_to_le16(length); in ixgbe_aci_read_nvm()
2229 * ixgbe_nvm_validate_checksum - validate checksum
2251 cmd->flags = IXGBE_ACI_NVM_CHECKSUM_VERIFY; in ixgbe_nvm_validate_checksum()
2257 if (!err && cmd->checksum != in ixgbe_nvm_validate_checksum()
2262 err = -EIO; in ixgbe_nvm_validate_checksum()
2263 netdev_err(adapter->netdev, "Invalid Shadow Ram checksum"); in ixgbe_nvm_validate_checksum()
2270 * ixgbe_read_sr_word_aci - Reads Shadow RAM via ACI
2272 * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
2295 * ixgbe_read_flat_nvm - Read portion of NVM by flat offset
2322 (hw->eeprom.word_size * 2u))) in ixgbe_read_flat_nvm()
2323 return -EINVAL; in ixgbe_read_flat_nvm()
2334 IXGBE_ACI_MAX_BUFFER_SIZE - sector_offset, in ixgbe_read_flat_nvm()
2335 inlen - bytes_read); in ixgbe_read_flat_nvm()
2359 * ixgbe_read_sr_buf_aci - Read Shadow RAM buffer via ACI
2361 * @offset: offset of the Shadow RAM words to read (0x000000 - 0x001FFF)
2389 * ixgbe_read_ee_aci_e610 - Read EEPROM word using the admin command.
2405 if (hw->eeprom.type == ixgbe_eeprom_uninitialized) { in ixgbe_read_ee_aci_e610()
2406 err = hw->eeprom.ops.init_params(hw); in ixgbe_read_ee_aci_e610()
2422 * ixgbe_read_ee_aci_buffer_e610 - Read EEPROM words via ACI
2438 if (hw->eeprom.type == ixgbe_eeprom_uninitialized) { in ixgbe_read_ee_aci_buffer_e610()
2439 err = hw->eeprom.ops.init_params(hw); in ixgbe_read_ee_aci_buffer_e610()
2455 * ixgbe_validate_eeprom_checksum_e610 - Validate EEPROM checksum
2471 if (hw->eeprom.type == ixgbe_eeprom_uninitialized) { in ixgbe_validate_eeprom_checksum_e610()
2472 err = hw->eeprom.ops.init_params(hw); in ixgbe_validate_eeprom_checksum_e610()
2500 * ixgbe_reset_hw_e610 - Perform hardware reset
2510 u32 swfw_mask = hw->phy.phy_semaphore_mask; in ixgbe_reset_hw_e610()
2515 err = hw->mac.ops.stop_adapter(hw); in ixgbe_reset_hw_e610()
2522 hw->phy.ops.init(hw); in ixgbe_reset_hw_e610()
2524 err = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); in ixgbe_reset_hw_e610()
2526 return -EBUSY; in ixgbe_reset_hw_e610()
2531 hw->mac.ops.release_swfw_sync(hw, swfw_mask); in ixgbe_reset_hw_e610()
2533 /* Poll for reset bit to self-clear indicating reset is complete */ in ixgbe_reset_hw_e610()
2545 err = -EIO; in ixgbe_reset_hw_e610()
2546 netdev_err(adapter->netdev, "Reset polling failed to complete."); in ixgbe_reset_hw_e610()
2554 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { in ixgbe_reset_hw_e610()
2555 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; in ixgbe_reset_hw_e610()
2563 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); in ixgbe_reset_hw_e610()
2573 hw->mac.num_rar_entries = IXGBE_MAX_NUM_RAR; in ixgbe_reset_hw_e610()
2574 hw->mac.ops.init_rx_addrs(hw); in ixgbe_reset_hw_e610()
2577 hw->mac.ops.set_lan_id(hw); in ixgbe_reset_hw_e610()