Lines Matching +full:mac +full:- +full:address0
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2021 Intel Corporation. */
15 * i40e_set_mac_type - Sets MAC type
18 * This function sets the mac type of the adapter based on the
25 if (hw->vendor_id == PCI_VENDOR_ID_INTEL) { in i40e_set_mac_type()
26 switch (hw->device_id) { in i40e_set_mac_type()
47 hw->mac.type = I40E_MAC_XL710; in i40e_set_mac_type()
56 hw->mac.type = I40E_MAC_X722; in i40e_set_mac_type()
59 hw->mac.type = I40E_MAC_GENERIC; in i40e_set_mac_type()
63 status = -ENODEV; in i40e_set_mac_type()
66 hw_dbg(hw, "i40e_set_mac_type found mac: %d, returns: %d\n", in i40e_set_mac_type()
67 hw->mac.type, status); in i40e_set_mac_type()
72 * i40e_aq_str - convert AQ err code to a string
127 snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err); in i40e_aq_str()
128 return hw->err_str; in i40e_aq_str()
145 u32 effective_mask = hw->debug_mask & mask; in i40e_debug_aq()
153 len = le16_to_cpu(aq_desc->datalen); in i40e_debug_aq()
157 le16_to_cpu(aq_desc->opcode), in i40e_debug_aq()
158 le16_to_cpu(aq_desc->flags), in i40e_debug_aq()
159 le16_to_cpu(aq_desc->datalen), in i40e_debug_aq()
160 le16_to_cpu(aq_desc->retval)); in i40e_debug_aq()
163 le32_to_cpu(aq_desc->cookie_high), in i40e_debug_aq()
164 le32_to_cpu(aq_desc->cookie_low)); in i40e_debug_aq()
167 le32_to_cpu(aq_desc->params.internal.param0), in i40e_debug_aq()
168 le32_to_cpu(aq_desc->params.internal.param1)); in i40e_debug_aq()
171 le32_to_cpu(aq_desc->params.external.addr_high), in i40e_debug_aq()
172 le32_to_cpu(aq_desc->params.external.addr_low)); in i40e_debug_aq()
182 hw->bus.bus_id, in i40e_debug_aq()
183 hw->bus.device, in i40e_debug_aq()
184 hw->bus.func); in i40e_debug_aq()
200 if (!hw->aq.asq.count) in i40e_check_asq_alive()
226 cmd->driver_unloading = cpu_to_le32(I40E_AQ_DRIVER_UNLOADING); in i40e_aq_queue_shutdown()
267 cmd_resp->vsi_id = cpu_to_le16(vsi_id); in i40e_aq_get_set_rss_lut()
276 cmd_resp->flags = cpu_to_le16(flags); in i40e_aq_get_set_rss_lut()
348 cmd_resp->vsi_id = cpu_to_le16(vsi_id); in i40e_aq_get_set_rss_key()
385 * i40e_init_shared_code - Initialize the shared code
388 * This assigns the MAC type and PHY code and inits the NVM.
403 switch (hw->mac.type) { in i40e_init_shared_code()
408 return -ENODEV; in i40e_init_shared_code()
411 hw->phy.get_link_info = true; in i40e_init_shared_code()
416 hw->port = (u8)port; in i40e_init_shared_code()
421 hw->pf_id = (u8)(func_rid & 0xff); in i40e_init_shared_code()
423 hw->pf_id = (u8)(func_rid & 0x7); in i40e_init_shared_code()
430 * i40e_aq_mac_address_read - Retrieve the MAC addresses
433 * @addrs: the requestor's mac addr store
452 *flags = le16_to_cpu(cmd_data->command_flags); in i40e_aq_mac_address_read()
458 * i40e_aq_mac_address_write - Change the MAC addresses
460 * @flags: indicates which MAC to be written
475 cmd_data->command_flags = cpu_to_le16(flags); in i40e_aq_mac_address_write()
476 cmd_data->mac_sah = cpu_to_le16((u16)mac_addr[0] << 8 | mac_addr[1]); in i40e_aq_mac_address_write()
477 cmd_data->mac_sal = cpu_to_le32(((u32)mac_addr[2] << 24) | in i40e_aq_mac_address_write()
488 * i40e_get_mac_addr - get MAC address
490 * @mac_addr: pointer to MAC address
492 * Reads the adapter's MAC address from register
509 * i40e_get_port_mac_addr - get Port MAC address
511 * @mac_addr: pointer to Port MAC address
513 * Reads the adapter's Port MAC address
528 status = -EINVAL; in i40e_get_port_mac_addr()
534 * i40e_pre_tx_queue_cfg - pre tx queue configure
544 u32 abs_queue_idx = hw->func_caps.base_queue + queue; in i40e_pre_tx_queue_cfg()
566 * i40e_get_pba_string - Reads part number string from EEPROM
571 * to i40e_hw->pba_id field.
608 pba_size--; in i40e_get_pba_string()
618 hw->pba_id = ptr; in i40e_get_pba_string()
624 devm_kfree(i40e_hw_to_dev(hw), hw->pba_id); in i40e_get_pba_string()
625 hw->pba_id = NULL; in i40e_get_pba_string()
635 * i40e_get_media_type - Gets media type
642 switch (hw->phy.link_info.phy_type) { in i40e_get_media_type()
694 * i40e_poll_globr - Poll for Global Reset completion
713 return -EIO; in i40e_poll_globr()
719 * i40e_pf_reset - Reset the PF
752 return -EIO; in i40e_pf_reset()
771 return -EIO; in i40e_pf_reset()
779 if (hw->revision_id == 0) in i40e_pf_reset()
786 for (; cnt; cnt--) { in i40e_pf_reset()
797 return -EIO; in i40e_pf_reset()
800 return -EIO; in i40e_pf_reset()
810 * i40e_clear_hw - clear out any left over hw state
836 num_queues = (j - base_queue) + 1; in i40e_clear_hw()
844 num_vfs = (j - i) + 1; in i40e_clear_hw()
851 for (i = 0; i < num_pf_int - 2; i++) in i40e_clear_hw()
857 for (i = 0; i < num_pf_int - 2; i++) in i40e_clear_hw()
862 for (i = 0; i < num_vf_int - 2; i++) in i40e_clear_hw()
897 * i40e_clear_pxe_mode - clear pxe operations mode
901 * like descriptor fetch/write-back mode.
910 /* Clear single descriptor fetch/write-back mode */ in i40e_clear_pxe_mode()
913 if (hw->revision_id == 0) { in i40e_clear_pxe_mode()
922 * i40e_led_is_mine - helper to find matching led
933 if (!I40E_IS_X710TL_DEVICE(hw->device_id) && in i40e_led_is_mine()
934 !hw->func_caps.led[idx]) in i40e_led_is_mine()
943 (port != hw->port)) in i40e_led_is_mine()
959 * i40e_led_get - return current on/off mode
972 /* as per the documentation GPIO 22-29 are the LED in i40e_led_get()
989 * i40e_led_set - set new on/off mode
1006 /* as per the documentation GPIO 22-29 are the LED in i40e_led_set()
1015 if (I40E_IS_X710TL_DEVICE(hw->device_id)) { in i40e_led_set()
1067 return -EINVAL; in i40e_aq_get_phy_capabilities()
1088 switch (hw->aq.asq_last_status) { in i40e_aq_get_phy_capabilities()
1090 status = -EIO; in i40e_aq_get_phy_capabilities()
1095 status = -EIO; in i40e_aq_get_phy_capabilities()
1102 } while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) && in i40e_aq_get_phy_capabilities()
1109 if (hw->mac.type == I40E_MAC_XL710 && in i40e_aq_get_phy_capabilities()
1114 hw->phy.phy_types = le32_to_cpu(abilities->phy_type); in i40e_aq_get_phy_capabilities()
1115 hw->phy.phy_types |= in i40e_aq_get_phy_capabilities()
1116 ((u64)abilities->phy_type_ext << 32); in i40e_aq_get_phy_capabilities()
1145 return -EINVAL; in i40e_aq_set_phy_config()
1163 enum i40e_fc_mode fc_mode = hw->fc.requested_mode; in i40e_set_fc_status()
1183 config.abilities = abilities->abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX) & in i40e_set_fc_status()
1188 if (config.abilities == abilities->abilities) in i40e_set_fc_status()
1195 config.phy_type = abilities->phy_type; in i40e_set_fc_status()
1196 config.phy_type_ext = abilities->phy_type_ext; in i40e_set_fc_status()
1197 config.link_speed = abilities->link_speed; in i40e_set_fc_status()
1198 config.eee_capability = abilities->eee_capability; in i40e_set_fc_status()
1199 config.eeer = abilities->eeer_val; in i40e_set_fc_status()
1200 config.low_power_ctrl = abilities->d3_lpan; in i40e_set_fc_status()
1201 config.fec_config = abilities->fec_cfg_curr_mod_ext_info & in i40e_set_fc_status()
1269 cmd->rx_cnt = 0x2; in i40e_aq_clear_pxe_mode()
1284 * Sets up the link and restarts the Auto-Negotiation over the link.
1298 cmd->command = I40E_AQ_PHY_RESTART_AN; in i40e_aq_set_link_restart_an()
1300 cmd->command |= I40E_AQ_PHY_LINK_ENABLE; in i40e_aq_set_link_restart_an()
1302 cmd->command &= ~I40E_AQ_PHY_LINK_ENABLE; in i40e_aq_set_link_restart_an()
1313 * @link: pointer to link status structure - optional
1325 struct i40e_link_status *hw_link_info = &hw->phy.link_info; in i40e_aq_get_link_info()
1336 resp->command_flags = cpu_to_le16(command_flags); in i40e_aq_get_link_info()
1344 hw->phy.link_info_old = *hw_link_info; in i40e_aq_get_link_info()
1347 hw_link_info->phy_type = (enum i40e_aq_phy_type)resp->phy_type; in i40e_aq_get_link_info()
1348 hw->phy.media_type = i40e_get_media_type(hw); in i40e_aq_get_link_info()
1349 hw_link_info->link_speed = (enum i40e_aq_link_speed)resp->link_speed; in i40e_aq_get_link_info()
1350 hw_link_info->link_info = resp->link_info; in i40e_aq_get_link_info()
1351 hw_link_info->an_info = resp->an_info; in i40e_aq_get_link_info()
1352 hw_link_info->fec_info = resp->config & (I40E_AQ_CONFIG_FEC_KR_ENA | in i40e_aq_get_link_info()
1354 hw_link_info->ext_info = resp->ext_info; in i40e_aq_get_link_info()
1355 hw_link_info->loopback = resp->loopback & I40E_AQ_LOOPBACK_MASK; in i40e_aq_get_link_info()
1356 hw_link_info->max_frame_size = le16_to_cpu(resp->max_frame_size); in i40e_aq_get_link_info()
1357 hw_link_info->pacing = resp->config & I40E_AQ_CONFIG_PACING_MASK; in i40e_aq_get_link_info()
1360 tx_pause = !!(resp->an_info & I40E_AQ_LINK_PAUSE_TX); in i40e_aq_get_link_info()
1361 rx_pause = !!(resp->an_info & I40E_AQ_LINK_PAUSE_RX); in i40e_aq_get_link_info()
1363 hw->fc.current_mode = I40E_FC_FULL; in i40e_aq_get_link_info()
1365 hw->fc.current_mode = I40E_FC_TX_PAUSE; in i40e_aq_get_link_info()
1367 hw->fc.current_mode = I40E_FC_RX_PAUSE; in i40e_aq_get_link_info()
1369 hw->fc.current_mode = I40E_FC_NONE; in i40e_aq_get_link_info()
1371 if (resp->config & I40E_AQ_CONFIG_CRC_ENA) in i40e_aq_get_link_info()
1372 hw_link_info->crc_enable = true; in i40e_aq_get_link_info()
1374 hw_link_info->crc_enable = false; in i40e_aq_get_link_info()
1376 if (resp->command_flags & cpu_to_le16(I40E_AQ_LSE_IS_ENABLED)) in i40e_aq_get_link_info()
1377 hw_link_info->lse_enable = true; in i40e_aq_get_link_info()
1379 hw_link_info->lse_enable = false; in i40e_aq_get_link_info()
1381 if (hw->mac.type == I40E_MAC_XL710 && i40e_is_fw_ver_lt(hw, 4, 40) && in i40e_aq_get_link_info()
1382 hw_link_info->phy_type == 0xE) in i40e_aq_get_link_info()
1383 hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; in i40e_aq_get_link_info()
1385 if (test_bit(I40E_HW_CAP_AQ_PHY_ACCESS, hw->caps) && in i40e_aq_get_link_info()
1386 hw->mac.type != I40E_MAC_X722) { in i40e_aq_get_link_info()
1389 memcpy(&tmp, resp->link_type, sizeof(tmp)); in i40e_aq_get_link_info()
1390 hw->phy.phy_types = le32_to_cpu(tmp); in i40e_aq_get_link_info()
1391 hw->phy.phy_types |= ((u64)resp->link_type_ext << 32); in i40e_aq_get_link_info()
1399 hw->phy.get_link_info = false; in i40e_aq_get_link_info()
1425 cmd->event_mask = cpu_to_le16(mask); in i40e_aq_set_phy_int_mask()
1449 if (hw->nvm.version <= I40E_LEGACY_LOOPBACK_NVM_VER) in i40e_aq_set_mac_loopback()
1450 cmd->lb_mode = cpu_to_le16(I40E_AQ_LB_MAC_LOCAL_LEGACY); in i40e_aq_set_mac_loopback()
1452 cmd->lb_mode = cpu_to_le16(I40E_AQ_LB_MAC_LOCAL); in i40e_aq_set_mac_loopback()
1477 cmd->command_flags = cmd_flags; in i40e_aq_set_phy_debug()
1507 cmd->uplink_seid = cpu_to_le16(vsi_ctx->uplink_seid); in i40e_aq_add_vsi()
1508 cmd->connection_type = vsi_ctx->connection_type; in i40e_aq_add_vsi()
1509 cmd->vf_id = vsi_ctx->vf_num; in i40e_aq_add_vsi()
1510 cmd->vsi_flags = cpu_to_le16(vsi_ctx->flags); in i40e_aq_add_vsi()
1514 status = i40e_asq_send_command_atomic(hw, &desc, &vsi_ctx->info, in i40e_aq_add_vsi()
1515 sizeof(vsi_ctx->info), in i40e_aq_add_vsi()
1521 vsi_ctx->seid = le16_to_cpu(resp->seid); in i40e_aq_add_vsi()
1522 vsi_ctx->vsi_number = le16_to_cpu(resp->vsi_number); in i40e_aq_add_vsi()
1523 vsi_ctx->vsis_allocated = le16_to_cpu(resp->vsi_used); in i40e_aq_add_vsi()
1524 vsi_ctx->vsis_unallocated = le16_to_cpu(resp->vsi_free); in i40e_aq_add_vsi()
1549 cmd->promiscuous_flags = cpu_to_le16(I40E_AQC_SET_VSI_DEFAULT); in i40e_aq_set_default_vsi()
1550 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_DEFAULT); in i40e_aq_set_default_vsi()
1551 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_default_vsi()
1577 cmd->promiscuous_flags = cpu_to_le16(0); in i40e_aq_clear_default_vsi()
1578 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_DEFAULT); in i40e_aq_clear_default_vsi()
1579 cmd->seid = cpu_to_le16(seid); in i40e_aq_clear_default_vsi()
1614 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_unicast_promiscuous()
1616 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST); in i40e_aq_set_vsi_unicast_promiscuous()
1618 cmd->valid_flags |= in i40e_aq_set_vsi_unicast_promiscuous()
1621 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_unicast_promiscuous()
1650 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_multicast_promiscuous()
1652 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_MULTICAST); in i40e_aq_set_vsi_multicast_promiscuous()
1654 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_multicast_promiscuous()
1664 * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
1665 * @vid: The VLAN tag filter - capture any multicast packet with this VLAN tag
1685 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_mc_promisc_on_vlan()
1686 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_MULTICAST); in i40e_aq_set_vsi_mc_promisc_on_vlan()
1687 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_mc_promisc_on_vlan()
1688 cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID); in i40e_aq_set_vsi_mc_promisc_on_vlan()
1700 * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
1701 * @vid: The VLAN tag filter - capture any unicast packet with this VLAN tag
1724 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_uc_promisc_on_vlan()
1725 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST); in i40e_aq_set_vsi_uc_promisc_on_vlan()
1727 cmd->valid_flags |= in i40e_aq_set_vsi_uc_promisc_on_vlan()
1729 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_uc_promisc_on_vlan()
1730 cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID); in i40e_aq_set_vsi_uc_promisc_on_vlan()
1743 * @vid: The VLAN tag filter - capture any broadcast packet with this VLAN tag
1762 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_bc_promisc_on_vlan()
1763 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_BROADCAST); in i40e_aq_set_vsi_bc_promisc_on_vlan()
1764 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_bc_promisc_on_vlan()
1765 cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID); in i40e_aq_set_vsi_bc_promisc_on_vlan()
1794 cmd->promiscuous_flags in i40e_aq_set_vsi_broadcast()
1797 cmd->promiscuous_flags in i40e_aq_set_vsi_broadcast()
1800 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_BROADCAST); in i40e_aq_set_vsi_broadcast()
1801 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_broadcast()
1808 * i40e_aq_set_vsi_vlan_promisc - control the VLAN promiscuous setting
1811 * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
1829 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_vlan_promisc()
1830 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_VLAN); in i40e_aq_set_vsi_vlan_promisc()
1831 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_vlan_promisc()
1839 * i40e_aq_get_vsi_params - get VSI configuration info
1859 cmd->uplink_seid = cpu_to_le16(vsi_ctx->seid); in i40e_aq_get_vsi_params()
1863 status = i40e_asq_send_command(hw, &desc, &vsi_ctx->info, in i40e_aq_get_vsi_params()
1864 sizeof(vsi_ctx->info), NULL); in i40e_aq_get_vsi_params()
1869 vsi_ctx->seid = le16_to_cpu(resp->seid); in i40e_aq_get_vsi_params()
1870 vsi_ctx->vsi_number = le16_to_cpu(resp->vsi_number); in i40e_aq_get_vsi_params()
1871 vsi_ctx->vsis_allocated = le16_to_cpu(resp->vsi_used); in i40e_aq_get_vsi_params()
1872 vsi_ctx->vsis_unallocated = le16_to_cpu(resp->vsi_free); in i40e_aq_get_vsi_params()
1900 cmd->uplink_seid = cpu_to_le16(vsi_ctx->seid); in i40e_aq_update_vsi_params()
1904 status = i40e_asq_send_command_atomic(hw, &desc, &vsi_ctx->info, in i40e_aq_update_vsi_params()
1905 sizeof(vsi_ctx->info), in i40e_aq_update_vsi_params()
1908 vsi_ctx->vsis_allocated = le16_to_cpu(resp->vsi_used); in i40e_aq_update_vsi_params()
1909 vsi_ctx->vsis_unallocated = le16_to_cpu(resp->vsi_free); in i40e_aq_update_vsi_params()
1939 scfg->seid = cpu_to_le16(*start_seid); in i40e_aq_get_switch_config()
1942 *start_seid = le16_to_cpu(scfg->seid); in i40e_aq_get_switch_config()
1970 scfg->flags = cpu_to_le16(flags); in i40e_aq_set_switch_config()
1971 scfg->valid_flags = cpu_to_le16(valid_flags); in i40e_aq_set_switch_config()
1972 scfg->mode = mode; in i40e_aq_set_switch_config()
1973 if (test_bit(I40E_HW_CAP_802_1AD, hw->caps)) { in i40e_aq_set_switch_config()
1974 scfg->switch_tag = cpu_to_le16(hw->switch_tag); in i40e_aq_set_switch_config()
1975 scfg->first_tag = cpu_to_le16(hw->first_tag); in i40e_aq_set_switch_config()
1976 scfg->second_tag = cpu_to_le16(hw->second_tag); in i40e_aq_set_switch_config()
2012 *fw_major_version = le16_to_cpu(resp->fw_major); in i40e_aq_get_firmware_version()
2014 *fw_minor_version = le16_to_cpu(resp->fw_minor); in i40e_aq_get_firmware_version()
2016 *fw_build = le32_to_cpu(resp->fw_build); in i40e_aq_get_firmware_version()
2018 *api_major_version = le16_to_cpu(resp->api_major); in i40e_aq_get_firmware_version()
2020 *api_minor_version = le16_to_cpu(resp->api_minor); in i40e_aq_get_firmware_version()
2045 return -EINVAL; in i40e_aq_send_driver_version()
2050 cmd->driver_major_ver = dv->major_version; in i40e_aq_send_driver_version()
2051 cmd->driver_minor_ver = dv->minor_version; in i40e_aq_send_driver_version()
2052 cmd->driver_build_ver = dv->build_version; in i40e_aq_send_driver_version()
2053 cmd->driver_subbuild_ver = dv->subbuild_version; in i40e_aq_send_driver_version()
2056 while (len < sizeof(dv->driver_string) && in i40e_aq_send_driver_version()
2057 (dv->driver_string[len] < 0x80) && in i40e_aq_send_driver_version()
2058 dv->driver_string[len]) in i40e_aq_send_driver_version()
2060 status = i40e_asq_send_command(hw, &desc, dv->driver_string, in i40e_aq_send_driver_version()
2067 * i40e_get_link_status - get status of the HW network link
2080 if (hw->phy.get_link_info) { in i40e_get_link_status()
2088 *link_up = hw->phy.link_info.link_info & I40E_AQ_LINK_UP; in i40e_get_link_status()
2094 * i40e_update_link_info - update status of the HW network link
2107 if ((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && in i40e_update_link_info()
2108 ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || in i40e_update_link_info()
2109 !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) { in i40e_update_link_info()
2117 hw->phy.link_info.req_fec_info = in i40e_update_link_info()
2121 hw->phy.link_info.req_fec_info = in i40e_update_link_info()
2126 memcpy(hw->phy.link_info.module_type, &abilities.module_type, in i40e_update_link_info()
2127 sizeof(hw->phy.link_info.module_type)); in i40e_update_link_info()
2134 * i40e_aq_add_veb - Insert a VEB between the VSI and the MAC
2136 * @uplink_seid: the MAC or other gizmo SEID
2163 return -EINVAL; in i40e_aq_add_veb()
2167 cmd->uplink_seid = cpu_to_le16(uplink_seid); in i40e_aq_add_veb()
2168 cmd->downlink_seid = cpu_to_le16(downlink_seid); in i40e_aq_add_veb()
2169 cmd->enable_tcs = enabled_tc; in i40e_aq_add_veb()
2181 cmd->veb_flags = cpu_to_le16(veb_flags); in i40e_aq_add_veb()
2186 *veb_seid = le16_to_cpu(resp->veb_seid); in i40e_aq_add_veb()
2192 * i40e_aq_get_veb_parameters - Retrieve VEB parameters
2218 return -EINVAL; in i40e_aq_get_veb_parameters()
2222 cmd_resp->seid = cpu_to_le16(veb_seid); in i40e_aq_get_veb_parameters()
2229 *switch_id = le16_to_cpu(cmd_resp->switch_id); in i40e_aq_get_veb_parameters()
2231 *statistic_index = le16_to_cpu(cmd_resp->statistic_index); in i40e_aq_get_veb_parameters()
2233 *vebs_used = le16_to_cpu(cmd_resp->vebs_used); in i40e_aq_get_veb_parameters()
2235 *vebs_free = le16_to_cpu(cmd_resp->vebs_free); in i40e_aq_get_veb_parameters()
2237 u16 flags = le16_to_cpu(cmd_resp->veb_flags); in i40e_aq_get_veb_parameters()
2254 * @seid: VSI for the mac address
2264 (struct i40e_aqc_macvlan *)&desc->params.raw; in i40e_prepare_add_macvlan()
2272 cmd->num_addresses = cpu_to_le16(count); in i40e_prepare_add_macvlan()
2273 cmd->seid[0] = cpu_to_le16(I40E_AQC_MACVLAN_CMD_SEID_VALID | seid); in i40e_prepare_add_macvlan()
2274 cmd->seid[1] = 0; in i40e_prepare_add_macvlan()
2275 cmd->seid[2] = 0; in i40e_prepare_add_macvlan()
2282 desc->flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); in i40e_prepare_add_macvlan()
2284 desc->flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB); in i40e_prepare_add_macvlan()
2292 * @seid: VSI for the mac address
2297 * Add MAC/VLAN addresses to the HW filtering
2308 return -EINVAL; in i40e_aq_add_macvlan()
2319 * @seid: VSI for the mac address
2325 * Add MAC/VLAN addresses to the HW filtering.
2327 * to avoid race conditions in access to hw->aq.asq_last_status.
2341 return -EINVAL; in i40e_aq_add_macvlan_v2()
2352 * @seid: VSI for the mac address
2357 * Remove MAC/VLAN addresses from the HW filtering
2371 return -EINVAL; in i40e_aq_remove_macvlan()
2377 cmd->num_addresses = cpu_to_le16(count); in i40e_aq_remove_macvlan()
2378 cmd->seid[0] = cpu_to_le16(I40E_AQC_MACVLAN_CMD_SEID_VALID | seid); in i40e_aq_remove_macvlan()
2379 cmd->seid[1] = 0; in i40e_aq_remove_macvlan()
2380 cmd->seid[2] = 0; in i40e_aq_remove_macvlan()
2395 * @seid: VSI for the mac address
2401 * Remove MAC/VLAN addresses from the HW filtering.
2403 * to avoid race conditions in access to hw->aq.asq_last_status.
2418 return -EINVAL; in i40e_aq_remove_macvlan_v2()
2425 cmd->num_addresses = cpu_to_le16(count); in i40e_aq_remove_macvlan_v2()
2426 cmd->seid[0] = cpu_to_le16(I40E_AQC_MACVLAN_CMD_SEID_VALID | seid); in i40e_aq_remove_macvlan_v2()
2427 cmd->seid[1] = 0; in i40e_aq_remove_macvlan_v2()
2428 cmd->seid[2] = 0; in i40e_aq_remove_macvlan_v2()
2439 * i40e_mirrorrule_op - Internal helper function to add/delete mirror rule
2473 cmd->seid = cpu_to_le16(sw_seid); in i40e_mirrorrule_op()
2474 cmd->rule_type = cpu_to_le16(rule_type & in i40e_mirrorrule_op()
2476 cmd->num_entries = cpu_to_le16(count); in i40e_mirrorrule_op()
2478 cmd->destination = cpu_to_le16(id); in i40e_mirrorrule_op()
2489 hw->aq.asq_last_status == I40E_AQ_RC_ENOSPC) { in i40e_mirrorrule_op()
2491 *rule_id = le16_to_cpu(resp->rule_id); in i40e_mirrorrule_op()
2493 *rules_used = le16_to_cpu(resp->mirror_rules_used); in i40e_mirrorrule_op()
2495 *rules_free = le16_to_cpu(resp->mirror_rules_free); in i40e_mirrorrule_op()
2501 * i40e_aq_add_mirrorrule - add a mirror rule
2524 return -EINVAL; in i40e_aq_add_mirrorrule()
2533 * i40e_aq_delete_mirrorrule - delete a mirror rule
2560 return -EINVAL; in i40e_aq_delete_mirrorrule()
2572 * @v_opcode: opcodes for VF-PF communication
2590 cmd->id = cpu_to_le32(vfid); in i40e_aq_send_msg_to_vf()
2625 return -EINVAL; in i40e_aq_debug_read_register()
2629 cmd_resp->address = cpu_to_le32(reg_addr); in i40e_aq_debug_read_register()
2634 *reg_val = ((u64)le32_to_cpu(cmd_resp->value_high) << 32) | in i40e_aq_debug_read_register()
2635 (u64)le32_to_cpu(cmd_resp->value_low); in i40e_aq_debug_read_register()
2661 cmd->address = cpu_to_le32(reg_addr); in i40e_aq_debug_write_register()
2662 cmd->value_high = cpu_to_le32((u32)(reg_val >> 32)); in i40e_aq_debug_write_register()
2663 cmd->value_low = cpu_to_le32((u32)(reg_val & 0xFFFFFFFF)); in i40e_aq_debug_write_register()
2694 cmd_resp->resource_id = cpu_to_le16(resource); in i40e_aq_request_resource()
2695 cmd_resp->access_type = cpu_to_le16(access); in i40e_aq_request_resource()
2696 cmd_resp->resource_number = cpu_to_le32(sdp_number); in i40e_aq_request_resource()
2705 if (!status || hw->aq.asq_last_status == I40E_AQ_RC_EBUSY) in i40e_aq_request_resource()
2706 *timeout = le32_to_cpu(cmd_resp->timeout); in i40e_aq_request_resource()
2732 cmd->resource_id = cpu_to_le16(resource); in i40e_aq_release_resource()
2733 cmd->resource_number = cpu_to_le32(sdp_number); in i40e_aq_release_resource()
2764 status = -EINVAL; in i40e_aq_read_nvm()
2772 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD; in i40e_aq_read_nvm()
2773 cmd->module_pointer = module_pointer; in i40e_aq_read_nvm()
2774 cmd->offset = cpu_to_le32(offset); in i40e_aq_read_nvm()
2775 cmd->length = cpu_to_le16(length); in i40e_aq_read_nvm()
2809 status = -EINVAL; in i40e_aq_erase_nvm()
2817 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD; in i40e_aq_erase_nvm()
2818 cmd->module_pointer = module_pointer; in i40e_aq_erase_nvm()
2819 cmd->offset = cpu_to_le32(offset); in i40e_aq_erase_nvm()
2820 cmd->length = cpu_to_le16(length); in i40e_aq_erase_nvm()
2853 p = &hw->dev_caps; in i40e_parse_discover_capabilities()
2855 p = &hw->func_caps; in i40e_parse_discover_capabilities()
2860 id = le16_to_cpu(cap->id); in i40e_parse_discover_capabilities()
2861 number = le32_to_cpu(cap->number); in i40e_parse_discover_capabilities()
2862 logical_id = le32_to_cpu(cap->logical_id); in i40e_parse_discover_capabilities()
2863 phys_id = le32_to_cpu(cap->phys_id); in i40e_parse_discover_capabilities()
2864 major_rev = cap->major_rev; in i40e_parse_discover_capabilities()
2868 p->switch_mode = number; in i40e_parse_discover_capabilities()
2871 p->management_mode = number; in i40e_parse_discover_capabilities()
2873 p->mng_protocols_over_mctp = logical_id; in i40e_parse_discover_capabilities()
2876 p->mng_protocols_over_mctp); in i40e_parse_discover_capabilities()
2878 p->mng_protocols_over_mctp = 0; in i40e_parse_discover_capabilities()
2882 p->npar_enable = number; in i40e_parse_discover_capabilities()
2885 p->os2bmc = number; in i40e_parse_discover_capabilities()
2888 p->valid_functions = number; in i40e_parse_discover_capabilities()
2892 p->sr_iov_1_1 = true; in i40e_parse_discover_capabilities()
2895 p->num_vfs = number; in i40e_parse_discover_capabilities()
2896 p->vf_base_id = logical_id; in i40e_parse_discover_capabilities()
2900 p->vmdq = true; in i40e_parse_discover_capabilities()
2904 p->evb_802_1_qbg = true; in i40e_parse_discover_capabilities()
2908 p->evb_802_1_qbh = true; in i40e_parse_discover_capabilities()
2911 p->num_vsis = number; in i40e_parse_discover_capabilities()
2915 p->dcb = true; in i40e_parse_discover_capabilities()
2916 p->enabled_tcmap = logical_id; in i40e_parse_discover_capabilities()
2917 p->maxtc = phys_id; in i40e_parse_discover_capabilities()
2922 p->fcoe = true; in i40e_parse_discover_capabilities()
2926 p->iscsi = true; in i40e_parse_discover_capabilities()
2929 p->rss = true; in i40e_parse_discover_capabilities()
2930 p->rss_table_size = number; in i40e_parse_discover_capabilities()
2931 p->rss_table_entry_width = logical_id; in i40e_parse_discover_capabilities()
2934 p->num_rx_qp = number; in i40e_parse_discover_capabilities()
2935 p->base_queue = phys_id; in i40e_parse_discover_capabilities()
2938 p->num_tx_qp = number; in i40e_parse_discover_capabilities()
2939 p->base_queue = phys_id; in i40e_parse_discover_capabilities()
2942 p->num_msix_vectors = number; in i40e_parse_discover_capabilities()
2945 p->num_msix_vectors); in i40e_parse_discover_capabilities()
2948 p->num_msix_vectors_vf = number; in i40e_parse_discover_capabilities()
2953 p->flex10_enable = true; in i40e_parse_discover_capabilities()
2954 p->flex10_capable = true; in i40e_parse_discover_capabilities()
2959 p->flex10_enable = true; in i40e_parse_discover_capabilities()
2961 p->flex10_capable = true; in i40e_parse_discover_capabilities()
2963 p->flex10_mode = logical_id; in i40e_parse_discover_capabilities()
2964 p->flex10_status = phys_id; in i40e_parse_discover_capabilities()
2968 p->mgmt_cem = true; in i40e_parse_discover_capabilities()
2972 p->iwarp = true; in i40e_parse_discover_capabilities()
2976 p->led[phys_id] = true; in i40e_parse_discover_capabilities()
2980 p->sdp[phys_id] = true; in i40e_parse_discover_capabilities()
2984 p->mdio_port_num = phys_id; in i40e_parse_discover_capabilities()
2985 p->mdio_port_mode = logical_id; in i40e_parse_discover_capabilities()
2990 p->ieee_1588 = true; in i40e_parse_discover_capabilities()
2993 p->fd = true; in i40e_parse_discover_capabilities()
2994 p->fd_filters_guaranteed = number; in i40e_parse_discover_capabilities()
2995 p->fd_filters_best_effort = logical_id; in i40e_parse_discover_capabilities()
2998 p->wr_csr_prot = (u64)number; in i40e_parse_discover_capabilities()
2999 p->wr_csr_prot |= (u64)logical_id << 32; in i40e_parse_discover_capabilities()
3003 p->sec_rev_disabled = true; in i40e_parse_discover_capabilities()
3005 p->update_disabled = true; in i40e_parse_discover_capabilities()
3012 if (p->fcoe) in i40e_parse_discover_capabilities()
3018 if (p->npar_enable || p->flex10_enable) in i40e_parse_discover_capabilities()
3019 p->fcoe = false; in i40e_parse_discover_capabilities()
3022 hw->num_ports = 0; in i40e_parse_discover_capabilities()
3032 hw->num_ports++; in i40e_parse_discover_capabilities()
3042 if (hw->mac.type == I40E_MAC_X722) { in i40e_parse_discover_capabilities()
3050 hw->num_ports = 4; in i40e_parse_discover_capabilities()
3055 valid_functions = p->valid_functions; in i40e_parse_discover_capabilities()
3063 /* partition id is 1-based, and functions are evenly spread in i40e_parse_discover_capabilities()
3066 if (hw->num_ports != 0) { in i40e_parse_discover_capabilities()
3067 hw->partition_id = (hw->pf_id / hw->num_ports) + 1; in i40e_parse_discover_capabilities()
3068 hw->num_partitions = num_functions / hw->num_ports; in i40e_parse_discover_capabilities()
3074 p->rx_buf_chain_len = I40E_MAX_CHAINED_RX_BUFFERS; in i40e_parse_discover_capabilities()
3083 * @list_type_opc: capabilities type to discover - pass in the command opcode
3101 status = -EINVAL; in i40e_aq_discover_capabilities()
3117 i40e_parse_discover_capabilities(hw, buff, le32_to_cpu(cmd->count), in i40e_aq_discover_capabilities()
3149 status = -EINVAL; in i40e_aq_update_nvm()
3157 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD; in i40e_aq_update_nvm()
3158 if (hw->mac.type == I40E_MAC_X722) { in i40e_aq_update_nvm()
3160 cmd->command_flags |= in i40e_aq_update_nvm()
3164 cmd->command_flags |= in i40e_aq_update_nvm()
3168 cmd->module_pointer = module_pointer; in i40e_aq_update_nvm()
3169 cmd->offset = cpu_to_le32(offset); in i40e_aq_update_nvm()
3170 cmd->length = cpu_to_le16(length); in i40e_aq_update_nvm()
3206 status = -EINVAL; in i40e_aq_rearrange_nvm()
3210 cmd->command_flags |= rearrange_nvm; in i40e_aq_rearrange_nvm()
3243 return -EINVAL; in i40e_aq_get_lldp_mib()
3249 cmd->type = mib_type & I40E_AQ_LLDP_MIB_TYPE_MASK; in i40e_aq_get_lldp_mib()
3250 cmd->type |= FIELD_PREP(I40E_AQ_LLDP_BRIDGE_TYPE_MASK, bridge_type); in i40e_aq_get_lldp_mib()
3261 *local_len = le16_to_cpu(resp->local_len); in i40e_aq_get_lldp_mib()
3263 *remote_len = le16_to_cpu(resp->remote_len); in i40e_aq_get_lldp_mib()
3270 * i40e_aq_set_lldp_mib - Set the LLDP MIB
3290 return -EINVAL; in i40e_aq_set_lldp_mib()
3300 cmd->type = mib_type; in i40e_aq_set_lldp_mib()
3301 cmd->length = cpu_to_le16(buff_size); in i40e_aq_set_lldp_mib()
3302 cmd->address_high = cpu_to_le32(upper_32_bits((uintptr_t)buff)); in i40e_aq_set_lldp_mib()
3303 cmd->address_low = cpu_to_le32(lower_32_bits((uintptr_t)buff)); in i40e_aq_set_lldp_mib()
3330 cmd->command |= I40E_AQ_LLDP_MIB_UPDATE_DISABLE; in i40e_aq_cfg_lldp_mib_change_event()
3356 if (!test_bit(I40E_HW_CAP_FW_LLDP_PERSISTENT, hw->caps)) { in i40e_aq_restore_lldp()
3359 return -ENODEV; in i40e_aq_restore_lldp()
3365 cmd->command |= I40E_AQ_LLDP_AGENT_RESTORE; in i40e_aq_restore_lldp()
3370 *setting = cmd->command & 1; in i40e_aq_restore_lldp()
3396 cmd->command |= I40E_AQ_LLDP_AGENT_SHUTDOWN; in i40e_aq_stop_lldp()
3399 if (test_bit(I40E_HW_CAP_FW_LLDP_PERSISTENT, hw->caps)) in i40e_aq_stop_lldp()
3400 cmd->command |= I40E_AQ_LLDP_AGENT_STOP_PERSIST; in i40e_aq_stop_lldp()
3429 cmd->command = I40E_AQ_LLDP_AGENT_START; in i40e_aq_start_lldp()
3432 if (test_bit(I40E_HW_CAP_FW_LLDP_PERSISTENT, hw->caps)) in i40e_aq_start_lldp()
3433 cmd->command |= I40E_AQ_LLDP_AGENT_START_PERSIST; in i40e_aq_start_lldp()
3460 if (!test_bit(I40E_HW_CAP_FW_LLDP_STOPPABLE, hw->caps)) in i40e_aq_set_dcb_parameters()
3461 return -ENODEV; in i40e_aq_set_dcb_parameters()
3467 cmd->valid_flags = I40E_DCB_VALID; in i40e_aq_set_dcb_parameters()
3468 cmd->command = I40E_AQ_DCB_SET_AGENT; in i40e_aq_set_dcb_parameters()
3492 return -EINVAL; in i40e_aq_get_cee_dcb_config()
3529 cmd->udp_port = cpu_to_le16(udp_port); in i40e_aq_add_udp_tunnel()
3530 cmd->protocol_type = protocol_index; in i40e_aq_add_udp_tunnel()
3535 *filter_index = resp->index; in i40e_aq_add_udp_tunnel()
3556 cmd->index = index; in i40e_aq_del_udp_tunnel()
3564 * i40e_aq_delete_element - Delete switch element
3580 return -EINVAL; in i40e_aq_delete_element()
3584 cmd->seid = cpu_to_le16(seid); in i40e_aq_delete_element()
3593 * i40e_aq_dcb_updated - DCB Updated Command
3615 * i40e_aq_tx_sched_cmd - generic Tx scheduler AQ command handler
3654 return -EINVAL; in i40e_aq_tx_sched_cmd()
3668 cmd->vsi_seid = cpu_to_le16(seid); in i40e_aq_tx_sched_cmd()
3676 * i40e_aq_config_vsi_bw_limit - Configure VSI BW Limit
3695 cmd->vsi_seid = cpu_to_le16(seid); in i40e_aq_config_vsi_bw_limit()
3696 cmd->credit = cpu_to_le16(credit); in i40e_aq_config_vsi_bw_limit()
3697 cmd->max_credit = max_credit; in i40e_aq_config_vsi_bw_limit()
3705 * i40e_aq_config_vsi_tc_bw - Config VSI BW Allocation per TC
3722 * i40e_aq_config_switch_comp_ets - Enable/Disable/Modify ETS on the port
3741 * i40e_aq_config_switch_comp_bw_config - Config Switch comp BW Alloc per TC
3759 * i40e_aq_query_vsi_bw_config - Query VSI BW configuration
3777 * i40e_aq_query_vsi_ets_sla_config - Query VSI BW configuration per TC
3795 * i40e_aq_query_switch_comp_ets_config - Query Switch comp BW config per TC
3813 * i40e_aq_query_port_ets_config - Query Physical Port ETS configuration
3831 * i40e_aq_query_switch_comp_bw_config - Query Switch comp BW configuration
3869 switch (settings->fcoe_filt_num) { in i40e_validate_filter_settings()
3877 fcoe_filt_size <<= (u32)settings->fcoe_filt_num; in i40e_validate_filter_settings()
3880 return -EINVAL; in i40e_validate_filter_settings()
3883 switch (settings->fcoe_cntx_num) { in i40e_validate_filter_settings()
3889 fcoe_cntx_size <<= (u32)settings->fcoe_cntx_num; in i40e_validate_filter_settings()
3892 return -EINVAL; in i40e_validate_filter_settings()
3896 switch (settings->pe_filt_num) { in i40e_validate_filter_settings()
3910 return -EINVAL; in i40e_validate_filter_settings()
3913 switch (settings->pe_cntx_num) { in i40e_validate_filter_settings()
3926 return -EINVAL; in i40e_validate_filter_settings()
3933 return -EINVAL; in i40e_validate_filter_settings()
3955 return -EINVAL; in i40e_set_filter_control()
3967 val |= FIELD_PREP(I40E_PFQF_CTL_0_PEHSIZE_MASK, settings->pe_filt_num); in i40e_set_filter_control()
3970 val |= FIELD_PREP(I40E_PFQF_CTL_0_PEDSIZE_MASK, settings->pe_cntx_num); in i40e_set_filter_control()
3975 settings->fcoe_filt_num); in i40e_set_filter_control()
3979 settings->fcoe_cntx_num); in i40e_set_filter_control()
3983 if (settings->hash_lut_size == I40E_HASH_LUT_SIZE_512) in i40e_set_filter_control()
3988 if (settings->enable_fdir) in i40e_set_filter_control()
3990 if (settings->enable_ethtype) in i40e_set_filter_control()
3992 if (settings->enable_macvlan) in i40e_set_filter_control()
4001 * i40e_aq_add_rem_control_packet_filter - Add or Remove Control Packet Filter
4003 * @mac_addr: MAC address to use in the filter
4032 return -EINVAL; in i40e_aq_add_rem_control_packet_filter()
4037 cmd->queue = cpu_to_le16(queue); in i40e_aq_add_rem_control_packet_filter()
4044 ether_addr_copy(cmd->mac, mac_addr); in i40e_aq_add_rem_control_packet_filter()
4046 cmd->etype = cpu_to_le16(ethtype); in i40e_aq_add_rem_control_packet_filter()
4047 cmd->flags = cpu_to_le16(flags); in i40e_aq_add_rem_control_packet_filter()
4048 cmd->seid = cpu_to_le16(vsi_seid); in i40e_aq_add_rem_control_packet_filter()
4053 stats->mac_etype_used = le16_to_cpu(resp->mac_etype_used); in i40e_aq_add_rem_control_packet_filter()
4054 stats->etype_used = le16_to_cpu(resp->etype_used); in i40e_aq_add_rem_control_packet_filter()
4055 stats->mac_etype_free = le16_to_cpu(resp->mac_etype_free); in i40e_aq_add_rem_control_packet_filter()
4056 stats->etype_free = le16_to_cpu(resp->etype_free); in i40e_aq_add_rem_control_packet_filter()
4063 * i40e_add_filter_to_drop_tx_flow_control_frames- filter to drop flow control
4107 return -EINVAL; in i40e_aq_alternate_read()
4110 cmd_resp->address0 = cpu_to_le32(reg_addr0); in i40e_aq_alternate_read()
4111 cmd_resp->address1 = cpu_to_le32(reg_addr1); in i40e_aq_alternate_read()
4116 *reg_val0 = le32_to_cpu(cmd_resp->data0); in i40e_aq_alternate_read()
4119 *reg_val1 = le32_to_cpu(cmd_resp->data1); in i40e_aq_alternate_read()
4142 cmd->vsi_seid = cpu_to_le16(seid); in i40e_aq_suspend_port_tx()
4169 * i40e_set_pci_config_data - store PCI bus info
4177 hw->bus.type = i40e_bus_type_pci_express; in i40e_set_pci_config_data()
4181 hw->bus.width = i40e_bus_width_pcie_x1; in i40e_set_pci_config_data()
4184 hw->bus.width = i40e_bus_width_pcie_x2; in i40e_set_pci_config_data()
4187 hw->bus.width = i40e_bus_width_pcie_x4; in i40e_set_pci_config_data()
4190 hw->bus.width = i40e_bus_width_pcie_x8; in i40e_set_pci_config_data()
4193 hw->bus.width = i40e_bus_width_unknown; in i40e_set_pci_config_data()
4199 hw->bus.speed = i40e_bus_speed_2500; in i40e_set_pci_config_data()
4202 hw->bus.speed = i40e_bus_speed_5000; in i40e_set_pci_config_data()
4205 hw->bus.speed = i40e_bus_speed_8000; in i40e_set_pci_config_data()
4208 hw->bus.speed = i40e_bus_speed_unknown; in i40e_set_pci_config_data()
4243 return -EINVAL; in i40e_aq_debug_dump()
4252 cmd->cluster_id = cluster_id; in i40e_aq_debug_dump()
4253 cmd->table_id = table_id; in i40e_aq_debug_dump()
4254 cmd->idx = cpu_to_le32(start_index); in i40e_aq_debug_dump()
4263 *ret_next_table = resp->table_id; in i40e_aq_debug_dump()
4265 *ret_next_index = le32_to_cpu(resp->idx); in i40e_aq_debug_dump()
4291 (I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id); in i40e_read_bw_from_alt_ram()
4294 (I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id); in i40e_read_bw_from_alt_ram()
4360 u8 port_num = (u8)hw->func_caps.mdio_port_num; in i40e_read_phy_register_clause22()
4361 int status = -EIO; in i40e_read_phy_register_clause22()
4378 retry--; in i40e_read_phy_register_clause22()
4404 u8 port_num = (u8)hw->func_caps.mdio_port_num; in i40e_write_phy_register_clause22()
4405 int status = -EIO; in i40e_write_phy_register_clause22()
4426 retry--; in i40e_write_phy_register_clause22()
4445 u8 port_num = hw->func_caps.mdio_port_num; in i40e_read_phy_register_clause45()
4446 int status = -EIO; in i40e_read_phy_register_clause45()
4465 retry--; in i40e_read_phy_register_clause45()
4480 status = -EIO; in i40e_read_phy_register_clause45()
4490 retry--; in i40e_read_phy_register_clause45()
4518 u8 port_num = hw->func_caps.mdio_port_num; in i40e_write_phy_register_clause45()
4519 int status = -EIO; in i40e_write_phy_register_clause45()
4538 retry--; in i40e_write_phy_register_clause45()
4555 status = -EIO; in i40e_write_phy_register_clause45()
4565 retry--; in i40e_write_phy_register_clause45()
4587 switch (hw->device_id) { in i40e_write_phy_register()
4604 status = -EIO; in i40e_write_phy_register()
4626 switch (hw->device_id) { in i40e_read_phy_register()
4643 status = -EIO; in i40e_read_phy_register()
4659 u8 port_num = hw->func_caps.mdio_port_num; in i40e_get_phy_address()
4740 * i40e_led_get_reg - read LED register
4754 if (test_bit(I40E_HW_CAP_AQ_PHY_ACCESS, hw->caps)) { in i40e_led_get_reg()
4774 * i40e_led_set_reg - write LED register
4787 if (test_bit(I40E_HW_CAP_AQ_PHY_ACCESS, hw->caps)) { in i40e_led_set_reg()
4808 * i40e_led_get_phy - return current on/off mode
4826 if (test_bit(I40E_HW_CAP_AQ_PHY_ACCESS, hw->caps)) { in i40e_led_get_phy()
4909 * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
4928 return -EINVAL; in i40e_aq_rx_ctl_read_register()
4932 cmd_resp->address = cpu_to_le32(reg_addr); in i40e_aq_rx_ctl_read_register()
4937 *reg_val = le32_to_cpu(cmd_resp->value); in i40e_aq_rx_ctl_read_register()
4943 * i40e_read_rx_ctl - read from an Rx control register
4954 if (i40e_is_aq_api_ver_lt(hw, 1, 5) || hw->mac.type == I40E_MAC_X722) in i40e_read_rx_ctl()
4960 if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN && retry) { in i40e_read_rx_ctl()
4962 retry--; in i40e_read_rx_ctl()
4967 /* if the AQ access failed, try the old-fashioned way */ in i40e_read_rx_ctl()
4995 cmd->address = cpu_to_le32(reg_addr); in i40e_aq_rx_ctl_write_register()
4996 cmd->value = cpu_to_le32(reg_val); in i40e_aq_rx_ctl_write_register()
5004 * i40e_write_rx_ctl - write to an Rx control register
5015 if (i40e_is_aq_api_ver_lt(hw, 1, 5) || hw->mac.type == I40E_MAC_X722) in i40e_write_rx_ctl()
5022 if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN && retry) { in i40e_write_rx_ctl()
5024 retry--; in i40e_write_rx_ctl()
5029 /* if the AQ access failed, try the old-fashioned way */ in i40e_write_rx_ctl()
5035 * i40e_mdio_if_number_selection - MDIO I/F number selection
5046 cmd->phy_interface != I40E_AQ_PHY_REG_ACCESS_EXTERNAL) in i40e_mdio_if_number_selection()
5049 if (test_bit(I40E_HW_CAP_AQ_PHY_ACCESS_EXTENDED, hw->caps)) { in i40e_mdio_if_number_selection()
5050 cmd->cmd_flags |= in i40e_mdio_if_number_selection()
5089 cmd->phy_interface = phy_select; in i40e_aq_set_phy_register_ext()
5090 cmd->dev_address = dev_addr; in i40e_aq_set_phy_register_ext()
5091 cmd->reg_address = cpu_to_le32(reg_addr); in i40e_aq_set_phy_register_ext()
5092 cmd->reg_value = cpu_to_le32(reg_val); in i40e_aq_set_phy_register_ext()
5097 cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE; in i40e_aq_set_phy_register_ext()
5134 cmd->phy_interface = phy_select; in i40e_aq_get_phy_register_ext()
5135 cmd->dev_address = dev_addr; in i40e_aq_get_phy_register_ext()
5136 cmd->reg_address = cpu_to_le32(reg_addr); in i40e_aq_get_phy_register_ext()
5141 cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE; in i40e_aq_get_phy_register_ext()
5145 *reg_val = le32_to_cpu(cmd->reg_value); in i40e_aq_get_phy_register_ext()
5151 * i40e_aq_write_ddp - Write dynamic device personalization (ddp)
5181 cmd->profile_track_id = cpu_to_le32(track_id); in i40e_aq_write_ddp()
5187 *error_offset = le32_to_cpu(resp->error_offset); in i40e_aq_write_ddp()
5189 *error_info = le32_to_cpu(resp->error_info); in i40e_aq_write_ddp()
5196 * i40e_aq_get_ddp_list - Read dynamic device personalization (ddp)
5220 cmd->flags = flags; in i40e_aq_get_ddp_list()
5244 for (i = 0; i < pkg_hdr->segment_count; i++) { in i40e_find_segment_in_package()
5247 pkg_hdr->segment_offset[i]); in i40e_find_segment_in_package()
5249 if (segment->type == segment_type) in i40e_find_segment_in_package()
5262 count = p->device_table_count; \
5263 nvm = (u32 *)&p->device_table[count]; \
5289 if (profile->header.type != SEGMENT_TYPE_I40E) in i40e_find_section_in_profile()
5294 for (i = 0; i < sec_tbl->section_count; i++) { in i40e_find_section_in_profile()
5295 sec_off = sec_tbl->section_offset[i]; in i40e_find_section_in_profile()
5297 if (sec->section.type == section_type) in i40e_find_section_in_profile()
5305 * i40e_ddp_exec_aq_section - Execute generic AQ for DDP
5317 i40e_fill_default_direct_cmd_desc(&desc, aq->opcode); in i40e_ddp_exec_aq_section()
5318 desc.flags |= cpu_to_le16(aq->flags); in i40e_ddp_exec_aq_section()
5319 memcpy(desc.params.raw, aq->param, sizeof(desc.params.raw)); in i40e_ddp_exec_aq_section()
5321 msglen = aq->datalen; in i40e_ddp_exec_aq_section()
5328 msg = &aq->data[0]; in i40e_ddp_exec_aq_section()
5336 aq->opcode, status); in i40e_ddp_exec_aq_section()
5341 memcpy(aq->param, desc.params.raw, sizeof(desc.params.raw)); in i40e_ddp_exec_aq_section()
5369 return -EOPNOTSUPP; in i40e_validate_profile()
5372 dev_cnt = profile->device_table_count; in i40e_validate_profile()
5374 vendor_dev_id = profile->device_table[i].vendor_dev_id; in i40e_validate_profile()
5376 hw->device_id == (vendor_dev_id & 0xFFFF)) in i40e_validate_profile()
5382 return -ENODEV; in i40e_validate_profile()
5388 for (i = 0; i < sec_tbl->section_count; i++) { in i40e_validate_profile()
5389 sec_off = sec_tbl->section_offset[i]; in i40e_validate_profile()
5392 if (sec->section.type == SECTION_TYPE_MMIO || in i40e_validate_profile()
5393 sec->section.type == SECTION_TYPE_AQ || in i40e_validate_profile()
5394 sec->section.type == SECTION_TYPE_RB_AQ) { in i40e_validate_profile()
5396 "Not a roll-back package\n"); in i40e_validate_profile()
5397 return -EOPNOTSUPP; in i40e_validate_profile()
5400 if (sec->section.type == SECTION_TYPE_RB_AQ || in i40e_validate_profile()
5401 sec->section.type == SECTION_TYPE_RB_MMIO) { in i40e_validate_profile()
5404 return -EOPNOTSUPP; in i40e_validate_profile()
5439 for (i = 0; i < sec_tbl->section_count; i++) { in i40e_write_profile()
5440 sec_off = sec_tbl->section_offset[i]; in i40e_write_profile()
5443 if (sec->section.type == SECTION_TYPE_AQ) { in i40e_write_profile()
5449 i, ddp_aq->opcode); in i40e_write_profile()
5452 sec->section.type = SECTION_TYPE_RB_AQ; in i40e_write_profile()
5455 /* Skip any non-mmio sections */ in i40e_write_profile()
5456 if (sec->section.type != SECTION_TYPE_MMIO) in i40e_write_profile()
5459 section_size = sec->section.size + in i40e_write_profile()
5502 for (i = sec_tbl->section_count - 1; i >= 0; i--) { in i40e_rollback_profile()
5503 sec_off = sec_tbl->section_offset[i]; in i40e_rollback_profile()
5506 /* Skip any non-rollback sections */ in i40e_rollback_profile()
5507 if (sec->section.type != SECTION_TYPE_RB_MMIO) in i40e_rollback_profile()
5510 section_size = sec->section.size + in i40e_rollback_profile()
5513 /* Write roll-back MMIO section */ in i40e_rollback_profile()
5546 sec->tbl_size = 1; in i40e_add_pinfo_to_list()
5547 sec->data_end = sizeof(struct i40e_profile_section_header) + in i40e_add_pinfo_to_list()
5549 sec->section.type = SECTION_TYPE_INFO; in i40e_add_pinfo_to_list()
5550 sec->section.offset = sizeof(struct i40e_profile_section_header); in i40e_add_pinfo_to_list()
5551 sec->section.size = sizeof(struct i40e_profile_info); in i40e_add_pinfo_to_list()
5553 sec->section.offset); in i40e_add_pinfo_to_list()
5554 pinfo->track_id = track_id; in i40e_add_pinfo_to_list()
5555 pinfo->version = profile->version; in i40e_add_pinfo_to_list()
5556 pinfo->op = I40E_DDP_ADD_TRACKID; in i40e_add_pinfo_to_list()
5557 memcpy(pinfo->name, profile->name, I40E_DDP_NAME_SIZE); in i40e_add_pinfo_to_list()
5559 status = i40e_aq_write_ddp(hw, (void *)sec, sec->data_end, in i40e_add_pinfo_to_list()
5594 cmd->num_filters = filter_count; in i40e_aq_add_cloud_filters()
5595 cmd->seid = cpu_to_le16(seid); in i40e_aq_add_cloud_filters()
5632 cmd->num_filters = filter_count; in i40e_aq_add_cloud_filters_bb()
5633 cmd->seid = cpu_to_le16(seid); in i40e_aq_add_cloud_filters_bb()
5634 cmd->big_buffer_flag = I40E_AQC_ADD_CLOUD_CMD_BB; in i40e_aq_add_cloud_filters_bb()
5687 cmd->num_filters = filter_count; in i40e_aq_rem_cloud_filters()
5688 cmd->seid = cpu_to_le16(seid); in i40e_aq_rem_cloud_filters()
5725 cmd->num_filters = filter_count; in i40e_aq_rem_cloud_filters_bb()
5726 cmd->seid = cpu_to_le16(seid); in i40e_aq_rem_cloud_filters_bb()
5727 cmd->big_buffer_flag = I40E_AQC_ADD_CLOUD_CMD_BB; in i40e_aq_rem_cloud_filters_bb()