Lines Matching +full:mac +full:- +full:address0

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2021 Intel Corporation. */
11 * i40e_set_mac_type - Sets MAC type
14 * This function sets the mac type of the adapter based on the
21 if (hw->vendor_id == PCI_VENDOR_ID_INTEL) { in i40e_set_mac_type()
22 switch (hw->device_id) { in i40e_set_mac_type()
43 hw->mac.type = I40E_MAC_XL710; in i40e_set_mac_type()
52 hw->mac.type = I40E_MAC_X722; in i40e_set_mac_type()
55 hw->mac.type = I40E_MAC_GENERIC; in i40e_set_mac_type()
62 hw_dbg(hw, "i40e_set_mac_type found mac: %d, returns: %d\n", in i40e_set_mac_type()
63 hw->mac.type, status); in i40e_set_mac_type()
68 * i40e_aq_str - convert AQ err code to a string
123 snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err); in i40e_aq_str()
124 return hw->err_str; in i40e_aq_str()
128 * i40e_stat_str - convert status err code to a string
271 snprintf(hw->err_str, sizeof(hw->err_str), "%d", stat_err); in i40e_stat_str()
272 return hw->err_str; in i40e_stat_str()
289 u32 effective_mask = hw->debug_mask & mask; in i40e_debug_aq()
297 len = le16_to_cpu(aq_desc->datalen); in i40e_debug_aq()
301 le16_to_cpu(aq_desc->opcode), in i40e_debug_aq()
302 le16_to_cpu(aq_desc->flags), in i40e_debug_aq()
303 le16_to_cpu(aq_desc->datalen), in i40e_debug_aq()
304 le16_to_cpu(aq_desc->retval)); in i40e_debug_aq()
307 le32_to_cpu(aq_desc->cookie_high), in i40e_debug_aq()
308 le32_to_cpu(aq_desc->cookie_low)); in i40e_debug_aq()
311 le32_to_cpu(aq_desc->params.internal.param0), in i40e_debug_aq()
312 le32_to_cpu(aq_desc->params.internal.param1)); in i40e_debug_aq()
315 le32_to_cpu(aq_desc->params.external.addr_high), in i40e_debug_aq()
316 le32_to_cpu(aq_desc->params.external.addr_low)); in i40e_debug_aq()
326 hw->bus.bus_id, in i40e_debug_aq()
327 hw->bus.device, in i40e_debug_aq()
328 hw->bus.func); in i40e_debug_aq()
343 if (hw->aq.asq.len) in i40e_check_asq_alive()
344 return !!(rd32(hw, hw->aq.asq.len) & in i40e_check_asq_alive()
370 cmd->driver_unloading = cpu_to_le32(I40E_AQ_DRIVER_UNLOADING); in i40e_aq_queue_shutdown()
408 cmd_resp->vsi_id = in i40e_aq_get_set_rss_lut()
412 cmd_resp->vsi_id |= cpu_to_le16((u16)I40E_AQC_SET_RSS_LUT_VSI_VALID); in i40e_aq_get_set_rss_lut()
415 cmd_resp->flags |= cpu_to_le16((u16) in i40e_aq_get_set_rss_lut()
420 cmd_resp->flags |= cpu_to_le16((u16) in i40e_aq_get_set_rss_lut()
494 cmd_resp->vsi_id = in i40e_aq_get_set_rss_key()
498 cmd_resp->vsi_id |= cpu_to_le16((u16)I40E_AQC_SET_RSS_KEY_VSI_VALID); in i40e_aq_get_set_rss_key()
534 /* The i40e_ptype_lookup table is used to convert from the 8-bit ptype in the
535 * hardware to a bit-field that can be used by SW to more easily determine the
541 * We store the PTYPE in the top byte of the bit field - this is just so that
577 /* Lookup table mapping in the 8-bit HW PTYPE to the bit field for decoding */
612 /* IPv4 --> IPv4 */
621 /* IPv4 --> IPv6 */
630 /* IPv4 --> GRE/NAT */
633 /* IPv4 --> GRE/NAT --> IPv4 */
642 /* IPv4 --> GRE/NAT --> IPv6 */
651 /* IPv4 --> GRE/NAT --> MAC */
654 /* IPv4 --> GRE/NAT --> MAC --> IPv4 */
663 /* IPv4 --> GRE/NAT -> MAC --> IPv6 */
672 /* IPv4 --> GRE/NAT --> MAC/VLAN */
675 /* IPv4 ---> GRE/NAT -> MAC/VLAN --> IPv4 */
684 /* IPv4 -> GRE/NAT -> MAC/VLAN --> IPv6 */
702 /* IPv6 --> IPv4 */
711 /* IPv6 --> IPv6 */
720 /* IPv6 --> GRE/NAT */
723 /* IPv6 --> GRE/NAT -> IPv4 */
732 /* IPv6 --> GRE/NAT -> IPv6 */
741 /* IPv6 --> GRE/NAT -> MAC */
744 /* IPv6 --> GRE/NAT -> MAC -> IPv4 */
753 /* IPv6 --> GRE/NAT -> MAC -> IPv6 */
762 /* IPv6 --> GRE/NAT -> MAC/VLAN */
765 /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv4 */
774 /* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv6 */
788 * i40e_init_shared_code - Initialize the shared code
791 * This assigns the MAC type and PHY code and inits the NVM.
806 switch (hw->mac.type) { in i40e_init_shared_code()
814 hw->phy.get_link_info = true; in i40e_init_shared_code()
819 hw->port = (u8)port; in i40e_init_shared_code()
824 hw->pf_id = (u8)(func_rid & 0xff); in i40e_init_shared_code()
826 hw->pf_id = (u8)(func_rid & 0x7); in i40e_init_shared_code()
833 * i40e_aq_mac_address_read - Retrieve the MAC addresses
836 * @addrs: the requestor's mac addr store
854 *flags = le16_to_cpu(cmd_data->command_flags); in i40e_aq_mac_address_read()
860 * i40e_aq_mac_address_write - Change the MAC addresses
862 * @flags: indicates which MAC to be written
877 cmd_data->command_flags = cpu_to_le16(flags); in i40e_aq_mac_address_write()
878 cmd_data->mac_sah = cpu_to_le16((u16)mac_addr[0] << 8 | mac_addr[1]); in i40e_aq_mac_address_write()
879 cmd_data->mac_sal = cpu_to_le32(((u32)mac_addr[2] << 24) | in i40e_aq_mac_address_write()
890 * i40e_get_mac_addr - get MAC address
892 * @mac_addr: pointer to MAC address
894 * Reads the adapter's MAC address from register
911 * i40e_get_port_mac_addr - get Port MAC address
913 * @mac_addr: pointer to Port MAC address
915 * Reads the adapter's Port MAC address
936 * i40e_pre_tx_queue_cfg - pre tx queue configure
946 u32 abs_queue_idx = hw->func_caps.base_queue + queue; in i40e_pre_tx_queue_cfg()
968 * i40e_read_pba_string - Reads part number string from EEPROM
1005 pba_size--; in i40e_read_pba_string()
1027 * i40e_get_media_type - Gets media type
1034 switch (hw->phy.link_info.phy_type) { in i40e_get_media_type()
1086 * i40e_poll_globr - Poll for Global Reset completion
1111 * i40e_pf_reset - Reset the PF
1172 if (hw->revision_id == 0) in i40e_pf_reset()
1179 for (; cnt; cnt--) { in i40e_pf_reset()
1203 * i40e_clear_hw - clear out any left over hw state
1233 num_queues = (j - base_queue) + 1; in i40e_clear_hw()
1243 num_vfs = (j - i) + 1; in i40e_clear_hw()
1250 for (i = 0; i < num_pf_int - 2; i++) in i40e_clear_hw()
1256 for (i = 0; i < num_pf_int - 2; i++) in i40e_clear_hw()
1261 for (i = 0; i < num_vf_int - 2; i++) in i40e_clear_hw()
1296 * i40e_clear_pxe_mode - clear pxe operations mode
1300 * like descriptor fetch/write-back mode.
1309 /* Clear single descriptor fetch/write-back mode */ in i40e_clear_pxe_mode()
1312 if (hw->revision_id == 0) { in i40e_clear_pxe_mode()
1321 * i40e_led_is_mine - helper to find matching led
1332 if (!I40E_IS_X710TL_DEVICE(hw->device_id) && in i40e_led_is_mine()
1333 !hw->func_caps.led[idx]) in i40e_led_is_mine()
1343 (port != hw->port)) in i40e_led_is_mine()
1359 * i40e_led_get - return current on/off mode
1372 /* as per the documentation GPIO 22-29 are the LED in i40e_led_get()
1390 * i40e_led_set - set new on/off mode
1407 /* as per the documentation GPIO 22-29 are the LED in i40e_led_set()
1416 if (I40E_IS_X710TL_DEVICE(hw->device_id)) { in i40e_led_set()
1488 switch (hw->aq.asq_last_status) { in i40e_aq_get_phy_capabilities()
1502 } while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) && in i40e_aq_get_phy_capabilities()
1509 if (hw->mac.type == I40E_MAC_XL710 && in i40e_aq_get_phy_capabilities()
1510 hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && in i40e_aq_get_phy_capabilities()
1511 hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) { in i40e_aq_get_phy_capabilities()
1514 hw->phy.phy_types = le32_to_cpu(abilities->phy_type); in i40e_aq_get_phy_capabilities()
1515 hw->phy.phy_types |= in i40e_aq_get_phy_capabilities()
1516 ((u64)abilities->phy_type_ext << 32); in i40e_aq_get_phy_capabilities()
1563 enum i40e_fc_mode fc_mode = hw->fc.requested_mode; in i40e_set_fc_status()
1583 config.abilities = abilities->abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX) & in i40e_set_fc_status()
1588 if (config.abilities == abilities->abilities) in i40e_set_fc_status()
1595 config.phy_type = abilities->phy_type; in i40e_set_fc_status()
1596 config.phy_type_ext = abilities->phy_type_ext; in i40e_set_fc_status()
1597 config.link_speed = abilities->link_speed; in i40e_set_fc_status()
1598 config.eee_capability = abilities->eee_capability; in i40e_set_fc_status()
1599 config.eeer = abilities->eeer_val; in i40e_set_fc_status()
1600 config.low_power_ctrl = abilities->d3_lpan; in i40e_set_fc_status()
1601 config.fec_config = abilities->fec_cfg_curr_mod_ext_info & in i40e_set_fc_status()
1669 cmd->rx_cnt = 0x2; in i40e_aq_clear_pxe_mode()
1684 * Sets up the link and restarts the Auto-Negotiation over the link.
1698 cmd->command = I40E_AQ_PHY_RESTART_AN; in i40e_aq_set_link_restart_an()
1700 cmd->command |= I40E_AQ_PHY_LINK_ENABLE; in i40e_aq_set_link_restart_an()
1702 cmd->command &= ~I40E_AQ_PHY_LINK_ENABLE; in i40e_aq_set_link_restart_an()
1713 * @link: pointer to link status structure - optional
1725 struct i40e_link_status *hw_link_info = &hw->phy.link_info; in i40e_aq_get_link_info()
1736 resp->command_flags = cpu_to_le16(command_flags); in i40e_aq_get_link_info()
1744 hw->phy.link_info_old = *hw_link_info; in i40e_aq_get_link_info()
1747 hw_link_info->phy_type = (enum i40e_aq_phy_type)resp->phy_type; in i40e_aq_get_link_info()
1748 hw->phy.media_type = i40e_get_media_type(hw); in i40e_aq_get_link_info()
1749 hw_link_info->link_speed = (enum i40e_aq_link_speed)resp->link_speed; in i40e_aq_get_link_info()
1750 hw_link_info->link_info = resp->link_info; in i40e_aq_get_link_info()
1751 hw_link_info->an_info = resp->an_info; in i40e_aq_get_link_info()
1752 hw_link_info->fec_info = resp->config & (I40E_AQ_CONFIG_FEC_KR_ENA | in i40e_aq_get_link_info()
1754 hw_link_info->ext_info = resp->ext_info; in i40e_aq_get_link_info()
1755 hw_link_info->loopback = resp->loopback & I40E_AQ_LOOPBACK_MASK; in i40e_aq_get_link_info()
1756 hw_link_info->max_frame_size = le16_to_cpu(resp->max_frame_size); in i40e_aq_get_link_info()
1757 hw_link_info->pacing = resp->config & I40E_AQ_CONFIG_PACING_MASK; in i40e_aq_get_link_info()
1760 tx_pause = !!(resp->an_info & I40E_AQ_LINK_PAUSE_TX); in i40e_aq_get_link_info()
1761 rx_pause = !!(resp->an_info & I40E_AQ_LINK_PAUSE_RX); in i40e_aq_get_link_info()
1763 hw->fc.current_mode = I40E_FC_FULL; in i40e_aq_get_link_info()
1765 hw->fc.current_mode = I40E_FC_TX_PAUSE; in i40e_aq_get_link_info()
1767 hw->fc.current_mode = I40E_FC_RX_PAUSE; in i40e_aq_get_link_info()
1769 hw->fc.current_mode = I40E_FC_NONE; in i40e_aq_get_link_info()
1771 if (resp->config & I40E_AQ_CONFIG_CRC_ENA) in i40e_aq_get_link_info()
1772 hw_link_info->crc_enable = true; in i40e_aq_get_link_info()
1774 hw_link_info->crc_enable = false; in i40e_aq_get_link_info()
1776 if (resp->command_flags & cpu_to_le16(I40E_AQ_LSE_IS_ENABLED)) in i40e_aq_get_link_info()
1777 hw_link_info->lse_enable = true; in i40e_aq_get_link_info()
1779 hw_link_info->lse_enable = false; in i40e_aq_get_link_info()
1781 if ((hw->mac.type == I40E_MAC_XL710) && in i40e_aq_get_link_info()
1782 (hw->aq.fw_maj_ver < 4 || (hw->aq.fw_maj_ver == 4 && in i40e_aq_get_link_info()
1783 hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) in i40e_aq_get_link_info()
1784 hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; in i40e_aq_get_link_info()
1786 if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE && in i40e_aq_get_link_info()
1787 hw->mac.type != I40E_MAC_X722) { in i40e_aq_get_link_info()
1790 memcpy(&tmp, resp->link_type, sizeof(tmp)); in i40e_aq_get_link_info()
1791 hw->phy.phy_types = le32_to_cpu(tmp); in i40e_aq_get_link_info()
1792 hw->phy.phy_types |= ((u64)resp->link_type_ext << 32); in i40e_aq_get_link_info()
1800 hw->phy.get_link_info = false; in i40e_aq_get_link_info()
1826 cmd->event_mask = cpu_to_le16(mask); in i40e_aq_set_phy_int_mask()
1852 cmd->command_flags = cmd_flags; in i40e_aq_set_phy_debug()
1870 return (aq->api_maj_ver > maj || in i40e_is_aq_api_ver_ge()
1871 (aq->api_maj_ver == maj && aq->api_min_ver >= min)); in i40e_is_aq_api_ver_ge()
1897 cmd->uplink_seid = cpu_to_le16(vsi_ctx->uplink_seid); in i40e_aq_add_vsi()
1898 cmd->connection_type = vsi_ctx->connection_type; in i40e_aq_add_vsi()
1899 cmd->vf_id = vsi_ctx->vf_num; in i40e_aq_add_vsi()
1900 cmd->vsi_flags = cpu_to_le16(vsi_ctx->flags); in i40e_aq_add_vsi()
1904 status = i40e_asq_send_command_atomic(hw, &desc, &vsi_ctx->info, in i40e_aq_add_vsi()
1905 sizeof(vsi_ctx->info), in i40e_aq_add_vsi()
1911 vsi_ctx->seid = le16_to_cpu(resp->seid); in i40e_aq_add_vsi()
1912 vsi_ctx->vsi_number = le16_to_cpu(resp->vsi_number); in i40e_aq_add_vsi()
1913 vsi_ctx->vsis_allocated = le16_to_cpu(resp->vsi_used); in i40e_aq_add_vsi()
1914 vsi_ctx->vsis_unallocated = le16_to_cpu(resp->vsi_free); in i40e_aq_add_vsi()
1939 cmd->promiscuous_flags = cpu_to_le16(I40E_AQC_SET_VSI_DEFAULT); in i40e_aq_set_default_vsi()
1940 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_DEFAULT); in i40e_aq_set_default_vsi()
1941 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_default_vsi()
1967 cmd->promiscuous_flags = cpu_to_le16(0); in i40e_aq_clear_default_vsi()
1968 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_DEFAULT); in i40e_aq_clear_default_vsi()
1969 cmd->seid = cpu_to_le16(seid); in i40e_aq_clear_default_vsi()
2000 if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) in i40e_aq_set_vsi_unicast_promiscuous()
2004 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_unicast_promiscuous()
2006 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST); in i40e_aq_set_vsi_unicast_promiscuous()
2007 if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) in i40e_aq_set_vsi_unicast_promiscuous()
2008 cmd->valid_flags |= in i40e_aq_set_vsi_unicast_promiscuous()
2011 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_unicast_promiscuous()
2039 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_multicast_promiscuous()
2041 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_MULTICAST); in i40e_aq_set_vsi_multicast_promiscuous()
2043 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_multicast_promiscuous()
2053 * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
2054 * @vid: The VLAN tag filter - capture any multicast packet with this VLAN tag
2074 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_mc_promisc_on_vlan()
2075 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_MULTICAST); in i40e_aq_set_vsi_mc_promisc_on_vlan()
2076 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_mc_promisc_on_vlan()
2077 cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID); in i40e_aq_set_vsi_mc_promisc_on_vlan()
2089 * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
2090 * @vid: The VLAN tag filter - capture any unicast packet with this VLAN tag
2109 if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) in i40e_aq_set_vsi_uc_promisc_on_vlan()
2113 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_uc_promisc_on_vlan()
2114 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST); in i40e_aq_set_vsi_uc_promisc_on_vlan()
2115 if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) in i40e_aq_set_vsi_uc_promisc_on_vlan()
2116 cmd->valid_flags |= in i40e_aq_set_vsi_uc_promisc_on_vlan()
2118 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_uc_promisc_on_vlan()
2119 cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID); in i40e_aq_set_vsi_uc_promisc_on_vlan()
2132 * @vid: The VLAN tag filter - capture any broadcast packet with this VLAN tag
2151 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_bc_promisc_on_vlan()
2152 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_BROADCAST); in i40e_aq_set_vsi_bc_promisc_on_vlan()
2153 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_bc_promisc_on_vlan()
2154 cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID); in i40e_aq_set_vsi_bc_promisc_on_vlan()
2183 cmd->promiscuous_flags in i40e_aq_set_vsi_broadcast()
2186 cmd->promiscuous_flags in i40e_aq_set_vsi_broadcast()
2189 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_BROADCAST); in i40e_aq_set_vsi_broadcast()
2190 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_broadcast()
2197 * i40e_aq_set_vsi_vlan_promisc - control the VLAN promiscuous setting
2200 * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
2218 cmd->promiscuous_flags = cpu_to_le16(flags); in i40e_aq_set_vsi_vlan_promisc()
2219 cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_VLAN); in i40e_aq_set_vsi_vlan_promisc()
2220 cmd->seid = cpu_to_le16(seid); in i40e_aq_set_vsi_vlan_promisc()
2228 * i40e_aq_get_vsi_params - get VSI configuration info
2248 cmd->uplink_seid = cpu_to_le16(vsi_ctx->seid); in i40e_aq_get_vsi_params()
2252 status = i40e_asq_send_command(hw, &desc, &vsi_ctx->info, in i40e_aq_get_vsi_params()
2253 sizeof(vsi_ctx->info), NULL); in i40e_aq_get_vsi_params()
2258 vsi_ctx->seid = le16_to_cpu(resp->seid); in i40e_aq_get_vsi_params()
2259 vsi_ctx->vsi_number = le16_to_cpu(resp->vsi_number); in i40e_aq_get_vsi_params()
2260 vsi_ctx->vsis_allocated = le16_to_cpu(resp->vsi_used); in i40e_aq_get_vsi_params()
2261 vsi_ctx->vsis_unallocated = le16_to_cpu(resp->vsi_free); in i40e_aq_get_vsi_params()
2289 cmd->uplink_seid = cpu_to_le16(vsi_ctx->seid); in i40e_aq_update_vsi_params()
2293 status = i40e_asq_send_command_atomic(hw, &desc, &vsi_ctx->info, in i40e_aq_update_vsi_params()
2294 sizeof(vsi_ctx->info), in i40e_aq_update_vsi_params()
2297 vsi_ctx->vsis_allocated = le16_to_cpu(resp->vsi_used); in i40e_aq_update_vsi_params()
2298 vsi_ctx->vsis_unallocated = le16_to_cpu(resp->vsi_free); in i40e_aq_update_vsi_params()
2328 scfg->seid = cpu_to_le16(*start_seid); in i40e_aq_get_switch_config()
2331 *start_seid = le16_to_cpu(scfg->seid); in i40e_aq_get_switch_config()
2359 scfg->flags = cpu_to_le16(flags); in i40e_aq_set_switch_config()
2360 scfg->valid_flags = cpu_to_le16(valid_flags); in i40e_aq_set_switch_config()
2361 scfg->mode = mode; in i40e_aq_set_switch_config()
2362 if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) { in i40e_aq_set_switch_config()
2363 scfg->switch_tag = cpu_to_le16(hw->switch_tag); in i40e_aq_set_switch_config()
2364 scfg->first_tag = cpu_to_le16(hw->first_tag); in i40e_aq_set_switch_config()
2365 scfg->second_tag = cpu_to_le16(hw->second_tag); in i40e_aq_set_switch_config()
2401 *fw_major_version = le16_to_cpu(resp->fw_major); in i40e_aq_get_firmware_version()
2403 *fw_minor_version = le16_to_cpu(resp->fw_minor); in i40e_aq_get_firmware_version()
2405 *fw_build = le32_to_cpu(resp->fw_build); in i40e_aq_get_firmware_version()
2407 *api_major_version = le16_to_cpu(resp->api_major); in i40e_aq_get_firmware_version()
2409 *api_minor_version = le16_to_cpu(resp->api_minor); in i40e_aq_get_firmware_version()
2439 cmd->driver_major_ver = dv->major_version; in i40e_aq_send_driver_version()
2440 cmd->driver_minor_ver = dv->minor_version; in i40e_aq_send_driver_version()
2441 cmd->driver_build_ver = dv->build_version; in i40e_aq_send_driver_version()
2442 cmd->driver_subbuild_ver = dv->subbuild_version; in i40e_aq_send_driver_version()
2445 while (len < sizeof(dv->driver_string) && in i40e_aq_send_driver_version()
2446 (dv->driver_string[len] < 0x80) && in i40e_aq_send_driver_version()
2447 dv->driver_string[len]) in i40e_aq_send_driver_version()
2449 status = i40e_asq_send_command(hw, &desc, dv->driver_string, in i40e_aq_send_driver_version()
2456 * i40e_get_link_status - get status of the HW network link
2469 if (hw->phy.get_link_info) { in i40e_get_link_status()
2477 *link_up = hw->phy.link_info.link_info & I40E_AQ_LINK_UP; in i40e_get_link_status()
2483 * i40e_update_link_info - update status of the HW network link
2496 if ((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && in i40e_update_link_info()
2497 ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || in i40e_update_link_info()
2498 !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) { in i40e_update_link_info()
2506 hw->phy.link_info.req_fec_info = in i40e_update_link_info()
2510 hw->phy.link_info.req_fec_info = in i40e_update_link_info()
2515 memcpy(hw->phy.link_info.module_type, &abilities.module_type, in i40e_update_link_info()
2516 sizeof(hw->phy.link_info.module_type)); in i40e_update_link_info()
2523 * i40e_aq_add_veb - Insert a VEB between the VSI and the MAC
2525 * @uplink_seid: the MAC or other gizmo SEID
2556 cmd->uplink_seid = cpu_to_le16(uplink_seid); in i40e_aq_add_veb()
2557 cmd->downlink_seid = cpu_to_le16(downlink_seid); in i40e_aq_add_veb()
2558 cmd->enable_tcs = enabled_tc; in i40e_aq_add_veb()
2570 cmd->veb_flags = cpu_to_le16(veb_flags); in i40e_aq_add_veb()
2575 *veb_seid = le16_to_cpu(resp->veb_seid); in i40e_aq_add_veb()
2581 * i40e_aq_get_veb_parameters - Retrieve VEB parameters
2611 cmd_resp->seid = cpu_to_le16(veb_seid); in i40e_aq_get_veb_parameters()
2618 *switch_id = le16_to_cpu(cmd_resp->switch_id); in i40e_aq_get_veb_parameters()
2620 *statistic_index = le16_to_cpu(cmd_resp->statistic_index); in i40e_aq_get_veb_parameters()
2622 *vebs_used = le16_to_cpu(cmd_resp->vebs_used); in i40e_aq_get_veb_parameters()
2624 *vebs_free = le16_to_cpu(cmd_resp->vebs_free); in i40e_aq_get_veb_parameters()
2626 u16 flags = le16_to_cpu(cmd_resp->veb_flags); in i40e_aq_get_veb_parameters()
2643 * @seid: VSI for the mac address
2653 (struct i40e_aqc_macvlan *)&desc->params.raw; in i40e_prepare_add_macvlan()
2661 cmd->num_addresses = cpu_to_le16(count); in i40e_prepare_add_macvlan()
2662 cmd->seid[0] = cpu_to_le16(I40E_AQC_MACVLAN_CMD_SEID_VALID | seid); in i40e_prepare_add_macvlan()
2663 cmd->seid[1] = 0; in i40e_prepare_add_macvlan()
2664 cmd->seid[2] = 0; in i40e_prepare_add_macvlan()
2671 desc->flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); in i40e_prepare_add_macvlan()
2673 desc->flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB); in i40e_prepare_add_macvlan()
2681 * @seid: VSI for the mac address
2686 * Add MAC/VLAN addresses to the HW filtering
2708 * @seid: VSI for the mac address
2714 * Add MAC/VLAN addresses to the HW filtering.
2716 * to avoid race conditions in access to hw->aq.asq_last_status.
2741 * @seid: VSI for the mac address
2746 * Remove MAC/VLAN addresses from the HW filtering
2765 cmd->num_addresses = cpu_to_le16(count); in i40e_aq_remove_macvlan()
2766 cmd->seid[0] = cpu_to_le16(I40E_AQC_MACVLAN_CMD_SEID_VALID | seid); in i40e_aq_remove_macvlan()
2767 cmd->seid[1] = 0; in i40e_aq_remove_macvlan()
2768 cmd->seid[2] = 0; in i40e_aq_remove_macvlan()
2783 * @seid: VSI for the mac address
2789 * Remove MAC/VLAN addresses from the HW filtering.
2791 * to avoid race conditions in access to hw->aq.asq_last_status.
2813 cmd->num_addresses = cpu_to_le16(count); in i40e_aq_remove_macvlan_v2()
2814 cmd->seid[0] = cpu_to_le16(I40E_AQC_MACVLAN_CMD_SEID_VALID | seid); in i40e_aq_remove_macvlan_v2()
2815 cmd->seid[1] = 0; in i40e_aq_remove_macvlan_v2()
2816 cmd->seid[2] = 0; in i40e_aq_remove_macvlan_v2()
2827 * i40e_mirrorrule_op - Internal helper function to add/delete mirror rule
2861 cmd->seid = cpu_to_le16(sw_seid); in i40e_mirrorrule_op()
2862 cmd->rule_type = cpu_to_le16(rule_type & in i40e_mirrorrule_op()
2864 cmd->num_entries = cpu_to_le16(count); in i40e_mirrorrule_op()
2866 cmd->destination = cpu_to_le16(id); in i40e_mirrorrule_op()
2877 hw->aq.asq_last_status == I40E_AQ_RC_ENOSPC) { in i40e_mirrorrule_op()
2879 *rule_id = le16_to_cpu(resp->rule_id); in i40e_mirrorrule_op()
2881 *rules_used = le16_to_cpu(resp->mirror_rules_used); in i40e_mirrorrule_op()
2883 *rules_free = le16_to_cpu(resp->mirror_rules_free); in i40e_mirrorrule_op()
2889 * i40e_aq_add_mirrorrule - add a mirror rule
2920 * i40e_aq_delete_mirrorrule - delete a mirror rule
2958 * @v_opcode: opcodes for VF-PF communication
2976 cmd->id = cpu_to_le32(vfid); in i40e_aq_send_msg_to_vf()
3015 cmd_resp->address = cpu_to_le32(reg_addr); in i40e_aq_debug_read_register()
3020 *reg_val = ((u64)le32_to_cpu(cmd_resp->value_high) << 32) | in i40e_aq_debug_read_register()
3021 (u64)le32_to_cpu(cmd_resp->value_low); in i40e_aq_debug_read_register()
3047 cmd->address = cpu_to_le32(reg_addr); in i40e_aq_debug_write_register()
3048 cmd->value_high = cpu_to_le32((u32)(reg_val >> 32)); in i40e_aq_debug_write_register()
3049 cmd->value_low = cpu_to_le32((u32)(reg_val & 0xFFFFFFFF)); in i40e_aq_debug_write_register()
3080 cmd_resp->resource_id = cpu_to_le16(resource); in i40e_aq_request_resource()
3081 cmd_resp->access_type = cpu_to_le16(access); in i40e_aq_request_resource()
3082 cmd_resp->resource_number = cpu_to_le32(sdp_number); in i40e_aq_request_resource()
3091 if (!status || hw->aq.asq_last_status == I40E_AQ_RC_EBUSY) in i40e_aq_request_resource()
3092 *timeout = le32_to_cpu(cmd_resp->timeout); in i40e_aq_request_resource()
3118 cmd->resource_id = cpu_to_le16(resource); in i40e_aq_release_resource()
3119 cmd->resource_number = cpu_to_le32(sdp_number); in i40e_aq_release_resource()
3158 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD; in i40e_aq_read_nvm()
3159 cmd->module_pointer = module_pointer; in i40e_aq_read_nvm()
3160 cmd->offset = cpu_to_le32(offset); in i40e_aq_read_nvm()
3161 cmd->length = cpu_to_le16(length); in i40e_aq_read_nvm()
3203 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD; in i40e_aq_erase_nvm()
3204 cmd->module_pointer = module_pointer; in i40e_aq_erase_nvm()
3205 cmd->offset = cpu_to_le32(offset); in i40e_aq_erase_nvm()
3206 cmd->length = cpu_to_le16(length); in i40e_aq_erase_nvm()
3239 p = &hw->dev_caps; in i40e_parse_discover_capabilities()
3241 p = &hw->func_caps; in i40e_parse_discover_capabilities()
3246 id = le16_to_cpu(cap->id); in i40e_parse_discover_capabilities()
3247 number = le32_to_cpu(cap->number); in i40e_parse_discover_capabilities()
3248 logical_id = le32_to_cpu(cap->logical_id); in i40e_parse_discover_capabilities()
3249 phys_id = le32_to_cpu(cap->phys_id); in i40e_parse_discover_capabilities()
3250 major_rev = cap->major_rev; in i40e_parse_discover_capabilities()
3254 p->switch_mode = number; in i40e_parse_discover_capabilities()
3257 p->management_mode = number; in i40e_parse_discover_capabilities()
3259 p->mng_protocols_over_mctp = logical_id; in i40e_parse_discover_capabilities()
3262 p->mng_protocols_over_mctp); in i40e_parse_discover_capabilities()
3264 p->mng_protocols_over_mctp = 0; in i40e_parse_discover_capabilities()
3268 p->npar_enable = number; in i40e_parse_discover_capabilities()
3271 p->os2bmc = number; in i40e_parse_discover_capabilities()
3274 p->valid_functions = number; in i40e_parse_discover_capabilities()
3278 p->sr_iov_1_1 = true; in i40e_parse_discover_capabilities()
3281 p->num_vfs = number; in i40e_parse_discover_capabilities()
3282 p->vf_base_id = logical_id; in i40e_parse_discover_capabilities()
3286 p->vmdq = true; in i40e_parse_discover_capabilities()
3290 p->evb_802_1_qbg = true; in i40e_parse_discover_capabilities()
3294 p->evb_802_1_qbh = true; in i40e_parse_discover_capabilities()
3297 p->num_vsis = number; in i40e_parse_discover_capabilities()
3301 p->dcb = true; in i40e_parse_discover_capabilities()
3302 p->enabled_tcmap = logical_id; in i40e_parse_discover_capabilities()
3303 p->maxtc = phys_id; in i40e_parse_discover_capabilities()
3308 p->fcoe = true; in i40e_parse_discover_capabilities()
3312 p->iscsi = true; in i40e_parse_discover_capabilities()
3315 p->rss = true; in i40e_parse_discover_capabilities()
3316 p->rss_table_size = number; in i40e_parse_discover_capabilities()
3317 p->rss_table_entry_width = logical_id; in i40e_parse_discover_capabilities()
3320 p->num_rx_qp = number; in i40e_parse_discover_capabilities()
3321 p->base_queue = phys_id; in i40e_parse_discover_capabilities()
3324 p->num_tx_qp = number; in i40e_parse_discover_capabilities()
3325 p->base_queue = phys_id; in i40e_parse_discover_capabilities()
3328 p->num_msix_vectors = number; in i40e_parse_discover_capabilities()
3331 p->num_msix_vectors); in i40e_parse_discover_capabilities()
3334 p->num_msix_vectors_vf = number; in i40e_parse_discover_capabilities()
3339 p->flex10_enable = true; in i40e_parse_discover_capabilities()
3340 p->flex10_capable = true; in i40e_parse_discover_capabilities()
3345 p->flex10_enable = true; in i40e_parse_discover_capabilities()
3347 p->flex10_capable = true; in i40e_parse_discover_capabilities()
3349 p->flex10_mode = logical_id; in i40e_parse_discover_capabilities()
3350 p->flex10_status = phys_id; in i40e_parse_discover_capabilities()
3354 p->mgmt_cem = true; in i40e_parse_discover_capabilities()
3358 p->iwarp = true; in i40e_parse_discover_capabilities()
3362 p->led[phys_id] = true; in i40e_parse_discover_capabilities()
3366 p->sdp[phys_id] = true; in i40e_parse_discover_capabilities()
3370 p->mdio_port_num = phys_id; in i40e_parse_discover_capabilities()
3371 p->mdio_port_mode = logical_id; in i40e_parse_discover_capabilities()
3376 p->ieee_1588 = true; in i40e_parse_discover_capabilities()
3379 p->fd = true; in i40e_parse_discover_capabilities()
3380 p->fd_filters_guaranteed = number; in i40e_parse_discover_capabilities()
3381 p->fd_filters_best_effort = logical_id; in i40e_parse_discover_capabilities()
3384 p->wr_csr_prot = (u64)number; in i40e_parse_discover_capabilities()
3385 p->wr_csr_prot |= (u64)logical_id << 32; in i40e_parse_discover_capabilities()
3389 p->sec_rev_disabled = true; in i40e_parse_discover_capabilities()
3391 p->update_disabled = true; in i40e_parse_discover_capabilities()
3398 if (p->fcoe) in i40e_parse_discover_capabilities()
3404 if (p->npar_enable || p->flex10_enable) in i40e_parse_discover_capabilities()
3405 p->fcoe = false; in i40e_parse_discover_capabilities()
3408 hw->num_ports = 0; in i40e_parse_discover_capabilities()
3418 hw->num_ports++; in i40e_parse_discover_capabilities()
3428 if (hw->mac.type == I40E_MAC_X722) { in i40e_parse_discover_capabilities()
3436 hw->num_ports = 4; in i40e_parse_discover_capabilities()
3441 valid_functions = p->valid_functions; in i40e_parse_discover_capabilities()
3449 /* partition id is 1-based, and functions are evenly spread in i40e_parse_discover_capabilities()
3452 if (hw->num_ports != 0) { in i40e_parse_discover_capabilities()
3453 hw->partition_id = (hw->pf_id / hw->num_ports) + 1; in i40e_parse_discover_capabilities()
3454 hw->num_partitions = num_functions / hw->num_ports; in i40e_parse_discover_capabilities()
3460 p->rx_buf_chain_len = I40E_MAX_CHAINED_RX_BUFFERS; in i40e_parse_discover_capabilities()
3469 * @list_type_opc: capabilities type to discover - pass in the command opcode
3503 i40e_parse_discover_capabilities(hw, buff, le32_to_cpu(cmd->count), in i40e_aq_discover_capabilities()
3543 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD; in i40e_aq_update_nvm()
3544 if (hw->mac.type == I40E_MAC_X722) { in i40e_aq_update_nvm()
3546 cmd->command_flags |= in i40e_aq_update_nvm()
3550 cmd->command_flags |= in i40e_aq_update_nvm()
3554 cmd->module_pointer = module_pointer; in i40e_aq_update_nvm()
3555 cmd->offset = cpu_to_le32(offset); in i40e_aq_update_nvm()
3556 cmd->length = cpu_to_le16(length); in i40e_aq_update_nvm()
3596 cmd->command_flags |= rearrange_nvm; in i40e_aq_rearrange_nvm()
3635 cmd->type = mib_type & I40E_AQ_LLDP_MIB_TYPE_MASK; in i40e_aq_get_lldp_mib()
3636 cmd->type |= ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) & in i40e_aq_get_lldp_mib()
3648 *local_len = le16_to_cpu(resp->local_len); in i40e_aq_get_lldp_mib()
3650 *remote_len = le16_to_cpu(resp->remote_len); in i40e_aq_get_lldp_mib()
3657 * i40e_aq_set_lldp_mib - Set the LLDP MIB
3687 cmd->type = mib_type; in i40e_aq_set_lldp_mib()
3688 cmd->length = cpu_to_le16(buff_size); in i40e_aq_set_lldp_mib()
3689 cmd->address_high = cpu_to_le32(upper_32_bits((uintptr_t)buff)); in i40e_aq_set_lldp_mib()
3690 cmd->address_low = cpu_to_le32(lower_32_bits((uintptr_t)buff)); in i40e_aq_set_lldp_mib()
3717 cmd->command |= I40E_AQ_LLDP_MIB_UPDATE_DISABLE; in i40e_aq_cfg_lldp_mib_change_event()
3743 if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) { in i40e_aq_restore_lldp()
3752 cmd->command |= I40E_AQ_LLDP_AGENT_RESTORE; in i40e_aq_restore_lldp()
3757 *setting = cmd->command & 1; in i40e_aq_restore_lldp()
3783 cmd->command |= I40E_AQ_LLDP_AGENT_SHUTDOWN; in i40e_aq_stop_lldp()
3786 if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) in i40e_aq_stop_lldp()
3787 cmd->command |= I40E_AQ_LLDP_AGENT_STOP_PERSIST; in i40e_aq_stop_lldp()
3816 cmd->command = I40E_AQ_LLDP_AGENT_START; in i40e_aq_start_lldp()
3819 if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) in i40e_aq_start_lldp()
3820 cmd->command |= I40E_AQ_LLDP_AGENT_START_PERSIST; in i40e_aq_start_lldp()
3847 if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE)) in i40e_aq_set_dcb_parameters()
3854 cmd->valid_flags = I40E_DCB_VALID; in i40e_aq_set_dcb_parameters()
3855 cmd->command = I40E_AQ_DCB_SET_AGENT; in i40e_aq_set_dcb_parameters()
3916 cmd->udp_port = cpu_to_le16(udp_port); in i40e_aq_add_udp_tunnel()
3917 cmd->protocol_type = protocol_index; in i40e_aq_add_udp_tunnel()
3922 *filter_index = resp->index; in i40e_aq_add_udp_tunnel()
3943 cmd->index = index; in i40e_aq_del_udp_tunnel()
3951 * i40e_aq_delete_element - Delete switch element
3971 cmd->seid = cpu_to_le16(seid); in i40e_aq_delete_element()
3980 * i40e_aq_dcb_updated - DCB Updated Command
4002 * i40e_aq_tx_sched_cmd - generic Tx scheduler AQ command handler
4055 cmd->vsi_seid = cpu_to_le16(seid); in i40e_aq_tx_sched_cmd()
4063 * i40e_aq_config_vsi_bw_limit - Configure VSI BW Limit
4082 cmd->vsi_seid = cpu_to_le16(seid); in i40e_aq_config_vsi_bw_limit()
4083 cmd->credit = cpu_to_le16(credit); in i40e_aq_config_vsi_bw_limit()
4084 cmd->max_credit = max_credit; in i40e_aq_config_vsi_bw_limit()
4092 * i40e_aq_config_vsi_tc_bw - Config VSI BW Allocation per TC
4109 * i40e_aq_config_switch_comp_ets - Enable/Disable/Modify ETS on the port
4127 * i40e_aq_config_switch_comp_bw_config - Config Switch comp BW Alloc per TC
4144 * i40e_aq_query_vsi_bw_config - Query VSI BW configuration
4161 * i40e_aq_query_vsi_ets_sla_config - Query VSI BW configuration per TC
4178 * i40e_aq_query_switch_comp_ets_config - Query Switch comp BW config per TC
4195 * i40e_aq_query_port_ets_config - Query Physical Port ETS configuration
4212 * i40e_aq_query_switch_comp_bw_config - Query Switch comp BW configuration
4248 switch (settings->fcoe_filt_num) { in i40e_validate_filter_settings()
4256 fcoe_filt_size <<= (u32)settings->fcoe_filt_num; in i40e_validate_filter_settings()
4262 switch (settings->fcoe_cntx_num) { in i40e_validate_filter_settings()
4268 fcoe_cntx_size <<= (u32)settings->fcoe_cntx_num; in i40e_validate_filter_settings()
4275 switch (settings->pe_filt_num) { in i40e_validate_filter_settings()
4292 switch (settings->pe_cntx_num) { in i40e_validate_filter_settings()
4347 val |= ((u32)settings->pe_filt_num << I40E_PFQF_CTL_0_PEHSIZE_SHIFT) & in i40e_set_filter_control()
4351 val |= ((u32)settings->pe_cntx_num << I40E_PFQF_CTL_0_PEDSIZE_SHIFT) & in i40e_set_filter_control()
4356 val |= ((u32)settings->fcoe_filt_num << in i40e_set_filter_control()
4361 val |= ((u32)settings->fcoe_cntx_num << in i40e_set_filter_control()
4367 if (settings->hash_lut_size == I40E_HASH_LUT_SIZE_512) in i40e_set_filter_control()
4373 if (settings->enable_fdir) in i40e_set_filter_control()
4375 if (settings->enable_ethtype) in i40e_set_filter_control()
4377 if (settings->enable_macvlan) in i40e_set_filter_control()
4386 * i40e_aq_add_rem_control_packet_filter - Add or Remove Control Packet Filter
4388 * @mac_addr: MAC address to use in the filter
4422 cmd->queue = cpu_to_le16(queue); in i40e_aq_add_rem_control_packet_filter()
4429 ether_addr_copy(cmd->mac, mac_addr); in i40e_aq_add_rem_control_packet_filter()
4431 cmd->etype = cpu_to_le16(ethtype); in i40e_aq_add_rem_control_packet_filter()
4432 cmd->flags = cpu_to_le16(flags); in i40e_aq_add_rem_control_packet_filter()
4433 cmd->seid = cpu_to_le16(vsi_seid); in i40e_aq_add_rem_control_packet_filter()
4438 stats->mac_etype_used = le16_to_cpu(resp->mac_etype_used); in i40e_aq_add_rem_control_packet_filter()
4439 stats->etype_used = le16_to_cpu(resp->etype_used); in i40e_aq_add_rem_control_packet_filter()
4440 stats->mac_etype_free = le16_to_cpu(resp->mac_etype_free); in i40e_aq_add_rem_control_packet_filter()
4441 stats->etype_free = le16_to_cpu(resp->etype_free); in i40e_aq_add_rem_control_packet_filter()
4448 * i40e_add_filter_to_drop_tx_flow_control_frames- filter to drop flow control
4495 cmd_resp->address0 = cpu_to_le32(reg_addr0); in i40e_aq_alternate_read()
4496 cmd_resp->address1 = cpu_to_le32(reg_addr1); in i40e_aq_alternate_read()
4501 *reg_val0 = le32_to_cpu(cmd_resp->data0); in i40e_aq_alternate_read()
4504 *reg_val1 = le32_to_cpu(cmd_resp->data1); in i40e_aq_alternate_read()
4527 cmd->vsi_seid = cpu_to_le16(seid); in i40e_aq_suspend_port_tx()
4554 * i40e_set_pci_config_data - store PCI bus info
4562 hw->bus.type = i40e_bus_type_pci_express; in i40e_set_pci_config_data()
4566 hw->bus.width = i40e_bus_width_pcie_x1; in i40e_set_pci_config_data()
4569 hw->bus.width = i40e_bus_width_pcie_x2; in i40e_set_pci_config_data()
4572 hw->bus.width = i40e_bus_width_pcie_x4; in i40e_set_pci_config_data()
4575 hw->bus.width = i40e_bus_width_pcie_x8; in i40e_set_pci_config_data()
4578 hw->bus.width = i40e_bus_width_unknown; in i40e_set_pci_config_data()
4584 hw->bus.speed = i40e_bus_speed_2500; in i40e_set_pci_config_data()
4587 hw->bus.speed = i40e_bus_speed_5000; in i40e_set_pci_config_data()
4590 hw->bus.speed = i40e_bus_speed_8000; in i40e_set_pci_config_data()
4593 hw->bus.speed = i40e_bus_speed_unknown; in i40e_set_pci_config_data()
4637 cmd->cluster_id = cluster_id; in i40e_aq_debug_dump()
4638 cmd->table_id = table_id; in i40e_aq_debug_dump()
4639 cmd->idx = cpu_to_le32(start_index); in i40e_aq_debug_dump()
4648 *ret_next_table = resp->table_id; in i40e_aq_debug_dump()
4650 *ret_next_index = le32_to_cpu(resp->idx); in i40e_aq_debug_dump()
4676 (I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id); in i40e_read_bw_from_alt_ram()
4679 (I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id); in i40e_read_bw_from_alt_ram()
4745 u8 port_num = (u8)hw->func_caps.mdio_port_num; in i40e_read_phy_register_clause22()
4762 retry--; in i40e_read_phy_register_clause22()
4790 u8 port_num = (u8)hw->func_caps.mdio_port_num; in i40e_write_phy_register_clause22()
4811 retry--; in i40e_write_phy_register_clause22()
4833 u8 port_num = hw->func_caps.mdio_port_num; in i40e_read_phy_register_clause45()
4850 retry--; in i40e_read_phy_register_clause45()
4875 retry--; in i40e_read_phy_register_clause45()
4907 u8 port_num = hw->func_caps.mdio_port_num; in i40e_write_phy_register_clause45()
4924 retry--; in i40e_write_phy_register_clause45()
4951 retry--; in i40e_write_phy_register_clause45()
4973 switch (hw->device_id) { in i40e_write_phy_register()
5012 switch (hw->device_id) { in i40e_read_phy_register()
5045 u8 port_num = hw->func_caps.mdio_port_num; in i40e_get_phy_address()
5126 * i40e_led_get_reg - read LED register
5140 if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE) { in i40e_led_get_reg()
5160 * i40e_led_set_reg - write LED register
5173 if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE) { in i40e_led_set_reg()
5194 * i40e_led_get_phy - return current on/off mode
5212 if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE) { in i40e_led_get_phy()
5295 * i40e_aq_rx_ctl_read_register - use FW to read from an Rx control register
5318 cmd_resp->address = cpu_to_le32(reg_addr); in i40e_aq_rx_ctl_read_register()
5323 *reg_val = le32_to_cpu(cmd_resp->value); in i40e_aq_rx_ctl_read_register()
5329 * i40e_read_rx_ctl - read from an Rx control register
5340 use_register = (((hw->aq.api_maj_ver == 1) && in i40e_read_rx_ctl()
5341 (hw->aq.api_min_ver < 5)) || in i40e_read_rx_ctl()
5342 (hw->mac.type == I40E_MAC_X722)); in i40e_read_rx_ctl()
5346 if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN && retry) { in i40e_read_rx_ctl()
5348 retry--; in i40e_read_rx_ctl()
5353 /* if the AQ access failed, try the old-fashioned way */ in i40e_read_rx_ctl()
5381 cmd->address = cpu_to_le32(reg_addr); in i40e_aq_rx_ctl_write_register()
5382 cmd->value = cpu_to_le32(reg_val); in i40e_aq_rx_ctl_write_register()
5390 * i40e_write_rx_ctl - write to an Rx control register
5401 use_register = (((hw->aq.api_maj_ver == 1) && in i40e_write_rx_ctl()
5402 (hw->aq.api_min_ver < 5)) || in i40e_write_rx_ctl()
5403 (hw->mac.type == I40E_MAC_X722)); in i40e_write_rx_ctl()
5408 if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN && retry) { in i40e_write_rx_ctl()
5410 retry--; in i40e_write_rx_ctl()
5415 /* if the AQ access failed, try the old-fashioned way */ in i40e_write_rx_ctl()
5421 * i40e_mdio_if_number_selection - MDIO I/F number selection
5431 if (set_mdio && cmd->phy_interface == I40E_AQ_PHY_REG_ACCESS_EXTERNAL) { in i40e_mdio_if_number_selection()
5432 if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED) in i40e_mdio_if_number_selection()
5433 cmd->cmd_flags |= in i40e_mdio_if_number_selection()
5474 cmd->phy_interface = phy_select; in i40e_aq_set_phy_register_ext()
5475 cmd->dev_address = dev_addr; in i40e_aq_set_phy_register_ext()
5476 cmd->reg_address = cpu_to_le32(reg_addr); in i40e_aq_set_phy_register_ext()
5477 cmd->reg_value = cpu_to_le32(reg_val); in i40e_aq_set_phy_register_ext()
5482 cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE; in i40e_aq_set_phy_register_ext()
5519 cmd->phy_interface = phy_select; in i40e_aq_get_phy_register_ext()
5520 cmd->dev_address = dev_addr; in i40e_aq_get_phy_register_ext()
5521 cmd->reg_address = cpu_to_le32(reg_addr); in i40e_aq_get_phy_register_ext()
5526 cmd->cmd_flags = I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE; in i40e_aq_get_phy_register_ext()
5530 *reg_val = le32_to_cpu(cmd->reg_value); in i40e_aq_get_phy_register_ext()
5536 * i40e_aq_write_ddp - Write dynamic device personalization (ddp)
5567 cmd->profile_track_id = cpu_to_le32(track_id); in i40e_aq_write_ddp()
5573 *error_offset = le32_to_cpu(resp->error_offset); in i40e_aq_write_ddp()
5575 *error_info = le32_to_cpu(resp->error_info); in i40e_aq_write_ddp()
5582 * i40e_aq_get_ddp_list - Read dynamic device personalization (ddp)
5607 cmd->flags = flags; in i40e_aq_get_ddp_list()
5631 for (i = 0; i < pkg_hdr->segment_count; i++) { in i40e_find_segment_in_package()
5634 pkg_hdr->segment_offset[i]); in i40e_find_segment_in_package()
5636 if (segment->type == segment_type) in i40e_find_segment_in_package()
5649 count = p->device_table_count; \
5650 nvm = (u32 *)&p->device_table[count]; \
5676 if (profile->header.type != SEGMENT_TYPE_I40E) in i40e_find_section_in_profile()
5681 for (i = 0; i < sec_tbl->section_count; i++) { in i40e_find_section_in_profile()
5682 sec_off = sec_tbl->section_offset[i]; in i40e_find_section_in_profile()
5684 if (sec->section.type == section_type) in i40e_find_section_in_profile()
5692 * i40e_ddp_exec_aq_section - Execute generic AQ for DDP
5705 i40e_fill_default_direct_cmd_desc(&desc, aq->opcode); in i40e_ddp_exec_aq_section()
5706 desc.flags |= cpu_to_le16(aq->flags); in i40e_ddp_exec_aq_section()
5707 memcpy(desc.params.raw, aq->param, sizeof(desc.params.raw)); in i40e_ddp_exec_aq_section()
5709 msglen = aq->datalen; in i40e_ddp_exec_aq_section()
5716 msg = &aq->data[0]; in i40e_ddp_exec_aq_section()
5724 aq->opcode, status); in i40e_ddp_exec_aq_section()
5729 memcpy(aq->param, desc.params.raw, sizeof(desc.params.raw)); in i40e_ddp_exec_aq_section()
5760 dev_cnt = profile->device_table_count; in i40e_validate_profile()
5762 vendor_dev_id = profile->device_table[i].vendor_dev_id; in i40e_validate_profile()
5764 hw->device_id == (vendor_dev_id & 0xFFFF)) in i40e_validate_profile()
5776 for (i = 0; i < sec_tbl->section_count; i++) { in i40e_validate_profile()
5777 sec_off = sec_tbl->section_offset[i]; in i40e_validate_profile()
5780 if (sec->section.type == SECTION_TYPE_MMIO || in i40e_validate_profile()
5781 sec->section.type == SECTION_TYPE_AQ || in i40e_validate_profile()
5782 sec->section.type == SECTION_TYPE_RB_AQ) { in i40e_validate_profile()
5784 "Not a roll-back package\n"); in i40e_validate_profile()
5788 if (sec->section.type == SECTION_TYPE_RB_AQ || in i40e_validate_profile()
5789 sec->section.type == SECTION_TYPE_RB_MMIO) { in i40e_validate_profile()
5827 for (i = 0; i < sec_tbl->section_count; i++) { in i40e_write_profile()
5828 sec_off = sec_tbl->section_offset[i]; in i40e_write_profile()
5831 if (sec->section.type == SECTION_TYPE_AQ) { in i40e_write_profile()
5837 i, ddp_aq->opcode); in i40e_write_profile()
5840 sec->section.type = SECTION_TYPE_RB_AQ; in i40e_write_profile()
5843 /* Skip any non-mmio sections */ in i40e_write_profile()
5844 if (sec->section.type != SECTION_TYPE_MMIO) in i40e_write_profile()
5847 section_size = sec->section.size + in i40e_write_profile()
5890 for (i = sec_tbl->section_count - 1; i >= 0; i--) { in i40e_rollback_profile()
5891 sec_off = sec_tbl->section_offset[i]; in i40e_rollback_profile()
5894 /* Skip any non-rollback sections */ in i40e_rollback_profile()
5895 if (sec->section.type != SECTION_TYPE_RB_MMIO) in i40e_rollback_profile()
5898 section_size = sec->section.size + in i40e_rollback_profile()
5901 /* Write roll-back MMIO section */ in i40e_rollback_profile()
5934 sec->tbl_size = 1; in i40e_add_pinfo_to_list()
5935 sec->data_end = sizeof(struct i40e_profile_section_header) + in i40e_add_pinfo_to_list()
5937 sec->section.type = SECTION_TYPE_INFO; in i40e_add_pinfo_to_list()
5938 sec->section.offset = sizeof(struct i40e_profile_section_header); in i40e_add_pinfo_to_list()
5939 sec->section.size = sizeof(struct i40e_profile_info); in i40e_add_pinfo_to_list()
5941 sec->section.offset); in i40e_add_pinfo_to_list()
5942 pinfo->track_id = track_id; in i40e_add_pinfo_to_list()
5943 pinfo->version = profile->version; in i40e_add_pinfo_to_list()
5944 pinfo->op = I40E_DDP_ADD_TRACKID; in i40e_add_pinfo_to_list()
5945 memcpy(pinfo->name, profile->name, I40E_DDP_NAME_SIZE); in i40e_add_pinfo_to_list()
5947 status = i40e_aq_write_ddp(hw, (void *)sec, sec->data_end, in i40e_add_pinfo_to_list()
5982 cmd->num_filters = filter_count; in i40e_aq_add_cloud_filters()
5983 cmd->seid = cpu_to_le16(seid); in i40e_aq_add_cloud_filters()
6020 cmd->num_filters = filter_count; in i40e_aq_add_cloud_filters_bb()
6021 cmd->seid = cpu_to_le16(seid); in i40e_aq_add_cloud_filters_bb()
6022 cmd->big_buffer_flag = I40E_AQC_ADD_CLOUD_CMD_BB; in i40e_aq_add_cloud_filters_bb()
6076 cmd->num_filters = filter_count; in i40e_aq_rem_cloud_filters()
6077 cmd->seid = cpu_to_le16(seid); in i40e_aq_rem_cloud_filters()
6114 cmd->num_filters = filter_count; in i40e_aq_rem_cloud_filters_bb()
6115 cmd->seid = cpu_to_le16(seid); in i40e_aq_rem_cloud_filters_bb()
6116 cmd->big_buffer_flag = I40E_AQC_ADD_CLOUD_CMD_BB; in i40e_aq_rem_cloud_filters_bb()