Lines Matching refs:efx

80 static void efx_ef10_rx_push_rss_config(struct efx_nic *efx);
81 static void efx_ef10_rx_free_indir_table(struct efx_nic *efx);
82 static void efx_ef10_filter_table_remove(struct efx_nic *efx);
84 static int efx_ef10_get_warm_boot_count(struct efx_nic *efx) in efx_ef10_get_warm_boot_count() argument
88 efx_readd(efx, &reg, ER_DZ_BIU_MC_SFT_STATUS); in efx_ef10_get_warm_boot_count()
93 static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx) in efx_ef10_mem_map_size() argument
95 return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]); in efx_ef10_mem_map_size()
98 static int efx_ef10_init_datapath_caps(struct efx_nic *efx) in efx_ef10_init_datapath_caps() argument
101 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_datapath_caps()
107 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CAPABILITIES, NULL, 0, in efx_ef10_init_datapath_caps()
112 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_datapath_caps()
122 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_datapath_caps()
129 netif_err(efx, probe, efx->net_dev, in efx_ef10_init_datapath_caps()
137 static int efx_ef10_get_sysclk_freq(struct efx_nic *efx) in efx_ef10_get_sysclk_freq() argument
142 rc = efx_mcdi_rpc(efx, MC_CMD_GET_CLOCK, NULL, 0, in efx_ef10_get_sysclk_freq()
150 static int efx_ef10_get_mac_address(struct efx_nic *efx, u8 *mac_address) in efx_ef10_get_mac_address() argument
158 rc = efx_mcdi_rpc(efx, MC_CMD_GET_MAC_ADDRESSES, NULL, 0, in efx_ef10_get_mac_address()
170 static int efx_ef10_probe(struct efx_nic *efx) in efx_ef10_probe() argument
178 efx->max_channels = in efx_ef10_probe()
181 resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / in efx_ef10_probe()
183 if (WARN_ON(efx->max_channels == 0)) in efx_ef10_probe()
189 efx->nic_data = nic_data; in efx_ef10_probe()
191 rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf, in efx_ef10_probe()
201 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_probe()
217 _efx_writed(efx, cpu_to_le32(1), ER_DZ_MC_DB_HWRD); in efx_ef10_probe()
219 rc = efx_mcdi_init(efx); in efx_ef10_probe()
224 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); in efx_ef10_probe()
229 rc = efx_mcdi_log_ctrl(efx, true, false, 0); in efx_ef10_probe()
233 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_probe()
237 efx->rx_packet_len_offset = in efx_ef10_probe()
240 rc = efx_mcdi_port_get_number(efx); in efx_ef10_probe()
243 efx->port_num = rc; in efx_ef10_probe()
245 rc = efx_ef10_get_mac_address(efx, efx->net_dev->perm_addr); in efx_ef10_probe()
249 rc = efx_ef10_get_sysclk_freq(efx); in efx_ef10_probe()
252 efx->timer_quantum_ns = 1536000 / rc; /* 1536 cycles */ in efx_ef10_probe()
255 rc = efx_mcdi_set_workaround(efx, MC_CMD_WORKAROUND_BUG35388, true); in efx_ef10_probe()
260 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_probe()
264 rc = efx_mcdi_mon_probe(efx); in efx_ef10_probe()
268 efx_ptp_probe(efx, NULL); in efx_ef10_probe()
273 efx_mcdi_fini(efx); in efx_ef10_probe()
275 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_probe()
278 efx->nic_data = NULL; in efx_ef10_probe()
282 static int efx_ef10_free_vis(struct efx_nic *efx) in efx_ef10_free_vis() argument
286 int rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FREE_VIS, NULL, 0, in efx_ef10_free_vis()
293 efx_mcdi_display_error(efx, MC_CMD_FREE_VIS, 0, outbuf, outlen, in efx_ef10_free_vis()
300 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
302 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_free_piobufs()
312 rc = efx_mcdi_rpc(efx, MC_CMD_FREE_PIOBUF, inbuf, sizeof(inbuf), in efx_ef10_free_piobufs()
320 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
322 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_piobufs()
331 rc = efx_mcdi_rpc(efx, MC_CMD_ALLOC_PIOBUF, NULL, 0, in efx_ef10_alloc_piobufs()
341 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_alloc_piobufs()
348 efx_ef10_free_piobufs(efx); in efx_ef10_alloc_piobufs()
352 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
354 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_link_piobufs()
372 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
376 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
382 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
388 efx_for_each_channel(channel, efx) { in efx_ef10_link_piobufs()
394 offset = ((efx->tx_channel_offset + efx->n_tx_channels - in efx_ef10_link_piobufs()
415 rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, in efx_ef10_link_piobufs()
424 netif_err(efx, drv, efx->net_dev, in efx_ef10_link_piobufs()
433 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_link_piobufs()
448 efx_mcdi_rpc(efx, MC_CMD_UNLINK_PIOBUF, in efx_ef10_link_piobufs()
457 static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) in efx_ef10_alloc_piobufs() argument
462 static int efx_ef10_link_piobufs(struct efx_nic *efx) in efx_ef10_link_piobufs() argument
467 static void efx_ef10_free_piobufs(struct efx_nic *efx) in efx_ef10_free_piobufs() argument
473 static void efx_ef10_remove(struct efx_nic *efx) in efx_ef10_remove() argument
475 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_remove()
478 efx_ptp_remove(efx); in efx_ef10_remove()
480 efx_mcdi_mon_remove(efx); in efx_ef10_remove()
482 efx_ef10_rx_free_indir_table(efx); in efx_ef10_remove()
487 rc = efx_ef10_free_vis(efx); in efx_ef10_remove()
491 efx_ef10_free_piobufs(efx); in efx_ef10_remove()
493 efx_mcdi_fini(efx); in efx_ef10_remove()
494 efx_nic_free_buffer(efx, &nic_data->mcdi_buf); in efx_ef10_remove()
498 static int efx_ef10_alloc_vis(struct efx_nic *efx, in efx_ef10_alloc_vis() argument
503 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_alloc_vis()
509 rc = efx_mcdi_rpc(efx, MC_CMD_ALLOC_VIS, inbuf, sizeof(inbuf), in efx_ef10_alloc_vis()
517 netif_dbg(efx, drv, efx->net_dev, "base VI is A0x%03x\n", in efx_ef10_alloc_vis()
528 static int efx_ef10_dimension_resources(struct efx_nic *efx) in efx_ef10_dimension_resources() argument
530 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_dimension_resources()
536 min_vis = max(efx->n_channels, efx->n_tx_channels * EFX_TXQ_TYPES); in efx_ef10_dimension_resources()
547 efx->n_tx_channels) { in efx_ef10_dimension_resources()
549 DIV_ROUND_UP(efx->n_tx_channels, in efx_ef10_dimension_resources()
552 rc = efx_ef10_alloc_piobufs(efx, n_piobufs); in efx_ef10_dimension_resources()
554 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
557 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
593 rc = efx_ef10_free_vis(efx); in efx_ef10_dimension_resources()
597 rc = efx_ef10_alloc_vis(efx, min_vis, max_vis); in efx_ef10_dimension_resources()
607 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
610 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
614 membase = ioremap_nocache(efx->membase_phys, uc_mem_map_size); in efx_ef10_dimension_resources()
616 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
621 iounmap(efx->membase); in efx_ef10_dimension_resources()
622 efx->membase = membase; in efx_ef10_dimension_resources()
626 nic_data->wc_membase = ioremap_wc(efx->membase_phys + in efx_ef10_dimension_resources()
630 netif_err(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
641 rc = efx_ef10_link_piobufs(efx); in efx_ef10_dimension_resources()
643 efx_ef10_free_piobufs(efx); in efx_ef10_dimension_resources()
646 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_dimension_resources()
648 &efx->membase_phys, efx->membase, uc_mem_map_size, in efx_ef10_dimension_resources()
654 static int efx_ef10_init_nic(struct efx_nic *efx) in efx_ef10_init_nic() argument
656 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_init_nic()
660 rc = efx_ef10_init_datapath_caps(efx); in efx_ef10_init_nic()
668 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, in efx_ef10_init_nic()
676 rc = efx_ef10_alloc_piobufs(efx, nic_data->n_piobufs); in efx_ef10_init_nic()
678 rc = efx_ef10_link_piobufs(efx); in efx_ef10_init_nic()
680 efx_ef10_free_piobufs(efx); in efx_ef10_init_nic()
685 netif_err(efx, drv, efx->net_dev, in efx_ef10_init_nic()
690 efx_ef10_rx_push_rss_config(efx); in efx_ef10_init_nic()
694 static void efx_ef10_reset_mc_allocations(struct efx_nic *efx) in efx_ef10_reset_mc_allocations() argument
696 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_reset_mc_allocations()
735 static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) in efx_ef10_reset() argument
737 int rc = efx_mcdi_reset(efx, reset_type); in efx_ef10_reset()
747 efx_ef10_reset_mc_allocations(efx); in efx_ef10_reset()
891 static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) in efx_ef10_raw_stat_mask() argument
894 u32 port_caps = efx_mcdi_phy_get_caps(efx); in efx_ef10_raw_stat_mask()
895 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_raw_stat_mask()
909 static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) in efx_ef10_get_stat_mask() argument
911 u64 raw_mask = efx_ef10_raw_stat_mask(efx); in efx_ef10_get_stat_mask()
921 static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) in efx_ef10_describe_stats() argument
925 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_describe_stats()
930 static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) in efx_ef10_try_update_nic_stats() argument
932 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats()
938 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_try_update_nic_stats()
940 dma_stats = efx->stats_buffer.addr; in efx_ef10_try_update_nic_stats()
941 nic_data = efx->nic_data; in efx_ef10_try_update_nic_stats()
948 stats, efx->stats_buffer.addr, false); in efx_ef10_try_update_nic_stats()
955 efx_nic_fix_nodesc_drop_stat(efx, &stats[EF10_STAT_rx_nodesc_drops]); in efx_ef10_try_update_nic_stats()
961 efx_update_sw_stats(efx, stats); in efx_ef10_try_update_nic_stats()
966 static size_t efx_ef10_update_stats(struct efx_nic *efx, u64 *full_stats, in efx_ef10_update_stats() argument
970 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_update_stats()
975 efx_ef10_get_stat_mask(efx, mask); in efx_ef10_update_stats()
981 if (efx_ef10_try_update_nic_stats(efx) == 0) in efx_ef10_update_stats()
1020 struct efx_nic *efx = channel->efx; in efx_ef10_push_irq_moderation() local
1032 if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_push_irq_moderation()
1037 efx_writed_page(efx, &timer_cmd, ER_DD_EVQ_INDIRECT, in efx_ef10_push_irq_moderation()
1042 efx_writed_page(efx, &timer_cmd, ER_DZ_EVQ_TMR, in efx_ef10_push_irq_moderation()
1047 static void efx_ef10_get_wol(struct efx_nic *efx, struct ethtool_wolinfo *wol) in efx_ef10_get_wol() argument
1054 static int efx_ef10_set_wol(struct efx_nic *efx, u32 type) in efx_ef10_set_wol() argument
1061 static void efx_ef10_mcdi_request(struct efx_nic *efx, in efx_ef10_mcdi_request() argument
1065 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_request()
1078 _efx_writed(efx, cpu_to_le32((u64)nic_data->mcdi_buf.dma_addr >> 32), in efx_ef10_mcdi_request()
1080 _efx_writed(efx, cpu_to_le32((u32)nic_data->mcdi_buf.dma_addr), in efx_ef10_mcdi_request()
1084 static bool efx_ef10_mcdi_poll_response(struct efx_nic *efx) in efx_ef10_mcdi_poll_response() argument
1086 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_response()
1094 efx_ef10_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf, in efx_ef10_mcdi_read_response() argument
1097 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_read_response()
1103 static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) in efx_ef10_mcdi_poll_reboot() argument
1105 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_mcdi_poll_reboot()
1108 rc = efx_ef10_get_warm_boot_count(efx); in efx_ef10_mcdi_poll_reboot()
1124 efx_ef10_reset_mc_allocations(efx); in efx_ef10_mcdi_poll_reboot()
1147 struct efx_nic *efx = context->efx; in efx_ef10_msi_interrupt() local
1149 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_msi_interrupt()
1152 if (likely(ACCESS_ONCE(efx->irq_soft_enabled))) { in efx_ef10_msi_interrupt()
1154 if (context->index == efx->irq_level) in efx_ef10_msi_interrupt()
1155 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_msi_interrupt()
1158 efx_schedule_channel_irq(efx->channel[context->index]); in efx_ef10_msi_interrupt()
1166 struct efx_nic *efx = dev_id; in efx_ef10_legacy_interrupt() local
1167 bool soft_enabled = ACCESS_ONCE(efx->irq_soft_enabled); in efx_ef10_legacy_interrupt()
1173 efx_readd(efx, &reg, ER_DZ_BIU_INT_ISR); in efx_ef10_legacy_interrupt()
1181 if (queues & (1U << efx->irq_level)) in efx_ef10_legacy_interrupt()
1182 efx->last_irq_cpu = raw_smp_processor_id(); in efx_ef10_legacy_interrupt()
1184 efx_for_each_channel(channel, efx) { in efx_ef10_legacy_interrupt()
1191 netif_vdbg(efx, intr, efx->net_dev, in efx_ef10_legacy_interrupt()
1198 static void efx_ef10_irq_test_generate(struct efx_nic *efx) in efx_ef10_irq_test_generate() argument
1204 MCDI_SET_DWORD(inbuf, TRIGGER_INTERRUPT_IN_INTR_LEVEL, efx->irq_level); in efx_ef10_irq_test_generate()
1205 (void) efx_mcdi_rpc(efx, MC_CMD_TRIGGER_INTERRUPT, in efx_ef10_irq_test_generate()
1211 return efx_nic_alloc_buffer(tx_queue->efx, &tx_queue->txd.buf, in efx_ef10_tx_probe()
1227 efx_writeo_page(tx_queue->efx, &reg, in efx_ef10_push_tx_desc()
1239 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_init() local
1258 netif_dbg(efx, hw, efx->net_dev, "pushing TXQ %d. %zu entries (%llx)\n", in efx_ef10_tx_init()
1268 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_TXQ, inbuf, inlen, in efx_ef10_tx_init()
1295 netdev_WARN(efx->net_dev, "failed to initialise TXQ %d\n", in efx_ef10_tx_init()
1303 struct efx_nic *efx = tx_queue->efx; in efx_ef10_tx_fini() local
1310 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_TXQ, inbuf, sizeof(inbuf), in efx_ef10_tx_fini()
1319 efx_mcdi_display_error(efx, MC_CMD_FINI_TXQ, MC_CMD_FINI_TXQ_IN_LEN, in efx_ef10_tx_fini()
1325 efx_nic_free_buffer(tx_queue->efx, &tx_queue->txd.buf); in efx_ef10_tx_remove()
1336 efx_writed_page(tx_queue->efx, &reg, in efx_ef10_notify_tx_desc()
1383 static int efx_ef10_alloc_rss_context(struct efx_nic *efx, u32 *context) in efx_ef10_alloc_rss_context() argument
1397 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_ALLOC, inbuf, sizeof(inbuf), in efx_ef10_alloc_rss_context()
1410 static void efx_ef10_free_rss_context(struct efx_nic *efx, u32 context) in efx_ef10_free_rss_context() argument
1418 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_FREE, inbuf, sizeof(inbuf), in efx_ef10_free_rss_context()
1423 static int efx_ef10_populate_rss_table(struct efx_nic *efx, u32 context) in efx_ef10_populate_rss_table() argument
1431 BUILD_BUG_ON(ARRAY_SIZE(efx->rx_indir_table) != in efx_ef10_populate_rss_table()
1434 for (i = 0; i < ARRAY_SIZE(efx->rx_indir_table); ++i) in efx_ef10_populate_rss_table()
1437 (u8) efx->rx_indir_table[i]; in efx_ef10_populate_rss_table()
1439 rc = efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_TABLE, tablebuf, in efx_ef10_populate_rss_table()
1446 BUILD_BUG_ON(ARRAY_SIZE(efx->rx_hash_key) != in efx_ef10_populate_rss_table()
1448 for (i = 0; i < ARRAY_SIZE(efx->rx_hash_key); ++i) in efx_ef10_populate_rss_table()
1450 efx->rx_hash_key[i]; in efx_ef10_populate_rss_table()
1452 return efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_KEY, keybuf, in efx_ef10_populate_rss_table()
1456 static void efx_ef10_rx_free_indir_table(struct efx_nic *efx) in efx_ef10_rx_free_indir_table() argument
1458 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_free_indir_table()
1461 efx_ef10_free_rss_context(efx, nic_data->rx_rss_context); in efx_ef10_rx_free_indir_table()
1465 static void efx_ef10_rx_push_rss_config(struct efx_nic *efx) in efx_ef10_rx_push_rss_config() argument
1467 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_rx_push_rss_config()
1470 netif_dbg(efx, drv, efx->net_dev, "pushing RSS config\n"); in efx_ef10_rx_push_rss_config()
1473 rc = efx_ef10_alloc_rss_context(efx, &nic_data->rx_rss_context); in efx_ef10_rx_push_rss_config()
1478 rc = efx_ef10_populate_rss_table(efx, nic_data->rx_rss_context); in efx_ef10_rx_push_rss_config()
1485 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_rx_push_rss_config()
1490 return efx_nic_alloc_buffer(rx_queue->efx, &rx_queue->rxd.buf, in efx_ef10_rx_probe()
1504 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_init() local
1526 netif_dbg(efx, hw, efx->net_dev, "pushing RXQ %d. %zu entries (%llx)\n", in efx_ef10_rx_init()
1536 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_RXQ, inbuf, inlen, in efx_ef10_rx_init()
1539 netdev_WARN(efx->net_dev, "failed to initialise RXQ %d\n", in efx_ef10_rx_init()
1547 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_fini() local
1554 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_RXQ, inbuf, sizeof(inbuf), in efx_ef10_rx_fini()
1563 efx_mcdi_display_error(efx, MC_CMD_FINI_RXQ, MC_CMD_FINI_RXQ_IN_LEN, in efx_ef10_rx_fini()
1569 efx_nic_free_buffer(rx_queue->efx, &rx_queue->rxd.buf); in efx_ef10_rx_remove()
1588 struct efx_nic *efx = rx_queue->efx; in efx_ef10_rx_write() local
1606 efx_writed_page(efx, &reg, ER_DZ_RX_DESC_UPD, in efx_ef10_rx_write()
1630 efx_mcdi_rpc_async(channel->efx, MC_CMD_DRIVER_EVENT, in efx_ef10_rx_defer_refill()
1636 efx_ef10_rx_defer_refill_complete(struct efx_nic *efx, unsigned long cookie, in efx_ef10_rx_defer_refill_complete() argument
1645 return efx_nic_alloc_buffer(channel->efx, &channel->eventq.buf, in efx_ef10_ev_probe()
1658 struct efx_nic *efx = channel->efx; in efx_ef10_ev_init() local
1666 nic_data = efx->nic_data; in efx_ef10_ev_init()
1699 rc = efx_mcdi_rpc(efx, MC_CMD_INIT_EVQ, inbuf, inlen, in efx_ef10_ev_init()
1709 struct efx_nic *efx = channel->efx; in efx_ef10_ev_fini() local
1715 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_FINI_EVQ, inbuf, sizeof(inbuf), in efx_ef10_ev_fini()
1724 efx_mcdi_display_error(efx, MC_CMD_FINI_EVQ, MC_CMD_FINI_EVQ_IN_LEN, in efx_ef10_ev_fini()
1730 efx_nic_free_buffer(channel->efx, &channel->eventq.buf); in efx_ef10_ev_remove()
1736 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_wrong_queue() local
1738 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_wrong_queue()
1742 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_wrong_queue()
1750 struct efx_nic *efx = rx_queue->efx; in efx_ef10_handle_rx_bad_lbits() local
1752 netif_info(efx, hw, efx->net_dev, in efx_ef10_handle_rx_bad_lbits()
1756 efx_schedule_reset(efx, RESET_TYPE_DISABLE); in efx_ef10_handle_rx_bad_lbits()
1764 netif_dbg(rx_queue->efx, hw, rx_queue->efx->net_dev, in efx_ef10_handle_rx_abort()
1784 struct efx_nic *efx = channel->efx; in efx_ef10_handle_rx_event() local
1789 if (unlikely(ACCESS_ONCE(efx->reset_pending))) in efx_ef10_handle_rx_event()
1800 netdev_WARN(efx->net_dev, "saw RX_DROP_EVENT: event=" in efx_ef10_handle_rx_event()
1813 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_handle_rx_event()
1818 netdev_WARN(efx->net_dev, in efx_ef10_handle_rx_event()
1893 struct efx_nic *efx = channel->efx; in efx_ef10_handle_tx_event() local
1899 if (unlikely(ACCESS_ONCE(efx->reset_pending))) in efx_ef10_handle_tx_event()
1920 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_event() local
1933 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_event()
1945 struct efx_nic *efx = channel->efx; in efx_ef10_handle_driver_generated_event() local
1962 netif_err(efx, hw, efx->net_dev, in efx_ef10_handle_driver_generated_event()
1972 struct efx_nic *efx = channel->efx; in efx_ef10_ev_process() local
1997 netif_vdbg(efx, drv, efx->net_dev, in efx_ef10_ev_process()
2017 if (tx_descs > efx->txq_entries) { in efx_ef10_ev_process()
2033 netif_err(efx, hw, efx->net_dev, in efx_ef10_ev_process()
2048 struct efx_nic *efx = channel->efx; in efx_ef10_ev_read_ack() local
2051 if (EFX_EF10_WORKAROUND_35388(efx)) { in efx_ef10_ev_read_ack()
2063 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
2070 efx_writed_page(efx, &rptr, ER_DD_EVQ_INDIRECT, in efx_ef10_ev_read_ack()
2076 efx_writed_page(efx, &rptr, ER_DZ_EVQ_RPTR, channel->channel); in efx_ef10_ev_read_ack()
2083 struct efx_nic *efx = channel->efx; in efx_ef10_ev_test_generate() local
2099 rc = efx_mcdi_rpc(efx, MC_CMD_DRIVER_EVENT, inbuf, sizeof(inbuf), in efx_ef10_ev_test_generate()
2108 netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); in efx_ef10_ev_test_generate()
2111 void efx_ef10_handle_drain_event(struct efx_nic *efx) in efx_ef10_handle_drain_event() argument
2113 if (atomic_dec_and_test(&efx->active_queues)) in efx_ef10_handle_drain_event()
2114 wake_up(&efx->flush_wq); in efx_ef10_handle_drain_event()
2116 WARN_ON(atomic_read(&efx->active_queues) < 0); in efx_ef10_handle_drain_event()
2119 static int efx_ef10_fini_dmaq(struct efx_nic *efx) in efx_ef10_fini_dmaq() argument
2121 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_fini_dmaq()
2131 atomic_set(&efx->active_queues, 0); in efx_ef10_fini_dmaq()
2136 if (efx->state != STATE_RECOVERY) { in efx_ef10_fini_dmaq()
2137 efx_for_each_channel(channel, efx) { in efx_ef10_fini_dmaq()
2144 wait_event_timeout(efx->flush_wq, in efx_ef10_fini_dmaq()
2145 atomic_read(&efx->active_queues) == 0, in efx_ef10_fini_dmaq()
2147 pending = atomic_read(&efx->active_queues); in efx_ef10_fini_dmaq()
2149 netif_err(efx, hw, efx->net_dev, "failed to flush %d queues\n", in efx_ef10_fini_dmaq()
2158 static void efx_ef10_prepare_flr(struct efx_nic *efx) in efx_ef10_prepare_flr() argument
2160 atomic_set(&efx->active_queues, 0); in efx_ef10_prepare_flr()
2235 static void efx_ef10_filter_push_prep(struct efx_nic *efx, in efx_ef10_filter_push_prep() argument
2240 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_push_prep()
2312 static int efx_ef10_filter_push(struct efx_nic *efx, in efx_ef10_filter_push() argument
2320 efx_ef10_filter_push_prep(efx, spec, inbuf, *handle, replacing); in efx_ef10_filter_push()
2321 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, inbuf, sizeof(inbuf), in efx_ef10_filter_push()
2344 static s32 efx_ef10_filter_insert(struct efx_nic *efx, in efx_ef10_filter_insert() argument
2348 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_insert()
2382 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2438 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2486 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2488 rc = efx_ef10_filter_push(efx, spec, &table->entry[ins_index].handle, in efx_ef10_filter_insert()
2492 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2529 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2534 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_insert()
2537 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2558 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_insert()
2563 static void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx) in efx_ef10_filter_update_rx_scatter() argument
2573 static int efx_ef10_filter_remove_internal(struct efx_nic *efx, in efx_ef10_filter_remove_internal() argument
2578 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_remove_internal()
2591 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_remove_internal()
2596 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_remove_internal()
2624 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_remove_internal()
2636 rc = efx_ef10_filter_push(efx, &new_spec, in efx_ef10_filter_remove_internal()
2640 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_remove_internal()
2652 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, in efx_ef10_filter_remove_internal()
2655 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_remove_internal()
2665 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_remove_internal()
2670 static int efx_ef10_filter_remove_safe(struct efx_nic *efx, in efx_ef10_filter_remove_safe() argument
2674 return efx_ef10_filter_remove_internal(efx, 1U << priority, in efx_ef10_filter_remove_safe()
2678 static int efx_ef10_filter_get_safe(struct efx_nic *efx, in efx_ef10_filter_get_safe() argument
2683 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_get_safe()
2687 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_get_safe()
2697 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_get_safe()
2701 static int efx_ef10_filter_clear_rx(struct efx_nic *efx, in efx_ef10_filter_clear_rx() argument
2712 rc = efx_ef10_filter_remove_internal(efx, priority_mask, in efx_ef10_filter_clear_rx()
2721 static u32 efx_ef10_filter_count_rx_used(struct efx_nic *efx, in efx_ef10_filter_count_rx_used() argument
2724 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_count_rx_used()
2728 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_count_rx_used()
2735 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_count_rx_used()
2739 static u32 efx_ef10_filter_get_rx_id_limit(struct efx_nic *efx) in efx_ef10_filter_get_rx_id_limit() argument
2741 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_get_rx_id_limit()
2746 static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx, in efx_ef10_filter_get_rx_ids() argument
2750 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_get_rx_ids()
2755 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_get_rx_ids()
2769 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_get_rx_ids()
2777 static s32 efx_ef10_filter_rfs_insert(struct efx_nic *efx, in efx_ef10_filter_rfs_insert() argument
2780 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_rfs_insert()
2801 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_insert()
2861 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_insert()
2866 efx_ef10_filter_push_prep(efx, spec, inbuf, in efx_ef10_filter_rfs_insert()
2868 efx_mcdi_rpc_async(efx, MC_CMD_FILTER_OP, inbuf, sizeof(inbuf), in efx_ef10_filter_rfs_insert()
2875 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_insert()
2880 efx_ef10_filter_rfs_insert_complete(struct efx_nic *efx, unsigned long cookie, in efx_ef10_filter_rfs_insert_complete() argument
2884 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_rfs_insert_complete()
2894 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_insert_complete()
2906 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_insert_complete()
2912 efx_ef10_filter_rfs_expire_complete(struct efx_nic *efx,
2917 static bool efx_ef10_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, in efx_ef10_filter_rfs_expire_one() argument
2920 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_rfs_expire_one()
2930 !rps_may_expire_flow(efx->net_dev, spec->dmaq_id, in efx_ef10_filter_rfs_expire_one()
2938 if (efx_mcdi_rpc_async(efx, MC_CMD_FILTER_OP, inbuf, sizeof(inbuf), 0, in efx_ef10_filter_rfs_expire_one()
2947 efx_ef10_filter_rfs_expire_complete(struct efx_nic *efx, in efx_ef10_filter_rfs_expire_complete() argument
2952 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_rfs_expire_complete()
2956 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_expire_complete()
2963 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_rfs_expire_complete()
3000 static int efx_ef10_filter_table_probe(struct efx_nic *efx) in efx_ef10_filter_table_probe() argument
3016 rc = efx_mcdi_rpc(efx, MC_CMD_GET_PARSER_DISP_INFO, in efx_ef10_filter_table_probe()
3033 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_filter_table_probe()
3037 netif_dbg(efx, probe, efx->net_dev, in efx_ef10_filter_table_probe()
3051 efx->filter_state = table; in efx_ef10_filter_table_probe()
3060 static void efx_ef10_filter_table_restore(struct efx_nic *efx) in efx_ef10_filter_table_restore() argument
3062 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_table_restore()
3063 struct efx_ef10_nic_data *nic_data = efx->nic_data; in efx_ef10_filter_table_restore()
3072 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_table_restore()
3080 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_table_restore()
3082 rc = efx_ef10_filter_push(efx, spec, in efx_ef10_filter_table_restore()
3088 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_table_restore()
3098 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_table_restore()
3101 netif_err(efx, hw, efx->net_dev, in efx_ef10_filter_table_restore()
3107 static void efx_ef10_filter_table_remove(struct efx_nic *efx) in efx_ef10_filter_table_remove() argument
3109 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_table_remove()
3126 rc = efx_mcdi_rpc(efx, MC_CMD_FILTER_OP, inbuf, sizeof(inbuf), in efx_ef10_filter_table_remove()
3129 netdev_WARN(efx->net_dev, in efx_ef10_filter_table_remove()
3140 static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx) in efx_ef10_filter_sync_rx_mode() argument
3142 struct efx_ef10_filter_table *table = efx->filter_state; in efx_ef10_filter_sync_rx_mode()
3143 struct net_device *net_dev = efx->net_dev; in efx_ef10_filter_sync_rx_mode()
3151 if (!efx_dev_registered(efx)) in efx_ef10_filter_sync_rx_mode()
3155 spin_lock_bh(&efx->filter_lock); in efx_ef10_filter_sync_rx_mode()
3166 spin_unlock_bh(&efx->filter_lock); in efx_ef10_filter_sync_rx_mode()
3206 rc = efx_ef10_filter_insert(efx, &spec, true); in efx_ef10_filter_sync_rx_mode()
3211 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_sync_rx_mode()
3224 rc = efx_ef10_filter_insert(efx, &spec, true); in efx_ef10_filter_sync_rx_mode()
3241 rc = efx_ef10_filter_insert(efx, &spec, true); in efx_ef10_filter_sync_rx_mode()
3246 efx, EFX_FILTER_PRI_AUTO, in efx_ef10_filter_sync_rx_mode()
3259 rc = efx_ef10_filter_insert(efx, &spec, true); in efx_ef10_filter_sync_rx_mode()
3277 efx, 1U << EFX_FILTER_PRI_AUTO, in efx_ef10_filter_sync_rx_mode()
3285 static int efx_ef10_mac_reconfigure(struct efx_nic *efx) in efx_ef10_mac_reconfigure() argument
3287 efx_ef10_filter_sync_rx_mode(efx); in efx_ef10_mac_reconfigure()
3289 return efx_mcdi_set_mac(efx); in efx_ef10_mac_reconfigure()
3292 static int efx_ef10_start_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_start_bist() argument
3297 return efx_mcdi_rpc(efx, MC_CMD_START_BIST, inbuf, sizeof(inbuf), in efx_ef10_start_bist()
3305 static int efx_ef10_poll_bist(struct efx_nic *efx) in efx_ef10_poll_bist() argument
3312 rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, in efx_ef10_poll_bist()
3323 netif_dbg(efx, hw, efx->net_dev, "BIST passed.\n"); in efx_ef10_poll_bist()
3326 netif_err(efx, hw, efx->net_dev, "BIST timed out\n"); in efx_ef10_poll_bist()
3329 netif_err(efx, hw, efx->net_dev, "BIST failed.\n"); in efx_ef10_poll_bist()
3332 netif_err(efx, hw, efx->net_dev, in efx_ef10_poll_bist()
3338 static int efx_ef10_run_bist(struct efx_nic *efx, u32 bist_type) in efx_ef10_run_bist() argument
3342 netif_dbg(efx, drv, efx->net_dev, "starting BIST type %u\n", bist_type); in efx_ef10_run_bist()
3344 rc = efx_ef10_start_bist(efx, bist_type); in efx_ef10_run_bist()
3348 return efx_ef10_poll_bist(efx); in efx_ef10_run_bist()
3352 efx_ef10_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) in efx_ef10_test_chip() argument
3356 efx_reset_down(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
3358 rc = efx_mcdi_rpc(efx, MC_CMD_ENABLE_OFFLINE_BIST, in efx_ef10_test_chip()
3363 tests->memory = efx_ef10_run_bist(efx, MC_CMD_MC_MEM_BIST) ? -1 : 1; in efx_ef10_test_chip()
3364 tests->registers = efx_ef10_run_bist(efx, MC_CMD_REG_BIST) ? -1 : 1; in efx_ef10_test_chip()
3366 rc = efx_mcdi_reset(efx, RESET_TYPE_WORLD); in efx_ef10_test_chip()
3369 rc2 = efx_reset_up(efx, RESET_TYPE_WORLD, rc == 0); in efx_ef10_test_chip()
3395 static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, in efx_ef10_mtd_probe_partition() argument
3413 if (info->port != efx_port_num(efx)) in efx_ef10_mtd_probe_partition()
3416 rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); in efx_ef10_mtd_probe_partition()
3425 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_METADATA, inbuf, sizeof(inbuf), in efx_ef10_mtd_probe_partition()
3447 static int efx_ef10_mtd_probe(struct efx_nic *efx) in efx_ef10_mtd_probe() argument
3458 rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_PARTITIONS, NULL, 0, in efx_ef10_mtd_probe()
3478 rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type); in efx_ef10_mtd_probe()
3485 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in efx_ef10_mtd_probe()
3494 static void efx_ef10_ptp_write_host_time(struct efx_nic *efx, u32 host_time) in efx_ef10_ptp_write_host_time() argument
3496 _efx_writed(efx, cpu_to_le32(host_time), ER_DZ_MC_DB_LWRD); in efx_ef10_ptp_write_host_time()
3516 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_enable_timestamping()
3549 rc = efx_mcdi_rpc(channel->efx, MC_CMD_PTP, in efx_ef10_rx_disable_timestamping()
3555 static int efx_ef10_ptp_set_ts_sync_events(struct efx_nic *efx, bool en, in efx_ef10_ptp_set_ts_sync_events() argument
3565 efx_for_each_channel(channel, efx) { in efx_ef10_ptp_set_ts_sync_events()
3568 efx_ef10_ptp_set_ts_sync_events(efx, false, temp); in efx_ef10_ptp_set_ts_sync_events()
3576 static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx, in efx_ef10_ptp_set_ts_config() argument
3583 efx_ef10_ptp_set_ts_sync_events(efx, false, false); in efx_ef10_ptp_set_ts_config()
3585 return efx_ptp_change_mode(efx, in efx_ef10_ptp_set_ts_config()
3601 rc = efx_ptp_change_mode(efx, true, 0); in efx_ef10_ptp_set_ts_config()
3603 rc = efx_ef10_ptp_set_ts_sync_events(efx, true, false); in efx_ef10_ptp_set_ts_config()
3605 efx_ptp_change_mode(efx, false, 0); in efx_ef10_ptp_set_ts_config()