Lines Matching refs:efx
42 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading);
45 static int efx_ef10_get_warm_boot_count(struct efx_nic *efx) in efx_ef10_get_warm_boot_count() argument
49 efx_readd(efx, ®, ER_DZ_BIU_MC_SFT_STATUS); in efx_ef10_get_warm_boot_count()
58 static unsigned int efx_ef10_pf_mem_bar(struct efx_nic *efx) in efx_ef10_pf_mem_bar() argument
60 switch (efx->pci_dev->device) { in efx_ef10_pf_mem_bar()
69 static unsigned int efx_ef10_vf_mem_bar(struct efx_nic *efx) in efx_ef10_vf_mem_bar() argument
74 static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx) in efx_ef10_mem_map_size() argument
78 bar = efx->type->mem_bar(efx); in efx_ef10_mem_map_size()
79 return resource_size(&efx->pci_dev->resource[bar]); in efx_ef10_mem_map_size()
82 static bool efx_ef10_is_vf(struct efx_nic *efx) in efx_ef10_is_vf() argument
84 return efx->type->is_vf; in efx_ef10_is_vf()
88 static int efx_ef10_get_vf_index(struct efx_nic *efx) in efx_ef10_get_vf_index() argument
91 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_vf_index()
95 rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, in efx_ef10_get_vf_index()
107 static int efx_ef10_init_datapath_caps(struct efx_nic *efx) in efx_ef10_init_datapath_caps() argument
110 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_datapath_caps()
116 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CAPABILITIES, NULL, 0, in efx_ef10_init_datapath_caps()
121 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_datapath_caps()
148 netif_err(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
157 rc = efx_mcdi_window_mode_to_stride(efx, vi_window_mode); in efx_ef10_init_datapath_caps()
162 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
164 efx->vi_stride); in efx_ef10_init_datapath_caps()
168 efx->num_mac_stats = MCDI_WORD(outbuf, in efx_ef10_init_datapath_caps()
170 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
172 efx->num_mac_stats); in efx_ef10_init_datapath_caps()
175 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
177 efx->num_mac_stats); in efx_ef10_init_datapath_caps()
183 static void efx_ef10_read_licensed_features(struct efx_nic *efx) in efx_ef10_read_licensed_features() argument
187 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_read_licensed_features()
193 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_LICENSING_V3, inbuf, sizeof(inbuf), in efx_ef10_read_licensed_features()
202 static int efx_ef10_get_sysclk_freq(struct efx_nic *efx) in efx_ef10_get_sysclk_freq() argument
207 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CLOCK, NULL, 0, in efx_ef10_get_sysclk_freq()
215 static int efx_ef10_get_timer_workarounds(struct efx_nic *efx) in efx_ef10_get_timer_workarounds() argument
217 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_timer_workarounds()
225 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_get_timer_workarounds()
241 rc = efx_mcdi_set_workaround(efx, in efx_ef10_get_timer_workarounds()
251 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_get_timer_workarounds()
254 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_get_timer_workarounds()
261 static void efx_ef10_process_timer_config(struct efx_nic *efx, in efx_ef10_process_timer_config() argument
266 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_process_timer_config()
267 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
269 efx->timer_max_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
271 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_process_timer_config()
272 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
276 efx->timer_max_ns = max_count * efx->timer_quantum_ns; in efx_ef10_process_timer_config()
278 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
282 efx->timer_max_ns = max_count * efx->timer_quantum_ns; in efx_ef10_process_timer_config()
285 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_process_timer_config()
287 efx->timer_quantum_ns, efx->timer_max_ns); in efx_ef10_process_timer_config()
290 static int efx_ef10_get_timer_config(struct efx_nic *efx) in efx_ef10_get_timer_config() argument
295 rc = efx_ef10_get_timer_workarounds(efx); in efx_ef10_get_timer_config()
299 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_GET_EVQ_TMR_PROPERTIES, NULL, 0, in efx_ef10_get_timer_config()
303 efx_ef10_process_timer_config(efx, outbuf); in efx_ef10_get_timer_config()
308 rc = efx_ef10_get_sysclk_freq(efx); in efx_ef10_get_timer_config()
313 efx->timer_quantum_ns = quantum; in efx_ef10_get_timer_config()
314 efx->timer_max_ns = efx->type->timer_period_max * quantum; in efx_ef10_get_timer_config()
317 efx_mcdi_display_error(efx, MC_CMD_GET_EVQ_TMR_PROPERTIES, in efx_ef10_get_timer_config()
325 static int efx_ef10_get_mac_address_pf(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address_pf() argument
333 rc = efx_mcdi_rpc(efx, MC_CMD_GET_MAC_ADDRESSES, NULL, 0, in efx_ef10_get_mac_address_pf()
345 static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address_vf() argument
354 rc = efx_mcdi_rpc(efx, MC_CMD_VPORT_GET_MAC_ADDRESSES, inbuf, in efx_ef10_get_mac_address_vf()
377 struct efx_nic *efx = dev_get_drvdata(dev); in link_control_flag_show() local
380 ((efx->mcdi->fn_flags) & in link_control_flag_show()
389 struct efx_nic *efx = dev_get_drvdata(dev); in primary_flag_show() local
392 ((efx->mcdi->fn_flags) & in primary_flag_show()
397 static struct efx_ef10_vlan *efx_ef10_find_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_find_vlan() argument
399 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_find_vlan()
412 static int efx_ef10_add_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_add_vlan() argument
414 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_add_vlan()
420 vlan = efx_ef10_find_vlan(efx, vid); in efx_ef10_add_vlan()
427 netif_warn(efx, drv, efx->net_dev, in efx_ef10_add_vlan()
442 if (efx->filter_state) { in efx_ef10_add_vlan()
443 mutex_lock(&efx->mac_lock); in efx_ef10_add_vlan()
444 down_write(&efx->filter_sem); in efx_ef10_add_vlan()
445 rc = efx_mcdi_filter_add_vlan(efx, vlan->vid); in efx_ef10_add_vlan()
446 up_write(&efx->filter_sem); in efx_ef10_add_vlan()
447 mutex_unlock(&efx->mac_lock); in efx_ef10_add_vlan()
465 static void efx_ef10_del_vlan_internal(struct efx_nic *efx, in efx_ef10_del_vlan_internal() argument
468 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_del_vlan_internal()
472 if (efx->filter_state) { in efx_ef10_del_vlan_internal()
473 down_write(&efx->filter_sem); in efx_ef10_del_vlan_internal()
474 efx_mcdi_filter_del_vlan(efx, vlan->vid); in efx_ef10_del_vlan_internal()
475 up_write(&efx->filter_sem); in efx_ef10_del_vlan_internal()
482 static int efx_ef10_del_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_del_vlan() argument
484 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_del_vlan()
497 vlan = efx_ef10_find_vlan(efx, vid); in efx_ef10_del_vlan()
499 netif_err(efx, drv, efx->net_dev, in efx_ef10_del_vlan()
503 efx_ef10_del_vlan_internal(efx, vlan); in efx_ef10_del_vlan()
511 static void efx_ef10_cleanup_vlans(struct efx_nic *efx) in efx_ef10_cleanup_vlans() argument
513 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_cleanup_vlans()
518 efx_ef10_del_vlan_internal(efx, vlan); in efx_ef10_cleanup_vlans()
525 static int efx_ef10_probe(struct efx_nic *efx) in efx_ef10_probe() argument
533 efx->nic_data = nic_data; in efx_ef10_probe()
538 rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf, in efx_ef10_probe()
548 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_probe()
562 _efx_writed(efx, cpu_to_le32(1), ER_DZ_MC_DB_HWRD); in efx_ef10_probe()
564 rc = efx_mcdi_init(efx); in efx_ef10_probe()
574 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); in efx_ef10_probe()
579 rc = efx_mcdi_log_ctrl(efx, true, false, 0); in efx_ef10_probe()
583 rc = device_create_file(&efx->pci_dev->dev, in efx_ef10_probe()
588 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_probe()
592 rc = efx_get_pf_index(efx, &nic_data->pf_index); in efx_ef10_probe()
596 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_probe()
600 efx_ef10_read_licensed_features(efx); in efx_ef10_probe()
608 efx->tx_queues_per_channel = 4; in efx_ef10_probe()
610 efx->tx_queues_per_channel = 2; in efx_ef10_probe()
611 efx->max_vis = efx_ef10_mem_map_size(efx) / efx->vi_stride; in efx_ef10_probe()
612 if (!efx->max_vis) { in efx_ef10_probe()
613 netif_err(efx, drv, efx->net_dev, "error determining max VIs\n"); in efx_ef10_probe()
617 efx->max_channels = min_t(unsigned int, EFX_MAX_CHANNELS, in efx_ef10_probe()
618 efx->max_vis / efx->tx_queues_per_channel); in efx_ef10_probe()
619 efx->max_tx_channels = efx->max_channels; in efx_ef10_probe()
620 if (WARN_ON(efx->max_channels == 0)) { in efx_ef10_probe()
625 efx->rx_packet_len_offset = in efx_ef10_probe()
630 efx->net_dev->hw_features |= NETIF_F_RXFCS; in efx_ef10_probe()
632 rc = efx_mcdi_port_get_number(efx); in efx_ef10_probe()
635 efx->port_num = rc; in efx_ef10_probe()
637 rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr); in efx_ef10_probe()
641 rc = efx_ef10_get_timer_config(efx); in efx_ef10_probe()
645 rc = efx_mcdi_mon_probe(efx); in efx_ef10_probe()
649 efx_ptp_defer_probe_with_channel(efx); in efx_ef10_probe()
652 if ((efx->pci_dev->physfn) && (!efx->pci_dev->is_physfn)) { in efx_ef10_probe()
653 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_probe()
659 ether_addr_copy(nic_data->port_id, efx->net_dev->perm_addr); in efx_ef10_probe()
665 rc = efx_ef10_add_vlan(efx, EFX_FILTER_VID_UNSPEC); in efx_ef10_probe()
673 rc = efx_ef10_add_vlan(efx, 0); in efx_ef10_probe()
679 efx->mcdi->fn_flags & in efx_ef10_probe()
681 efx->net_dev->udp_tunnel_nic_info = &efx_ef10_udp_tunnels; in efx_ef10_probe()
686 efx_ef10_cleanup_vlans(efx); in efx_ef10_probe()
689 efx_ptp_remove(efx); in efx_ef10_probe()
690 efx_mcdi_mon_remove(efx); in efx_ef10_probe()
692 device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_probe()
694 device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag); in efx_ef10_probe()
696 efx_mcdi_detach(efx); in efx_ef10_probe()
700 (void)efx_ef10_set_udp_tnl_ports(efx, true); in efx_ef10_probe()
704 efx_mcdi_fini(efx); in efx_ef10_probe()
706 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_probe()
709 efx->nic_data = NULL; in efx_ef10_probe()
715 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
717 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_free_piobufs()
727 rc = efx_mcdi_rpc(efx, MC_CMD_FREE_PIOBUF, inbuf, sizeof(inbuf), in efx_ef10_free_piobufs()
735 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
737 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_piobufs()
746 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_ALLOC_PIOBUF, NULL, 0, in efx_ef10_alloc_piobufs()
752 if (!(efx_ef10_is_vf(efx) && rc == -ENOSPC)) in efx_ef10_alloc_piobufs()
753 efx_mcdi_display_error(efx, MC_CMD_ALLOC_PIOBUF, in efx_ef10_alloc_piobufs()
763 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_alloc_piobufs()
770 efx_ef10_free_piobufs(efx); in efx_ef10_alloc_piobufs()
774 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
776 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_link_piobufs()
792 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
796 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
802 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
808 efx_for_each_channel(channel, efx) { in efx_ef10_link_piobufs()
813 channel->channel >= efx->xdp_channel_offset) in efx_ef10_link_piobufs()
821 offset = ((efx->tx_channel_offset + efx->n_tx_channels - in efx_ef10_link_piobufs()
842 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
851 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
858 index * efx->vi_stride + offset; in efx_ef10_link_piobufs()
860 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
879 efx_mcdi_rpc(efx, MC_CMD_UNLINK_PIOBUF, in efx_ef10_link_piobufs()
886 static void efx_ef10_forget_old_piobufs(struct efx_nic *efx) in efx_ef10_forget_old_piobufs() argument
892 efx_for_each_channel(channel, efx) in efx_ef10_forget_old_piobufs()
899 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
904 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
909 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
913 static void efx_ef10_forget_old_piobufs(struct efx_nic *efx) in efx_ef10_forget_old_piobufs() argument
919 static void efx_ef10_remove(struct efx_nic *efx) in efx_ef10_remove() argument
921 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_remove()
930 if (efx->pci_dev->is_virtfn) { in efx_ef10_remove()
931 pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_remove()
936 vf->efx = NULL; in efx_ef10_remove()
938 netif_info(efx, drv, efx->net_dev, in efx_ef10_remove()
943 efx_ef10_cleanup_vlans(efx); in efx_ef10_remove()
946 efx_ptp_remove(efx); in efx_ef10_remove()
948 efx_mcdi_mon_remove(efx); in efx_ef10_remove()
950 efx_mcdi_rx_free_indir_table(efx); in efx_ef10_remove()
955 rc = efx_mcdi_free_vis(efx); in efx_ef10_remove()
959 efx_ef10_free_piobufs(efx); in efx_ef10_remove()
961 device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_remove()
962 device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag); in efx_ef10_remove()
964 efx_mcdi_detach(efx); in efx_ef10_remove()
968 (void)efx_ef10_set_udp_tnl_ports(efx, true); in efx_ef10_remove()
973 efx_mcdi_fini(efx); in efx_ef10_remove()
974 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_remove()
978 static int efx_ef10_probe_pf(struct efx_nic *efx) in efx_ef10_probe_pf() argument
980 return efx_ef10_probe(efx); in efx_ef10_probe_pf()
983 int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id, in efx_ef10_vadaptor_query() argument
987 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vadaptor_query()
998 rc = efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_QUERY, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_query()
1022 int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vadaptor_alloc() argument
1027 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_alloc()
1031 int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vadaptor_free() argument
1036 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_free()
1040 int efx_ef10_vport_add_mac(struct efx_nic *efx, in efx_ef10_vport_add_mac() argument
1048 return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf, in efx_ef10_vport_add_mac()
1052 int efx_ef10_vport_del_mac(struct efx_nic *efx, in efx_ef10_vport_del_mac() argument
1060 return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, in efx_ef10_vport_del_mac()
1065 static int efx_ef10_probe_vf(struct efx_nic *efx) in efx_ef10_probe_vf() argument
1075 pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_probe_vf()
1081 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_vf()
1088 rc = efx_ef10_probe(efx); in efx_ef10_probe_vf()
1092 rc = efx_ef10_get_vf_index(efx); in efx_ef10_probe_vf()
1096 if (efx->pci_dev->is_virtfn) { in efx_ef10_probe_vf()
1097 if (efx->pci_dev->physfn) { in efx_ef10_probe_vf()
1099 pci_get_drvdata(efx->pci_dev->physfn); in efx_ef10_probe_vf()
1101 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_probe_vf()
1103 nic_data_p->vf[nic_data->vf_index].efx = efx; in efx_ef10_probe_vf()
1105 efx->pci_dev; in efx_ef10_probe_vf()
1107 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_vf()
1114 efx_ef10_remove(efx); in efx_ef10_probe_vf()
1118 static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) in efx_ef10_probe_vf() argument
1124 static int efx_ef10_alloc_vis(struct efx_nic *efx, in efx_ef10_alloc_vis() argument
1127 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_vis()
1129 return efx_mcdi_alloc_vis(efx, min_vis, max_vis, &nic_data->vi_base, in efx_ef10_alloc_vis()
1136 static int efx_ef10_dimension_resources(struct efx_nic *efx) in efx_ef10_dimension_resources() argument
1138 unsigned int min_vis = max_t(unsigned int, efx->tx_queues_per_channel, in efx_ef10_dimension_resources()
1141 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_dimension_resources()
1146 channel_vis = max(efx->n_channels, in efx_ef10_dimension_resources()
1147 ((efx->n_tx_channels + efx->n_extra_tx_channels) * in efx_ef10_dimension_resources()
1148 efx->tx_queues_per_channel) + in efx_ef10_dimension_resources()
1149 efx->n_xdp_channels * efx->xdp_tx_per_channel); in efx_ef10_dimension_resources()
1150 if (efx->max_vis && efx->max_vis < channel_vis) { in efx_ef10_dimension_resources()
1151 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_dimension_resources()
1153 channel_vis, efx->max_vis); in efx_ef10_dimension_resources()
1154 channel_vis = efx->max_vis; in efx_ef10_dimension_resources()
1166 efx->n_tx_channels) { in efx_ef10_dimension_resources()
1168 DIV_ROUND_UP(efx->n_tx_channels, in efx_ef10_dimension_resources()
1171 rc = efx_ef10_alloc_piobufs(efx, n_piobufs); in efx_ef10_dimension_resources()
1173 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1176 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1179 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1182 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1199 uc_mem_map_size = PAGE_ALIGN((channel_vis - 1) * efx->vi_stride + in efx_ef10_dimension_resources()
1205 pio_write_vi_base = uc_mem_map_size / efx->vi_stride; in efx_ef10_dimension_resources()
1208 efx->vi_stride) - in efx_ef10_dimension_resources()
1218 rc = efx_mcdi_free_vis(efx); in efx_ef10_dimension_resources()
1222 rc = efx_ef10_alloc_vis(efx, min_vis, max_vis); in efx_ef10_dimension_resources()
1227 netif_info(efx, drv, efx->net_dev, in efx_ef10_dimension_resources()
1235 efx->max_channels = nic_data->n_allocated_vis; in efx_ef10_dimension_resources()
1236 efx->max_tx_channels = in efx_ef10_dimension_resources()
1237 nic_data->n_allocated_vis / efx->tx_queues_per_channel; in efx_ef10_dimension_resources()
1239 efx_mcdi_free_vis(efx); in efx_ef10_dimension_resources()
1249 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1252 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
1256 membase = ioremap(efx->membase_phys, uc_mem_map_size); in efx_ef10_dimension_resources()
1258 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1263 iounmap(efx->membase); in efx_ef10_dimension_resources()
1264 efx->membase = membase; in efx_ef10_dimension_resources()
1268 nic_data->wc_membase = ioremap_wc(efx->membase_phys + in efx_ef10_dimension_resources()
1272 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1280 (pio_write_vi_base * efx->vi_stride + ER_DZ_TX_PIOBUF - in efx_ef10_dimension_resources()
1283 rc = efx_ef10_link_piobufs(efx); in efx_ef10_dimension_resources()
1285 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
1288 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1290 &efx->membase_phys, efx->membase, uc_mem_map_size, in efx_ef10_dimension_resources()
1296 static void efx_ef10_fini_nic(struct efx_nic *efx) in efx_ef10_fini_nic() argument
1298 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_fini_nic()
1300 spin_lock_bh(&efx->stats_lock); in efx_ef10_fini_nic()
1303 spin_unlock_bh(&efx->stats_lock); in efx_ef10_fini_nic()
1306 static int efx_ef10_init_nic(struct efx_nic *efx) in efx_ef10_init_nic() argument
1308 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_nic()
1309 struct net_device *net_dev = efx->net_dev; in efx_ef10_init_nic()
1314 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_init_nic()
1320 if (efx->must_realloc_vis) { in efx_ef10_init_nic()
1322 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, in efx_ef10_init_nic()
1326 efx->must_realloc_vis = false; in efx_ef10_init_nic()
1329 nic_data->mc_stats = kmalloc(efx->num_mac_stats * sizeof(__le64), in efx_ef10_init_nic()
1335 rc = efx_ef10_alloc_piobufs(efx, nic_data->n_piobufs); in efx_ef10_init_nic()
1337 rc = efx_ef10_link_piobufs(efx); in efx_ef10_init_nic()
1339 efx_ef10_free_piobufs(efx); in efx_ef10_init_nic()
1347 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1350 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1356 if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx)) in efx_ef10_init_nic()
1365 if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { in efx_ef10_init_nic()
1381 rc = efx->type->rx_push_rss_config(efx, false, in efx_ef10_init_nic()
1382 efx->rss_context.rx_indir_table, NULL); in efx_ef10_init_nic()
1387 static void efx_ef10_table_reset_mc_allocations(struct efx_nic *efx) in efx_ef10_table_reset_mc_allocations() argument
1389 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_table_reset_mc_allocations()
1395 efx->must_realloc_vis = true; in efx_ef10_table_reset_mc_allocations()
1396 efx_mcdi_filter_table_reset_mc_allocations(efx); in efx_ef10_table_reset_mc_allocations()
1398 efx_ef10_forget_old_piobufs(efx); in efx_ef10_table_reset_mc_allocations()
1399 efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID; in efx_ef10_table_reset_mc_allocations()
1403 efx->vport_id = EVB_PORT_ID_ASSIGNED; in efx_ef10_table_reset_mc_allocations()
1406 for (i = 0; i < efx->vf_count; i++) in efx_ef10_table_reset_mc_allocations()
1449 static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) in efx_ef10_reset() argument
1451 int rc = efx_mcdi_reset(efx, reset_type); in efx_ef10_reset()
1467 efx_ef10_table_reset_mc_allocations(efx); in efx_ef10_reset()
1687 static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) in efx_ef10_raw_stat_mask() argument
1690 u32 port_caps = efx_mcdi_phy_get_caps(efx); in efx_ef10_raw_stat_mask()
1691 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_raw_stat_mask()
1693 if (!(efx->mcdi->fn_flags & in efx_ef10_raw_stat_mask()
1714 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) in efx_ef10_get_stat_mask() argument
1716 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_stat_mask()
1719 raw_mask[0] = efx_ef10_raw_stat_mask(efx); in efx_ef10_get_stat_mask()
1730 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V2) in efx_ef10_get_stat_mask()
1737 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V3 && in efx_ef10_get_stat_mask()
1754 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) in efx_ef10_describe_stats() argument
1758 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_describe_stats()
1763 static void efx_ef10_get_fec_stats(struct efx_nic *efx, in efx_ef10_get_fec_stats() argument
1767 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_fec_stats()
1770 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_get_fec_stats()
1779 static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_common() argument
1783 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_common()
1787 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats_common()
1848 static size_t efx_ef10_update_stats_pf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_pf() argument
1851 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_pf()
1855 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats_pf()
1861 efx_nic_copy_stats(efx, nic_data->mc_stats); in efx_ef10_update_stats_pf()
1867 efx_nic_fix_nodesc_drop_stat(efx, in efx_ef10_update_stats_pf()
1888 efx_update_sw_stats(efx, stats); in efx_ef10_update_stats_pf()
1890 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_pf()
1893 static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx) in efx_ef10_try_update_nic_stats_vf() argument
1894 __must_hold(&efx->stats_lock) in efx_ef10_try_update_nic_stats_vf()
1897 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats_vf()
1901 u32 dma_len = efx->num_mac_stats * sizeof(u64); in efx_ef10_try_update_nic_stats_vf()
1906 spin_unlock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1908 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats_vf()
1910 rc = efx_nic_alloc_buffer(efx, &stats_buf, dma_len, GFP_KERNEL); in efx_ef10_try_update_nic_stats_vf()
1912 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1917 dma_stats[efx->num_mac_stats - 1] = EFX_MC_STATS_GENERATION_INVALID; in efx_ef10_try_update_nic_stats_vf()
1925 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), in efx_ef10_try_update_nic_stats_vf()
1927 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1930 if (rc != -ENOENT || atomic_read(&efx->active_queues)) in efx_ef10_try_update_nic_stats_vf()
1931 efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, in efx_ef10_try_update_nic_stats_vf()
1936 generation_end = dma_stats[efx->num_mac_stats - 1]; in efx_ef10_try_update_nic_stats_vf()
1951 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_vf()
1954 spin_unlock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1955 efx_nic_free_buffer(efx, &stats_buf); in efx_ef10_try_update_nic_stats_vf()
1956 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1960 static size_t efx_ef10_update_stats_vf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_vf() argument
1963 if (efx_ef10_try_update_nic_stats_vf(efx)) in efx_ef10_update_stats_vf()
1966 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_vf()
1969 static size_t efx_ef10_update_stats_atomic_vf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_atomic_vf() argument
1972 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_atomic_vf()
1977 efx_update_sw_stats(efx, nic_data->stats); in efx_ef10_update_stats_atomic_vf()
1978 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_atomic_vf()
1983 struct efx_nic *efx = channel->efx; in efx_ef10_push_irq_moderation() local
1995 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_push_irq_moderation()
2005 efx_mcdi_rpc_async(efx, MC_CMD_SET_EVQ_TMR, in efx_ef10_push_irq_moderation()
2007 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_push_irq_moderation()
2008 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2014 efx_writed_page(efx, &timer_cmd, ER_DD_EVQ_INDIRECT, in efx_ef10_push_irq_moderation()
2017 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2022 efx_writed_page(efx, &timer_cmd, ER_DZ_EVQ_TMR, in efx_ef10_push_irq_moderation()
2027 static void efx_ef10_get_wol_vf(struct efx_nic *efx, in efx_ef10_get_wol_vf() argument
2030 static int efx_ef10_set_wol_vf(struct efx_nic *efx, u32 type) in efx_ef10_set_wol_vf() argument
2035 static void efx_ef10_get_wol(struct efx_nic *efx, struct ethtool_wolinfo *wol) in efx_ef10_get_wol() argument
2042 static int efx_ef10_set_wol(struct efx_nic *efx, u32 type) in efx_ef10_set_wol() argument
2049 static void efx_ef10_mcdi_request(struct efx_nic *efx, in efx_ef10_mcdi_request() argument
2053 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_request()
2066 _efx_writed(efx, cpu_to_le32((u64)nic_data->mcdi_buf.dma_addr >> 32), in efx_ef10_mcdi_request()
2068 _efx_writed(efx, cpu_to_le32((u32)nic_data->mcdi_buf.dma_addr), in efx_ef10_mcdi_request()
2072 static bool efx_ef10_mcdi_poll_response(struct efx_nic *efx) in efx_ef10_mcdi_poll_response() argument
2074 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_response()
2082 efx_ef10_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf, in efx_ef10_mcdi_read_response() argument
2085 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_read_response()
2091 static void efx_ef10_mcdi_reboot_detected(struct efx_nic *efx) in efx_ef10_mcdi_reboot_detected() argument
2093 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_reboot_detected()
2096 efx_ef10_table_reset_mc_allocations(efx); in efx_ef10_mcdi_reboot_detected()
2107 static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) in efx_ef10_mcdi_poll_reboot() argument
2109 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_reboot()
2112 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_mcdi_poll_reboot()
2126 efx_ef10_mcdi_reboot_detected(efx); in efx_ef10_mcdi_poll_reboot()
2141 struct efx_nic *efx = context->efx; in efx_ef10_msi_interrupt() local
2143 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_msi_interrupt()
2146 if (likely(READ_ONCE(efx->irq_soft_enabled))) { in efx_ef10_msi_interrupt()
2148 if (context->index == efx->irq_level) in efx_ef10_msi_interrupt()
2149 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_msi_interrupt()
2152 efx_schedule_channel_irq(efx->channel[context->index]); in efx_ef10_msi_interrupt()
2160 struct efx_nic *efx = dev_id; in efx_ef10_legacy_interrupt() local
2161 bool soft_enabled = READ_ONCE(efx->irq_soft_enabled); in efx_ef10_legacy_interrupt()
2167 efx_readd(efx, ®, ER_DZ_BIU_INT_ISR); in efx_ef10_legacy_interrupt()
2175 if (queues & (1U << efx->irq_level)) in efx_ef10_legacy_interrupt()
2176 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_legacy_interrupt()
2178 efx_for_each_channel(channel, efx) { in efx_ef10_legacy_interrupt()
2185 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_legacy_interrupt()
2192 static int efx_ef10_irq_test_generate(struct efx_nic *efx) in efx_ef10_irq_test_generate() argument
2196 if (efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG41750, true, in efx_ef10_irq_test_generate()
2202 MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level); in efx_ef10_irq_test_generate()
2203 return efx_mcdi_rpc(efx, MC_CMD_TRIGGER_INTERRUPT, in efx_ef10_irq_test_generate()
2212 return efx_nic_alloc_buffer(tx_queue->efx, &tx_queue->txd, in efx_ef10_tx_probe()
2228 efx_writeo_page(tx_queue->efx, ®, in efx_ef10_push_tx_desc()
2327 static u32 efx_ef10_tso_versions(struct efx_nic *efx) in efx_ef10_tso_versions() argument
2329 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_tso_versions()
2346 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_init() local
2351 nic_data = efx->nic_data; in efx_ef10_tx_init()
2360 if (efx->type->ptp_set_ts_sync_events) in efx_ef10_tx_init()
2361 efx->type->ptp_set_ts_sync_events(efx, false, false); in efx_ef10_tx_init()
2370 if (efx_has_cap(efx, TX_TSO_V2)) { in efx_ef10_tx_init()
2374 netif_dbg(efx, hw, efx->net_dev, "Using TSOv2 for channel %u\n", in efx_ef10_tx_init()
2377 } else if (efx_has_cap(efx, TX_TSO)) { in efx_ef10_tx_init()
2405 if (tx_queue->tso_version == 2 && efx_has_cap(efx, TX_TSO_V2_ENCAP)) in efx_ef10_tx_init()
2414 netdev_WARN(efx->net_dev, "failed to initialise TXQ %d\n", in efx_ef10_tx_init()
2426 efx_writed_page(tx_queue->efx, ®, in efx_ef10_notify_tx_desc()
2496 static int efx_ef10_probe_multicast_chaining(struct efx_nic *efx) in efx_ef10_probe_multicast_chaining() argument
2498 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_probe_multicast_chaining()
2503 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_probe_multicast_chaining()
2521 rc = efx_mcdi_set_workaround(efx, in efx_ef10_probe_multicast_chaining()
2527 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_multicast_chaining()
2537 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_probe_multicast_chaining()
2551 static int efx_ef10_filter_table_probe(struct efx_nic *efx) in efx_ef10_filter_table_probe() argument
2553 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_probe()
2554 int rc = efx_ef10_probe_multicast_chaining(efx); in efx_ef10_filter_table_probe()
2559 down_write(&efx->filter_sem); in efx_ef10_filter_table_probe()
2560 rc = efx_mcdi_filter_table_probe(efx, nic_data->workaround_26807); in efx_ef10_filter_table_probe()
2566 rc = efx_mcdi_filter_add_vlan(efx, vlan->vid); in efx_ef10_filter_table_probe()
2573 efx_mcdi_filter_table_remove(efx); in efx_ef10_filter_table_probe()
2575 up_write(&efx->filter_sem); in efx_ef10_filter_table_probe()
2579 static void efx_ef10_filter_table_remove(struct efx_nic *efx) in efx_ef10_filter_table_remove() argument
2581 down_write(&efx->filter_sem); in efx_ef10_filter_table_remove()
2582 efx_mcdi_filter_table_remove(efx); in efx_ef10_filter_table_remove()
2583 up_write(&efx->filter_sem); in efx_ef10_filter_table_remove()
2602 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_write() local
2620 efx_writed_page(efx, ®, ER_DZ_RX_DESC_UPD, in efx_ef10_rx_write()
2644 efx_mcdi_rpc_async(channel->efx, MC_CMD_DRIVER_EVENT, in efx_ef10_rx_defer_refill()
2650 efx_ef10_rx_defer_refill_complete(struct efx_nic *efx, unsigned long cookie, in efx_ef10_rx_defer_refill_complete() argument
2659 struct efx_nic *efx = channel->efx; in efx_ef10_ev_init() local
2663 nic_data = efx->nic_data; in efx_ef10_ev_init()
2674 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_wrong_queue() local
2676 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_wrong_queue()
2680 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_wrong_queue()
2688 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_bad_lbits() local
2690 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_bad_lbits()
2694 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_bad_lbits()
2702 netif_dbg(rx_queue->efx, hw, rx_queue->efx->net_dev, in efx_ef10_handle_rx_abort()
2724 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event_errors() local
2728 if (!(efx->net_dev->features & NETIF_F_RXALL)) { in efx_ef10_handle_rx_event_errors()
2729 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2741 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2745 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2757 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2761 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2769 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2777 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2781 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2787 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2795 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2799 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2814 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event() local
2815 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
2821 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_rx_event()
2838 netdev_WARN(efx->net_dev, "saw RX_DROP_EVENT: event=" in efx_ef10_handle_rx_event()
2851 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
2856 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
2922 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
2963 struct efx_nic *efx = channel->efx; in efx_ef10_handle_tx_event() local
2971 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_tx_event()
3031 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_tx_event()
3045 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_event() local
3058 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_event()
3070 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_generated_event() local
3087 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_generated_event()
3099 struct efx_nic *efx = channel->efx; in efx_ef10_ev_process() local
3124 netif_vdbg(efx, drv, efx->net_dev, in efx_ef10_ev_process()
3158 netif_err(efx, hw, efx->net_dev, in efx_ef10_ev_process()
3173 struct efx_nic *efx = channel->efx; in efx_ef10_ev_read_ack() local
3176 if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_ev_read_ack()
3188 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3195 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3201 efx_writed_page(efx, &rptr, ER_DZ_EVQ_RPTR, channel->channel); in efx_ef10_ev_read_ack()
3208 struct efx_nic *efx = channel->efx; in efx_ef10_ev_test_generate() local
3224 rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf), in efx_ef10_ev_test_generate()
3233 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_ev_test_generate()
3236 static void efx_ef10_prepare_flr(struct efx_nic *efx) in efx_ef10_prepare_flr() argument
3238 atomic_set(&efx->active_queues, 0); in efx_ef10_prepare_flr()
3241 static int efx_ef10_vport_set_mac_address(struct efx_nic *efx) in efx_ef10_vport_set_mac_address() argument
3243 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vport_set_mac_address()
3251 efx_device_detach_sync(efx); in efx_ef10_vport_set_mac_address()
3252 efx_net_stop(efx->net_dev); in efx_ef10_vport_set_mac_address()
3253 efx_ef10_filter_table_remove(efx); in efx_ef10_vport_set_mac_address()
3255 rc = efx_ef10_vadaptor_free(efx, efx->vport_id); in efx_ef10_vport_set_mac_address()
3260 rc = efx_ef10_vport_del_mac(efx, efx->vport_id, in efx_ef10_vport_set_mac_address()
3265 rc = efx_ef10_vport_add_mac(efx, efx->vport_id, in efx_ef10_vport_set_mac_address()
3266 efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
3268 ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
3270 rc2 = efx_ef10_vport_add_mac(efx, efx->vport_id, mac_old); in efx_ef10_vport_set_mac_address()
3279 rc2 = efx_ef10_vadaptor_alloc(efx, efx->vport_id); in efx_ef10_vport_set_mac_address()
3283 rc2 = efx_ef10_filter_table_probe(efx); in efx_ef10_vport_set_mac_address()
3287 rc2 = efx_net_open(efx->net_dev); in efx_ef10_vport_set_mac_address()
3291 efx_device_attach_if_not_resetting(efx); in efx_ef10_vport_set_mac_address()
3296 netif_err(efx, drv, efx->net_dev, in efx_ef10_vport_set_mac_address()
3298 efx_schedule_reset(efx, RESET_TYPE_DATAPATH); in efx_ef10_vport_set_mac_address()
3303 static int efx_ef10_set_mac_address(struct efx_nic *efx) in efx_ef10_set_mac_address() argument
3306 bool was_enabled = efx->port_enabled; in efx_ef10_set_mac_address()
3313 if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { in efx_ef10_set_mac_address()
3314 struct efx_nic *efx_pf = pci_get_drvdata(efx->pci_dev->physfn); in efx_ef10_set_mac_address()
3315 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_mac_address()
3321 ether_addr_copy(mac, efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
3327 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_set_mac_address()
3333 efx_device_detach_sync(efx); in efx_ef10_set_mac_address()
3334 efx_net_stop(efx->net_dev); in efx_ef10_set_mac_address()
3336 mutex_lock(&efx->mac_lock); in efx_ef10_set_mac_address()
3337 efx_ef10_filter_table_remove(efx); in efx_ef10_set_mac_address()
3340 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
3342 efx->vport_id); in efx_ef10_set_mac_address()
3343 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, in efx_ef10_set_mac_address()
3346 efx_ef10_filter_table_probe(efx); in efx_ef10_set_mac_address()
3347 mutex_unlock(&efx->mac_lock); in efx_ef10_set_mac_address()
3350 efx_net_open(efx->net_dev); in efx_ef10_set_mac_address()
3351 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_mac_address()
3354 netif_err(efx, drv, efx->net_dev, in efx_ef10_set_mac_address()
3357 } else if (rc == -ENOSYS && !efx_ef10_is_vf(efx)) { in efx_ef10_set_mac_address()
3363 rc = efx_ef10_vport_set_mac_address(efx); in efx_ef10_set_mac_address()
3365 efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC, in efx_ef10_set_mac_address()
3372 static int efx_ef10_mac_reconfigure(struct efx_nic *efx, bool mtu_only) in efx_ef10_mac_reconfigure() argument
3374 WARN_ON(!mutex_is_locked(&efx->mac_lock)); in efx_ef10_mac_reconfigure()
3376 efx_mcdi_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure()
3378 if (mtu_only && efx_has_cap(efx, SET_MAC_ENHANCED)) in efx_ef10_mac_reconfigure()
3379 return efx_mcdi_set_mtu(efx); in efx_ef10_mac_reconfigure()
3380 return efx_mcdi_set_mac(efx); in efx_ef10_mac_reconfigure()
3383 static int efx_ef10_start_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_start_bist() argument
3388 return efx_mcdi_rpc(efx, MC_CMD_START_BIST, inbuf, sizeof(inbuf), in efx_ef10_start_bist()
3396 static int efx_ef10_poll_bist(struct efx_nic *efx) in efx_ef10_poll_bist() argument
3403 rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, in efx_ef10_poll_bist()
3414 netif_dbg(efx, hw, efx->net_dev, "BIST passed.\n"); in efx_ef10_poll_bist()
3417 netif_err(efx, hw, efx->net_dev, "BIST timed out\n"); in efx_ef10_poll_bist()
3420 netif_err(efx, hw, efx->net_dev, "BIST failed.\n"); in efx_ef10_poll_bist()
3423 netif_err(efx, hw, efx->net_dev, in efx_ef10_poll_bist()
3429 static int efx_ef10_run_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_run_bist() argument
3433 netif_dbg(efx, drv, efx->net_dev, "starting BIST type %u\n", bist_type); in efx_ef10_run_bist()
3435 rc = efx_ef10_start_bist(efx, bist_type); in efx_ef10_run_bist()
3439 return efx_ef10_poll_bist(efx); in efx_ef10_run_bist()
3443 efx_ef10_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) in efx_ef10_test_chip() argument
3447 efx_reset_down(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
3449 rc = efx_mcdi_rpc(efx, MC_CMD_ENABLE_OFFLINE_BIST, in efx_ef10_test_chip()
3454 tests->memory = efx_ef10_run_bist(efx, MC_CMD_MC_MEM_BIST) ? -1 : 1; in efx_ef10_test_chip()
3455 tests->registers = efx_ef10_run_bist(efx, MC_CMD_REG_BIST) ? -1 : 1; in efx_ef10_test_chip()
3457 rc = efx_mcdi_reset(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
3462 rc2 = efx_reset_up(efx, RESET_TYPE_WORLD, rc == 0); in efx_ef10_test_chip()
3496 static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, in efx_ef10_mtd_probe_partition() argument
3516 if (info->port != efx_port_num(efx)) in efx_ef10_mtd_probe_partition()
3519 rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); in efx_ef10_mtd_probe_partition()
3542 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_METADATA, inbuf, sizeof(inbuf), in efx_ef10_mtd_probe_partition()
3567 static int efx_ef10_mtd_probe(struct efx_nic *efx) in efx_ef10_mtd_probe() argument
3579 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_PARTITIONS, NULL, 0, in efx_ef10_mtd_probe()
3599 rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type, in efx_ef10_mtd_probe()
3613 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in efx_ef10_mtd_probe()
3622 static void efx_ef10_ptp_write_host_time(struct efx_nic *efx, u32 host_time) in efx_ef10_ptp_write_host_time() argument
3624 _efx_writed(efx, cpu_to_le32(host_time), ER_DZ_MC_DB_LWRD); in efx_ef10_ptp_write_host_time()
3627 static void efx_ef10_ptp_write_host_time_vf(struct efx_nic *efx, in efx_ef10_ptp_write_host_time_vf() argument
3647 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_enable_timestamping()
3680 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_disable_timestamping()
3686 static int efx_ef10_ptp_set_ts_sync_events(struct efx_nic *efx, bool en, in efx_ef10_ptp_set_ts_sync_events() argument
3696 channel = efx_ptp_channel(efx); in efx_ef10_ptp_set_ts_sync_events()
3700 efx_ef10_ptp_set_ts_sync_events(efx, false, temp); in efx_ef10_ptp_set_ts_sync_events()
3708 static int efx_ef10_ptp_set_ts_config_vf(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config_vf() argument
3714 static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config() argument
3721 efx_ef10_ptp_set_ts_sync_events(efx, false, false); in efx_ef10_ptp_set_ts_config()
3723 return efx_ptp_change_mode(efx, in efx_ef10_ptp_set_ts_config()
3740 rc = efx_ptp_change_mode(efx, true, 0); in efx_ef10_ptp_set_ts_config()
3742 rc = efx_ef10_ptp_set_ts_sync_events(efx, true, false); in efx_ef10_ptp_set_ts_config()
3744 efx_ptp_change_mode(efx, false, 0); in efx_ef10_ptp_set_ts_config()
3751 static int efx_ef10_get_phys_port_id(struct efx_nic *efx, in efx_ef10_get_phys_port_id() argument
3754 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_phys_port_id()
3765 static int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_add_vid() argument
3770 return efx_ef10_add_vlan(efx, vid); in efx_ef10_vlan_rx_add_vid()
3773 static int efx_ef10_vlan_rx_kill_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_kill_vid() argument
3778 return efx_ef10_del_vlan(efx, vid); in efx_ef10_vlan_rx_kill_vid()
3786 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading) in efx_ef10_set_udp_tnl_ports() argument
3788 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_udp_tnl_ports()
3804 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
3841 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS, in efx_ef10_set_udp_tnl_ports()
3855 netif_warn(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
3859 netif_info(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
3876 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
3882 static int efx_ef10_udp_tnl_push_ports(struct efx_nic *efx) in efx_ef10_udp_tnl_push_ports() argument
3884 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_push_ports()
3892 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_push_ports()
3893 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_push_ports()
3903 struct efx_nic *efx = efx_netdev_priv(dev); in efx_ef10_udp_tnl_set_port() local
3912 nic_data = efx->nic_data; in efx_ef10_udp_tnl_set_port()
3921 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_set_port()
3924 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_set_port()
3935 static bool efx_ef10_udp_tnl_has_port(struct efx_nic *efx, __be16 port) in efx_ef10_udp_tnl_has_port() argument
3937 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_has_port()
3963 struct efx_nic *efx = efx_netdev_priv(dev); in efx_ef10_udp_tnl_unset_port() local
3967 nic_data = efx->nic_data; in efx_ef10_udp_tnl_unset_port()
3973 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_unset_port()
3976 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_unset_port()
3998 static size_t efx_ef10_print_additional_fwver(struct efx_nic *efx, char *buf, in efx_ef10_print_additional_fwver() argument
4001 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_print_additional_fwver()
4008 static unsigned int ef10_check_caps(const struct efx_nic *efx, in ef10_check_caps() argument
4012 const struct efx_ef10_nic_data *nic_data = efx->nic_data; in ef10_check_caps()
4024 static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx) in efx_ef10_recycle_ring_size() argument
4031 switch (efx->pci_dev->device & 0xfff) { in efx_ef10_recycle_ring_size()