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()
1304 static int efx_ef10_init_nic(struct efx_nic *efx) in efx_ef10_init_nic() argument
1306 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_nic()
1311 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_init_nic()
1317 if (efx->must_realloc_vis) { in efx_ef10_init_nic()
1319 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, in efx_ef10_init_nic()
1323 efx->must_realloc_vis = false; in efx_ef10_init_nic()
1326 nic_data->mc_stats = kmalloc(efx->num_mac_stats * sizeof(__le64), in efx_ef10_init_nic()
1332 rc = efx_ef10_alloc_piobufs(efx, nic_data->n_piobufs); in efx_ef10_init_nic()
1334 rc = efx_ef10_link_piobufs(efx); in efx_ef10_init_nic()
1336 efx_ef10_free_piobufs(efx); in efx_ef10_init_nic()
1344 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1347 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1353 if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx)) in efx_ef10_init_nic()
1356 if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { in efx_ef10_init_nic()
1363 efx->net_dev->features |= encap_tso_features; in efx_ef10_init_nic()
1365 efx->net_dev->hw_enc_features = hw_enc_features; in efx_ef10_init_nic()
1368 rc = efx->type->rx_push_rss_config(efx, false, in efx_ef10_init_nic()
1369 efx->rss_context.rx_indir_table, NULL); in efx_ef10_init_nic()
1374 static void efx_ef10_table_reset_mc_allocations(struct efx_nic *efx) in efx_ef10_table_reset_mc_allocations() argument
1376 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_table_reset_mc_allocations()
1382 efx->must_realloc_vis = true; in efx_ef10_table_reset_mc_allocations()
1383 efx_mcdi_filter_table_reset_mc_allocations(efx); in efx_ef10_table_reset_mc_allocations()
1385 efx_ef10_forget_old_piobufs(efx); in efx_ef10_table_reset_mc_allocations()
1386 efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID; in efx_ef10_table_reset_mc_allocations()
1390 efx->vport_id = EVB_PORT_ID_ASSIGNED; in efx_ef10_table_reset_mc_allocations()
1393 for (i = 0; i < efx->vf_count; i++) in efx_ef10_table_reset_mc_allocations()
1436 static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) in efx_ef10_reset() argument
1438 int rc = efx_mcdi_reset(efx, reset_type); in efx_ef10_reset()
1454 efx_ef10_table_reset_mc_allocations(efx); in efx_ef10_reset()
1674 static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) in efx_ef10_raw_stat_mask() argument
1677 u32 port_caps = efx_mcdi_phy_get_caps(efx); in efx_ef10_raw_stat_mask()
1678 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_raw_stat_mask()
1680 if (!(efx->mcdi->fn_flags & in efx_ef10_raw_stat_mask()
1701 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) in efx_ef10_get_stat_mask() argument
1703 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_stat_mask()
1706 raw_mask[0] = efx_ef10_raw_stat_mask(efx); in efx_ef10_get_stat_mask()
1717 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V2) in efx_ef10_get_stat_mask()
1724 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V3 && in efx_ef10_get_stat_mask()
1741 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) in efx_ef10_describe_stats() argument
1745 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_describe_stats()
1750 static void efx_ef10_get_fec_stats(struct efx_nic *efx, in efx_ef10_get_fec_stats() argument
1754 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_fec_stats()
1757 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_get_fec_stats()
1766 static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_common() argument
1770 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_common()
1774 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats_common()
1835 static size_t efx_ef10_update_stats_pf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_pf() argument
1838 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_pf()
1842 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats_pf()
1844 efx_nic_copy_stats(efx, nic_data->mc_stats); in efx_ef10_update_stats_pf()
1849 efx_nic_fix_nodesc_drop_stat(efx, in efx_ef10_update_stats_pf()
1870 efx_update_sw_stats(efx, stats); in efx_ef10_update_stats_pf()
1872 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_pf()
1875 static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx) in efx_ef10_try_update_nic_stats_vf() argument
1876 __must_hold(&efx->stats_lock) in efx_ef10_try_update_nic_stats_vf()
1879 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats_vf()
1883 u32 dma_len = efx->num_mac_stats * sizeof(u64); in efx_ef10_try_update_nic_stats_vf()
1888 spin_unlock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1890 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats_vf()
1892 rc = efx_nic_alloc_buffer(efx, &stats_buf, dma_len, GFP_KERNEL); in efx_ef10_try_update_nic_stats_vf()
1894 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1899 dma_stats[efx->num_mac_stats - 1] = EFX_MC_STATS_GENERATION_INVALID; in efx_ef10_try_update_nic_stats_vf()
1907 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), in efx_ef10_try_update_nic_stats_vf()
1909 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1912 if (rc != -ENOENT || atomic_read(&efx->active_queues)) in efx_ef10_try_update_nic_stats_vf()
1913 efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, in efx_ef10_try_update_nic_stats_vf()
1918 generation_end = dma_stats[efx->num_mac_stats - 1]; in efx_ef10_try_update_nic_stats_vf()
1933 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_vf()
1936 spin_unlock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1937 efx_nic_free_buffer(efx, &stats_buf); in efx_ef10_try_update_nic_stats_vf()
1938 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
1942 static size_t efx_ef10_update_stats_vf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_vf() argument
1945 if (efx_ef10_try_update_nic_stats_vf(efx)) in efx_ef10_update_stats_vf()
1948 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_vf()
1951 static size_t efx_ef10_update_stats_atomic_vf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_atomic_vf() argument
1954 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_atomic_vf()
1959 efx_update_sw_stats(efx, nic_data->stats); in efx_ef10_update_stats_atomic_vf()
1960 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_atomic_vf()
1965 struct efx_nic *efx = channel->efx; in efx_ef10_push_irq_moderation() local
1977 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_push_irq_moderation()
1987 efx_mcdi_rpc_async(efx, MC_CMD_SET_EVQ_TMR, in efx_ef10_push_irq_moderation()
1989 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_push_irq_moderation()
1990 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
1996 efx_writed_page(efx, &timer_cmd, ER_DD_EVQ_INDIRECT, in efx_ef10_push_irq_moderation()
1999 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2004 efx_writed_page(efx, &timer_cmd, ER_DZ_EVQ_TMR, in efx_ef10_push_irq_moderation()
2009 static void efx_ef10_get_wol_vf(struct efx_nic *efx, in efx_ef10_get_wol_vf() argument
2012 static int efx_ef10_set_wol_vf(struct efx_nic *efx, u32 type) in efx_ef10_set_wol_vf() argument
2017 static void efx_ef10_get_wol(struct efx_nic *efx, struct ethtool_wolinfo *wol) in efx_ef10_get_wol() argument
2024 static int efx_ef10_set_wol(struct efx_nic *efx, u32 type) in efx_ef10_set_wol() argument
2031 static void efx_ef10_mcdi_request(struct efx_nic *efx, in efx_ef10_mcdi_request() argument
2035 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_request()
2048 _efx_writed(efx, cpu_to_le32((u64)nic_data->mcdi_buf.dma_addr >> 32), in efx_ef10_mcdi_request()
2050 _efx_writed(efx, cpu_to_le32((u32)nic_data->mcdi_buf.dma_addr), in efx_ef10_mcdi_request()
2054 static bool efx_ef10_mcdi_poll_response(struct efx_nic *efx) in efx_ef10_mcdi_poll_response() argument
2056 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_response()
2064 efx_ef10_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf, in efx_ef10_mcdi_read_response() argument
2067 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_read_response()
2073 static void efx_ef10_mcdi_reboot_detected(struct efx_nic *efx) in efx_ef10_mcdi_reboot_detected() argument
2075 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_reboot_detected()
2078 efx_ef10_table_reset_mc_allocations(efx); in efx_ef10_mcdi_reboot_detected()
2089 static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) in efx_ef10_mcdi_poll_reboot() argument
2091 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_reboot()
2094 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_mcdi_poll_reboot()
2108 efx_ef10_mcdi_reboot_detected(efx); in efx_ef10_mcdi_poll_reboot()
2123 struct efx_nic *efx = context->efx; in efx_ef10_msi_interrupt() local
2125 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_msi_interrupt()
2128 if (likely(READ_ONCE(efx->irq_soft_enabled))) { in efx_ef10_msi_interrupt()
2130 if (context->index == efx->irq_level) in efx_ef10_msi_interrupt()
2131 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_msi_interrupt()
2134 efx_schedule_channel_irq(efx->channel[context->index]); in efx_ef10_msi_interrupt()
2142 struct efx_nic *efx = dev_id; in efx_ef10_legacy_interrupt() local
2143 bool soft_enabled = READ_ONCE(efx->irq_soft_enabled); in efx_ef10_legacy_interrupt()
2149 efx_readd(efx, ®, ER_DZ_BIU_INT_ISR); in efx_ef10_legacy_interrupt()
2157 if (queues & (1U << efx->irq_level)) in efx_ef10_legacy_interrupt()
2158 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_legacy_interrupt()
2160 efx_for_each_channel(channel, efx) { in efx_ef10_legacy_interrupt()
2167 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_legacy_interrupt()
2174 static int efx_ef10_irq_test_generate(struct efx_nic *efx) in efx_ef10_irq_test_generate() argument
2178 if (efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG41750, true, in efx_ef10_irq_test_generate()
2184 MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level); in efx_ef10_irq_test_generate()
2185 return efx_mcdi_rpc(efx, MC_CMD_TRIGGER_INTERRUPT, in efx_ef10_irq_test_generate()
2194 return efx_nic_alloc_buffer(tx_queue->efx, &tx_queue->txd.buf, in efx_ef10_tx_probe()
2210 efx_writeo_page(tx_queue->efx, ®, in efx_ef10_push_tx_desc()
2309 static u32 efx_ef10_tso_versions(struct efx_nic *efx) in efx_ef10_tso_versions() argument
2311 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_tso_versions()
2328 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_init() local
2333 nic_data = efx->nic_data; in efx_ef10_tx_init()
2342 if (efx->type->ptp_set_ts_sync_events) in efx_ef10_tx_init()
2343 efx->type->ptp_set_ts_sync_events(efx, false, false); in efx_ef10_tx_init()
2352 if (efx_has_cap(efx, TX_TSO_V2)) { in efx_ef10_tx_init()
2356 netif_dbg(efx, hw, efx->net_dev, "Using TSOv2 for channel %u\n", in efx_ef10_tx_init()
2359 } else if (efx_has_cap(efx, TX_TSO)) { in efx_ef10_tx_init()
2387 if (tx_queue->tso_version == 2 && efx_has_cap(efx, TX_TSO_V2_ENCAP)) in efx_ef10_tx_init()
2396 netdev_WARN(efx->net_dev, "failed to initialise TXQ %d\n", in efx_ef10_tx_init()
2408 efx_writed_page(tx_queue->efx, ®, in efx_ef10_notify_tx_desc()
2478 static int efx_ef10_probe_multicast_chaining(struct efx_nic *efx) in efx_ef10_probe_multicast_chaining() argument
2480 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_probe_multicast_chaining()
2485 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_probe_multicast_chaining()
2503 rc = efx_mcdi_set_workaround(efx, in efx_ef10_probe_multicast_chaining()
2509 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_multicast_chaining()
2519 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_probe_multicast_chaining()
2533 static int efx_ef10_filter_table_probe(struct efx_nic *efx) in efx_ef10_filter_table_probe() argument
2535 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_probe()
2536 int rc = efx_ef10_probe_multicast_chaining(efx); in efx_ef10_filter_table_probe()
2541 down_write(&efx->filter_sem); in efx_ef10_filter_table_probe()
2542 rc = efx_mcdi_filter_table_probe(efx, nic_data->workaround_26807); in efx_ef10_filter_table_probe()
2548 rc = efx_mcdi_filter_add_vlan(efx, vlan->vid); in efx_ef10_filter_table_probe()
2555 efx_mcdi_filter_table_remove(efx); in efx_ef10_filter_table_probe()
2557 up_write(&efx->filter_sem); in efx_ef10_filter_table_probe()
2561 static void efx_ef10_filter_table_remove(struct efx_nic *efx) in efx_ef10_filter_table_remove() argument
2563 down_write(&efx->filter_sem); in efx_ef10_filter_table_remove()
2564 efx_mcdi_filter_table_remove(efx); in efx_ef10_filter_table_remove()
2565 up_write(&efx->filter_sem); in efx_ef10_filter_table_remove()
2584 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_write() local
2602 efx_writed_page(efx, ®, ER_DZ_RX_DESC_UPD, in efx_ef10_rx_write()
2626 efx_mcdi_rpc_async(channel->efx, MC_CMD_DRIVER_EVENT, in efx_ef10_rx_defer_refill()
2632 efx_ef10_rx_defer_refill_complete(struct efx_nic *efx, unsigned long cookie, in efx_ef10_rx_defer_refill_complete() argument
2641 struct efx_nic *efx = channel->efx; in efx_ef10_ev_init() local
2645 nic_data = efx->nic_data; in efx_ef10_ev_init()
2656 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_wrong_queue() local
2658 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_wrong_queue()
2662 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_wrong_queue()
2670 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_bad_lbits() local
2672 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_bad_lbits()
2676 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_bad_lbits()
2684 netif_dbg(rx_queue->efx, hw, rx_queue->efx->net_dev, in efx_ef10_handle_rx_abort()
2706 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event_errors() local
2710 if (!(efx->net_dev->features & NETIF_F_RXALL)) { in efx_ef10_handle_rx_event_errors()
2711 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2723 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2727 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2739 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2743 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
2751 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2759 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
2763 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()
2796 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event() local
2797 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
2803 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_rx_event()
2820 netdev_WARN(efx->net_dev, "saw RX_DROP_EVENT: event=" in efx_ef10_handle_rx_event()
2833 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
2838 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
2904 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
2945 struct efx_nic *efx = channel->efx; in efx_ef10_handle_tx_event() local
2952 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_tx_event()
3011 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_tx_event()
3023 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_event() local
3036 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_event()
3048 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_generated_event() local
3065 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_generated_event()
3075 struct efx_nic *efx = channel->efx; in efx_ef10_ev_process() local
3099 netif_vdbg(efx, drv, efx->net_dev, in efx_ef10_ev_process()
3129 netif_err(efx, hw, efx->net_dev, in efx_ef10_ev_process()
3144 struct efx_nic *efx = channel->efx; in efx_ef10_ev_read_ack() local
3147 if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_ev_read_ack()
3159 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3166 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3172 efx_writed_page(efx, &rptr, ER_DZ_EVQ_RPTR, channel->channel); in efx_ef10_ev_read_ack()
3179 struct efx_nic *efx = channel->efx; in efx_ef10_ev_test_generate() local
3195 rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf), in efx_ef10_ev_test_generate()
3204 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_ev_test_generate()
3207 static void efx_ef10_prepare_flr(struct efx_nic *efx) in efx_ef10_prepare_flr() argument
3209 atomic_set(&efx->active_queues, 0); in efx_ef10_prepare_flr()
3212 static int efx_ef10_vport_set_mac_address(struct efx_nic *efx) in efx_ef10_vport_set_mac_address() argument
3214 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vport_set_mac_address()
3222 efx_device_detach_sync(efx); in efx_ef10_vport_set_mac_address()
3223 efx_net_stop(efx->net_dev); in efx_ef10_vport_set_mac_address()
3224 efx_ef10_filter_table_remove(efx); in efx_ef10_vport_set_mac_address()
3226 rc = efx_ef10_vadaptor_free(efx, efx->vport_id); in efx_ef10_vport_set_mac_address()
3231 rc = efx_ef10_vport_del_mac(efx, efx->vport_id, in efx_ef10_vport_set_mac_address()
3236 rc = efx_ef10_vport_add_mac(efx, efx->vport_id, in efx_ef10_vport_set_mac_address()
3237 efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
3239 ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
3241 rc2 = efx_ef10_vport_add_mac(efx, efx->vport_id, mac_old); in efx_ef10_vport_set_mac_address()
3250 rc2 = efx_ef10_vadaptor_alloc(efx, efx->vport_id); in efx_ef10_vport_set_mac_address()
3254 rc2 = efx_ef10_filter_table_probe(efx); in efx_ef10_vport_set_mac_address()
3258 rc2 = efx_net_open(efx->net_dev); in efx_ef10_vport_set_mac_address()
3262 efx_device_attach_if_not_resetting(efx); in efx_ef10_vport_set_mac_address()
3267 netif_err(efx, drv, efx->net_dev, in efx_ef10_vport_set_mac_address()
3269 efx_schedule_reset(efx, RESET_TYPE_DATAPATH); in efx_ef10_vport_set_mac_address()
3274 static int efx_ef10_set_mac_address(struct efx_nic *efx) in efx_ef10_set_mac_address() argument
3277 bool was_enabled = efx->port_enabled; in efx_ef10_set_mac_address()
3284 if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { in efx_ef10_set_mac_address()
3285 struct efx_nic *efx_pf = pci_get_drvdata(efx->pci_dev->physfn); in efx_ef10_set_mac_address()
3286 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_mac_address()
3292 ether_addr_copy(mac, efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
3298 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_set_mac_address()
3304 efx_device_detach_sync(efx); in efx_ef10_set_mac_address()
3305 efx_net_stop(efx->net_dev); in efx_ef10_set_mac_address()
3307 mutex_lock(&efx->mac_lock); in efx_ef10_set_mac_address()
3308 efx_ef10_filter_table_remove(efx); in efx_ef10_set_mac_address()
3311 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
3313 efx->vport_id); in efx_ef10_set_mac_address()
3314 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, in efx_ef10_set_mac_address()
3317 efx_ef10_filter_table_probe(efx); in efx_ef10_set_mac_address()
3318 mutex_unlock(&efx->mac_lock); in efx_ef10_set_mac_address()
3321 efx_net_open(efx->net_dev); in efx_ef10_set_mac_address()
3322 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_mac_address()
3325 netif_err(efx, drv, efx->net_dev, in efx_ef10_set_mac_address()
3328 } else if (rc == -ENOSYS && !efx_ef10_is_vf(efx)) { in efx_ef10_set_mac_address()
3334 rc = efx_ef10_vport_set_mac_address(efx); in efx_ef10_set_mac_address()
3336 efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC, in efx_ef10_set_mac_address()
3343 static int efx_ef10_mac_reconfigure(struct efx_nic *efx, bool mtu_only) in efx_ef10_mac_reconfigure() argument
3345 WARN_ON(!mutex_is_locked(&efx->mac_lock)); in efx_ef10_mac_reconfigure()
3347 efx_mcdi_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure()
3349 if (mtu_only && efx_has_cap(efx, SET_MAC_ENHANCED)) in efx_ef10_mac_reconfigure()
3350 return efx_mcdi_set_mtu(efx); in efx_ef10_mac_reconfigure()
3351 return efx_mcdi_set_mac(efx); in efx_ef10_mac_reconfigure()
3354 static int efx_ef10_start_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_start_bist() argument
3359 return efx_mcdi_rpc(efx, MC_CMD_START_BIST, inbuf, sizeof(inbuf), in efx_ef10_start_bist()
3367 static int efx_ef10_poll_bist(struct efx_nic *efx) in efx_ef10_poll_bist() argument
3374 rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, in efx_ef10_poll_bist()
3385 netif_dbg(efx, hw, efx->net_dev, "BIST passed.\n"); in efx_ef10_poll_bist()
3388 netif_err(efx, hw, efx->net_dev, "BIST timed out\n"); in efx_ef10_poll_bist()
3391 netif_err(efx, hw, efx->net_dev, "BIST failed.\n"); in efx_ef10_poll_bist()
3394 netif_err(efx, hw, efx->net_dev, in efx_ef10_poll_bist()
3400 static int efx_ef10_run_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_run_bist() argument
3404 netif_dbg(efx, drv, efx->net_dev, "starting BIST type %u\n", bist_type); in efx_ef10_run_bist()
3406 rc = efx_ef10_start_bist(efx, bist_type); in efx_ef10_run_bist()
3410 return efx_ef10_poll_bist(efx); in efx_ef10_run_bist()
3414 efx_ef10_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) in efx_ef10_test_chip() argument
3418 efx_reset_down(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
3420 rc = efx_mcdi_rpc(efx, MC_CMD_ENABLE_OFFLINE_BIST, in efx_ef10_test_chip()
3425 tests->memory = efx_ef10_run_bist(efx, MC_CMD_MC_MEM_BIST) ? -1 : 1; in efx_ef10_test_chip()
3426 tests->registers = efx_ef10_run_bist(efx, MC_CMD_REG_BIST) ? -1 : 1; in efx_ef10_test_chip()
3428 rc = efx_mcdi_reset(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
3433 rc2 = efx_reset_up(efx, RESET_TYPE_WORLD, rc == 0); in efx_ef10_test_chip()
3467 static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, in efx_ef10_mtd_probe_partition() argument
3487 if (info->port != efx_port_num(efx)) in efx_ef10_mtd_probe_partition()
3490 rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); in efx_ef10_mtd_probe_partition()
3513 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_METADATA, inbuf, sizeof(inbuf), in efx_ef10_mtd_probe_partition()
3538 static int efx_ef10_mtd_probe(struct efx_nic *efx) in efx_ef10_mtd_probe() argument
3550 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_PARTITIONS, NULL, 0, in efx_ef10_mtd_probe()
3570 rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type, in efx_ef10_mtd_probe()
3584 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in efx_ef10_mtd_probe()
3593 static void efx_ef10_ptp_write_host_time(struct efx_nic *efx, u32 host_time) in efx_ef10_ptp_write_host_time() argument
3595 _efx_writed(efx, cpu_to_le32(host_time), ER_DZ_MC_DB_LWRD); in efx_ef10_ptp_write_host_time()
3598 static void efx_ef10_ptp_write_host_time_vf(struct efx_nic *efx, in efx_ef10_ptp_write_host_time_vf() argument
3618 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_enable_timestamping()
3651 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_disable_timestamping()
3657 static int efx_ef10_ptp_set_ts_sync_events(struct efx_nic *efx, bool en, in efx_ef10_ptp_set_ts_sync_events() argument
3667 channel = efx_ptp_channel(efx); in efx_ef10_ptp_set_ts_sync_events()
3671 efx_ef10_ptp_set_ts_sync_events(efx, false, temp); in efx_ef10_ptp_set_ts_sync_events()
3679 static int efx_ef10_ptp_set_ts_config_vf(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config_vf() argument
3685 static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config() argument
3692 efx_ef10_ptp_set_ts_sync_events(efx, false, false); in efx_ef10_ptp_set_ts_config()
3694 return efx_ptp_change_mode(efx, in efx_ef10_ptp_set_ts_config()
3711 rc = efx_ptp_change_mode(efx, true, 0); in efx_ef10_ptp_set_ts_config()
3713 rc = efx_ef10_ptp_set_ts_sync_events(efx, true, false); in efx_ef10_ptp_set_ts_config()
3715 efx_ptp_change_mode(efx, false, 0); in efx_ef10_ptp_set_ts_config()
3722 static int efx_ef10_get_phys_port_id(struct efx_nic *efx, in efx_ef10_get_phys_port_id() argument
3725 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_phys_port_id()
3736 static int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_add_vid() argument
3741 return efx_ef10_add_vlan(efx, vid); in efx_ef10_vlan_rx_add_vid()
3744 static int efx_ef10_vlan_rx_kill_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_kill_vid() argument
3749 return efx_ef10_del_vlan(efx, vid); in efx_ef10_vlan_rx_kill_vid()
3757 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading) in efx_ef10_set_udp_tnl_ports() argument
3759 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_udp_tnl_ports()
3775 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
3812 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS, in efx_ef10_set_udp_tnl_ports()
3826 netif_warn(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
3830 netif_info(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
3847 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
3853 static int efx_ef10_udp_tnl_push_ports(struct efx_nic *efx) in efx_ef10_udp_tnl_push_ports() argument
3855 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_push_ports()
3863 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_push_ports()
3864 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_push_ports()
3874 struct efx_nic *efx = efx_netdev_priv(dev); in efx_ef10_udp_tnl_set_port() local
3883 nic_data = efx->nic_data; in efx_ef10_udp_tnl_set_port()
3892 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_set_port()
3895 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_set_port()
3906 static bool efx_ef10_udp_tnl_has_port(struct efx_nic *efx, __be16 port) in efx_ef10_udp_tnl_has_port() argument
3908 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_has_port()
3934 struct efx_nic *efx = efx_netdev_priv(dev); in efx_ef10_udp_tnl_unset_port() local
3938 nic_data = efx->nic_data; in efx_ef10_udp_tnl_unset_port()
3944 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_unset_port()
3947 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_unset_port()
3969 static size_t efx_ef10_print_additional_fwver(struct efx_nic *efx, char *buf, in efx_ef10_print_additional_fwver() argument
3972 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_print_additional_fwver()
3979 static unsigned int ef10_check_caps(const struct efx_nic *efx, in ef10_check_caps() argument
3983 const struct efx_ef10_nic_data *nic_data = efx->nic_data; in ef10_check_caps()
3995 static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx) in efx_ef10_recycle_ring_size() argument
4002 switch (efx->pci_dev->device & 0xfff) { in efx_ef10_recycle_ring_size()