Lines Matching refs:efx

125 static void efx_ef10_rx_free_indir_table(struct efx_nic *efx);
126 static void efx_ef10_filter_table_remove(struct efx_nic *efx);
127 static int efx_ef10_filter_add_vlan(struct efx_nic *efx, u16 vid);
128 static void efx_ef10_filter_del_vlan_internal(struct efx_nic *efx,
130 static void efx_ef10_filter_del_vlan(struct efx_nic *efx, u16 vid);
131 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading);
149 static int efx_ef10_get_warm_boot_count(struct efx_nic *efx) in efx_ef10_get_warm_boot_count() argument
153 efx_readd(efx, &reg, ER_DZ_BIU_MC_SFT_STATUS); in efx_ef10_get_warm_boot_count()
162 static unsigned int efx_ef10_pf_mem_bar(struct efx_nic *efx) in efx_ef10_pf_mem_bar() argument
164 switch (efx->pci_dev->device) { in efx_ef10_pf_mem_bar()
173 static unsigned int efx_ef10_vf_mem_bar(struct efx_nic *efx) in efx_ef10_vf_mem_bar() argument
178 static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx) in efx_ef10_mem_map_size() argument
182 bar = efx->type->mem_bar(efx); in efx_ef10_mem_map_size()
183 return resource_size(&efx->pci_dev->resource[bar]); in efx_ef10_mem_map_size()
186 static bool efx_ef10_is_vf(struct efx_nic *efx) in efx_ef10_is_vf() argument
188 return efx->type->is_vf; in efx_ef10_is_vf()
191 static int efx_ef10_get_pf_index(struct efx_nic *efx) in efx_ef10_get_pf_index() argument
194 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_pf_index()
198 rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, in efx_ef10_get_pf_index()
210 static int efx_ef10_get_vf_index(struct efx_nic *efx) in efx_ef10_get_vf_index() argument
213 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_vf_index()
217 rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, in efx_ef10_get_vf_index()
229 static int efx_ef10_init_datapath_caps(struct efx_nic *efx) in efx_ef10_init_datapath_caps() argument
232 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_datapath_caps()
238 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CAPABILITIES, NULL, 0, in efx_ef10_init_datapath_caps()
243 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_datapath_caps()
270 netif_err(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
281 efx->vi_stride = 8192; in efx_ef10_init_datapath_caps()
284 efx->vi_stride = 16384; in efx_ef10_init_datapath_caps()
287 efx->vi_stride = 65536; in efx_ef10_init_datapath_caps()
290 netif_err(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
295 netif_dbg(efx, probe, efx->net_dev, "vi_stride = %u\n", in efx_ef10_init_datapath_caps()
296 efx->vi_stride); in efx_ef10_init_datapath_caps()
299 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
301 efx->vi_stride); in efx_ef10_init_datapath_caps()
305 efx->num_mac_stats = MCDI_WORD(outbuf, in efx_ef10_init_datapath_caps()
307 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
309 efx->num_mac_stats); in efx_ef10_init_datapath_caps()
312 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
314 efx->num_mac_stats); in efx_ef10_init_datapath_caps()
320 static void efx_ef10_read_licensed_features(struct efx_nic *efx) in efx_ef10_read_licensed_features() argument
324 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_read_licensed_features()
330 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_LICENSING_V3, inbuf, sizeof(inbuf), in efx_ef10_read_licensed_features()
339 static int efx_ef10_get_sysclk_freq(struct efx_nic *efx) in efx_ef10_get_sysclk_freq() argument
344 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CLOCK, NULL, 0, in efx_ef10_get_sysclk_freq()
352 static int efx_ef10_get_timer_workarounds(struct efx_nic *efx) in efx_ef10_get_timer_workarounds() argument
354 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_timer_workarounds()
362 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_get_timer_workarounds()
378 rc = efx_mcdi_set_workaround(efx, in efx_ef10_get_timer_workarounds()
388 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_get_timer_workarounds()
391 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_get_timer_workarounds()
398 static void efx_ef10_process_timer_config(struct efx_nic *efx, in efx_ef10_process_timer_config() argument
403 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_process_timer_config()
404 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
406 efx->timer_max_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
408 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_process_timer_config()
409 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
413 efx->timer_max_ns = max_count * efx->timer_quantum_ns; in efx_ef10_process_timer_config()
415 efx->timer_quantum_ns = MCDI_DWORD(data, in efx_ef10_process_timer_config()
419 efx->timer_max_ns = max_count * efx->timer_quantum_ns; in efx_ef10_process_timer_config()
422 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_process_timer_config()
424 efx->timer_quantum_ns, efx->timer_max_ns); in efx_ef10_process_timer_config()
427 static int efx_ef10_get_timer_config(struct efx_nic *efx) in efx_ef10_get_timer_config() argument
432 rc = efx_ef10_get_timer_workarounds(efx); in efx_ef10_get_timer_config()
436 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_GET_EVQ_TMR_PROPERTIES, NULL, 0, in efx_ef10_get_timer_config()
440 efx_ef10_process_timer_config(efx, outbuf); in efx_ef10_get_timer_config()
445 rc = efx_ef10_get_sysclk_freq(efx); in efx_ef10_get_timer_config()
450 efx->timer_quantum_ns = quantum; in efx_ef10_get_timer_config()
451 efx->timer_max_ns = efx->type->timer_period_max * quantum; in efx_ef10_get_timer_config()
454 efx_mcdi_display_error(efx, MC_CMD_GET_EVQ_TMR_PROPERTIES, in efx_ef10_get_timer_config()
462 static int efx_ef10_get_mac_address_pf(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address_pf() argument
470 rc = efx_mcdi_rpc(efx, MC_CMD_GET_MAC_ADDRESSES, NULL, 0, in efx_ef10_get_mac_address_pf()
482 static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address_vf() argument
491 rc = efx_mcdi_rpc(efx, MC_CMD_VPORT_GET_MAC_ADDRESSES, inbuf, in efx_ef10_get_mac_address_vf()
514 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); in efx_ef10_show_link_control_flag() local
517 ((efx->mcdi->fn_flags) & in efx_ef10_show_link_control_flag()
526 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); in efx_ef10_show_primary_flag() local
529 ((efx->mcdi->fn_flags) & in efx_ef10_show_primary_flag()
534 static struct efx_ef10_vlan *efx_ef10_find_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_find_vlan() argument
536 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_find_vlan()
549 static int efx_ef10_add_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_add_vlan() argument
551 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_add_vlan()
557 vlan = efx_ef10_find_vlan(efx, vid); in efx_ef10_add_vlan()
564 netif_warn(efx, drv, efx->net_dev, in efx_ef10_add_vlan()
579 if (efx->filter_state) { in efx_ef10_add_vlan()
580 mutex_lock(&efx->mac_lock); in efx_ef10_add_vlan()
581 down_write(&efx->filter_sem); in efx_ef10_add_vlan()
582 rc = efx_ef10_filter_add_vlan(efx, vlan->vid); in efx_ef10_add_vlan()
583 up_write(&efx->filter_sem); in efx_ef10_add_vlan()
584 mutex_unlock(&efx->mac_lock); in efx_ef10_add_vlan()
602 static void efx_ef10_del_vlan_internal(struct efx_nic *efx, in efx_ef10_del_vlan_internal() argument
605 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_del_vlan_internal()
609 if (efx->filter_state) { in efx_ef10_del_vlan_internal()
610 down_write(&efx->filter_sem); in efx_ef10_del_vlan_internal()
611 efx_ef10_filter_del_vlan(efx, vlan->vid); in efx_ef10_del_vlan_internal()
612 up_write(&efx->filter_sem); in efx_ef10_del_vlan_internal()
619 static int efx_ef10_del_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_del_vlan() argument
621 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_del_vlan()
634 vlan = efx_ef10_find_vlan(efx, vid); in efx_ef10_del_vlan()
636 netif_err(efx, drv, efx->net_dev, in efx_ef10_del_vlan()
640 efx_ef10_del_vlan_internal(efx, vlan); in efx_ef10_del_vlan()
648 static void efx_ef10_cleanup_vlans(struct efx_nic *efx) in efx_ef10_cleanup_vlans() argument
650 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_cleanup_vlans()
655 efx_ef10_del_vlan_internal(efx, vlan); in efx_ef10_cleanup_vlans()
663 static int efx_ef10_probe(struct efx_nic *efx) in efx_ef10_probe() argument
671 efx->nic_data = nic_data; in efx_ef10_probe()
676 rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf, in efx_ef10_probe()
686 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_probe()
695 efx->rss_context.context_id = EFX_EF10_RSS_CONTEXT_INVALID; in efx_ef10_probe()
704 _efx_writed(efx, cpu_to_le32(1), ER_DZ_MC_DB_HWRD); in efx_ef10_probe()
706 rc = efx_mcdi_init(efx); in efx_ef10_probe()
713 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); in efx_ef10_probe()
718 rc = efx_mcdi_log_ctrl(efx, true, false, 0); in efx_ef10_probe()
722 rc = device_create_file(&efx->pci_dev->dev, in efx_ef10_probe()
727 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_probe()
731 rc = efx_ef10_get_pf_index(efx); in efx_ef10_probe()
735 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_probe()
739 efx_ef10_read_licensed_features(efx); in efx_ef10_probe()
745 efx->max_channels = min_t(unsigned int, in efx_ef10_probe()
747 efx_ef10_mem_map_size(efx) / in efx_ef10_probe()
748 (efx->vi_stride * EFX_TXQ_TYPES)); in efx_ef10_probe()
749 efx->max_tx_channels = efx->max_channels; in efx_ef10_probe()
750 if (WARN_ON(efx->max_channels == 0)) { in efx_ef10_probe()
755 efx->rx_packet_len_offset = in efx_ef10_probe()
760 efx->net_dev->hw_features |= NETIF_F_RXFCS; in efx_ef10_probe()
762 rc = efx_mcdi_port_get_number(efx); in efx_ef10_probe()
765 efx->port_num = rc; in efx_ef10_probe()
767 rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr); in efx_ef10_probe()
771 rc = efx_ef10_get_timer_config(efx); in efx_ef10_probe()
775 rc = efx_mcdi_mon_probe(efx); in efx_ef10_probe()
779 efx_ptp_defer_probe_with_channel(efx); in efx_ef10_probe()
782 if ((efx->pci_dev->physfn) && (!efx->pci_dev->is_physfn)) { in efx_ef10_probe()
783 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_probe()
789 ether_addr_copy(nic_data->port_id, efx->net_dev->perm_addr); in efx_ef10_probe()
795 rc = efx_ef10_add_vlan(efx, EFX_FILTER_VID_UNSPEC); in efx_ef10_probe()
803 rc = efx_ef10_add_vlan(efx, 0); in efx_ef10_probe()
810 efx_ef10_cleanup_vlans(efx); in efx_ef10_probe()
813 efx_ptp_remove(efx); in efx_ef10_probe()
814 efx_mcdi_mon_remove(efx); in efx_ef10_probe()
816 device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_probe()
818 device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag); in efx_ef10_probe()
820 efx_mcdi_detach(efx); in efx_ef10_probe()
824 (void)efx_ef10_set_udp_tnl_ports(efx, true); in efx_ef10_probe()
828 efx_mcdi_fini(efx); in efx_ef10_probe()
830 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_probe()
833 efx->nic_data = NULL; in efx_ef10_probe()
837 static int efx_ef10_free_vis(struct efx_nic *efx) in efx_ef10_free_vis() argument
841 int rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FREE_VIS, NULL, 0, in efx_ef10_free_vis()
848 efx_mcdi_display_error(efx, MC_CMD_FREE_VIS, 0, outbuf, outlen, in efx_ef10_free_vis()
855 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
857 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_free_piobufs()
867 rc = efx_mcdi_rpc(efx, MC_CMD_FREE_PIOBUF, inbuf, sizeof(inbuf), in efx_ef10_free_piobufs()
875 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
877 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_piobufs()
886 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_ALLOC_PIOBUF, NULL, 0, in efx_ef10_alloc_piobufs()
892 if (!(efx_ef10_is_vf(efx) && rc == -ENOSPC)) in efx_ef10_alloc_piobufs()
893 efx_mcdi_display_error(efx, MC_CMD_ALLOC_PIOBUF, in efx_ef10_alloc_piobufs()
903 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_alloc_piobufs()
910 efx_ef10_free_piobufs(efx); in efx_ef10_alloc_piobufs()
914 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
916 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_link_piobufs()
932 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
936 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
942 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
948 efx_for_each_channel(channel, efx) { in efx_ef10_link_piobufs()
959 offset = ((efx->tx_channel_offset + efx->n_tx_channels - in efx_ef10_link_piobufs()
980 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
989 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
996 index * efx->vi_stride + offset; in efx_ef10_link_piobufs()
998 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
1017 efx_mcdi_rpc(efx, MC_CMD_UNLINK_PIOBUF, in efx_ef10_link_piobufs()
1024 static void efx_ef10_forget_old_piobufs(struct efx_nic *efx) in efx_ef10_forget_old_piobufs() argument
1030 efx_for_each_channel(channel, efx) in efx_ef10_forget_old_piobufs()
1037 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
1042 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
1047 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
1051 static void efx_ef10_forget_old_piobufs(struct efx_nic *efx) in efx_ef10_forget_old_piobufs() argument
1057 static void efx_ef10_remove(struct efx_nic *efx) in efx_ef10_remove() argument
1059 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_remove()
1068 if (efx->pci_dev->is_virtfn) { in efx_ef10_remove()
1069 pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_remove()
1074 vf->efx = NULL; in efx_ef10_remove()
1076 netif_info(efx, drv, efx->net_dev, in efx_ef10_remove()
1081 efx_ef10_cleanup_vlans(efx); in efx_ef10_remove()
1084 efx_ptp_remove(efx); in efx_ef10_remove()
1086 efx_mcdi_mon_remove(efx); in efx_ef10_remove()
1088 efx_ef10_rx_free_indir_table(efx); in efx_ef10_remove()
1093 rc = efx_ef10_free_vis(efx); in efx_ef10_remove()
1097 efx_ef10_free_piobufs(efx); in efx_ef10_remove()
1099 device_remove_file(&efx->pci_dev->dev, &dev_attr_primary_flag); in efx_ef10_remove()
1100 device_remove_file(&efx->pci_dev->dev, &dev_attr_link_control_flag); in efx_ef10_remove()
1102 efx_mcdi_detach(efx); in efx_ef10_remove()
1106 (void)efx_ef10_set_udp_tnl_ports(efx, true); in efx_ef10_remove()
1111 efx_mcdi_fini(efx); in efx_ef10_remove()
1112 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_remove()
1116 static int efx_ef10_probe_pf(struct efx_nic *efx) in efx_ef10_probe_pf() argument
1118 return efx_ef10_probe(efx); in efx_ef10_probe_pf()
1121 int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id, in efx_ef10_vadaptor_query() argument
1125 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vadaptor_query()
1136 rc = efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_QUERY, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_query()
1160 int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vadaptor_alloc() argument
1165 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_alloc()
1169 int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id) in efx_ef10_vadaptor_free() argument
1174 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf), in efx_ef10_vadaptor_free()
1178 int efx_ef10_vport_add_mac(struct efx_nic *efx, in efx_ef10_vport_add_mac() argument
1186 return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf, in efx_ef10_vport_add_mac()
1190 int efx_ef10_vport_del_mac(struct efx_nic *efx, in efx_ef10_vport_del_mac() argument
1198 return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf, in efx_ef10_vport_del_mac()
1203 static int efx_ef10_probe_vf(struct efx_nic *efx) in efx_ef10_probe_vf() argument
1212 pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_probe_vf()
1218 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_vf()
1225 rc = efx_ef10_probe(efx); in efx_ef10_probe_vf()
1229 rc = efx_ef10_get_vf_index(efx); in efx_ef10_probe_vf()
1233 if (efx->pci_dev->is_virtfn) { in efx_ef10_probe_vf()
1234 if (efx->pci_dev->physfn) { in efx_ef10_probe_vf()
1236 pci_get_drvdata(efx->pci_dev->physfn); in efx_ef10_probe_vf()
1238 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_probe_vf()
1240 nic_data_p->vf[nic_data->vf_index].efx = efx; in efx_ef10_probe_vf()
1242 efx->pci_dev; in efx_ef10_probe_vf()
1244 netif_info(efx, drv, efx->net_dev, in efx_ef10_probe_vf()
1251 efx_ef10_remove(efx); in efx_ef10_probe_vf()
1255 static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) in efx_ef10_probe_vf() argument
1261 static int efx_ef10_alloc_vis(struct efx_nic *efx, in efx_ef10_alloc_vis() argument
1266 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_vis()
1272 rc = efx_mcdi_rpc(efx, MC_CMD_ALLOC_VIS, inbuf, sizeof(inbuf), in efx_ef10_alloc_vis()
1280 netif_dbg(efx, drv, efx->net_dev, "base VI is A0x%03x\n", in efx_ef10_alloc_vis()
1291 static int efx_ef10_dimension_resources(struct efx_nic *efx) in efx_ef10_dimension_resources() argument
1293 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_dimension_resources()
1301 channel_vis = max(efx->n_channels, in efx_ef10_dimension_resources()
1302 (efx->n_tx_channels + efx->n_extra_tx_channels) * in efx_ef10_dimension_resources()
1314 efx->n_tx_channels) { in efx_ef10_dimension_resources()
1316 DIV_ROUND_UP(efx->n_tx_channels, in efx_ef10_dimension_resources()
1319 rc = efx_ef10_alloc_piobufs(efx, n_piobufs); in efx_ef10_dimension_resources()
1321 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1324 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1327 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1330 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1347 uc_mem_map_size = PAGE_ALIGN((channel_vis - 1) * efx->vi_stride + in efx_ef10_dimension_resources()
1353 pio_write_vi_base = uc_mem_map_size / efx->vi_stride; in efx_ef10_dimension_resources()
1356 efx->vi_stride) - in efx_ef10_dimension_resources()
1366 rc = efx_ef10_free_vis(efx); in efx_ef10_dimension_resources()
1370 rc = efx_ef10_alloc_vis(efx, min_vis, max_vis); in efx_ef10_dimension_resources()
1375 netif_info(efx, drv, efx->net_dev, in efx_ef10_dimension_resources()
1383 efx->max_channels = nic_data->n_allocated_vis; in efx_ef10_dimension_resources()
1384 efx->max_tx_channels = in efx_ef10_dimension_resources()
1387 efx_ef10_free_vis(efx); in efx_ef10_dimension_resources()
1397 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1400 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
1404 membase = ioremap_nocache(efx->membase_phys, uc_mem_map_size); in efx_ef10_dimension_resources()
1406 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1411 iounmap(efx->membase); in efx_ef10_dimension_resources()
1412 efx->membase = membase; in efx_ef10_dimension_resources()
1416 nic_data->wc_membase = ioremap_wc(efx->membase_phys + in efx_ef10_dimension_resources()
1420 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1428 (pio_write_vi_base * efx->vi_stride + ER_DZ_TX_PIOBUF - in efx_ef10_dimension_resources()
1431 rc = efx_ef10_link_piobufs(efx); in efx_ef10_dimension_resources()
1433 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
1436 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
1438 &efx->membase_phys, efx->membase, uc_mem_map_size, in efx_ef10_dimension_resources()
1444 static int efx_ef10_init_nic(struct efx_nic *efx) in efx_ef10_init_nic() argument
1446 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_nic()
1450 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_init_nic()
1458 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, in efx_ef10_init_nic()
1466 rc = efx_ef10_alloc_piobufs(efx, nic_data->n_piobufs); in efx_ef10_init_nic()
1468 rc = efx_ef10_link_piobufs(efx); in efx_ef10_init_nic()
1470 efx_ef10_free_piobufs(efx); in efx_ef10_init_nic()
1478 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1481 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_nic()
1487 rc = efx->type->rx_push_rss_config(efx, false, in efx_ef10_init_nic()
1488 efx->rss_context.rx_indir_table, NULL); in efx_ef10_init_nic()
1493 static void efx_ef10_reset_mc_allocations(struct efx_nic *efx) in efx_ef10_reset_mc_allocations() argument
1495 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_reset_mc_allocations()
1505 efx_ef10_forget_old_piobufs(efx); in efx_ef10_reset_mc_allocations()
1506 efx->rss_context.context_id = EFX_EF10_RSS_CONTEXT_INVALID; in efx_ef10_reset_mc_allocations()
1513 for (i = 0; i < efx->vf_count; i++) in efx_ef10_reset_mc_allocations()
1556 static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) in efx_ef10_reset() argument
1558 int rc = efx_mcdi_reset(efx, reset_type); in efx_ef10_reset()
1574 efx_ef10_reset_mc_allocations(efx); in efx_ef10_reset()
1796 static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) in efx_ef10_raw_stat_mask() argument
1799 u32 port_caps = efx_mcdi_phy_get_caps(efx); in efx_ef10_raw_stat_mask()
1800 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_raw_stat_mask()
1802 if (!(efx->mcdi->fn_flags & in efx_ef10_raw_stat_mask()
1823 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) in efx_ef10_get_stat_mask() argument
1825 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_stat_mask()
1828 raw_mask[0] = efx_ef10_raw_stat_mask(efx); in efx_ef10_get_stat_mask()
1839 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V2) in efx_ef10_get_stat_mask()
1846 if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V3 && in efx_ef10_get_stat_mask()
1863 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) in efx_ef10_describe_stats() argument
1867 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_describe_stats()
1872 static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_common() argument
1876 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats_common()
1880 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats_common()
1941 static int efx_ef10_try_update_nic_stats_pf(struct efx_nic *efx) in efx_ef10_try_update_nic_stats_pf() argument
1943 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats_pf()
1949 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats_pf()
1951 dma_stats = efx->stats_buffer.addr; in efx_ef10_try_update_nic_stats_pf()
1953 generation_end = dma_stats[efx->num_mac_stats - 1]; in efx_ef10_try_update_nic_stats_pf()
1958 stats, efx->stats_buffer.addr, false); in efx_ef10_try_update_nic_stats_pf()
1965 efx_nic_fix_nodesc_drop_stat(efx, in efx_ef10_try_update_nic_stats_pf()
1972 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_pf()
1977 static size_t efx_ef10_update_stats_pf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_pf() argument
1986 if (efx_ef10_try_update_nic_stats_pf(efx) == 0) in efx_ef10_update_stats_pf()
1991 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_pf()
1994 static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx) in efx_ef10_try_update_nic_stats_vf() argument
1997 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats_vf()
2001 u32 dma_len = efx->num_mac_stats * sizeof(u64); in efx_ef10_try_update_nic_stats_vf()
2006 spin_unlock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2012 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2013 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_vf()
2017 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats_vf()
2019 rc = efx_nic_alloc_buffer(efx, &stats_buf, dma_len, GFP_ATOMIC); in efx_ef10_try_update_nic_stats_vf()
2021 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2026 dma_stats[efx->num_mac_stats - 1] = EFX_MC_STATS_GENERATION_INVALID; in efx_ef10_try_update_nic_stats_vf()
2034 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), in efx_ef10_try_update_nic_stats_vf()
2036 spin_lock_bh(&efx->stats_lock); in efx_ef10_try_update_nic_stats_vf()
2039 if (rc != -ENOENT || atomic_read(&efx->active_queues)) in efx_ef10_try_update_nic_stats_vf()
2040 efx_mcdi_display_error(efx, MC_CMD_MAC_STATS, in efx_ef10_try_update_nic_stats_vf()
2045 generation_end = dma_stats[efx->num_mac_stats - 1]; in efx_ef10_try_update_nic_stats_vf()
2060 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats_vf()
2062 efx_nic_free_buffer(efx, &stats_buf); in efx_ef10_try_update_nic_stats_vf()
2066 static size_t efx_ef10_update_stats_vf(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats_vf() argument
2069 if (efx_ef10_try_update_nic_stats_vf(efx)) in efx_ef10_update_stats_vf()
2072 return efx_ef10_update_stats_common(efx, full_stats, core_stats); in efx_ef10_update_stats_vf()
2077 struct efx_nic *efx = channel->efx; in efx_ef10_push_irq_moderation() local
2089 if (EFX_EF10_WORKAROUND_61265(efx)) { in efx_ef10_push_irq_moderation()
2099 efx_mcdi_rpc_async(efx, MC_CMD_SET_EVQ_TMR, in efx_ef10_push_irq_moderation()
2101 } else if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_push_irq_moderation()
2102 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2108 efx_writed_page(efx, &timer_cmd, ER_DD_EVQ_INDIRECT, in efx_ef10_push_irq_moderation()
2111 unsigned int ticks = efx_usecs_to_ticks(efx, usecs); in efx_ef10_push_irq_moderation()
2116 efx_writed_page(efx, &timer_cmd, ER_DZ_EVQ_TMR, in efx_ef10_push_irq_moderation()
2121 static void efx_ef10_get_wol_vf(struct efx_nic *efx, in efx_ef10_get_wol_vf() argument
2124 static int efx_ef10_set_wol_vf(struct efx_nic *efx, u32 type) in efx_ef10_set_wol_vf() argument
2129 static void efx_ef10_get_wol(struct efx_nic *efx, struct ethtool_wolinfo *wol) in efx_ef10_get_wol() argument
2136 static int efx_ef10_set_wol(struct efx_nic *efx, u32 type) in efx_ef10_set_wol() argument
2143 static void efx_ef10_mcdi_request(struct efx_nic *efx, in efx_ef10_mcdi_request() argument
2147 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_request()
2160 _efx_writed(efx, cpu_to_le32((u64)nic_data->mcdi_buf.dma_addr >> 32), in efx_ef10_mcdi_request()
2162 _efx_writed(efx, cpu_to_le32((u32)nic_data->mcdi_buf.dma_addr), in efx_ef10_mcdi_request()
2166 static bool efx_ef10_mcdi_poll_response(struct efx_nic *efx) in efx_ef10_mcdi_poll_response() argument
2168 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_response()
2176 efx_ef10_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf, in efx_ef10_mcdi_read_response() argument
2179 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_read_response()
2185 static void efx_ef10_mcdi_reboot_detected(struct efx_nic *efx) in efx_ef10_mcdi_reboot_detected() argument
2187 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_reboot_detected()
2190 efx_ef10_reset_mc_allocations(efx); in efx_ef10_mcdi_reboot_detected()
2201 static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) in efx_ef10_mcdi_poll_reboot() argument
2203 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_reboot()
2206 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_mcdi_poll_reboot()
2220 efx_ef10_mcdi_reboot_detected(efx); in efx_ef10_mcdi_poll_reboot()
2235 struct efx_nic *efx = context->efx; in efx_ef10_msi_interrupt() local
2237 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_msi_interrupt()
2240 if (likely(READ_ONCE(efx->irq_soft_enabled))) { in efx_ef10_msi_interrupt()
2242 if (context->index == efx->irq_level) in efx_ef10_msi_interrupt()
2243 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_msi_interrupt()
2246 efx_schedule_channel_irq(efx->channel[context->index]); in efx_ef10_msi_interrupt()
2254 struct efx_nic *efx = dev_id; in efx_ef10_legacy_interrupt() local
2255 bool soft_enabled = READ_ONCE(efx->irq_soft_enabled); in efx_ef10_legacy_interrupt()
2261 efx_readd(efx, &reg, ER_DZ_BIU_INT_ISR); in efx_ef10_legacy_interrupt()
2269 if (queues & (1U << efx->irq_level)) in efx_ef10_legacy_interrupt()
2270 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_legacy_interrupt()
2272 efx_for_each_channel(channel, efx) { in efx_ef10_legacy_interrupt()
2279 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_legacy_interrupt()
2286 static int efx_ef10_irq_test_generate(struct efx_nic *efx) in efx_ef10_irq_test_generate() argument
2290 if (efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG41750, true, in efx_ef10_irq_test_generate()
2296 MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level); in efx_ef10_irq_test_generate()
2297 return efx_mcdi_rpc(efx, MC_CMD_TRIGGER_INTERRUPT, in efx_ef10_irq_test_generate()
2303 return efx_nic_alloc_buffer(tx_queue->efx, &tx_queue->txd.buf, in efx_ef10_tx_probe()
2319 efx_writeo_page(tx_queue->efx, &reg, in efx_ef10_push_tx_desc()
2395 static u32 efx_ef10_tso_versions(struct efx_nic *efx) in efx_ef10_tso_versions() argument
2397 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_tso_versions()
2416 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_init() local
2417 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_tx_init()
2433 if (efx->type->ptp_set_ts_sync_events) in efx_ef10_tx_init()
2434 efx->type->ptp_set_ts_sync_events(efx, false, false); in efx_ef10_tx_init()
2446 netif_dbg(efx, hw, efx->net_dev, "Using TSOv2 for channel %u\n", in efx_ef10_tx_init()
2459 netif_dbg(efx, hw, efx->net_dev, "pushing TXQ %d. %zu entries (%llx)\n", in efx_ef10_tx_init()
2481 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_INIT_TXQ, inbuf, inlen, in efx_ef10_tx_init()
2486 netif_warn(efx, probe, efx->net_dev, in efx_ef10_tx_init()
2489 efx_mcdi_display_error(efx, MC_CMD_INIT_TXQ, in efx_ef10_tx_init()
2528 netdev_WARN(efx->net_dev, "failed to initialise TXQ %d\n", in efx_ef10_tx_init()
2536 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_fini() local
2543 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_TXQ, inbuf, sizeof(inbuf), in efx_ef10_tx_fini()
2552 efx_mcdi_display_error(efx, MC_CMD_FINI_TXQ, MC_CMD_FINI_TXQ_IN_LEN, in efx_ef10_tx_fini()
2558 efx_nic_free_buffer(tx_queue->efx, &tx_queue->txd.buf); in efx_ef10_tx_remove()
2569 efx_writed_page(tx_queue->efx, &reg, in efx_ef10_notify_tx_desc()
2654 static int efx_ef10_get_rss_flags(struct efx_nic *efx, u32 context, u32 *flags) in efx_ef10_get_rss_flags() argument
2683 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_GET_FLAGS, inbuf, in efx_ef10_get_rss_flags()
2700 static void efx_ef10_set_rss_flags(struct efx_nic *efx, in efx_ef10_set_rss_flags() argument
2708 if (efx_ef10_get_rss_flags(efx, ctx->context_id, &flags) != 0) in efx_ef10_set_rss_flags()
2715 if (!efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_FLAGS, inbuf, sizeof(inbuf), in efx_ef10_set_rss_flags()
2721 static int efx_ef10_alloc_rss_context(struct efx_nic *efx, bool exclusive, in efx_ef10_alloc_rss_context() argument
2727 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_rss_context()
2734 efx->rss_spread : in efx_ef10_alloc_rss_context()
2735 min(rounddown_pow_of_two(efx->rss_spread), in efx_ef10_alloc_rss_context()
2754 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_alloc_rss_context()
2769 efx_ef10_set_rss_flags(efx, ctx); in efx_ef10_alloc_rss_context()
2774 static int efx_ef10_free_rss_context(struct efx_nic *efx, u32 context) in efx_ef10_free_rss_context() argument
2780 return efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_FREE, inbuf, sizeof(inbuf), in efx_ef10_free_rss_context()
2784 static int efx_ef10_populate_rss_table(struct efx_nic *efx, u32 context, in efx_ef10_populate_rss_table() argument
2793 BUILD_BUG_ON(ARRAY_SIZE(efx->rss_context.rx_indir_table) != in efx_ef10_populate_rss_table()
2801 for (i = 0; i < ARRAY_SIZE(efx->rss_context.rx_indir_table); ++i) in efx_ef10_populate_rss_table()
2806 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_TABLE, tablebuf, in efx_ef10_populate_rss_table()
2813 BUILD_BUG_ON(ARRAY_SIZE(efx->rss_context.rx_hash_key) != in efx_ef10_populate_rss_table()
2815 for (i = 0; i < ARRAY_SIZE(efx->rss_context.rx_hash_key); ++i) in efx_ef10_populate_rss_table()
2818 return efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_KEY, keybuf, in efx_ef10_populate_rss_table()
2822 static void efx_ef10_rx_free_indir_table(struct efx_nic *efx) in efx_ef10_rx_free_indir_table() argument
2826 if (efx->rss_context.context_id != EFX_EF10_RSS_CONTEXT_INVALID) { in efx_ef10_rx_free_indir_table()
2827 rc = efx_ef10_free_rss_context(efx, efx->rss_context.context_id); in efx_ef10_rx_free_indir_table()
2830 efx->rss_context.context_id = EFX_EF10_RSS_CONTEXT_INVALID; in efx_ef10_rx_free_indir_table()
2833 static int efx_ef10_rx_push_shared_rss_config(struct efx_nic *efx, in efx_ef10_rx_push_shared_rss_config() argument
2836 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_push_shared_rss_config()
2837 int rc = efx_ef10_alloc_rss_context(efx, false, &efx->rss_context, in efx_ef10_rx_push_shared_rss_config()
2844 efx_set_default_rx_indir_table(efx, &efx->rss_context); in efx_ef10_rx_push_shared_rss_config()
2848 static int efx_ef10_rx_push_exclusive_rss_config(struct efx_nic *efx, in efx_ef10_rx_push_exclusive_rss_config() argument
2852 u32 old_rx_rss_context = efx->rss_context.context_id; in efx_ef10_rx_push_exclusive_rss_config()
2853 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_push_exclusive_rss_config()
2856 if (efx->rss_context.context_id == EFX_EF10_RSS_CONTEXT_INVALID || in efx_ef10_rx_push_exclusive_rss_config()
2858 rc = efx_ef10_alloc_rss_context(efx, true, &efx->rss_context, in efx_ef10_rx_push_exclusive_rss_config()
2866 rc = efx_ef10_populate_rss_table(efx, efx->rss_context.context_id, in efx_ef10_rx_push_exclusive_rss_config()
2871 if (efx->rss_context.context_id != old_rx_rss_context && in efx_ef10_rx_push_exclusive_rss_config()
2873 WARN_ON(efx_ef10_free_rss_context(efx, old_rx_rss_context) != 0); in efx_ef10_rx_push_exclusive_rss_config()
2875 if (rx_indir_table != efx->rss_context.rx_indir_table) in efx_ef10_rx_push_exclusive_rss_config()
2876 memcpy(efx->rss_context.rx_indir_table, rx_indir_table, in efx_ef10_rx_push_exclusive_rss_config()
2877 sizeof(efx->rss_context.rx_indir_table)); in efx_ef10_rx_push_exclusive_rss_config()
2878 if (key != efx->rss_context.rx_hash_key) in efx_ef10_rx_push_exclusive_rss_config()
2879 memcpy(efx->rss_context.rx_hash_key, key, in efx_ef10_rx_push_exclusive_rss_config()
2880 efx->type->rx_hash_key_size); in efx_ef10_rx_push_exclusive_rss_config()
2885 if (old_rx_rss_context != efx->rss_context.context_id) { in efx_ef10_rx_push_exclusive_rss_config()
2886 WARN_ON(efx_ef10_free_rss_context(efx, efx->rss_context.context_id) != 0); in efx_ef10_rx_push_exclusive_rss_config()
2887 efx->rss_context.context_id = old_rx_rss_context; in efx_ef10_rx_push_exclusive_rss_config()
2890 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_rx_push_exclusive_rss_config()
2894 static int efx_ef10_rx_push_rss_context_config(struct efx_nic *efx, in efx_ef10_rx_push_rss_context_config() argument
2901 WARN_ON(!mutex_is_locked(&efx->rss_lock)); in efx_ef10_rx_push_rss_context_config()
2904 rc = efx_ef10_alloc_rss_context(efx, true, ctx, NULL); in efx_ef10_rx_push_rss_context_config()
2910 return efx_ef10_free_rss_context(efx, ctx->context_id); in efx_ef10_rx_push_rss_context_config()
2912 rc = efx_ef10_populate_rss_table(efx, ctx->context_id, in efx_ef10_rx_push_rss_context_config()
2918 sizeof(efx->rss_context.rx_indir_table)); in efx_ef10_rx_push_rss_context_config()
2919 memcpy(ctx->rx_hash_key, key, efx->type->rx_hash_key_size); in efx_ef10_rx_push_rss_context_config()
2924 static int efx_ef10_rx_pull_rss_context_config(struct efx_nic *efx, in efx_ef10_rx_pull_rss_context_config() argument
2933 WARN_ON(!mutex_is_locked(&efx->rss_lock)); in efx_ef10_rx_pull_rss_context_config()
2945 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_GET_TABLE, inbuf, sizeof(inbuf), in efx_ef10_rx_pull_rss_context_config()
2961 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_GET_KEY, inbuf, sizeof(inbuf), in efx_ef10_rx_pull_rss_context_config()
2976 static int efx_ef10_rx_pull_rss_config(struct efx_nic *efx) in efx_ef10_rx_pull_rss_config() argument
2980 mutex_lock(&efx->rss_lock); in efx_ef10_rx_pull_rss_config()
2981 rc = efx_ef10_rx_pull_rss_context_config(efx, &efx->rss_context); in efx_ef10_rx_pull_rss_config()
2982 mutex_unlock(&efx->rss_lock); in efx_ef10_rx_pull_rss_config()
2986 static void efx_ef10_rx_restore_rss_contexts(struct efx_nic *efx) in efx_ef10_rx_restore_rss_contexts() argument
2988 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_restore_rss_contexts()
2992 WARN_ON(!mutex_is_locked(&efx->rss_lock)); in efx_ef10_rx_restore_rss_contexts()
2997 list_for_each_entry(ctx, &efx->rss_context.list, list) { in efx_ef10_rx_restore_rss_contexts()
3001 rc = efx_ef10_rx_push_rss_context_config(efx, ctx, in efx_ef10_rx_restore_rss_contexts()
3005 netif_warn(efx, probe, efx->net_dev, in efx_ef10_rx_restore_rss_contexts()
3013 static int efx_ef10_pf_rx_push_rss_config(struct efx_nic *efx, bool user, in efx_ef10_pf_rx_push_rss_config() argument
3019 if (efx->rss_spread == 1) in efx_ef10_pf_rx_push_rss_config()
3023 key = efx->rss_context.rx_hash_key; in efx_ef10_pf_rx_push_rss_config()
3025 rc = efx_ef10_rx_push_exclusive_rss_config(efx, rx_indir_table, key); in efx_ef10_pf_rx_push_rss_config()
3033 i < ARRAY_SIZE(efx->rss_context.rx_indir_table) && !mismatch; in efx_ef10_pf_rx_push_rss_config()
3036 ethtool_rxfh_indir_default(i, efx->rss_spread); in efx_ef10_pf_rx_push_rss_config()
3038 rc = efx_ef10_rx_push_shared_rss_config(efx, &context_size); in efx_ef10_pf_rx_push_rss_config()
3040 if (context_size != efx->rss_spread) in efx_ef10_pf_rx_push_rss_config()
3041 netif_warn(efx, probe, efx->net_dev, in efx_ef10_pf_rx_push_rss_config()
3046 efx->rss_spread, context_size); in efx_ef10_pf_rx_push_rss_config()
3048 netif_warn(efx, probe, efx->net_dev, in efx_ef10_pf_rx_push_rss_config()
3054 netif_info(efx, probe, efx->net_dev, in efx_ef10_pf_rx_push_rss_config()
3062 static int efx_ef10_vf_rx_push_rss_config(struct efx_nic *efx, bool user, in efx_ef10_vf_rx_push_rss_config() argument
3070 if (efx->rss_context.context_id != EFX_EF10_RSS_CONTEXT_INVALID) in efx_ef10_vf_rx_push_rss_config()
3072 return efx_ef10_rx_push_shared_rss_config(efx, NULL); in efx_ef10_vf_rx_push_rss_config()
3077 return efx_nic_alloc_buffer(rx_queue->efx, &rx_queue->rxd.buf, in efx_ef10_rx_probe()
3090 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_init() local
3091 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_init()
3114 netif_dbg(efx, hw, efx->net_dev, "pushing RXQ %d. %zu entries (%llx)\n", in efx_ef10_rx_init()
3124 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_RXQ, inbuf, inlen, in efx_ef10_rx_init()
3127 netdev_WARN(efx->net_dev, "failed to initialise RXQ %d\n", in efx_ef10_rx_init()
3135 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_fini() local
3142 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_RXQ, inbuf, sizeof(inbuf), in efx_ef10_rx_fini()
3151 efx_mcdi_display_error(efx, MC_CMD_FINI_RXQ, MC_CMD_FINI_RXQ_IN_LEN, in efx_ef10_rx_fini()
3157 efx_nic_free_buffer(rx_queue->efx, &rx_queue->rxd.buf); in efx_ef10_rx_remove()
3176 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_write() local
3194 efx_writed_page(efx, &reg, ER_DZ_RX_DESC_UPD, in efx_ef10_rx_write()
3218 efx_mcdi_rpc_async(channel->efx, MC_CMD_DRIVER_EVENT, in efx_ef10_rx_defer_refill()
3224 efx_ef10_rx_defer_refill_complete(struct efx_nic *efx, unsigned long cookie, in efx_ef10_rx_defer_refill_complete() argument
3233 return efx_nic_alloc_buffer(channel->efx, &channel->eventq.buf, in efx_ef10_ev_probe()
3243 struct efx_nic *efx = channel->efx; in efx_ef10_ev_fini() local
3249 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_EVQ, inbuf, sizeof(inbuf), in efx_ef10_ev_fini()
3258 efx_mcdi_display_error(efx, MC_CMD_FINI_EVQ, MC_CMD_FINI_EVQ_IN_LEN, in efx_ef10_ev_fini()
3269 struct efx_nic *efx = channel->efx; in efx_ef10_ev_init() local
3277 nic_data = efx->nic_data; in efx_ef10_ev_init()
3323 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_EVQ, inbuf, inlen, in efx_ef10_ev_init()
3327 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_ev_init()
3337 rc = efx_mcdi_get_workarounds(efx, &implemented, &enabled); in efx_ef10_ev_init()
3354 rc = efx_mcdi_set_workaround(efx, in efx_ef10_ev_init()
3361 netif_info(efx, drv, efx->net_dev, in efx_ef10_ev_init()
3371 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_ev_init()
3394 efx_nic_free_buffer(channel->efx, &channel->eventq.buf); in efx_ef10_ev_remove()
3400 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_wrong_queue() local
3402 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_wrong_queue()
3406 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_wrong_queue()
3414 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_bad_lbits() local
3416 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_bad_lbits()
3420 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_bad_lbits()
3428 netif_dbg(rx_queue->efx, hw, rx_queue->efx->net_dev, in efx_ef10_handle_rx_abort()
3450 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event_errors() local
3454 if (!(efx->net_dev->features & NETIF_F_RXALL)) { in efx_ef10_handle_rx_event_errors()
3455 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3467 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3471 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3483 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3487 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3495 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3503 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3507 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3513 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3521 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event_errors()
3525 if (!efx->loopback_selftest) in efx_ef10_handle_rx_event_errors()
3540 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event() local
3541 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
3547 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_rx_event()
3564 netdev_WARN(efx->net_dev, "saw RX_DROP_EVENT: event=" in efx_ef10_handle_rx_event()
3577 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
3582 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
3648 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
3689 struct efx_nic *efx = channel->efx; in efx_ef10_handle_tx_event() local
3696 if (unlikely(READ_ONCE(efx->reset_pending))) in efx_ef10_handle_tx_event()
3754 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_tx_event()
3766 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_event() local
3779 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_event()
3791 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_generated_event() local
3808 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_generated_event()
3818 struct efx_nic *efx = channel->efx; in efx_ef10_ev_process() local
3842 netif_vdbg(efx, drv, efx->net_dev, in efx_ef10_ev_process()
3872 netif_err(efx, hw, efx->net_dev, in efx_ef10_ev_process()
3887 struct efx_nic *efx = channel->efx; in efx_ef10_ev_read_ack() local
3890 if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_ev_read_ack()
3902 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3909 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
3915 efx_writed_page(efx, &rptr, ER_DZ_EVQ_RPTR, channel->channel); in efx_ef10_ev_read_ack()
3922 struct efx_nic *efx = channel->efx; in efx_ef10_ev_test_generate() local
3938 rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf), in efx_ef10_ev_test_generate()
3947 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_ev_test_generate()
3950 void efx_ef10_handle_drain_event(struct efx_nic *efx) in efx_ef10_handle_drain_event() argument
3952 if (atomic_dec_and_test(&efx->active_queues)) in efx_ef10_handle_drain_event()
3953 wake_up(&efx->flush_wq); in efx_ef10_handle_drain_event()
3955 WARN_ON(atomic_read(&efx->active_queues) < 0); in efx_ef10_handle_drain_event()
3958 static int efx_ef10_fini_dmaq(struct efx_nic *efx) in efx_ef10_fini_dmaq() argument
3960 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_fini_dmaq()
3970 atomic_set(&efx->active_queues, 0); in efx_ef10_fini_dmaq()
3975 if (efx->state != STATE_RECOVERY) { in efx_ef10_fini_dmaq()
3976 efx_for_each_channel(channel, efx) { in efx_ef10_fini_dmaq()
3983 wait_event_timeout(efx->flush_wq, in efx_ef10_fini_dmaq()
3984 atomic_read(&efx->active_queues) == 0, in efx_ef10_fini_dmaq()
3986 pending = atomic_read(&efx->active_queues); in efx_ef10_fini_dmaq()
3988 netif_err(efx, hw, efx->net_dev, "failed to flush %d queues\n", in efx_ef10_fini_dmaq()
3997 static void efx_ef10_prepare_flr(struct efx_nic *efx) in efx_ef10_prepare_flr() argument
3999 atomic_set(&efx->active_queues, 0); in efx_ef10_prepare_flr()
4052 efx_ef10_filter_push_prep_set_match_fields(struct efx_nic *efx, in efx_ef10_filter_push_prep_set_match_fields() argument
4149 static void efx_ef10_filter_push_prep(struct efx_nic *efx, in efx_ef10_filter_push_prep() argument
4155 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_push_prep()
4176 efx_ef10_filter_push_prep_set_match_fields(efx, spec, inbuf); in efx_ef10_filter_push_prep()
4198 static int efx_ef10_filter_push(struct efx_nic *efx, in efx_ef10_filter_push() argument
4206 efx_ef10_filter_push_prep(efx, spec, inbuf, *handle, ctx, replacing); in efx_ef10_filter_push()
4207 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, inbuf, sizeof(inbuf), in efx_ef10_filter_push()
4291 static s32 efx_ef10_filter_insert_locked(struct efx_nic *efx, in efx_ef10_filter_insert_locked() argument
4296 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_insert_locked()
4310 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); in efx_ef10_filter_insert_locked()
4311 table = efx->filter_state; in efx_ef10_filter_insert_locked()
4332 mutex_lock(&efx->rss_lock); in efx_ef10_filter_insert_locked()
4335 ctx = efx_find_rss_context_entry(efx, spec->rss_context); in efx_ef10_filter_insert_locked()
4337 ctx = &efx->rss_context; in efx_ef10_filter_insert_locked()
4422 rc = efx_ef10_filter_push(efx, spec, &table->entry[ins_index].handle, in efx_ef10_filter_insert_locked()
4478 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_insert_locked()
4499 mutex_unlock(&efx->rss_lock); in efx_ef10_filter_insert_locked()
4504 static s32 efx_ef10_filter_insert(struct efx_nic *efx, in efx_ef10_filter_insert() argument
4510 down_read(&efx->filter_sem); in efx_ef10_filter_insert()
4511 ret = efx_ef10_filter_insert_locked(efx, spec, replace_equal); in efx_ef10_filter_insert()
4512 up_read(&efx->filter_sem); in efx_ef10_filter_insert()
4517 static void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx) in efx_ef10_filter_update_rx_scatter() argument
4529 static int efx_ef10_filter_remove_internal(struct efx_nic *efx, in efx_ef10_filter_remove_internal() argument
4534 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_internal()
4567 (efx_rss_active(&efx->rss_context) ? in efx_ef10_filter_remove_internal()
4571 rc = efx_ef10_filter_push(efx, &new_spec, in efx_ef10_filter_remove_internal()
4573 &efx->rss_context, in efx_ef10_filter_remove_internal()
4587 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_remove_internal()
4595 efx_mcdi_display_error(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_remove_internal()
4604 static int efx_ef10_filter_remove_safe(struct efx_nic *efx, in efx_ef10_filter_remove_safe() argument
4611 down_read(&efx->filter_sem); in efx_ef10_filter_remove_safe()
4612 table = efx->filter_state; in efx_ef10_filter_remove_safe()
4614 rc = efx_ef10_filter_remove_internal(efx, 1U << priority, filter_id, in efx_ef10_filter_remove_safe()
4617 up_read(&efx->filter_sem); in efx_ef10_filter_remove_safe()
4622 static void efx_ef10_filter_remove_unsafe(struct efx_nic *efx, in efx_ef10_filter_remove_unsafe() argument
4626 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_unsafe()
4632 efx_ef10_filter_remove_internal(efx, 1U << priority, filter_id, in efx_ef10_filter_remove_unsafe()
4637 static int efx_ef10_filter_get_safe(struct efx_nic *efx, in efx_ef10_filter_get_safe() argument
4646 down_read(&efx->filter_sem); in efx_ef10_filter_get_safe()
4647 table = efx->filter_state; in efx_ef10_filter_get_safe()
4659 up_read(&efx->filter_sem); in efx_ef10_filter_get_safe()
4663 static int efx_ef10_filter_clear_rx(struct efx_nic *efx, in efx_ef10_filter_clear_rx() argument
4674 down_read(&efx->filter_sem); in efx_ef10_filter_clear_rx()
4675 table = efx->filter_state; in efx_ef10_filter_clear_rx()
4678 rc = efx_ef10_filter_remove_internal(efx, priority_mask, in efx_ef10_filter_clear_rx()
4686 up_read(&efx->filter_sem); in efx_ef10_filter_clear_rx()
4690 static u32 efx_ef10_filter_count_rx_used(struct efx_nic *efx, in efx_ef10_filter_count_rx_used() argument
4697 down_read(&efx->filter_sem); in efx_ef10_filter_count_rx_used()
4698 table = efx->filter_state; in efx_ef10_filter_count_rx_used()
4707 up_read(&efx->filter_sem); in efx_ef10_filter_count_rx_used()
4711 static u32 efx_ef10_filter_get_rx_id_limit(struct efx_nic *efx) in efx_ef10_filter_get_rx_id_limit() argument
4713 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_get_rx_id_limit()
4718 static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx, in efx_ef10_filter_get_rx_ids() argument
4727 down_read(&efx->filter_sem); in efx_ef10_filter_get_rx_ids()
4728 table = efx->filter_state; in efx_ef10_filter_get_rx_ids()
4745 up_read(&efx->filter_sem); in efx_ef10_filter_get_rx_ids()
4751 static bool efx_ef10_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, in efx_ef10_filter_rfs_expire_one() argument
4760 down_read(&efx->filter_sem); in efx_ef10_filter_rfs_expire_one()
4761 table = efx->filter_state; in efx_ef10_filter_rfs_expire_one()
4768 spin_lock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4769 if (!efx->rps_hash_table) { in efx_ef10_filter_rfs_expire_one()
4773 rule = efx_rps_hash_find(efx, spec); in efx_ef10_filter_rfs_expire_one()
4782 spin_unlock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4786 if (!rps_may_expire_flow(efx->net_dev, spec->dmaq_id, flow_id, arfs_id)) in efx_ef10_filter_rfs_expire_one()
4792 spin_unlock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4800 ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority, in efx_ef10_filter_rfs_expire_one()
4807 spin_lock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4808 efx_rps_hash_del(efx, &saved_spec); in efx_ef10_filter_rfs_expire_one()
4809 spin_unlock_bh(&efx->rps_hash_lock); in efx_ef10_filter_rfs_expire_one()
4813 up_read(&efx->filter_sem); in efx_ef10_filter_rfs_expire_one()
4876 static void efx_ef10_filter_cleanup_vlans(struct efx_nic *efx) in efx_ef10_filter_cleanup_vlans() argument
4878 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_cleanup_vlans()
4882 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_cleanup_vlans()
4889 efx_ef10_filter_del_vlan_internal(efx, vlan); in efx_ef10_filter_cleanup_vlans()
4912 efx_ef10_filter_table_probe_matches(struct efx_nic *efx, in efx_ef10_filter_table_probe_matches() argument
4927 rc = efx_mcdi_rpc(efx, MC_CMD_GET_PARSER_DISP_INFO, in efx_ef10_filter_table_probe_matches()
4944 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_filter_table_probe_matches()
4948 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_filter_table_probe_matches()
4960 static int efx_ef10_filter_table_probe(struct efx_nic *efx) in efx_ef10_filter_table_probe() argument
4962 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_probe()
4963 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_table_probe()
4968 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_table_probe()
4971 if (efx->filter_state) /* already probed */ in efx_ef10_filter_table_probe()
4979 rc = efx_ef10_filter_table_probe_matches(efx, table, false); in efx_ef10_filter_table_probe()
4984 rc = efx_ef10_filter_table_probe_matches(efx, table, true); in efx_ef10_filter_table_probe()
4987 if ((efx_supported_features(efx) & NETIF_F_HW_VLAN_CTAG_FILTER) && in efx_ef10_filter_table_probe()
4992 netif_info(efx, probe, net_dev, in efx_ef10_filter_table_probe()
4995 efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; in efx_ef10_filter_table_probe()
5008 !!(efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER); in efx_ef10_filter_table_probe()
5012 efx->filter_state = table; in efx_ef10_filter_table_probe()
5015 rc = efx_ef10_filter_add_vlan(efx, vlan->vid); in efx_ef10_filter_table_probe()
5023 efx_ef10_filter_cleanup_vlans(efx); in efx_ef10_filter_table_probe()
5024 efx->filter_state = NULL; in efx_ef10_filter_table_probe()
5033 static void efx_ef10_filter_table_restore(struct efx_nic *efx) in efx_ef10_filter_table_restore() argument
5035 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_table_restore()
5036 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_restore()
5046 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); in efx_ef10_filter_table_restore()
5055 mutex_lock(&efx->rss_lock); in efx_ef10_filter_table_restore()
5072 ctx = efx_find_rss_context_entry(efx, spec->rss_context); in efx_ef10_filter_table_restore()
5074 ctx = &efx->rss_context; in efx_ef10_filter_table_restore()
5077 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_table_restore()
5084 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_table_restore()
5092 rc = efx_ef10_filter_push(efx, spec, in efx_ef10_filter_table_restore()
5111 mutex_unlock(&efx->rss_lock); in efx_ef10_filter_table_restore()
5118 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_filter_table_restore()
5123 netif_err(efx, hw, efx->net_dev, in efx_ef10_filter_table_restore()
5129 static void efx_ef10_filter_table_remove(struct efx_nic *efx) in efx_ef10_filter_table_remove() argument
5131 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_table_remove()
5137 efx_ef10_filter_cleanup_vlans(efx); in efx_ef10_filter_table_remove()
5138 efx->filter_state = NULL; in efx_ef10_filter_table_remove()
5145 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_table_remove()
5162 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FILTER_OP, inbuf, in efx_ef10_filter_table_remove()
5165 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_table_remove()
5175 static void efx_ef10_filter_mark_one_old(struct efx_nic *efx, uint16_t *id) in efx_ef10_filter_mark_one_old() argument
5177 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_mark_one_old()
5185 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_filter_mark_one_old()
5194 static void _efx_ef10_filter_vlan_mark_old(struct efx_nic *efx, in _efx_ef10_filter_vlan_mark_old() argument
5197 struct efx_ef10_filter_table *table = efx->filter_state; in _efx_ef10_filter_vlan_mark_old()
5201 efx_ef10_filter_mark_one_old(efx, &vlan->uc[i]); in _efx_ef10_filter_vlan_mark_old()
5203 efx_ef10_filter_mark_one_old(efx, &vlan->mc[i]); in _efx_ef10_filter_vlan_mark_old()
5205 efx_ef10_filter_mark_one_old(efx, &vlan->default_filters[i]); in _efx_ef10_filter_vlan_mark_old()
5212 static void efx_ef10_filter_mark_old(struct efx_nic *efx) in efx_ef10_filter_mark_old() argument
5214 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_mark_old()
5219 _efx_ef10_filter_vlan_mark_old(efx, vlan); in efx_ef10_filter_mark_old()
5223 static void efx_ef10_filter_uc_addr_list(struct efx_nic *efx) in efx_ef10_filter_uc_addr_list() argument
5225 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_uc_addr_list()
5226 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_uc_addr_list()
5245 static void efx_ef10_filter_mc_addr_list(struct efx_nic *efx) in efx_ef10_filter_mc_addr_list() argument
5247 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_mc_addr_list()
5248 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_mc_addr_list()
5269 static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx, in efx_ef10_filter_insert_addr_list() argument
5273 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_insert_addr_list()
5293 filter_flags = efx_rss_active(&efx->rss_context) ? EFX_FILTER_FLAG_RX_RSS : 0; in efx_ef10_filter_insert_addr_list()
5300 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_addr_list()
5303 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_insert_addr_list()
5309 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_insert_addr_list()
5329 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_addr_list()
5331 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_insert_addr_list()
5336 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_insert_addr_list()
5350 static int efx_ef10_filter_insert_def(struct efx_nic *efx, in efx_ef10_filter_insert_def() argument
5355 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_insert_def()
5362 filter_flags = efx_rss_active(&efx->rss_context) ? EFX_FILTER_FLAG_RX_RSS : 0; in efx_ef10_filter_insert_def()
5385 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_def()
5409 netif_cond_dbg(efx, drv, efx->net_dev, in efx_ef10_filter_insert_def()
5445 rc = efx_ef10_filter_insert_locked(efx, &spec, true); in efx_ef10_filter_insert_def()
5447 netif_warn(efx, drv, efx->net_dev, in efx_ef10_filter_insert_def()
5453 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_insert_def()
5498 static void efx_ef10_filter_remove_old(struct efx_nic *efx) in efx_ef10_filter_remove_old() argument
5500 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_old()
5510 rc = efx_ef10_filter_remove_internal(efx, in efx_ef10_filter_remove_old()
5521 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_remove_old()
5525 netif_info(efx, drv, efx->net_dev, in efx_ef10_filter_remove_old()
5530 static int efx_ef10_vport_set_mac_address(struct efx_nic *efx) in efx_ef10_vport_set_mac_address() argument
5532 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_vport_set_mac_address()
5540 efx_device_detach_sync(efx); in efx_ef10_vport_set_mac_address()
5541 efx_net_stop(efx->net_dev); in efx_ef10_vport_set_mac_address()
5542 down_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5543 efx_ef10_filter_table_remove(efx); in efx_ef10_vport_set_mac_address()
5544 up_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5546 rc = efx_ef10_vadaptor_free(efx, nic_data->vport_id); in efx_ef10_vport_set_mac_address()
5551 rc = efx_ef10_vport_del_mac(efx, nic_data->vport_id, in efx_ef10_vport_set_mac_address()
5556 rc = efx_ef10_vport_add_mac(efx, nic_data->vport_id, in efx_ef10_vport_set_mac_address()
5557 efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
5559 ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr); in efx_ef10_vport_set_mac_address()
5561 rc2 = efx_ef10_vport_add_mac(efx, nic_data->vport_id, mac_old); in efx_ef10_vport_set_mac_address()
5570 rc2 = efx_ef10_vadaptor_alloc(efx, nic_data->vport_id); in efx_ef10_vport_set_mac_address()
5574 down_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5575 rc2 = efx_ef10_filter_table_probe(efx); in efx_ef10_vport_set_mac_address()
5576 up_write(&efx->filter_sem); in efx_ef10_vport_set_mac_address()
5580 rc2 = efx_net_open(efx->net_dev); in efx_ef10_vport_set_mac_address()
5584 efx_device_attach_if_not_resetting(efx); in efx_ef10_vport_set_mac_address()
5589 netif_err(efx, drv, efx->net_dev, in efx_ef10_vport_set_mac_address()
5591 efx_schedule_reset(efx, RESET_TYPE_DATAPATH); in efx_ef10_vport_set_mac_address()
5599 static void efx_ef10_filter_vlan_sync_rx_mode(struct efx_nic *efx, in efx_ef10_filter_vlan_sync_rx_mode() argument
5602 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_vlan_sync_rx_mode()
5603 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_vlan_sync_rx_mode()
5613 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_NONE, in efx_ef10_filter_vlan_sync_rx_mode()
5615 efx_ef10_filter_insert_addr_list(efx, vlan, false, false); in efx_ef10_filter_vlan_sync_rx_mode()
5621 if (efx_ef10_filter_insert_addr_list(efx, vlan, false, false)) in efx_ef10_filter_vlan_sync_rx_mode()
5622 efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5626 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_VXLAN | in efx_ef10_filter_vlan_sync_rx_mode()
5631 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_NVGRE | in efx_ef10_filter_vlan_sync_rx_mode()
5636 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE, in efx_ef10_filter_vlan_sync_rx_mode()
5638 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE | in efx_ef10_filter_vlan_sync_rx_mode()
5648 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_vlan_sync_rx_mode()
5654 if (efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5658 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_vlan_sync_rx_mode()
5659 efx_ef10_filter_insert_addr_list(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5667 efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5671 efx_ef10_filter_insert_addr_list(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5680 if (efx_ef10_filter_insert_addr_list(efx, vlan, true, true)) { in efx_ef10_filter_vlan_sync_rx_mode()
5683 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_vlan_sync_rx_mode()
5684 if (efx_ef10_filter_insert_def(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5687 efx_ef10_filter_insert_addr_list(efx, vlan, in efx_ef10_filter_vlan_sync_rx_mode()
5691 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_VXLAN | in efx_ef10_filter_vlan_sync_rx_mode()
5696 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_NVGRE | in efx_ef10_filter_vlan_sync_rx_mode()
5701 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE, in efx_ef10_filter_vlan_sync_rx_mode()
5703 efx_ef10_filter_insert_def(efx, vlan, EFX_ENCAP_TYPE_GENEVE | in efx_ef10_filter_vlan_sync_rx_mode()
5711 static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx) in efx_ef10_filter_sync_rx_mode() argument
5713 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_sync_rx_mode()
5714 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_sync_rx_mode()
5718 if (!efx_dev_registered(efx)) in efx_ef10_filter_sync_rx_mode()
5724 efx_ef10_filter_mark_old(efx); in efx_ef10_filter_sync_rx_mode()
5730 efx_ef10_filter_uc_addr_list(efx); in efx_ef10_filter_sync_rx_mode()
5731 efx_ef10_filter_mc_addr_list(efx); in efx_ef10_filter_sync_rx_mode()
5741 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_sync_rx_mode()
5745 efx_ef10_filter_vlan_sync_rx_mode(efx, vlan); in efx_ef10_filter_sync_rx_mode()
5747 efx_ef10_filter_remove_old(efx); in efx_ef10_filter_sync_rx_mode()
5751 static struct efx_ef10_filter_vlan *efx_ef10_filter_find_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_filter_find_vlan() argument
5753 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_find_vlan()
5756 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); in efx_ef10_filter_find_vlan()
5766 static int efx_ef10_filter_add_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_filter_add_vlan() argument
5768 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_add_vlan()
5772 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_add_vlan()
5775 vlan = efx_ef10_filter_find_vlan(efx, vid); in efx_ef10_filter_add_vlan()
5777 netif_err(efx, drv, efx->net_dev, in efx_ef10_filter_add_vlan()
5797 if (efx_dev_registered(efx)) in efx_ef10_filter_add_vlan()
5798 efx_ef10_filter_vlan_sync_rx_mode(efx, vlan); in efx_ef10_filter_add_vlan()
5803 static void efx_ef10_filter_del_vlan_internal(struct efx_nic *efx, in efx_ef10_filter_del_vlan_internal() argument
5809 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) 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()
5818 efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_del_vlan_internal()
5822 efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_del_vlan_internal()
5828 static void efx_ef10_filter_del_vlan(struct efx_nic *efx, u16 vid) in efx_ef10_filter_del_vlan() argument
5833 if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) in efx_ef10_filter_del_vlan()
5836 vlan = efx_ef10_filter_find_vlan(efx, vid); in efx_ef10_filter_del_vlan()
5838 netif_err(efx, drv, efx->net_dev, in efx_ef10_filter_del_vlan()
5843 efx_ef10_filter_del_vlan_internal(efx, vlan); in efx_ef10_filter_del_vlan()
5846 static int efx_ef10_set_mac_address(struct efx_nic *efx) in efx_ef10_set_mac_address() argument
5849 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_mac_address()
5850 bool was_enabled = efx->port_enabled; in efx_ef10_set_mac_address()
5853 efx_device_detach_sync(efx); in efx_ef10_set_mac_address()
5854 efx_net_stop(efx->net_dev); in efx_ef10_set_mac_address()
5856 mutex_lock(&efx->mac_lock); in efx_ef10_set_mac_address()
5857 down_write(&efx->filter_sem); in efx_ef10_set_mac_address()
5858 efx_ef10_filter_table_remove(efx); in efx_ef10_set_mac_address()
5861 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
5864 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, in efx_ef10_set_mac_address()
5867 efx_ef10_filter_table_probe(efx); in efx_ef10_set_mac_address()
5868 up_write(&efx->filter_sem); in efx_ef10_set_mac_address()
5869 mutex_unlock(&efx->mac_lock); in efx_ef10_set_mac_address()
5872 efx_net_open(efx->net_dev); in efx_ef10_set_mac_address()
5873 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_mac_address()
5876 if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { in efx_ef10_set_mac_address()
5877 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; in efx_ef10_set_mac_address()
5887 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
5899 if (vf->efx == efx) { in efx_ef10_set_mac_address()
5901 efx->net_dev->dev_addr); in efx_ef10_set_mac_address()
5909 netif_err(efx, drv, efx->net_dev, in efx_ef10_set_mac_address()
5912 } else if (rc == -ENOSYS && !efx_ef10_is_vf(efx)) { in efx_ef10_set_mac_address()
5918 rc = efx_ef10_vport_set_mac_address(efx); in efx_ef10_set_mac_address()
5920 efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC, in efx_ef10_set_mac_address()
5927 static int efx_ef10_mac_reconfigure(struct efx_nic *efx) in efx_ef10_mac_reconfigure() argument
5929 efx_ef10_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure()
5931 return efx_mcdi_set_mac(efx); in efx_ef10_mac_reconfigure()
5934 static int efx_ef10_mac_reconfigure_vf(struct efx_nic *efx) in efx_ef10_mac_reconfigure_vf() argument
5936 efx_ef10_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure_vf()
5941 static int efx_ef10_start_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_start_bist() argument
5946 return efx_mcdi_rpc(efx, MC_CMD_START_BIST, inbuf, sizeof(inbuf), in efx_ef10_start_bist()
5954 static int efx_ef10_poll_bist(struct efx_nic *efx) in efx_ef10_poll_bist() argument
5961 rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, in efx_ef10_poll_bist()
5972 netif_dbg(efx, hw, efx->net_dev, "BIST passed.\n"); in efx_ef10_poll_bist()
5975 netif_err(efx, hw, efx->net_dev, "BIST timed out\n"); in efx_ef10_poll_bist()
5978 netif_err(efx, hw, efx->net_dev, "BIST failed.\n"); in efx_ef10_poll_bist()
5981 netif_err(efx, hw, efx->net_dev, in efx_ef10_poll_bist()
5987 static int efx_ef10_run_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_run_bist() argument
5991 netif_dbg(efx, drv, efx->net_dev, "starting BIST type %u\n", bist_type); in efx_ef10_run_bist()
5993 rc = efx_ef10_start_bist(efx, bist_type); in efx_ef10_run_bist()
5997 return efx_ef10_poll_bist(efx); in efx_ef10_run_bist()
6001 efx_ef10_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) in efx_ef10_test_chip() argument
6005 efx_reset_down(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
6007 rc = efx_mcdi_rpc(efx, MC_CMD_ENABLE_OFFLINE_BIST, in efx_ef10_test_chip()
6012 tests->memory = efx_ef10_run_bist(efx, MC_CMD_MC_MEM_BIST) ? -1 : 1; in efx_ef10_test_chip()
6013 tests->registers = efx_ef10_run_bist(efx, MC_CMD_REG_BIST) ? -1 : 1; in efx_ef10_test_chip()
6015 rc = efx_mcdi_reset(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
6020 rc2 = efx_reset_up(efx, RESET_TYPE_WORLD, rc == 0); in efx_ef10_test_chip()
6046 static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, in efx_ef10_mtd_probe_partition() argument
6064 if (info->port != efx_port_num(efx)) in efx_ef10_mtd_probe_partition()
6067 rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); in efx_ef10_mtd_probe_partition()
6076 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_METADATA, inbuf, sizeof(inbuf), in efx_ef10_mtd_probe_partition()
6098 static int efx_ef10_mtd_probe(struct efx_nic *efx) in efx_ef10_mtd_probe() argument
6109 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_PARTITIONS, NULL, 0, in efx_ef10_mtd_probe()
6129 rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type); in efx_ef10_mtd_probe()
6136 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in efx_ef10_mtd_probe()
6145 static void efx_ef10_ptp_write_host_time(struct efx_nic *efx, u32 host_time) in efx_ef10_ptp_write_host_time() argument
6147 _efx_writed(efx, cpu_to_le32(host_time), ER_DZ_MC_DB_LWRD); in efx_ef10_ptp_write_host_time()
6150 static void efx_ef10_ptp_write_host_time_vf(struct efx_nic *efx, in efx_ef10_ptp_write_host_time_vf() argument
6170 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_enable_timestamping()
6203 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_disable_timestamping()
6209 static int efx_ef10_ptp_set_ts_sync_events(struct efx_nic *efx, bool en, in efx_ef10_ptp_set_ts_sync_events() argument
6219 channel = efx_ptp_channel(efx); in efx_ef10_ptp_set_ts_sync_events()
6223 efx_ef10_ptp_set_ts_sync_events(efx, false, temp); in efx_ef10_ptp_set_ts_sync_events()
6231 static int efx_ef10_ptp_set_ts_config_vf(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config_vf() argument
6237 static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config() argument
6244 efx_ef10_ptp_set_ts_sync_events(efx, false, false); in efx_ef10_ptp_set_ts_config()
6246 return efx_ptp_change_mode(efx, in efx_ef10_ptp_set_ts_config()
6263 rc = efx_ptp_change_mode(efx, true, 0); in efx_ef10_ptp_set_ts_config()
6265 rc = efx_ef10_ptp_set_ts_sync_events(efx, true, false); in efx_ef10_ptp_set_ts_config()
6267 efx_ptp_change_mode(efx, false, 0); in efx_ef10_ptp_set_ts_config()
6274 static int efx_ef10_get_phys_port_id(struct efx_nic *efx, in efx_ef10_get_phys_port_id() argument
6277 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_get_phys_port_id()
6288 static int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_add_vid() argument
6293 return efx_ef10_add_vlan(efx, vid); in efx_ef10_vlan_rx_add_vid()
6296 static int efx_ef10_vlan_rx_kill_vid(struct efx_nic *efx, __be16 proto, u16 vid) in efx_ef10_vlan_rx_kill_vid() argument
6301 return efx_ef10_del_vlan(efx, vid); in efx_ef10_vlan_rx_kill_vid()
6309 static int efx_ef10_set_udp_tnl_ports(struct efx_nic *efx, bool unloading) in efx_ef10_set_udp_tnl_ports() argument
6311 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_set_udp_tnl_ports()
6327 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
6364 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS, in efx_ef10_set_udp_tnl_ports()
6378 netif_warn(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
6382 netif_info(efx, drv, efx->net_dev, in efx_ef10_set_udp_tnl_ports()
6399 efx_device_attach_if_not_resetting(efx); in efx_ef10_set_udp_tnl_ports()
6405 static int efx_ef10_udp_tnl_push_ports(struct efx_nic *efx) in efx_ef10_udp_tnl_push_ports() argument
6407 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_push_ports()
6415 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_push_ports()
6416 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_push_ports()
6422 static struct efx_udp_tunnel *__efx_ef10_udp_tnl_lookup_port(struct efx_nic *efx, in __efx_ef10_udp_tnl_lookup_port() argument
6425 struct efx_ef10_nic_data *nic_data = efx->nic_data; in __efx_ef10_udp_tnl_lookup_port()
6437 static int efx_ef10_udp_tnl_add_port(struct efx_nic *efx, in efx_ef10_udp_tnl_add_port() argument
6440 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_add_port()
6451 netif_dbg(efx, drv, efx->net_dev, "Adding UDP tunnel (%s) port %d\n", in efx_ef10_udp_tnl_add_port()
6458 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_add_port()
6460 match = __efx_ef10_udp_tnl_lookup_port(efx, tnl.port); in efx_ef10_udp_tnl_add_port()
6463 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_add_port()
6472 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_add_port()
6483 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_add_port()
6487 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_add_port()
6503 static bool efx_ef10_udp_tnl_has_port(struct efx_nic *efx, __be16 port) in efx_ef10_udp_tnl_has_port() argument
6505 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_has_port()
6517 return __efx_ef10_udp_tnl_lookup_port(efx, port) != NULL; in efx_ef10_udp_tnl_has_port()
6520 static int efx_ef10_udp_tnl_del_port(struct efx_nic *efx, in efx_ef10_udp_tnl_del_port() argument
6523 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_udp_tnl_del_port()
6533 netif_dbg(efx, drv, efx->net_dev, "Removing UDP tunnel (%s) port %d\n", in efx_ef10_udp_tnl_del_port()
6540 efx_device_detach_sync(efx); in efx_ef10_udp_tnl_del_port()
6542 match = __efx_ef10_udp_tnl_lookup_port(efx, tnl.port); in efx_ef10_udp_tnl_del_port()
6547 netif_dbg(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_del_port()
6553 rc = efx_ef10_set_udp_tnl_ports(efx, false); in efx_ef10_udp_tnl_del_port()
6558 netif_warn(efx, drv, efx->net_dev, in efx_ef10_udp_tnl_del_port()