Lines Matching refs:efx
122 static void efx_ef10_rx_free_indir_table(struct efx_nic *efx);
123 static void efx_ef10_filter_table_remove(struct efx_nic *efx);
124 static int efx_ef10_filter_add_vlan(struct efx_nic *efx, u16 vid);
125 static void efx_ef10_filter_del_vlan_internal(struct efx_nic *efx,
127 static void efx_ef10_filter_del_vlan(struct efx_nic *efx, u16 vid);
128 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading);
146 static int efx_ef10_get_warm_boot_count(struct efx_nic *efx) in efx_ef10_get_warm_boot_count() argument
150 efx_readd(efx, ®, ER_DZ_BIU_MC_SFT_STATUS); in efx_ef10_get_warm_boot_count()
159 static unsigned int efx_ef10_pf_mem_bar(struct efx_nic *efx) in efx_ef10_pf_mem_bar() argument
161 switch (efx->pci_dev->device) { in efx_ef10_pf_mem_bar()
170 static unsigned int efx_ef10_vf_mem_bar(struct efx_nic *efx) in efx_ef10_vf_mem_bar() argument
175 static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx) in efx_ef10_mem_map_size() argument
179 bar = efx->type->mem_bar(efx); in efx_ef10_mem_map_size()
180 return resource_size(&efx->pci_dev->resource[bar]); in efx_ef10_mem_map_size()
183 static bool efx_ef10_is_vf(struct efx_nic *efx) in efx_ef10_is_vf() argument
185 return efx->type->is_vf; in efx_ef10_is_vf()
188 static int efx_ef10_get_pf_index(struct efx_nic *efx) in efx_ef10_get_pf_index() argument
191 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_pf_index()
195 rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, in efx_ef10_get_pf_index()
207 static int efx_ef10_get_vf_index(struct efx_nic *efx) in efx_ef10_get_vf_index() argument
210 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_vf_index()
214 rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, in efx_ef10_get_vf_index()
226 static int efx_ef10_init_datapath_caps(struct efx_nic *efx) in efx_ef10_init_datapath_caps() argument
229 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_datapath_caps()
235 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CAPABILITIES, NULL, 0, in efx_ef10_init_datapath_caps()
240 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_datapath_caps()
267 netif_err(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
278 efx->vi_stride = 8192; in efx_ef10_init_datapath_caps()
281 efx->vi_stride = 16384; in efx_ef10_init_datapath_caps()
284 efx->vi_stride = 65536; in efx_ef10_init_datapath_caps()
287 netif_err(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
292 netif_dbg(efx, probe, efx->net_dev, "vi_stride = %u\n", in efx_ef10_init_datapath_caps()
293 efx->vi_stride); in efx_ef10_init_datapath_caps()
296 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
298 efx->vi_stride); in efx_ef10_init_datapath_caps()
302 efx->num_mac_stats = MCDI_WORD(outbuf, in efx_ef10_init_datapath_caps()
304 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
306 efx->num_mac_stats); in efx_ef10_init_datapath_caps()
309 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
311 efx->num_mac_stats); in efx_ef10_init_datapath_caps()
317 static void efx_ef10_read_licensed_features(struct efx_nic *efx) in efx_ef10_read_licensed_features() argument
321 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_read_licensed_features()
327 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_LICENSING_V3, inbuf, sizeof(inbuf), in efx_ef10_read_licensed_features()
336 static int efx_ef10_get_sysclk_freq(struct efx_nic *efx) in efx_ef10_get_sysclk_freq() argument
341 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CLOCK, NULL, 0, in efx_ef10_get_sysclk_freq()
349 static int efx_ef10_get_timer_workarounds(struct efx_nic *efx) in efx_ef10_get_timer_workarounds() argument
351 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_timer_workarounds()
359 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_get_timer_workarounds()
375 rc = efx_mcdi_set_workaround(efx, in efx_ef10_get_timer_workarounds()
385 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_get_timer_workarounds()
388 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_get_timer_workarounds()
395 static void efx_ef10_process_timer_config(struct efx_nic *efx, in efx_ef10_process_timer_config() argument
400 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_process_timer_config()
401 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
403 efx->timer_max_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
405 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_process_timer_config()
406 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
410 efx->timer_max_ns = max_count * efx->timer_quantum_ns; in efx_ef10_process_timer_config()
412 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
416 efx->timer_max_ns = max_count * efx->timer_quantum_ns; in efx_ef10_process_timer_config()
419 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_process_timer_config()
421 efx->timer_quantum_ns, efx->timer_max_ns); in efx_ef10_process_timer_config()
424 static int efx_ef10_get_timer_config(struct efx_nic *efx) in efx_ef10_get_timer_config() argument
429 rc = efx_ef10_get_timer_workarounds(efx); in efx_ef10_get_timer_config()
433 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_GET_EVQ_TMR_PROPERTIES, NULL, 0, in efx_ef10_get_timer_config()
437 efx_ef10_process_timer_config(efx, outbuf); in efx_ef10_get_timer_config()
442 rc = efx_ef10_get_sysclk_freq(efx); in efx_ef10_get_timer_config()
447 efx->timer_quantum_ns = quantum; in efx_ef10_get_timer_config()
448 efx->timer_max_ns = efx->type->timer_period_max * quantum; in efx_ef10_get_timer_config()
451 efx_mcdi_display_error(efx, MC_CMD_GET_EVQ_TMR_PROPERTIES, in efx_ef10_get_timer_config()
459 static int efx_ef10_get_mac_address_pf(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address_pf() argument
467 rc = efx_mcdi_rpc(efx, MC_CMD_GET_MAC_ADDRESSES, NULL, 0, in efx_ef10_get_mac_address_pf()
479 static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address_vf() argument
488 rc = efx_mcdi_rpc(efx, MC_CMD_VPORT_GET_MAC_ADDRESSES, inbuf, in efx_ef10_get_mac_address_vf()
511 struct efx_nic *efx = dev_get_drvdata(dev); in efx_ef10_show_link_control_flag() local
514 ((efx->mcdi->fn_flags) & in efx_ef10_show_link_control_flag()
523 struct efx_nic *efx = dev_get_drvdata(dev); in efx_ef10_show_primary_flag() local
526 ((efx->mcdi->fn_flags) & in efx_ef10_show_primary_flag()
531 static struct efx_ef10_vlan *efx_ef10_find_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_find_vlan() argument
533 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_find_vlan()
546 static int efx_ef10_add_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_add_vlan() argument
548 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_add_vlan()
554 vlan = efx_ef10_find_vlan(efx, vid); in efx_ef10_add_vlan()
561 netif_warn(efx, drv, efx->net_dev, in efx_ef10_add_vlan()
576 if (efx->filter_state) { in efx_ef10_add_vlan()
577 mutex_lock(&efx->mac_lock); in efx_ef10_add_vlan()
578 down_write(&efx->filter_sem); in efx_ef10_add_vlan()
579 rc = efx_ef10_filter_add_vlan(efx, vlan->vid); in efx_ef10_add_vlan()
580 up_write(&efx->filter_sem); in efx_ef10_add_vlan()
581 mutex_unlock(&efx->mac_lock); in efx_ef10_add_vlan()
599 static void efx_ef10_del_vlan_internal(struct efx_nic *efx, in efx_ef10_del_vlan_internal() argument
602 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_del_vlan_internal()
606 if (efx->filter_state) { in efx_ef10_del_vlan_internal()
607 down_write(&efx->filter_sem); in efx_ef10_del_vlan_internal()
608 efx_ef10_filter_del_vlan(efx, vlan->vid); in efx_ef10_del_vlan_internal()
609 up_write(&efx->filter_sem); in efx_ef10_del_vlan_internal()
616 static int efx_ef10_del_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_del_vlan() argument
618 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_del_vlan()
631 vlan = efx_ef10_find_vlan(efx, vid); in efx_ef10_del_vlan()
633 netif_err(efx, drv, efx->net_dev, in efx_ef10_del_vlan()
637 efx_ef10_del_vlan_internal(efx, vlan); in efx_ef10_del_vlan()
645 static void efx_ef10_cleanup_vlans(struct efx_nic *efx) in efx_ef10_cleanup_vlans() argument
647 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_cleanup_vlans()
652 efx_ef10_del_vlan_internal(efx, vlan); in efx_ef10_cleanup_vlans()
660 static int efx_ef10_probe(struct efx_nic *efx) in efx_ef10_probe() argument
668 efx->nic_data = nic_data; in efx_ef10_probe()
673 rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf, in efx_ef10_probe()
683 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_probe()
692 efx->rss_context.context_id = EFX_EF10_RSS_CONTEXT_INVALID; in efx_ef10_probe()
701 _efx_writed(efx, cpu_to_le32(1), ER_DZ_MC_DB_HWRD); in efx_ef10_probe()
703 rc = efx_mcdi_init(efx); in efx_ef10_probe()
710 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); in efx_ef10_probe()
715 rc = efx_mcdi_log_ctrl(efx, true, false, 0); in efx_ef10_probe()
719 rc = device_create_file(&efx->pci_dev->dev, in efx_ef10_probe()
724 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_probe()
728 rc = efx_ef10_get_pf_index(efx); in efx_ef10_probe()
732 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_probe()
736 efx_ef10_read_licensed_features(efx); in efx_ef10_probe()
742 efx->max_channels = min_t(unsigned int, in efx_ef10_probe()
744 efx_ef10_mem_map_size(efx) / in efx_ef10_probe()
745 (efx->vi_stride * EFX_TXQ_TYPES)); in efx_ef10_probe()
746 efx->max_tx_channels = efx->max_channels; in efx_ef10_probe()
747 if (WARN_ON(efx->max_channels == 0)) { in efx_ef10_probe()
752 efx->rx_packet_len_offset = in efx_ef10_probe()
757 efx->net_dev->hw_features |= NETIF_F_RXFCS; in efx_ef10_probe()
759 rc = efx_mcdi_port_get_number(efx); in efx_ef10_probe()
762 efx->port_num = rc; in efx_ef10_probe()
764 rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr); in efx_ef10_probe()
768 rc = efx_ef10_get_timer_config(efx); in efx_ef10_probe()
772 rc = efx_mcdi_mon_probe(efx); in efx_ef10_probe()
776 efx_ptp_defer_probe_with_channel(efx); in efx_ef10_probe()
779 if ((efx->pci_dev->physfn) && (!efx->pci_dev->is_physfn)) { in efx_ef10_probe()
780 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_probe()
786 ether_addr_copy(nic_data->port_id, efx->net_dev->perm_addr); in efx_ef10_probe()
792 rc = efx_ef10_add_vlan(efx, EFX_FILTER_VID_UNSPEC); in efx_ef10_probe()
800 rc = efx_ef10_add_vlan(efx, 0); in efx_ef10_probe()
807 efx_ef10_cleanup_vlans(efx); in efx_ef10_probe()
810 efx_ptp_remove(efx); in efx_ef10_probe()
811 efx_mcdi_mon_remove(efx); in efx_ef10_probe()
813 device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_probe()
815 device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag); in efx_ef10_probe()
817 efx_mcdi_detach(efx); in efx_ef10_probe()
821 (void)efx_ef10_set_udp_tnl_ports(efx, true); in efx_ef10_probe()
825 efx_mcdi_fini(efx); in efx_ef10_probe()
827 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_probe()
830 efx->nic_data = NULL; in efx_ef10_probe()
834 static int efx_ef10_free_vis(struct efx_nic *efx) in efx_ef10_free_vis() argument
838 int rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FREE_VIS, NULL, 0, in efx_ef10_free_vis()
845 efx_mcdi_display_error(efx, MC_CMD_FREE_VIS, 0, outbuf, outlen, in efx_ef10_free_vis()
852 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
854 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_free_piobufs()
864 rc = efx_mcdi_rpc(efx, MC_CMD_FREE_PIOBUF, inbuf, sizeof(inbuf), in efx_ef10_free_piobufs()
872 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
874 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_piobufs()
883 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_ALLOC_PIOBUF, NULL, 0, in efx_ef10_alloc_piobufs()
889 if (!(efx_ef10_is_vf(efx) && rc == -ENOSPC)) in efx_ef10_alloc_piobufs()
890 efx_mcdi_display_error(efx, MC_CMD_ALLOC_PIOBUF, in efx_ef10_alloc_piobufs()
900 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_alloc_piobufs()
907 efx_ef10_free_piobufs(efx); in efx_ef10_alloc_piobufs()
911 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
913 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_link_piobufs()
929 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
933 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
939 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
945 efx_for_each_channel(channel, efx) { in efx_ef10_link_piobufs()
956 offset = ((efx->tx_channel_offset + efx->n_tx_channels - in efx_ef10_link_piobufs()
977 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
986 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
993 index * efx->vi_stride + offset; in efx_ef10_link_piobufs()
995 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
1014 efx_mcdi_rpc(efx, MC_CMD_UNLINK_PIOBUF, in efx_ef10_link_piobufs()
1021 static void efx_ef10_forget_old_piobufs(struct efx_nic *efx) in efx_ef10_forget_old_piobufs() argument
1027 efx_for_each_channel(channel, efx) in efx_ef10_forget_old_piobufs()
1034 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
1039 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
1044 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
1048 static void efx_ef10_forget_old_piobufs(struct efx_nic *efx) in efx_ef10_forget_old_piobufs() argument
1054 static void efx_ef10_remove(struct efx_nic *efx) in efx_ef10_remove() argument
1056 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_remove()
1065 if (efx->pci_dev->is_virtfn) { in efx_ef10_remove()
1066 pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_remove()
1071 vf->efx = NULL; in efx_ef10_remove()
1073 netif_info(efx, drv, efx->net_dev, in efx_ef10_remove()
1078 efx_ef10_cleanup_vlans(efx); in efx_ef10_remove()
1081 efx_ptp_remove(efx); in efx_ef10_remove()
1083 efx_mcdi_mon_remove(efx); in efx_ef10_remove()
1085 efx_ef10_rx_free_indir_table(efx); in efx_ef10_remove()
1090 rc = efx_ef10_free_vis(efx); in efx_ef10_remove()
1094 efx_ef10_free_piobufs(efx); in efx_ef10_remove()
1096 device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_remove()
1097 device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag); in efx_ef10_remove()
1099 efx_mcdi_detach(efx); in efx_ef10_remove()
1103 (void)efx_ef10_set_udp_tnl_ports(efx, true); in efx_ef10_remove()
1108 efx_mcdi_fini(efx); in efx_ef10_remove()
1109 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_remove()
1113 static int efx_ef10_probe_pf(struct efx_nic *efx) in efx_ef10_probe_pf() argument
1115 return efx_ef10_probe(efx); in efx_ef10_probe_pf()
1118 int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id, in efx_ef10_vadaptor_query() argument
1122 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vadaptor_query()
1133 rc = efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_QUERY, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_query()
1157 int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vadaptor_alloc() argument
1162 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_alloc()
1166 int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vadaptor_free() argument
1171 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_free()
1175 int efx_ef10_vport_add_mac(struct efx_nic *efx, in efx_ef10_vport_add_mac() argument
1183 return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf, in efx_ef10_vport_add_mac()
1187 int efx_ef10_vport_del_mac(struct efx_nic *efx, in efx_ef10_vport_del_mac() argument
1195 return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, in efx_ef10_vport_del_mac()
1200 static int efx_ef10_probe_vf(struct efx_nic *efx) in efx_ef10_probe_vf() argument
1209 pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_probe_vf()
1215 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_vf()
1222 rc = efx_ef10_probe(efx); in efx_ef10_probe_vf()
1226 rc = efx_ef10_get_vf_index(efx); in efx_ef10_probe_vf()
1230 if (efx->pci_dev->is_virtfn) { in efx_ef10_probe_vf()
1231 if (efx->pci_dev->physfn) { in efx_ef10_probe_vf()
1233 pci_get_drvdata(efx->pci_dev->physfn); in efx_ef10_probe_vf()
1235 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_probe_vf()
1237 nic_data_p->vf[nic_data->vf_index].efx = efx; in efx_ef10_probe_vf()
1239 efx->pci_dev; in efx_ef10_probe_vf()
1241 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_vf()
1248 efx_ef10_remove(efx); in efx_ef10_probe_vf()
1252 static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) in efx_ef10_probe_vf() argument
1258 static int efx_ef10_alloc_vis(struct efx_nic *efx, in efx_ef10_alloc_vis() argument
1263 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_vis()
1269 rc = efx_mcdi_rpc(efx, MC_CMD_ALLOC_VIS, inbuf, sizeof(inbuf), in efx_ef10_alloc_vis()
1277 netif_dbg(efx, drv, efx->net_dev, "base VI is A0x%03x\n", in efx_ef10_alloc_vis()
1288 static int efx_ef10_dimension_resources(struct efx_nic *efx) in efx_ef10_dimension_resources() argument
1290 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_dimension_resources()
1298 channel_vis = max(efx->n_channels, in efx_ef10_dimension_resources()
1299 (efx->n_tx_channels + efx->n_extra_tx_channels) * in efx_ef10_dimension_resources()
1311 efx->n_tx_channels) { in efx_ef10_dimension_resources()
1313 DIV_ROUND_UP(efx->n_tx_channels, in efx_ef10_dimension_resources()
1316 rc = efx_ef10_alloc_piobufs(efx, n_piobufs); in efx_ef10_dimension_resources()
1318 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1321 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1324 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1327 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1344 uc_mem_map_size = PAGE_ALIGN((channel_vis - 1) * efx->vi_stride + in efx_ef10_dimension_resources()
1350 pio_write_vi_base = uc_mem_map_size / efx->vi_stride; in efx_ef10_dimension_resources()
1353 efx->vi_stride) - in efx_ef10_dimension_resources()
1363 rc = efx_ef10_free_vis(efx); in efx_ef10_dimension_resources()
1367 rc = efx_ef10_alloc_vis(efx, min_vis, max_vis); in efx_ef10_dimension_resources()
1372 netif_info(efx, drv, efx->net_dev, in efx_ef10_dimension_resources()
1380 efx->max_channels = nic_data->n_allocated_vis; in efx_ef10_dimension_resources()
1381 efx->max_tx_channels = in efx_ef10_dimension_resources()
1384 efx_ef10_free_vis(efx); in efx_ef10_dimension_resources()
1394 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1397 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
1401 membase = ioremap_nocache(efx->membase_phys, uc_mem_map_size); in efx_ef10_dimension_resources()
1403 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1408 iounmap(efx->membase); in efx_ef10_dimension_resources()
1409 efx->membase = membase; in efx_ef10_dimension_resources()
1413 nic_data->wc_membase = ioremap_wc(efx->membase_phys + in efx_ef10_dimension_resources()
1417 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1425 (pio_write_vi_base * efx->vi_stride + ER_DZ_TX_PIOBUF - in efx_ef10_dimension_resources()
1428 rc = efx_ef10_link_piobufs(efx); in efx_ef10_dimension_resources()
1430 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
1433 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1435 &efx->membase_phys, efx->membase, uc_mem_map_size, in efx_ef10_dimension_resources()
1441 static int efx_ef10_init_nic(struct efx_nic *efx) in efx_ef10_init_nic() argument
1443 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_nic()
1447 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_init_nic()
1455 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, in efx_ef10_init_nic()
1463 rc = efx_ef10_alloc_piobufs(efx, nic_data->n_piobufs); in efx_ef10_init_nic()
1465 rc = efx_ef10_link_piobufs(efx); in efx_ef10_init_nic()
1467 efx_ef10_free_piobufs(efx); in efx_ef10_init_nic()
1475 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1478 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1484 rc = efx->type->rx_push_rss_config(efx, false, in efx_ef10_init_nic()
1485 efx->rss_context.rx_indir_table, NULL); in efx_ef10_init_nic()
1490 static void efx_ef10_reset_mc_allocations(struct efx_nic *efx) in efx_ef10_reset_mc_allocations() argument
1492 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_reset_mc_allocations()
1502 efx_ef10_forget_old_piobufs(efx); in efx_ef10_reset_mc_allocations()
1503 efx->rss_context.context_id = EFX_EF10_RSS_CONTEXT_INVALID; in efx_ef10_reset_mc_allocations()
1510 for (i = 0; i < efx->vf_count; i++) in efx_ef10_reset_mc_allocations()
1553 static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) in efx_ef10_reset() argument
1555 int rc = efx_mcdi_reset(efx, reset_type); in efx_ef10_reset()
1571 efx_ef10_reset_mc_allocations(efx); in efx_ef10_reset()
1793 static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) in efx_ef10_raw_stat_mask() argument
1796 u32 port_caps = efx_mcdi_phy_get_caps(efx); in efx_ef10_raw_stat_mask()
1797 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_raw_stat_mask()
1799 if (!(efx->mcdi->fn_flags & in efx_ef10_raw_stat_mask()
1820 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) in efx_ef10_get_stat_mask() argument
1822 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_stat_mask()
1825 raw_mask[0] = efx_ef10_raw_stat_mask(efx); in efx_ef10_get_stat_mask()
1836 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V2) in efx_ef10_get_stat_mask()
1843 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V3 && in efx_ef10_get_stat_mask()
1860 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) in efx_ef10_describe_stats() argument
1864 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_describe_stats()
1869 static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_common() argument
1873 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_common()
1877 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats_common()
1938 static int efx_ef10_try_update_nic_stats_pf(struct efx_nic *efx) in efx_ef10_try_update_nic_stats_pf() argument
1940 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats_pf()
1946 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats_pf()
1948 dma_stats = efx->stats_buffer.addr; in efx_ef10_try_update_nic_stats_pf()
1950 generation_end = dma_stats[efx->num_mac_stats - 1]; in efx_ef10_try_update_nic_stats_pf()
1955 stats, efx->stats_buffer.addr, false); in efx_ef10_try_update_nic_stats_pf()
1962 efx_nic_fix_nodesc_drop_stat(efx, in efx_ef10_try_update_nic_stats_pf()
1969 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_pf()
1974 static size_t efx_ef10_update_stats_pf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_pf() argument
1983 if (efx_ef10_try_update_nic_stats_pf(efx) == 0) in efx_ef10_update_stats_pf()
1988 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_pf()
1991 static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx) in efx_ef10_try_update_nic_stats_vf() argument
1994 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats_vf()
1998 u32 dma_len = efx->num_mac_stats * sizeof(u64); in efx_ef10_try_update_nic_stats_vf()
2003 spin_unlock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2009 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2010 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_vf()
2014 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats_vf()
2016 rc = efx_nic_alloc_buffer(efx, &stats_buf, dma_len, GFP_ATOMIC); in efx_ef10_try_update_nic_stats_vf()
2018 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2023 dma_stats[efx->num_mac_stats - 1] = EFX_MC_STATS_GENERATION_INVALID; in efx_ef10_try_update_nic_stats_vf()
2031 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), in efx_ef10_try_update_nic_stats_vf()
2033 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2036 if (rc != -ENOENT || atomic_read(&efx->active_queues)) in efx_ef10_try_update_nic_stats_vf()
2037 efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, in efx_ef10_try_update_nic_stats_vf()
2042 generation_end = dma_stats[efx->num_mac_stats - 1]; in efx_ef10_try_update_nic_stats_vf()
2057 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_vf()
2059 efx_nic_free_buffer(efx, &stats_buf); in efx_ef10_try_update_nic_stats_vf()
2063 static size_t efx_ef10_update_stats_vf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_vf() argument
2066 if (efx_ef10_try_update_nic_stats_vf(efx)) in efx_ef10_update_stats_vf()
2069 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_vf()
2074 struct efx_nic *efx = channel->efx; in efx_ef10_push_irq_moderation() local
2086 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_push_irq_moderation()
2096 efx_mcdi_rpc_async(efx, MC_CMD_SET_EVQ_TMR, in efx_ef10_push_irq_moderation()
2098 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_push_irq_moderation()
2099 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2105 efx_writed_page(efx, &timer_cmd, ER_DD_EVQ_INDIRECT, in efx_ef10_push_irq_moderation()
2108 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2113 efx_writed_page(efx, &timer_cmd, ER_DZ_EVQ_TMR, in efx_ef10_push_irq_moderation()
2118 static void efx_ef10_get_wol_vf(struct efx_nic *efx, in efx_ef10_get_wol_vf() argument
2121 static int efx_ef10_set_wol_vf(struct efx_nic *efx, u32 type) in efx_ef10_set_wol_vf() argument
2126 static void efx_ef10_get_wol(struct efx_nic *efx, struct ethtool_wolinfo *wol) in efx_ef10_get_wol() argument
2133 static int efx_ef10_set_wol(struct efx_nic *efx, u32 type) in efx_ef10_set_wol() argument
2140 static void efx_ef10_mcdi_request(struct efx_nic *efx, in efx_ef10_mcdi_request() argument
2144 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_request()
2157 _efx_writed(efx, cpu_to_le32((u64)nic_data->mcdi_buf.dma_addr >> 32), in efx_ef10_mcdi_request()
2159 _efx_writed(efx, cpu_to_le32((u32)nic_data->mcdi_buf.dma_addr), in efx_ef10_mcdi_request()
2163 static bool efx_ef10_mcdi_poll_response(struct efx_nic *efx) in efx_ef10_mcdi_poll_response() argument
2165 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_response()
2173 efx_ef10_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf, in efx_ef10_mcdi_read_response() argument
2176 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_read_response()
2182 static void efx_ef10_mcdi_reboot_detected(struct efx_nic *efx) in efx_ef10_mcdi_reboot_detected() argument
2184 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_reboot_detected()
2187 efx_ef10_reset_mc_allocations(efx); in efx_ef10_mcdi_reboot_detected()
2198 static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) in efx_ef10_mcdi_poll_reboot() argument
2200 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_reboot()
2203 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_mcdi_poll_reboot()
2217 efx_ef10_mcdi_reboot_detected(efx); in efx_ef10_mcdi_poll_reboot()
2232 struct efx_nic *efx = context->efx; in efx_ef10_msi_interrupt() local
2234 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_msi_interrupt()
2237 if (likely(READ_ONCE(efx->irq_soft_enabled))) { in efx_ef10_msi_interrupt()
2239 if (context->index == efx->irq_level) in efx_ef10_msi_interrupt()
2240 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_msi_interrupt()
2243 efx_schedule_channel_irq(efx->channel[context->index]); in efx_ef10_msi_interrupt()
2251 struct efx_nic *efx = dev_id; in efx_ef10_legacy_interrupt() local
2252 bool soft_enabled = READ_ONCE(efx->irq_soft_enabled); in efx_ef10_legacy_interrupt()
2258 efx_readd(efx, ®, ER_DZ_BIU_INT_ISR); in efx_ef10_legacy_interrupt()
2266 if (queues & (1U << efx->irq_level)) in efx_ef10_legacy_interrupt()
2267 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_legacy_interrupt()
2269 efx_for_each_channel(channel, efx) { in efx_ef10_legacy_interrupt()
2276 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_legacy_interrupt()
2283 static int efx_ef10_irq_test_generate(struct efx_nic *efx) in efx_ef10_irq_test_generate() argument
2287 if (efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG41750, true, in efx_ef10_irq_test_generate()
2293 MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level); in efx_ef10_irq_test_generate()
2294 return efx_mcdi_rpc(efx, MC_CMD_TRIGGER_INTERRUPT, in efx_ef10_irq_test_generate()
2300 return efx_nic_alloc_buffer(tx_queue->efx, &tx_queue->txd.buf, in efx_ef10_tx_probe()
2316 efx_writeo_page(tx_queue->efx, ®, in efx_ef10_push_tx_desc()
2392 static u32 efx_ef10_tso_versions(struct efx_nic *efx) in efx_ef10_tso_versions() argument
2394 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_tso_versions()
2413 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_init() local
2414 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_tx_init()
2430 if (efx->type->ptp_set_ts_sync_events) in efx_ef10_tx_init()
2431 efx->type->ptp_set_ts_sync_events(efx, false, false); in efx_ef10_tx_init()
2443 netif_dbg(efx, hw, efx->net_dev, "Using TSOv2 for channel %u\n", in efx_ef10_tx_init()
2456 netif_dbg(efx, hw, efx->net_dev, "pushing TXQ %d. %zu entries (%llx)\n", in efx_ef10_tx_init()
2478 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_INIT_TXQ, inbuf, inlen, in efx_ef10_tx_init()
2483 netif_warn(efx, probe, efx->net_dev, in efx_ef10_tx_init()
2486 efx_mcdi_display_error(efx, MC_CMD_INIT_TXQ, in efx_ef10_tx_init()
2525 netdev_WARN(efx->net_dev, "failed to initialise TXQ %d\n", in efx_ef10_tx_init()
2533 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_fini() local
2540 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_TXQ, inbuf, sizeof(inbuf), in efx_ef10_tx_fini()
2549 efx_mcdi_display_error(efx, MC_CMD_FINI_TXQ, MC_CMD_FINI_TXQ_IN_LEN, in efx_ef10_tx_fini()
2555 efx_nic_free_buffer(tx_queue->efx, &tx_queue->txd.buf); in efx_ef10_tx_remove()
2566 efx_writed_page(tx_queue->efx, ®, in efx_ef10_notify_tx_desc()
2651 static int efx_ef10_get_rss_flags(struct efx_nic *efx, u32 context, u32 *flags) in efx_ef10_get_rss_flags() argument
2680 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_GET_FLAGS, inbuf, in efx_ef10_get_rss_flags()
2697 static void efx_ef10_set_rss_flags(struct efx_nic *efx, in efx_ef10_set_rss_flags() argument
2705 if (efx_ef10_get_rss_flags(efx, ctx->context_id, &flags) != 0) in efx_ef10_set_rss_flags()
2712 if (!efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_FLAGS, inbuf, sizeof(inbuf), in efx_ef10_set_rss_flags()
2718 static int efx_ef10_alloc_rss_context(struct efx_nic *efx, bool exclusive, in efx_ef10_alloc_rss_context() argument
2724 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_rss_context()
2731 efx->rss_spread : in efx_ef10_alloc_rss_context()
2732 min(rounddown_pow_of_two(efx->rss_spread), in efx_ef10_alloc_rss_context()
2751 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_alloc_rss_context()
2766 efx_ef10_set_rss_flags(efx, ctx); in efx_ef10_alloc_rss_context()
2771 static int efx_ef10_free_rss_context(struct efx_nic *efx, u32 context) in efx_ef10_free_rss_context() argument
2777 return efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_FREE, inbuf, sizeof(inbuf), in efx_ef10_free_rss_context()
2781 static int efx_ef10_populate_rss_table(struct efx_nic *efx, u32 context, in efx_ef10_populate_rss_table() argument
2790 BUILD_BUG_ON(ARRAY_SIZE(efx->rss_context.rx_indir_table) != in efx_ef10_populate_rss_table()
2798 for (i = 0; i < ARRAY_SIZE(efx->rss_context.rx_indir_table); ++i) in efx_ef10_populate_rss_table()
2803 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_TABLE, tablebuf, in efx_ef10_populate_rss_table()
2810 BUILD_BUG_ON(ARRAY_SIZE(efx->rss_context.rx_hash_key) != in efx_ef10_populate_rss_table()
2812 for (i = 0; i < ARRAY_SIZE(efx->rss_context.rx_hash_key); ++i) in efx_ef10_populate_rss_table()
2815 return efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_KEY, keybuf, in efx_ef10_populate_rss_table()
2819 static void efx_ef10_rx_free_indir_table(struct efx_nic *efx) in efx_ef10_rx_free_indir_table() argument
2823 if (efx->rss_context.context_id != EFX_EF10_RSS_CONTEXT_INVALID) { in efx_ef10_rx_free_indir_table()
2824 rc = efx_ef10_free_rss_context(efx, efx->rss_context.context_id); in efx_ef10_rx_free_indir_table()
2827 efx->rss_context.context_id = EFX_EF10_RSS_CONTEXT_INVALID; in efx_ef10_rx_free_indir_table()
2830 static int efx_ef10_rx_push_shared_rss_config(struct efx_nic *efx, in efx_ef10_rx_push_shared_rss_config() argument
2833 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_push_shared_rss_config()
2834 int rc = efx_ef10_alloc_rss_context(efx, false, &efx->rss_context, in efx_ef10_rx_push_shared_rss_config()
2841 efx_set_default_rx_indir_table(efx, &efx->rss_context); in efx_ef10_rx_push_shared_rss_config()
2845 static int efx_ef10_rx_push_exclusive_rss_config(struct efx_nic *efx, in efx_ef10_rx_push_exclusive_rss_config() argument
2849 u32 old_rx_rss_context = efx->rss_context.context_id; in efx_ef10_rx_push_exclusive_rss_config()
2850 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_push_exclusive_rss_config()
2853 if (efx->rss_context.context_id == EFX_EF10_RSS_CONTEXT_INVALID || in efx_ef10_rx_push_exclusive_rss_config()
2855 rc = efx_ef10_alloc_rss_context(efx, true, &efx->rss_context, in efx_ef10_rx_push_exclusive_rss_config()
2863 rc = efx_ef10_populate_rss_table(efx, efx->rss_context.context_id, in efx_ef10_rx_push_exclusive_rss_config()
2868 if (efx->rss_context.context_id != old_rx_rss_context && in efx_ef10_rx_push_exclusive_rss_config()
2870 WARN_ON(efx_ef10_free_rss_context(efx, old_rx_rss_context) != 0); in efx_ef10_rx_push_exclusive_rss_config()
2872 if (rx_indir_table != efx->rss_context.rx_indir_table) in efx_ef10_rx_push_exclusive_rss_config()
2873 memcpy(efx->rss_context.rx_indir_table, rx_indir_table, in efx_ef10_rx_push_exclusive_rss_config()
2874 sizeof(efx->rss_context.rx_indir_table)); in efx_ef10_rx_push_exclusive_rss_config()
2875 if (key != efx->rss_context.rx_hash_key) in efx_ef10_rx_push_exclusive_rss_config()
2876 memcpy(efx->rss_context.rx_hash_key, key, in efx_ef10_rx_push_exclusive_rss_config()
2877 efx->type->rx_hash_key_size); in efx_ef10_rx_push_exclusive_rss_config()
2882 if (old_rx_rss_context != efx->rss_context.context_id) { in efx_ef10_rx_push_exclusive_rss_config()
2883 WARN_ON(efx_ef10_free_rss_context(efx, efx->rss_context.context_id) != 0); in efx_ef10_rx_push_exclusive_rss_config()
2884 efx->rss_context.context_id = old_rx_rss_context; in efx_ef10_rx_push_exclusive_rss_config()
2887 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_rx_push_exclusive_rss_config()
2891 static int efx_ef10_rx_push_rss_context_config(struct efx_nic *efx, in efx_ef10_rx_push_rss_context_config() argument
2898 WARN_ON(!mutex_is_locked(&efx->rss_lock)); in efx_ef10_rx_push_rss_context_config()
2901 rc = efx_ef10_alloc_rss_context(efx, true, ctx, NULL); in efx_ef10_rx_push_rss_context_config()
2907 return efx_ef10_free_rss_context(efx, ctx->context_id); in efx_ef10_rx_push_rss_context_config()
2909 rc = efx_ef10_populate_rss_table(efx, ctx->context_id, in efx_ef10_rx_push_rss_context_config()
2915 sizeof(efx->rss_context.rx_indir_table)); in efx_ef10_rx_push_rss_context_config()
2916 memcpy(ctx->rx_hash_key, key, efx->type->rx_hash_key_size); in efx_ef10_rx_push_rss_context_config()
2921 static int efx_ef10_rx_pull_rss_context_config(struct efx_nic *efx, in efx_ef10_rx_pull_rss_context_config() argument
2930 WARN_ON(!mutex_is_locked(&efx->rss_lock)); in efx_ef10_rx_pull_rss_context_config()
2942 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_GET_TABLE, inbuf, sizeof(inbuf), in efx_ef10_rx_pull_rss_context_config()
2958 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_GET_KEY, inbuf, sizeof(inbuf), in efx_ef10_rx_pull_rss_context_config()
2973 static int efx_ef10_rx_pull_rss_config(struct efx_nic *efx) in efx_ef10_rx_pull_rss_config() argument
2977 mutex_lock(&efx->rss_lock); in efx_ef10_rx_pull_rss_config()
2978 rc = efx_ef10_rx_pull_rss_context_config(efx, &efx->rss_context); in efx_ef10_rx_pull_rss_config()
2979 mutex_unlock(&efx->rss_lock); in efx_ef10_rx_pull_rss_config()
2983 static void efx_ef10_rx_restore_rss_contexts(struct efx_nic *efx) in efx_ef10_rx_restore_rss_contexts() argument
2985 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_restore_rss_contexts()
2989 WARN_ON(!mutex_is_locked(&efx->rss_lock)); in efx_ef10_rx_restore_rss_contexts()
2994 list_for_each_entry(ctx, &efx->rss_context.list, list) { in efx_ef10_rx_restore_rss_contexts()
2998 rc = efx_ef10_rx_push_rss_context_config(efx, ctx, in efx_ef10_rx_restore_rss_contexts()
3002 netif_warn(efx, probe, efx->net_dev, in efx_ef10_rx_restore_rss_contexts()
3010 static int efx_ef10_pf_rx_push_rss_config(struct efx_nic *efx, bool user, in efx_ef10_pf_rx_push_rss_config() argument
3016 if (efx->rss_spread == 1) in efx_ef10_pf_rx_push_rss_config()
3020 key = efx->rss_context.rx_hash_key; in efx_ef10_pf_rx_push_rss_config()
3022 rc = efx_ef10_rx_push_exclusive_rss_config(efx, rx_indir_table, key); in efx_ef10_pf_rx_push_rss_config()
3030 i < ARRAY_SIZE(efx->rss_context.rx_indir_table) && !mismatch; in efx_ef10_pf_rx_push_rss_config()
3033 ethtool_rxfh_indir_default(i, efx->rss_spread); in efx_ef10_pf_rx_push_rss_config()
3035 rc = efx_ef10_rx_push_shared_rss_config(efx, &context_size); in efx_ef10_pf_rx_push_rss_config()
3037 if (context_size != efx->rss_spread) in efx_ef10_pf_rx_push_rss_config()
3038 netif_warn(efx, probe, efx->net_dev, in efx_ef10_pf_rx_push_rss_config()
3043 efx->rss_spread, context_size); in efx_ef10_pf_rx_push_rss_config()
3045 netif_warn(efx, probe, efx->net_dev, in efx_ef10_pf_rx_push_rss_config()
3051 netif_info(efx, probe, efx->net_dev, in efx_ef10_pf_rx_push_rss_config()
3059 static int efx_ef10_vf_rx_push_rss_config(struct efx_nic *efx, bool user, in efx_ef10_vf_rx_push_rss_config() argument
3067 if (efx->rss_context.context_id != EFX_EF10_RSS_CONTEXT_INVALID) in efx_ef10_vf_rx_push_rss_config()
3069 return efx_ef10_rx_push_shared_rss_config(efx, NULL); in efx_ef10_vf_rx_push_rss_config()
3074 return efx_nic_alloc_buffer(rx_queue->efx, &rx_queue->rxd.buf, in efx_ef10_rx_probe()
3087 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_init() local
3088 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_init()
3111 netif_dbg(efx, hw, efx->net_dev, "pushing RXQ %d. %zu entries (%llx)\n", in efx_ef10_rx_init()
3121 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_RXQ, inbuf, inlen, in efx_ef10_rx_init()
3124 netdev_WARN(efx->net_dev, "failed to initialise RXQ %d\n", in efx_ef10_rx_init()
3132 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_fini() local
3139 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_RXQ, inbuf, sizeof(inbuf), in efx_ef10_rx_fini()
3148 efx_mcdi_display_error(efx, MC_CMD_FINI_RXQ, MC_CMD_FINI_RXQ_IN_LEN, in efx_ef10_rx_fini()
3154 efx_nic_free_buffer(rx_queue->efx, &rx_queue->rxd.buf); in efx_ef10_rx_remove()
3173 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_write() local
3191 efx_writed_page(efx, ®, ER_DZ_RX_DESC_UPD, in efx_ef10_rx_write()
3215 efx_mcdi_rpc_async(channel->efx, MC_CMD_DRIVER_EVENT, in efx_ef10_rx_defer_refill()
3221 efx_ef10_rx_defer_refill_complete(struct efx_nic *efx, unsigned long cookie, in efx_ef10_rx_defer_refill_complete() argument
3230 return efx_nic_alloc_buffer(channel->efx, &channel->eventq.buf, in efx_ef10_ev_probe()
3240 struct efx_nic *efx = channel->efx; in efx_ef10_ev_fini() local
3246 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_EVQ, inbuf, sizeof(inbuf), in efx_ef10_ev_fini()
3255 efx_mcdi_display_error(efx, MC_CMD_FINI_EVQ, MC_CMD_FINI_EVQ_IN_LEN, in efx_ef10_ev_fini()
3266 struct efx_nic *efx = channel->efx; in efx_ef10_ev_init() local
3274 nic_data = efx->nic_data; in efx_ef10_ev_init()
3320 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_EVQ, inbuf, inlen, in efx_ef10_ev_init()
3324 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_ev_init()
3334 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_ev_init()
3351 rc = efx_mcdi_set_workaround(efx, in efx_ef10_ev_init()
3358 netif_info(efx, drv, efx->net_dev, in efx_ef10_ev_init()
3368 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_ev_init()
3391 efx_nic_free_buffer(channel->efx, &channel->eventq.buf); in efx_ef10_ev_remove()
3397 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_wrong_queue() local
3399 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_wrong_queue()
3403 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_wrong_queue()
3411 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_bad_lbits() local
3413 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_bad_lbits()
3417 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_bad_lbits()
3425 netif_dbg(rx_queue->efx, hw, rx_queue->efx->net_dev, in efx_ef10_handle_rx_abort()
3447 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event_errors() local
3451 if (!(efx->net_dev->features & NETIF_F_RXALL)) { in efx_ef10_handle_rx_event_errors()
3452 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3464 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3468 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3480 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3484 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3492 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3500 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3504 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3510 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3518 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3522 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3537 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event() local
3538 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
3544 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_rx_event()
3561 netdev_WARN(efx->net_dev, "saw RX_DROP_EVENT: event=" in efx_ef10_handle_rx_event()
3574 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
3579 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
3645 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
3686 struct efx_nic *efx = channel->efx; in efx_ef10_handle_tx_event() local
3693 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_tx_event()
3751 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_tx_event()
3763 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_event() local
3776 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_event()
3788 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_generated_event() local
3805 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_generated_event()
3815 struct efx_nic *efx = channel->efx; in efx_ef10_ev_process() local
3839 netif_vdbg(efx, drv, efx->net_dev, in efx_ef10_ev_process()
3869 netif_err(efx, hw, efx->net_dev, in efx_ef10_ev_process()
3884 struct efx_nic *efx = channel->efx; in efx_ef10_ev_read_ack() local
3887 if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_ev_read_ack()
3899 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3906 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3912 efx_writed_page(efx, &rptr, ER_DZ_EVQ_RPTR, channel->channel); in efx_ef10_ev_read_ack()
3919 struct efx_nic *efx = channel->efx; in efx_ef10_ev_test_generate() local
3935 rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf), in efx_ef10_ev_test_generate()
3944 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_ev_test_generate()
3947 void efx_ef10_handle_drain_event(struct efx_nic *efx) in efx_ef10_handle_drain_event() argument
3949 if (atomic_dec_and_test(&efx->active_queues)) in efx_ef10_handle_drain_event()
3950 wake_up(&efx->flush_wq); in efx_ef10_handle_drain_event()
3952 WARN_ON(atomic_read(&efx->active_queues) < 0); in efx_ef10_handle_drain_event()
3955 static int efx_ef10_fini_dmaq(struct efx_nic *efx) in efx_ef10_fini_dmaq() argument
3957 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_fini_dmaq()
3967 atomic_set(&efx->active_queues, 0); in efx_ef10_fini_dmaq()
3972 if (efx->state != STATE_RECOVERY) { in efx_ef10_fini_dmaq()
3973 efx_for_each_channel(channel, efx) { in efx_ef10_fini_dmaq()
3980 wait_event_timeout(efx->flush_wq, in efx_ef10_fini_dmaq()
3981 atomic_read(&efx->active_queues) == 0, in efx_ef10_fini_dmaq()
3983 pending = atomic_read(&efx->active_queues); in efx_ef10_fini_dmaq()
3985 netif_err(efx, hw, efx->net_dev, "failed to flush %d queues\n", in efx_ef10_fini_dmaq()
3994 static void efx_ef10_prepare_flr(struct efx_nic *efx) in efx_ef10_prepare_flr() argument
3996 atomic_set(&efx->active_queues, 0); in efx_ef10_prepare_flr()
4049 efx_ef10_filter_push_prep_set_match_fields(struct efx_nic *efx, in efx_ef10_filter_push_prep_set_match_fields() argument
4146 static void efx_ef10_filter_push_prep(struct efx_nic *efx, in efx_ef10_filter_push_prep() argument
4152 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_push_prep()
4173 efx_ef10_filter_push_prep_set_match_fields(efx, spec, inbuf); in efx_ef10_filter_push_prep()
4195 static int efx_ef10_filter_push(struct efx_nic *efx, in efx_ef10_filter_push() argument
4203 efx_ef10_filter_push_prep(efx, spec, inbuf, *handle, ctx, replacing); in efx_ef10_filter_push()
4204 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, inbuf, sizeof(inbuf), in efx_ef10_filter_push()
4288 static s32 efx_ef10_filter_insert_locked(struct efx_nic *efx, in efx_ef10_filter_insert_locked() argument
4293 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_insert_locked()
4307 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); in efx_ef10_filter_insert_locked()
4308 table = efx->filter_state; in efx_ef10_filter_insert_locked()
4329 mutex_lock(&efx->rss_lock); in efx_ef10_filter_insert_locked()
4332 ctx = efx_find_rss_context_entry(efx, spec->rss_context); in efx_ef10_filter_insert_locked()
4334 ctx = &efx->rss_context; in efx_ef10_filter_insert_locked()
4419 rc = efx_ef10_filter_push(efx, spec, &table->entry[ins_index].handle, in efx_ef10_filter_insert_locked()
4475 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_insert_locked()
4496 mutex_unlock(&efx->rss_lock); in efx_ef10_filter_insert_locked()
4501 static s32 efx_ef10_filter_insert(struct efx_nic *efx, in efx_ef10_filter_insert() argument
4507 down_read(&efx->filter_sem); in efx_ef10_filter_insert()
4508 ret = efx_ef10_filter_insert_locked(efx, spec, replace_equal); in efx_ef10_filter_insert()
4509 up_read(&efx->filter_sem); in efx_ef10_filter_insert()
4514 static void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx) in efx_ef10_filter_update_rx_scatter() argument
4526 static int efx_ef10_filter_remove_internal(struct efx_nic *efx, in efx_ef10_filter_remove_internal() argument
4531 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_internal()
4564 (efx_rss_active(&efx->rss_context) ? in efx_ef10_filter_remove_internal()
4568 rc = efx_ef10_filter_push(efx, &new_spec, in efx_ef10_filter_remove_internal()
4570 &efx->rss_context, in efx_ef10_filter_remove_internal()
4584 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_remove_internal()
4592 efx_mcdi_display_error(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_remove_internal()
4601 static int efx_ef10_filter_remove_safe(struct efx_nic *efx, in efx_ef10_filter_remove_safe() argument
4608 down_read(&efx->filter_sem); in efx_ef10_filter_remove_safe()
4609 table = efx->filter_state; in efx_ef10_filter_remove_safe()
4611 rc = efx_ef10_filter_remove_internal(efx, 1U << priority, filter_id, in efx_ef10_filter_remove_safe()
4614 up_read(&efx->filter_sem); in efx_ef10_filter_remove_safe()
4619 static void efx_ef10_filter_remove_unsafe(struct efx_nic *efx, in efx_ef10_filter_remove_unsafe() argument
4623 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_unsafe()
4629 efx_ef10_filter_remove_internal(efx, 1U << priority, filter_id, in efx_ef10_filter_remove_unsafe()
4634 static int efx_ef10_filter_get_safe(struct efx_nic *efx, in efx_ef10_filter_get_safe() argument
4643 down_read(&efx->filter_sem); in efx_ef10_filter_get_safe()
4644 table = efx->filter_state; in efx_ef10_filter_get_safe()
4656 up_read(&efx->filter_sem); in efx_ef10_filter_get_safe()
4660 static int efx_ef10_filter_clear_rx(struct efx_nic *efx, in efx_ef10_filter_clear_rx() argument
4671 down_read(&efx->filter_sem); in efx_ef10_filter_clear_rx()
4672 table = efx->filter_state; in efx_ef10_filter_clear_rx()
4675 rc = efx_ef10_filter_remove_internal(efx, priority_mask, in efx_ef10_filter_clear_rx()
4683 up_read(&efx->filter_sem); in efx_ef10_filter_clear_rx()
4687 static u32 efx_ef10_filter_count_rx_used(struct efx_nic *efx, in efx_ef10_filter_count_rx_used() argument
4694 down_read(&efx->filter_sem); in efx_ef10_filter_count_rx_used()
4695 table = efx->filter_state; in efx_ef10_filter_count_rx_used()
4704 up_read(&efx->filter_sem); in efx_ef10_filter_count_rx_used()
4708 static u32 efx_ef10_filter_get_rx_id_limit(struct efx_nic *efx) in efx_ef10_filter_get_rx_id_limit() argument
4710 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_get_rx_id_limit()
4715 static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx, in efx_ef10_filter_get_rx_ids() argument
4724 down_read(&efx->filter_sem); in efx_ef10_filter_get_rx_ids()
4725 table = efx->filter_state; in efx_ef10_filter_get_rx_ids()
4742 up_read(&efx->filter_sem); in efx_ef10_filter_get_rx_ids()
4748 static bool efx_ef10_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, in efx_ef10_filter_rfs_expire_one() argument
4757 down_read(&efx->filter_sem); in efx_ef10_filter_rfs_expire_one()
4758 table = efx->filter_state; in efx_ef10_filter_rfs_expire_one()
4765 spin_lock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4766 if (!efx->rps_hash_table) { in efx_ef10_filter_rfs_expire_one()
4770 rule = efx_rps_hash_find(efx, spec); in efx_ef10_filter_rfs_expire_one()
4779 spin_unlock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4783 if (!rps_may_expire_flow(efx->net_dev, spec->dmaq_id, flow_id, arfs_id)) in efx_ef10_filter_rfs_expire_one()
4789 spin_unlock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4797 ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority, in efx_ef10_filter_rfs_expire_one()
4804 spin_lock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4805 efx_rps_hash_del(efx, &saved_spec); in efx_ef10_filter_rfs_expire_one()
4806 spin_unlock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4810 up_read(&efx->filter_sem); in efx_ef10_filter_rfs_expire_one()
4873 static void efx_ef10_filter_cleanup_vlans(struct efx_nic *efx) in efx_ef10_filter_cleanup_vlans() argument
4875 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_cleanup_vlans()
4879 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_cleanup_vlans()
4886 efx_ef10_filter_del_vlan_internal(efx, vlan); in efx_ef10_filter_cleanup_vlans()
4909 efx_ef10_filter_table_probe_matches(struct efx_nic *efx, in efx_ef10_filter_table_probe_matches() argument
4924 rc = efx_mcdi_rpc(efx, MC_CMD_GET_PARSER_DISP_INFO, in efx_ef10_filter_table_probe_matches()
4941 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_filter_table_probe_matches()
4945 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_filter_table_probe_matches()
4957 static int efx_ef10_filter_table_probe(struct efx_nic *efx) in efx_ef10_filter_table_probe() argument
4959 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_probe()
4960 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_table_probe()
4965 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_table_probe()
4968 if (efx->filter_state) /* already probed */ in efx_ef10_filter_table_probe()
4976 rc = efx_ef10_filter_table_probe_matches(efx, table, false); in efx_ef10_filter_table_probe()
4981 rc = efx_ef10_filter_table_probe_matches(efx, table, true); in efx_ef10_filter_table_probe()
4984 if ((efx_supported_features(efx) & NETIF_F_HW_VLAN_CTAG_FILTER) && in efx_ef10_filter_table_probe()
4989 netif_info(efx, probe, net_dev, in efx_ef10_filter_table_probe()
4992 efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; in efx_ef10_filter_table_probe()
5005 !!(efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER); in efx_ef10_filter_table_probe()
5009 efx->filter_state = table; in efx_ef10_filter_table_probe()
5012 rc = efx_ef10_filter_add_vlan(efx, vlan->vid); in efx_ef10_filter_table_probe()
5020 efx_ef10_filter_cleanup_vlans(efx); in efx_ef10_filter_table_probe()
5021 efx->filter_state = NULL; in efx_ef10_filter_table_probe()
5030 static void efx_ef10_filter_table_restore(struct efx_nic *efx) in efx_ef10_filter_table_restore() argument
5032 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_table_restore()
5033 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_restore()
5043 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); in efx_ef10_filter_table_restore()
5052 mutex_lock(&efx->rss_lock); in efx_ef10_filter_table_restore()
5069 ctx = efx_find_rss_context_entry(efx, spec->rss_context); in efx_ef10_filter_table_restore()
5071 ctx = &efx->rss_context; in efx_ef10_filter_table_restore()
5074 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_table_restore()
5081 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_table_restore()
5089 rc = efx_ef10_filter_push(efx, spec, in efx_ef10_filter_table_restore()
5108 mutex_unlock(&efx->rss_lock); in efx_ef10_filter_table_restore()
5115 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_filter_table_restore()
5120 netif_err(efx, hw, efx->net_dev, in efx_ef10_filter_table_restore()
5126 static void efx_ef10_filter_table_remove(struct efx_nic *efx) in efx_ef10_filter_table_remove() argument
5128 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_table_remove()
5134 efx_ef10_filter_cleanup_vlans(efx); in efx_ef10_filter_table_remove()
5135 efx->filter_state = NULL; in efx_ef10_filter_table_remove()
5142 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_table_remove()
5159 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FILTER_OP, inbuf, in efx_ef10_filter_table_remove()
5162 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_table_remove()
5172 static void efx_ef10_filter_mark_one_old(struct efx_nic *efx, uint16_t *id) in efx_ef10_filter_mark_one_old() argument
5174 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_mark_one_old()
5182 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_filter_mark_one_old()
5191 static void _efx_ef10_filter_vlan_mark_old(struct efx_nic *efx, in _efx_ef10_filter_vlan_mark_old() argument
5194 struct efx_ef10_filter_table *table = efx->filter_state; in _efx_ef10_filter_vlan_mark_old()
5198 efx_ef10_filter_mark_one_old(efx, &vlan->uc[i]); in _efx_ef10_filter_vlan_mark_old()
5200 efx_ef10_filter_mark_one_old(efx, &vlan->mc[i]); in _efx_ef10_filter_vlan_mark_old()
5202 efx_ef10_filter_mark_one_old(efx, &vlan->default_filters[i]); in _efx_ef10_filter_vlan_mark_old()
5209 static void efx_ef10_filter_mark_old(struct efx_nic *efx) in efx_ef10_filter_mark_old() argument
5211 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_mark_old()
5216 _efx_ef10_filter_vlan_mark_old(efx, vlan); in efx_ef10_filter_mark_old()
5220 static void efx_ef10_filter_uc_addr_list(struct efx_nic *efx) in efx_ef10_filter_uc_addr_list() argument
5222 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_uc_addr_list()
5223 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_uc_addr_list()
5242 static void efx_ef10_filter_mc_addr_list(struct efx_nic *efx) in efx_ef10_filter_mc_addr_list() argument
5244 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_mc_addr_list()
5245 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_mc_addr_list()
5266 static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx, in efx_ef10_filter_insert_addr_list() argument
5270 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_insert_addr_list()
5290 filter_flags = efx_rss_active(&efx->rss_context) ? EFX_FILTER_FLAG_RX_RSS : 0; in efx_ef10_filter_insert_addr_list()
5297 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_addr_list()
5300 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_insert_addr_list()
5306 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_insert_addr_list()
5326 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_addr_list()
5328 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_insert_addr_list()
5333 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_insert_addr_list()
5347 static int efx_ef10_filter_insert_def(struct efx_nic *efx, in efx_ef10_filter_insert_def() argument
5352 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_insert_def()
5359 filter_flags = efx_rss_active(&efx->rss_context) ? EFX_FILTER_FLAG_RX_RSS : 0; in efx_ef10_filter_insert_def()
5382 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_def()
5406 netif_cond_dbg(efx, drv, efx->net_dev, in efx_ef10_filter_insert_def()
5442 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_def()
5444 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_insert_def()
5450 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_insert_def()
5495 static void efx_ef10_filter_remove_old(struct efx_nic *efx) in efx_ef10_filter_remove_old() argument
5497 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_old()
5507 rc = efx_ef10_filter_remove_internal(efx, in efx_ef10_filter_remove_old()
5518 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_remove_old()
5522 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_remove_old()
5527 static int efx_ef10_vport_set_mac_address(struct efx_nic *efx) in efx_ef10_vport_set_mac_address() argument
5529 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vport_set_mac_address()
5537 efx_device_detach_sync(efx); in efx_ef10_vport_set_mac_address()
5538 efx_net_stop(efx->net_dev); in efx_ef10_vport_set_mac_address()
5539 down_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5540 efx_ef10_filter_table_remove(efx); in efx_ef10_vport_set_mac_address()
5541 up_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5543 rc = efx_ef10_vadaptor_free(efx, nic_data->vport_id); in efx_ef10_vport_set_mac_address()
5548 rc = efx_ef10_vport_del_mac(efx, nic_data->vport_id, in efx_ef10_vport_set_mac_address()
5553 rc = efx_ef10_vport_add_mac(efx, nic_data->vport_id, in efx_ef10_vport_set_mac_address()
5554 efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
5556 ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
5558 rc2 = efx_ef10_vport_add_mac(efx, nic_data->vport_id, mac_old); in efx_ef10_vport_set_mac_address()
5567 rc2 = efx_ef10_vadaptor_alloc(efx, nic_data->vport_id); in efx_ef10_vport_set_mac_address()
5571 down_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5572 rc2 = efx_ef10_filter_table_probe(efx); in efx_ef10_vport_set_mac_address()
5573 up_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5577 rc2 = efx_net_open(efx->net_dev); in efx_ef10_vport_set_mac_address()
5581 efx_device_attach_if_not_resetting(efx); in efx_ef10_vport_set_mac_address()
5586 netif_err(efx, drv, efx->net_dev, in efx_ef10_vport_set_mac_address()
5588 efx_schedule_reset(efx, RESET_TYPE_DATAPATH); in efx_ef10_vport_set_mac_address()
5596 static void efx_ef10_filter_vlan_sync_rx_mode(struct efx_nic *efx, in efx_ef10_filter_vlan_sync_rx_mode() argument
5599 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_vlan_sync_rx_mode()
5600 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_vlan_sync_rx_mode()
5610 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_NONE, in efx_ef10_filter_vlan_sync_rx_mode()
5612 efx_ef10_filter_insert_addr_list(efx, vlan, false, false); in efx_ef10_filter_vlan_sync_rx_mode()
5618 if (efx_ef10_filter_insert_addr_list(efx, vlan, false, false)) in efx_ef10_filter_vlan_sync_rx_mode()
5619 efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5623 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_VXLAN, in efx_ef10_filter_vlan_sync_rx_mode()
5625 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_VXLAN | in efx_ef10_filter_vlan_sync_rx_mode()
5628 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_NVGRE, in efx_ef10_filter_vlan_sync_rx_mode()
5630 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_NVGRE | in efx_ef10_filter_vlan_sync_rx_mode()
5633 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE, in efx_ef10_filter_vlan_sync_rx_mode()
5635 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE | in efx_ef10_filter_vlan_sync_rx_mode()
5645 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_vlan_sync_rx_mode()
5651 if (efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5655 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_vlan_sync_rx_mode()
5656 efx_ef10_filter_insert_addr_list(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5664 efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5668 efx_ef10_filter_insert_addr_list(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5677 if (efx_ef10_filter_insert_addr_list(efx, vlan, true, true)) { in efx_ef10_filter_vlan_sync_rx_mode()
5680 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_vlan_sync_rx_mode()
5681 if (efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5684 efx_ef10_filter_insert_addr_list(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5688 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_VXLAN, in efx_ef10_filter_vlan_sync_rx_mode()
5690 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_VXLAN | in efx_ef10_filter_vlan_sync_rx_mode()
5693 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_NVGRE, in efx_ef10_filter_vlan_sync_rx_mode()
5695 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_NVGRE | in efx_ef10_filter_vlan_sync_rx_mode()
5698 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE, in efx_ef10_filter_vlan_sync_rx_mode()
5700 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE | in efx_ef10_filter_vlan_sync_rx_mode()
5708 static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx) in efx_ef10_filter_sync_rx_mode() argument
5710 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_sync_rx_mode()
5711 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_sync_rx_mode()
5715 if (!efx_dev_registered(efx)) in efx_ef10_filter_sync_rx_mode()
5721 efx_ef10_filter_mark_old(efx); in efx_ef10_filter_sync_rx_mode()
5727 efx_ef10_filter_uc_addr_list(efx); in efx_ef10_filter_sync_rx_mode()
5728 efx_ef10_filter_mc_addr_list(efx); in efx_ef10_filter_sync_rx_mode()
5738 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_sync_rx_mode()
5742 efx_ef10_filter_vlan_sync_rx_mode(efx, vlan); in efx_ef10_filter_sync_rx_mode()
5744 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_sync_rx_mode()
5748 static struct efx_ef10_filter_vlan *efx_ef10_filter_find_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_filter_find_vlan() argument
5750 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_find_vlan()
5753 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); in efx_ef10_filter_find_vlan()
5763 static int efx_ef10_filter_add_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_filter_add_vlan() argument
5765 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_add_vlan()
5769 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_add_vlan()
5772 vlan = efx_ef10_filter_find_vlan(efx, vid); in efx_ef10_filter_add_vlan()
5774 netif_err(efx, drv, efx->net_dev, in efx_ef10_filter_add_vlan()
5794 if (efx_dev_registered(efx)) in efx_ef10_filter_add_vlan()
5795 efx_ef10_filter_vlan_sync_rx_mode(efx, vlan); in efx_ef10_filter_add_vlan()
5800 static void efx_ef10_filter_del_vlan_internal(struct efx_nic *efx, in efx_ef10_filter_del_vlan_internal() argument
5806 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_del_vlan_internal()
5812 efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_del_vlan_internal()
5815 efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_del_vlan_internal()
5819 efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_del_vlan_internal()
5825 static void efx_ef10_filter_del_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_filter_del_vlan() argument
5830 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_del_vlan()
5833 vlan = efx_ef10_filter_find_vlan(efx, vid); in efx_ef10_filter_del_vlan()
5835 netif_err(efx, drv, efx->net_dev, in efx_ef10_filter_del_vlan()
5840 efx_ef10_filter_del_vlan_internal(efx, vlan); in efx_ef10_filter_del_vlan()
5843 static int efx_ef10_set_mac_address(struct efx_nic *efx) in efx_ef10_set_mac_address() argument
5846 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_mac_address()
5847 bool was_enabled = efx->port_enabled; in efx_ef10_set_mac_address()
5850 efx_device_detach_sync(efx); in efx_ef10_set_mac_address()
5851 efx_net_stop(efx->net_dev); in efx_ef10_set_mac_address()
5853 mutex_lock(&efx->mac_lock); in efx_ef10_set_mac_address()
5854 down_write(&efx->filter_sem); in efx_ef10_set_mac_address()
5855 efx_ef10_filter_table_remove(efx); in efx_ef10_set_mac_address()
5858 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
5861 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, in efx_ef10_set_mac_address()
5864 efx_ef10_filter_table_probe(efx); in efx_ef10_set_mac_address()
5865 up_write(&efx->filter_sem); in efx_ef10_set_mac_address()
5866 mutex_unlock(&efx->mac_lock); in efx_ef10_set_mac_address()
5869 efx_net_open(efx->net_dev); in efx_ef10_set_mac_address()
5870 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_mac_address()
5873 if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { in efx_ef10_set_mac_address()
5874 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_set_mac_address()
5884 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
5896 if (vf->efx == efx) { in efx_ef10_set_mac_address()
5898 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
5906 netif_err(efx, drv, efx->net_dev, in efx_ef10_set_mac_address()
5909 } else if (rc == -ENOSYS && !efx_ef10_is_vf(efx)) { in efx_ef10_set_mac_address()
5915 rc = efx_ef10_vport_set_mac_address(efx); in efx_ef10_set_mac_address()
5917 efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC, in efx_ef10_set_mac_address()
5924 static int efx_ef10_mac_reconfigure(struct efx_nic *efx) in efx_ef10_mac_reconfigure() argument
5926 efx_ef10_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure()
5928 return efx_mcdi_set_mac(efx); in efx_ef10_mac_reconfigure()
5931 static int efx_ef10_mac_reconfigure_vf(struct efx_nic *efx) in efx_ef10_mac_reconfigure_vf() argument
5933 efx_ef10_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure_vf()
5938 static int efx_ef10_start_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_start_bist() argument
5943 return efx_mcdi_rpc(efx, MC_CMD_START_BIST, inbuf, sizeof(inbuf), in efx_ef10_start_bist()
5951 static int efx_ef10_poll_bist(struct efx_nic *efx) in efx_ef10_poll_bist() argument
5958 rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, in efx_ef10_poll_bist()
5969 netif_dbg(efx, hw, efx->net_dev, "BIST passed.\n"); in efx_ef10_poll_bist()
5972 netif_err(efx, hw, efx->net_dev, "BIST timed out\n"); in efx_ef10_poll_bist()
5975 netif_err(efx, hw, efx->net_dev, "BIST failed.\n"); in efx_ef10_poll_bist()
5978 netif_err(efx, hw, efx->net_dev, in efx_ef10_poll_bist()
5984 static int efx_ef10_run_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_run_bist() argument
5988 netif_dbg(efx, drv, efx->net_dev, "starting BIST type %u\n", bist_type); in efx_ef10_run_bist()
5990 rc = efx_ef10_start_bist(efx, bist_type); in efx_ef10_run_bist()
5994 return efx_ef10_poll_bist(efx); in efx_ef10_run_bist()
5998 efx_ef10_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) in efx_ef10_test_chip() argument
6002 efx_reset_down(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
6004 rc = efx_mcdi_rpc(efx, MC_CMD_ENABLE_OFFLINE_BIST, in efx_ef10_test_chip()
6009 tests->memory = efx_ef10_run_bist(efx, MC_CMD_MC_MEM_BIST) ? -1 : 1; in efx_ef10_test_chip()
6010 tests->registers = efx_ef10_run_bist(efx, MC_CMD_REG_BIST) ? -1 : 1; in efx_ef10_test_chip()
6012 rc = efx_mcdi_reset(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
6017 rc2 = efx_reset_up(efx, RESET_TYPE_WORLD, rc == 0); in efx_ef10_test_chip()
6051 static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, in efx_ef10_mtd_probe_partition() argument
6071 if (info->port != efx_port_num(efx)) in efx_ef10_mtd_probe_partition()
6074 rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); in efx_ef10_mtd_probe_partition()
6097 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_METADATA, inbuf, sizeof(inbuf), in efx_ef10_mtd_probe_partition()
6122 static int efx_ef10_mtd_probe(struct efx_nic *efx) in efx_ef10_mtd_probe() argument
6134 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_PARTITIONS, NULL, 0, in efx_ef10_mtd_probe()
6154 rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type, in efx_ef10_mtd_probe()
6163 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in efx_ef10_mtd_probe()
6172 static void efx_ef10_ptp_write_host_time(struct efx_nic *efx, u32 host_time) in efx_ef10_ptp_write_host_time() argument
6174 _efx_writed(efx, cpu_to_le32(host_time), ER_DZ_MC_DB_LWRD); in efx_ef10_ptp_write_host_time()
6177 static void efx_ef10_ptp_write_host_time_vf(struct efx_nic *efx, in efx_ef10_ptp_write_host_time_vf() argument
6197 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_enable_timestamping()
6230 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_disable_timestamping()
6236 static int efx_ef10_ptp_set_ts_sync_events(struct efx_nic *efx, bool en, in efx_ef10_ptp_set_ts_sync_events() argument
6246 channel = efx_ptp_channel(efx); in efx_ef10_ptp_set_ts_sync_events()
6250 efx_ef10_ptp_set_ts_sync_events(efx, false, temp); in efx_ef10_ptp_set_ts_sync_events()
6258 static int efx_ef10_ptp_set_ts_config_vf(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config_vf() argument
6264 static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config() argument
6271 efx_ef10_ptp_set_ts_sync_events(efx, false, false); in efx_ef10_ptp_set_ts_config()
6273 return efx_ptp_change_mode(efx, in efx_ef10_ptp_set_ts_config()
6290 rc = efx_ptp_change_mode(efx, true, 0); in efx_ef10_ptp_set_ts_config()
6292 rc = efx_ef10_ptp_set_ts_sync_events(efx, true, false); in efx_ef10_ptp_set_ts_config()
6294 efx_ptp_change_mode(efx, false, 0); in efx_ef10_ptp_set_ts_config()
6301 static int efx_ef10_get_phys_port_id(struct efx_nic *efx, in efx_ef10_get_phys_port_id() argument
6304 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_phys_port_id()
6315 static int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_add_vid() argument
6320 return efx_ef10_add_vlan(efx, vid); in efx_ef10_vlan_rx_add_vid()
6323 static int efx_ef10_vlan_rx_kill_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_kill_vid() argument
6328 return efx_ef10_del_vlan(efx, vid); in efx_ef10_vlan_rx_kill_vid()
6336 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading) in efx_ef10_set_udp_tnl_ports() argument
6338 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_udp_tnl_ports()
6354 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
6391 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS, in efx_ef10_set_udp_tnl_ports()
6405 netif_warn(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
6409 netif_info(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
6426 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
6432 static int efx_ef10_udp_tnl_push_ports(struct efx_nic *efx) in efx_ef10_udp_tnl_push_ports() argument
6434 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_push_ports()
6442 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_push_ports()
6443 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_push_ports()
6449 static struct efx_udp_tunnel *__efx_ef10_udp_tnl_lookup_port(struct efx_nic *efx, in __efx_ef10_udp_tnl_lookup_port() argument
6452 struct efx_ef10_nic_data *nic_data = efx->nic_data; in __efx_ef10_udp_tnl_lookup_port()
6464 static int efx_ef10_udp_tnl_add_port(struct efx_nic *efx, in efx_ef10_udp_tnl_add_port() argument
6467 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_add_port()
6478 netif_dbg(efx, drv, efx->net_dev, "Adding UDP tunnel (%s) port %d\n", in efx_ef10_udp_tnl_add_port()
6485 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_add_port()
6487 match = __efx_ef10_udp_tnl_lookup_port(efx, tnl.port); in efx_ef10_udp_tnl_add_port()
6490 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_add_port()
6499 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_add_port()
6510 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_add_port()
6514 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_add_port()
6530 static bool efx_ef10_udp_tnl_has_port(struct efx_nic *efx, __be16 port) in efx_ef10_udp_tnl_has_port() argument
6532 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_has_port()
6544 return __efx_ef10_udp_tnl_lookup_port(efx, port) != NULL; in efx_ef10_udp_tnl_has_port()
6547 static int efx_ef10_udp_tnl_del_port(struct efx_nic *efx, in efx_ef10_udp_tnl_del_port() argument
6550 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_del_port()
6560 netif_dbg(efx, drv, efx->net_dev, "Removing UDP tunnel (%s) port %d\n", in efx_ef10_udp_tnl_del_port()
6567 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_del_port()
6569 match = __efx_ef10_udp_tnl_lookup_port(efx, tnl.port); in efx_ef10_udp_tnl_del_port()
6574 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_del_port()
6580 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_del_port()
6585 netif_warn(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_del_port()